anothergene avatar anothergene committed 24d1091

added script for removing torrents that have hit a particular ratio or seed time. meant to be run by cron.

Comments (0)

Files changed (1)

transmission-removedone.py

+#!/usr/bin/env python
+'''
+Created on Feb 5, 2011
+
+@author: gmoreau
+'''
+import transmissionrpc
+from datetime import datetime
+
+TRANS_HOST = '192.168.100.150'  # The host transmission is running on
+TRANS_PORT = '9091' # The port the host is listening on
+TRANS_USER =  ''    # The user id you have set
+TRANS_PW = ''   # the password you have set
+MAX_RATIO = 1.5
+MAX_RETENTION = 5
+
+def Main():
+    tc = transmissionrpc.Client(TRANS_HOST, TRANS_PORT, TRANS_USER, TRANS_PW)
+    tl = tc.info()
+    nothing_processed = True
+    for t in tl:
+        age = datetime.now() - tl[t].date_added
+        if (tl[t].status == 'stopped' and tl[t].ratio >= MAX_RATIO) or (age.days >= MAX_RETENTION ):
+            nothing_processed = False
+            print 'removing torrent ' + tl[t].name +' and data file.'
+            tc.remove(t, True)
+    if nothing_processed :
+        print 'nothing due to be deleted, try again later'
+            
+if __name__ == '__main__':
+    Main()
+        
+        
+        
+               
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.