clinton-hall / nzbToMedia

Provides NZB and Torrent postprocessing To CouchPotatoServer, SickBeard/SickRage, HeadPhones, Mylar and Gamez
GNU General Public License v3.0
674 stars 176 forks source link

rTorrent nzbToMedia trigger command conflicts with moving files. #1864

Closed neo-neo1 closed 2 years ago

neo-neo1 commented 2 years ago

Describe the bug For rTorrent to trigger nzbToMedia upon download completion I copied the command from your Wiki into rtorrent.rc. However, this command conflicts with rTorrent moving files upon completion (e.g. from incomplete to complete directories). To be clear, nzbToMedia is still triggered but the finished download is never moved to compete folder.

Command to trigger nzbToMedia:

 method.set_key = event.download.finished,TorrentToMedia,"execute=/usr/local/bin/python2,/path/to/TorrentToMedia.py,$d.base_path=,$d.name=,$d.custom1=,$d.hash="

Command for completed downloads to move folders

method.insert = d.get_finished_dir, simple, "cat=$cfg.download_complete_custom=,$d.custom1="
method.insert = d.move_to_complete, simple, "d.directory.set=$argument.1=; execute=mkdir,-p,$argument.1=; execute=mv,-u,$argument.0=,$argument.1=; d.save_full_session="
method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir="

If I remove either command (from rtorrent.rc) the other works perfectly as expected.

I'm not the best at rTorrent's scripting language, unfortunately. I'm thinking I need to combine the nzbToMedia command to the completed folder move command. Question is, how?

clinton-hall commented 2 years ago

Not 100% on this, but to call 2 scripts:

method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir=; execute=/usr/local/bin/python2,/path/to/TorrentToMedia.py,$d.get_finished_dir=,$d.name=,$d.custom1=,$d.hash="
neo-neo1 commented 2 years ago

method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir=; execute=/usr/local/bin/python2,/path/to/TorrentToMedia.py,$d.get_finished_dir=,$d.name=,$d.custom1=,$d.hash="

This works.

I also tried this, and it also works. Which is more technically correct, though? We may never know lol

method.set_key = event.download.finished,move_complete,"d.move_to_complete=$d.data_path=,$d.get_finished_dir=","execute=/usr/bin/python3,/data/nzbtomedia/TorrentToMedia.py,$d.get_finished_dir=,$d.name=,$d.custom1=,$d.hash="