shell-rss-torrent icon indicating copy to clipboard operation
shell-rss-torrent copied to clipboard

Invalid config file

Open dragful opened this issue 2 years ago • 5 comments

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

dragful avatar Aug 23 '23 08:08 dragful

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.

Rafostar avatar Aug 23 '23 11:08 Rafostar

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.

dragful avatar Aug 23 '23 12:08 dragful

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.

Rafostar avatar Aug 23 '23 13:08 Rafostar

yes i'm sure about this

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

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

dragful avatar Aug 23 '23 14:08 dragful

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.

Rafostar avatar Aug 23 '23 15:08 Rafostar