Rafostar / shell-rss-torrent

Download torrents from RSS feeds with a simple shell script
MIT License
25 stars 6 forks source link

Invalid config file #4

Open dragful opened 1 year ago

dragful commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.