rtorrent doesnt call the script

Support for Synology NAS, QNAP NAS and other Embedded Linux systems
Post Reply
alexsmith2709
Posts: 12
Joined: 24 Nov 2019, 21:34

rtorrent doesnt call the script

Post by alexsmith2709 »

Hi,
I am hoping someone here can give more help than the rtorrent-pro .qpkg developer on the rtorrent-pro forum where i was told there is no rtorrent.rc and figure it out myself. I know this isnt a dev problem so hoping another QNAP owner can help.

I have rtorrent-pro 0.9.7 installed on my QNAP TS-253 Pro and cannot find the rtorrent.rc file and now been told by the developer it doesnt exist but there are some config files. I also found that there is a folder called scripts that you can put an external script in to run, but this doesnt seem to happen.
I have called the external script finished-filebot.sh and made it executable but when a torrent is finished downloading nothing happens so i assume the script isnt called. Has anyone been successful it getting this to work? If i need to edit one of the config files, which one?

My script is

Code: Select all

#!/bin/sh

# Input Parameters
ARG_PATH="$3"
ARG_NAME="$2"
ARG_LABEL="$4"

# Configuration
CONFIG_OUTPUT="/share/Rdownload/medialibrary/"

filebot -script fn:amc /share/Rdownload/complete --output "$CONFIG_OUTPUT" --action test --conflict auto -non-strict --order Airdate --log all --log-file ~/amc.log --def unsorted=y music=y skipExtract=y excludeList="$CONFIG_OUTPUT/excludes.txt" emby="host:api" ut_dir="$ARG_PATH" ut_kind="multi" ut_title="$ARG_NAME" ut_label="$ARG_LABEL" seriesFormat="{n}/Season {s}/{s00e00} - {t}" movieFormat="{ny}/{n.space('.')}.{source}.{vc}.{ac}" musicFormat="{albumArtist}/{album}/{media.PartPosition}{pi.pad(2)} - {t}"
User avatar
rednoah
The Source
Posts: 22970
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rtorrent doesnt call the script

Post by rednoah »

Are you sure that rtorrent and rtorrent-pro are even related? There is no such thing as rtorrent-pro at least as far as the rtorrent project is concerned:
https://github.com/rakshasa/rtorrent

rTorrent is a torrent client. ruTorrent is a very popular web-interface for rTorrent. Not sure what rtorrent-pro is supposed to be.
:idea: Please read the FAQ and How to Request Help.
alexsmith2709
Posts: 12
Joined: 24 Nov 2019, 21:34

Re: rtorrent doesnt call the script

Post by alexsmith2709 »

rtorrent-pro is a QNAP package for rtorrent and rutorrent, the link to it is https://qnapclub.eu/pl/qpkg/376.
I am getting one step closer. rtorrent does now call the script but it doesnt seem to work.
I've used the full path to filebot as instructed by the rtorrent-pro dev and it does echo the script to a file, but no log file is created and no files are copied.
My script now is:

Code: Select all

/share/CACHEDEV1_DATA/.qpkg/filebot/bin/filebot.sh -script fn:amc /share/Rdownload/complete --output /share/Rdownload/medialibrary/ --action hardlink --conflict auto -non-strict --order Airdate --log all --log-file /share/Rdownload/medialibrary/amc.log --def unsorted=y music=y skipExtract=y excludeList=/share/Rdownload/medialibrary/excludes.txt emby=host:api ut_label=tv seriesFormat={n}/Season {s}/{s00e00} - {t} movieFormat={ny}/{n.space('.')}.{source}.{vc}.{ac} musicFormat={albumArtist}/{album}/{media.PartPosition}{pi.pad(2)} - {t}
User avatar
rednoah
The Source
Posts: 22970
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rtorrent doesnt call the script

Post by rednoah »

:arrow: Please read Shell Script Debugging for Beginners.

:arrow: Please read Cmdline and Argument Passing.

:arrow: Use the @file syntax for reading command-line arguments from external text files.
:idea: Please read the FAQ and How to Request Help.
alexsmith2709
Posts: 12
Joined: 24 Nov 2019, 21:34

Re: rtorrent doesnt call the script

Post by alexsmith2709 »

I've done the things suggested and this is my script:

Code: Select all

#!/bin/sh

printenv > "/share/Public/log-test.txt"

/share/CACHEDEV1_DATA/.qpkg/filebot/bin/filebot.sh -script fn:sysenv > "/share/Public/log-test.txt" 2>&1

# do things that can't possibly not work (unless you don't have /tmp write permission)
date > /tmp/date.txt
whoami > /tmp/whoami.txt
printenv > /tmp/printenv.txt

# try things that might not work
java -version > /tmp/java-version.txt 2>&1
filebot -version > /tmp/filebot-version.txt 2>&1
filebot -script fn:sysinfo > /tmp/filebot-sysinfo.txt 2>&1
filebot -script fn:sysenv > /tmp/filebot-sysenv.txt 2>&1


