Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid config file #4

Open
dragful opened this issue Aug 23, 2023 · 5 comments
Open

Invalid config file #4

dragful opened this issue Aug 23, 2023 · 5 comments

Comments

@dragful
Copy link

dragful commented Aug 23, 2023

Hi,

Thanks for your script.

I have a problem with the config file.
I copied the bash script as it is, no modification...
Hten I created a xml file like this :

<config>
  <watchdir> /var/www/html/uploads</watchdir>
<history> /tmp/download_history</history>
  <feed url="myRSSfeed">
<contains ignore-case="1">Pack</contains>
    </feed>
</config>

but i get :
Error: invalid config file

Did i make any mistake in writing the xml ?

Thanks for you help

@Rafostar
Copy link
Owner

You shouldn't have spaces at the beginning/end of file path that are handled as-is meaning folders can have spaces there. Also check if you have all required apps mentioned in readme that we use installed.

@dragful
Copy link
Author

dragful commented Aug 23, 2023

Thanks for the answer.
I can't find my mistake.

Here is what i've made :

<config>
<watchdir>/var/www/html/uploads/</watchdir>
<feed url="https://rss_url">
<contains ignore-case="1">Pack</contains>
</feed>
</config>

wget is installed, as is libxml2

v@x:~/scripts|⇒  sudo apt-get install wget
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
wget is already the newest version (1.21.2-2ubuntu1).
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.

v@x~/scripts|⇒  sudo apt install libxml2-utils
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
libxml2-utils is already the newest version (2.9.13+dfsg-1ubuntu0.3).
0 upgraded, 0 newly installed, 0 to remove and 29 not upgraded.

@Rafostar
Copy link
Owner

Config seems OK, and you have libxml2-utils. Are you statrting this script with correct path to your config file as an arg? If path contains spaces you need to quote it.

@dragful
Copy link
Author

dragful commented Aug 23, 2023

yes i'm sure about this

v@x:~/scripts|⇒ sudo ./shell-rss-torrent "config.xml"

and both files are in the same directory
weird ....

@Rafostar
Copy link
Owner

Thats weird indeed. Let's try this, apply this change (either manually or as a git patch):

diff --git a/shell-rss-torrent b/shell-rss-torrent
index 598736a..e4ed4cb 100755
--- a/shell-rss-torrent
+++ b/shell-rss-torrent
@@ -18,6 +18,9 @@ parse_config() {
     if [ "$?" -ne 0 ]
     then
         echo "Error: invalid config file"
+        echo "WatchDir: \"$WatchDir\""
+        echo "ConfigData: \"$ConfigData\""
+        echo "ReadDir: \"$(echo "$ConfigData" | xmllint --xpath "string(//config/watchdir[1]/text())" -)\""
         exit 1
     fi
 

And try running your script like you usually do. It should print the values after your error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants