How do I move after seeding?

dsouvik215

Member
May 25, 2018
896
0
16
Hi,

I want to have 3 folders, Incomplete, Seeding, and Complete. I am currently using Automove to go from Incomplete to Seeding but I can't figure out a way to get that last step. I need rutorrent to move files to Complete after they are finished seeding. Is this possible?
 

das329717

Member
May 25, 2018
928
0
16
I think you're confused, rTorrent is the torrent client - ruTorrent is only a web-interface to control it
I assume you mean with "completed"; torrents which have been downloaded fully but which aren't seeding ("Stopped" status in ruTorrent)

You could use the rTorrent config file to fire an event whenever a torrent is stopped. Use it to check if the torrent has been completed or not and, depending on the result, move it or not
Read up on rTorrent config file syntaxes and RPC commands and try to come up with something yourself first
Here's a starting point: http://wiki.rtorrent.org/RtorrentScripting#Events
 

shwetha17

Member
May 24, 2018
785
0
16
Thanks. I think I understand better now. It looks like it should be something like this in the config file.

d.custom3.set="/media/server/downloads1/Complete/"
method.set_key=event.download.erased,move_complete,"execute=mv,-u,$d.get_base_path=,$d.get_custom3=;d.set_directory=$d.get_custom3="

My questions;
1. Is "event.download.erased" the correct event type for torrents that are no longer seeding. ie That have been removed from rtorrent.
2. Am I correct in understanding that the correct event type that are completely downloaded and are available to seed is "event.download.finished"?
3. Do I have the correct syntax?
4. Does it matter where in the config file I place this?
 

somus1735

Member
May 25, 2018
833
0
16
So here is the problem with this idea. The closed event type definitely fires when you shut down rtorrent so all torrents are moved to ...Completed/[label] even if they have not been removed from rtorrent. Also, it fires if a torrent is stopped and then restarted. There must be a more suitable event that only fires when a completed torrent is removed from rtorrent. Perhaps erased? but I thought erased only refers to incomplete torrents that have been erased. Can someone point me to some documentation?
 

jith45

Member
May 25, 2018
960
0
16
Here is a list of all events in 0.9.4:

event.download.closed
event.download.erased
event.download.finished
event.download.hash_done
event.download.hash_failed
event.download.hash_final_failed
event.download.hash_queued
event.download.hash_removed
event.download.inserted
event.download.inserted_new
event.download.inserted_session
event.download.opened
event.download.paused
event.download.resumed
 

simur612

Member
May 25, 2018
879
0
16
Thanks. I think I understand better now. It looks like it should be something like this in the config file.

d.custom3.set="/media/server/downloads1/Complete/"
method.set_key=event.download.erased,move_complete,"execute=mv,-u,$d.get_base_path=,$d.get_custom3=;d.set_directory=$d.get_custom3="

My questions;
1. Is "event.download.erased" the correct event type for torrents that are no longer seeding. ie That have been removed from rtorrent.
2. Am I correct in understanding that the correct event type that are completely downloaded and are available to seed is "event.download.finished"?
3. Do I have the correct syntax?
4. Does it matter where in the config file I place this?
ok, So I think the right event type for torrents that are no longer seeding is "event.download.closed" Is that correct? And, does anyone know if there is a way to get rtorrent to check a number of folders for duplicate downloads? During my testing, I am finding that if I move a torrent to "Completed" using this method and I try to load the same torrent again, it will download it all over again into the "Incomplete" folder even though the whole torrent is sitting in "Completed"
 

randac56

Member
May 25, 2018
915
0
16
I'll give it a try myself - here's my take at watch dirs with separate downloading, seeding and complete dirs for every category + labels. I haven't tested any of this so it might not work immediately
btw, I posted a complete rTorrent 0.9.4 RPC reference (undocumented though) here: http://pastebin.com/rN26HFsV

and no, doesn't matter where in the conifg file you place anything
Code:
# whitespaces can be used by proceeding them with double backslashes

# watch folder with auto start
# set download dir for music, set seeding dir, set completed dir, set label with custom1
schedule = watch_dir_music,10,10,"load_start=/Torrents/Watch/Music/*.torrent,d.set_directory=/Torrents/Downloading/Music,d.set_custom=seeding,/Torrents/Seeding/Music,d.set_custom=completed,/Media/Music,d.set_custom1=Music"

# downloading -> seeding
method.set_key = event.download.finished,move_seeding,"d.set_directory=$d.get_custom=seeding=;execute=mv,-u,$d.get_base_path=,$d.get_custom=seeding"

