1. anothergene
  2. TransmissionScripts

Commits

anothergene  committed 24d1091

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

  • Participants
  • Parent commits bfe4665
  • Branches default

Comments (0)

Files changed (1)

File transmission-removedone.py

View file
+#!/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()
+        
+        
+        
+