# Input Parameters
ARG_PATH="$3"
ARG_NAME="$2"
ARG_LABEL="$4"

# Configuration
CONFIG_OUTPUT="/share/Rdownload/medialibrary"

echo /share/CACHEDEV1_DATA/.qpkg/filebot/bin/filebot.sh -script fn:amc /share/Rdownload/complete --output "$CONFIG_OUTPUT/" --action test --conflict auto -non-strict --order Airdate --log all --log-file "$CONFIG_OUTPUT/amc.log" --def excludeList="$CONFIG_OUTPUT/excludes.txt" ut_label="$ARG_LABEL" @/share/Rdownload/scripts/args.txt >> /share/Public/finish.txt

exit 0
The files in tmp have all been created, including the ones that "might not work" and i can share the contents if needed. One thing i have noticed is that although i had the beta latest beta version of filebot installed, because rtorrent-pro has the filebot script included it keeps going back to that version of 4.8.5 which i know hasnt worked for me which is why i upgraded to the beta version and why i was using the full path.
My log-test.txt had this:

Code: Select all

Unrecognized option: --illegal-access=permit
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
User avatar
rednoah
The Source
Posts: 22970
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rtorrent doesnt call the script

Post by rednoah »

FileBot requires Java 11 or higher.

This error message suggests that you're using Java 8 or lower:

Code: Select all

Unrecognized option: --illegal-access=permit


The Java Installer package will help you install the latest Java 13 runtime:
https://github.com/rednoah/java-installer/releases

Once you're on Java 13, you will also need to upgrade to the latest FileBot beta release:
https://get.filebot.net/filebot/BETA/
:idea: Please read the FAQ and How to Request Help.
alexsmith2709
Posts: 12
Joined: 24 Nov 2019, 21:34

Re: rtorrent doesnt call the script

Post by alexsmith2709 »

I've got it working thanks to the dev of rtorrent-pro. He helped write a script which is placed in the scripts folder.
It is:

Code: Select all

#!/bin/sh

export PATH="/bin:/sbin:/usr/bin:/usr/sbin:/usr/bin/X11:/usr/local/sbin:/usr/local/bin"

_err() {
	echo $*
	exit 1
}

# Input Parameters
ARG_PATH="$3"
ARG_NAME="$2"
ARG_LABEL="$4"

# Configuration
CONFIG_OUTPUT="/share/Rdownload/medialibrary"

[ -d "$CONFIG_OUTPUT" ] || _err "Output directory does not exist ${CONFIG_OUTPUT}"

FILEBOT_PATH=$(getcfg -f /etc/config/qpkg.conf filebot Install_Path)
FILEBOT_BIN="${FILEBOT_PATH}/bin/filebot.sh"
${FILEBOT_BIN} -version | grep FileBot 2>/dev/null 1>/dev/null || _err Filebot not working

${FILEBOT_BIN} 						\
-script fn:amc 						\
--output "${CONFIG_OUTPUT}" 				\
--action hardlink 						\
--conflict auto 					\
-non-strict 						\
--order Airdate 					\
--log all 						\
--log-file "${CONFIG_OUTPUT}/amc.log" 			\
--def excludeList="${CONFIG_OUTPUT}/excludes.txt" 	\
ut_label="${ARG_LABEL}" 				\
ut_dir="${ARG_PATH}" 					\
ut_kind="multi" 					\
ut_title="${ARG_NAME}" 					\
unsorted=y 						\
music=y 						\
skipExtract=y 						\
emby="host:api" 	\
seriesFormat="{n}/Season {s}/{s00e00} - {t}" 		\
movieFormat="{ny}/{n.space('.')}.{source}.{vc}.{ac}" 	\
musicFormat="{albumArtist}/{album}/{media.PartPosition}{pi.pad(2)} - {t}" 	\
		 | tee -a "${CONFIG_OUTPUT}/filebot.log"

exit 0
My only issue seems to be that it doesnt copy the files to the the subfolders like Movies, TV Shows etc, it copies them into the main medialibrary folder. I would also like the excludes file in each subfolder to as thats how i copied existing files to the subfolders. Any ideas?
User avatar
rednoah
The Source
Posts: 22970
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: rtorrent doesnt call the script

Post by rednoah »

Your custom formats define the output path:

Code: Select all

seriesFormat="{n}/Season {s}/{s00e00} - {t}" 		\
movieFormat="{ny}/{n.space('.')}.{source}.{vc}.{ac}" 	\
musicFormat="{albumArtist}/{album}/{media.PartPosition}{pi.pad(2)} - {t}" 	\
:arrow: If you want different output paths, then you can modify these formats to make that happen.
:idea: Please read the FAQ and How to Request Help.
alexsmith2709
Posts: 12
Joined: 24 Nov 2019, 21:34

Re: rtorrent doesnt call the script

Post by alexsmith2709 »

Something so simple, thanks!
Post Reply