# seeding -> complete
method.set_key = event.download.closed,move_complete,"d.set_directory=$d.get_custom=completed=;execute=mv,-u,$d.get_base_path=,$d.get_custom=completed"
the checking for duplicates can be done by, whenever a torrent is added to rTorrent, matching and hash checking the seeding and complete dirs specified for the torrent (of course, this only works if the name of parent dir hasn't been changed). note that this can cause a lot of CPU load!

edit: if you want to rename parent dirs I think the best solution would be to use symlinks to link to the correct dir. an alternative and less straight-forward approach could be to write a script which searches for dirs with the correct size (piece length * pieces / 20, +/- piece length) and then hashes the content to see if it's the same (this way it can still find renamed torrents)
 

peshua19

Member
May 25, 2018
897
0
16
Thanks for such a detailed reply. So to me it looks like you are setting the label and then using the label to set the directory. Is that correct? Sorry if this is a stupid question - Why do you have "$d.get_custom=seeding" when going from downloading to seeding but then "$d.get_custom3=completed" when going from seeding to complete. What is the difference between custom and custom3?
 

lisas4567

Member
May 25, 2018
773
0
16
So to me it looks like you are setting the label and then using the label to set the directory. Is that correct?​
I'm setting the correct download location immediately without any intermediate steps with "d.set_directory=/Torrents/Downloading/Music"
I then define 2 variables to store the seeding dir and the completed dir
finally, I define another variable, custom1, for the label (this is purely because ruTorrent also uses custom1 labels which means I can now use those labels to sort in ruTorrent)

Why do you have "$d.get_custom=seeding" when going from downloading to seeding but then "$d.get_custom3=completed" when going from seeding to complete. What is the difference between custom and custom3?​
oops, typo. you can create custom variables with a self chosen name, I chose to name it "seeding". custom1 - custom5 are nothing more than already defined custom vars, I could've used custom3 instead of custom=seeding
 

saroos1

Member
May 25, 2018
718
0
16
Right. I get it now. This discussion has got me thinking, If I set the label to a final destination folder I want to use, is it possible to use the custom1 label to tell rtorrent to move the completed torrent from seeding to the subfolder set by label - for example base folder for all = /Downloads/rtorrent/completed/ and then of the label is set to "TVShows" when it's finished it should go to /Downloads/rtorrent/completed/TVShows and anything without a label can go to /Downloads/rtorrent/completed/Other
 

simur612

Member
May 25, 2018
879
0
16
Right. I get it now. This discussion has got me thinking, If I set the label to a final destination folder I want to use, is it possible to use the custom1 label to tell rtorrent to move the completed torrent from seeding to the subfolder set by label - for example base folder for all = /Downloads/rtorrent/completed/ and then of the label is set to "TVShows" when it's finished it should go to /Downloads/rtorrent/completed/TVShows and anything without a label can go to /Downloads/rtorrent/completed/Other
So that you don't "d.set_custom=completed,/Media/Music" but decide the folder depending on the value of custom1 at the moment you need to move it (so that if you change the label in ruTorrent while it is seeding for example, it will use that to decide the final folder)?
You could concatenate the value of custom1 with a base folder (eg "/Media" + "/" + "Music") when the closed event fires and use that for the completed folder
also, don't forget that you can always call an external script to perform more complicated tasks for you
 

randac56

Member
May 25, 2018
915
0
16
ok, So I was struggling to figure out how to actually do it so I did some googling anf came up with this.

http://www.krank.se/?p=431

Code:

# Add new method to get finished dir
system.method.insert = d.get_finished_dir,simple,"cat=[folder]/finished/,$d.get_custom1="

system.method.set_key = event.download.finished,move_complete,"d.set_directory=$d.get_finished_dir=;execute=mkdir,-p,$d.get_finished_dir=;execute=mv,-u,$d.get_base_path=,$d.get_finished_dir="

Although he wants to move them after they finish downloading. I want to do it when they finish seeding so I need to change the event to closed. Although I was wondering if there is something better than closed because it seems like it closes torrents when rtorrent shuts down even if the transfer isn't finished yet - perhaps "hash_removed"? Or maybe "erased" but I would need a way to handle incomplete torrents that are erased. God I wish there was a description somewhere of exactly what all these types mean.
 

peshua19

Member
May 25, 2018
897
0
16
So here is the problem with this idea. The closed event type definitely fires when you shut down rtorrent so all torrents are moved to ...Completed/[label] even if they have not been removed from rtorrent. Also, it fires if a torrent is stopped and then restarted. There must be a more suitable event that only fires when a completed torrent is removed from rtorrent. Perhaps erased? but I thought erased only refers to incomplete torrents that have been erased. Can someone point me to some documentation?
 

lisas4567

Member
May 25, 2018
773
0
16
Here is a list of all events in 0.9.4:

event.download.closed
event.download.erased
event.download.finished
event.download.hash_done
event.download.hash_failed
event.download.hash_final_failed
event.download.hash_queued
event.download.hash_removed
event.download.inserted
event.download.inserted_new
event.download.inserted_session
event.download.opened
event.download.paused
event.download.resumed
 

simur612

Member
May 25, 2018
879
0
16
I've decided to go with erased and delete incomplete torrents manually when I need to. Erased seems to be the only event that fires when a torrent is actually removed from rtorrent. It would be nice if there was a way to differentiate between complete and incomplete removals.