clinton-hall / nzbToMedia

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

Remove torrents after xxxx #80

Closed clinton-hall closed 5 months ago

clinton-hall commented 11 years ago

I'm not sure exactly what api options are available for utorrent... But we could call a number of api calls... If utorrent had a seed for x hours then delete... We could call it... http://www.utorrent.com/community/developers/webapi

They do have a http://[IP]:[PORT]/gui/?action=removedata&hash=[TORRENT HASH] This action removes the specified torrent job(s) from the torrent jobs list and removes the corresponding torrent contents (data) from disk. Multiple hashes may be specified to act on multiple torrent jobs. This action respects the option "Move to trash if possible".

So.. I wouldn't want the script looping for 24 hours... But what we could do is schedule a cron job to run in 24 hours time... But not sure if we can easily define the hash within the cron job...

Otherwise we could schedule a cron job to do regular checks (at defined intervals) to get the time since finish etc... Since utorrent does support a seed ratio and it appears from the link above that you can set a default seed time, perhaps these could be set there, and then a regular cron job could just remove torrents after x hours/days etc...

Otherwise we could write the torrent hash and end time into a file and have a regular cron job that would parse this file and when the times are met, call utorrent api to remove that torrent... And then remove the entry from that file...

The message below is from Rizo. This confirms that everything is currently working correctly (CPS and SB). Rizo is the originator of this potential enhancement.

................... [quote='Rizo'] Confirmed, all works well.

You got it, I'll have to make a github account and start updating parts I'm more comfortable with explaining. I'll try and start over the weekend when I'm done with my lab work.

On a side note, is there a list of parameters you can link me to so I define my own end command when renamer has run? After skimming the code, I tried editing the last bit:

[code]

Hardlink solution with uTorrent

if inputHash and useLink: Logger.debug("MAIN: Starting torrent %s in uTorrent", inputName) utorrentClass.start(inputHash)

[/code]

I see in client.py you've defined start, stop, pause, forcestart, etc. Say I wanted to stop and delete the torrent after 24 hrs of seeding (per BTN tracker rules), how would I go about that? I realize the script would be running continually, but that's fine.

Also this is a big one, but do you think it would be possible to vary the end command depending on what tracker the file is associated with? That would bring the script to god tier complete automation. :cool:

Like I said, legendary work man. Really nice script, thanks again.

jkaberg commented 11 years ago

We could check for releases "to delete" with the criterias you mention when the script is run, but that could be unreliable if no torrents are downloaded in a long perioid of time. Perhaps a hybrid doing both these would perhaps be the best solution?

I just think we should bring this up-to-par with Deluge atleast aswell (I doubt I can get Transmission to work with this)

If this is what we will do, perhaps move the cronjob code to seperate file which can be called individually (which would have the sole purpose of checking and deleteing old torrents?)

Suggested criterias: minimum seed time, minimum ratio (more?)

jkaberg commented 11 years ago

added the remove, removedata and recheck to the library, https://github.com/clinton-hall/nzbToMedia/commit/f491254dfd1968b0a04aeaeba4d64faf73ec7419

berkona commented 11 years ago

As for the per-tracker support. Can we get a hold of the actual torrent files? That seems to be the easiet way to do something like that.

jkaberg commented 11 years ago

We can get "per-tracker" support from uTorrent aswell (just need another lib :p)

2013/3/2 Jon Monroe notifications@github.com

As for the per-tracker support. Can we get a hold of the actual torrent files? That seems to be the easiet way to do something like that.

— Reply to this email directly or view it on GitHubhttps://github.com/clinton-hall/nzbToMedia/issues/80#issuecomment-14334107 .

berkona commented 11 years ago

We also need to consider some trackers have different requirements for different kinds of torrents. Maybe have a couple of options on the per_tracker settings to have support for multiple-episode vs. single-episode downloads.

clinton-hall commented 11 years ago

Added this to milestone 8.0 I think there will be a lot involved in doing this right... And There have been a number of changes made since 6.0 that I am keen to get merged over once I have confirmation on a few changes...

clinton-hall commented 11 years ago

I believe this is being (has been) implemented in CouchPotatoServer. As this would still apply to SickBeard and Headphones etc, I might try and borrow this when I know it is all working.

schumi2004 commented 11 years ago

Do you think this can also be done for other clients like Transmission?

clinton-hall commented 11 years ago

Yes, I believe it can be done. I'd need to look into the Transmission RPC a little closer.... I take it this is a feature you would like?

Are you interested in timed removal or ratio etc?

schumi2004 commented 11 years ago

timed is good for me to but i think ratio would be better. i'm now adding a script based on this for the time being http://1000umbrellas.com/2010/10/05/updated-how-to-automatically-move-and-remove-transmission-daemon-downloads