Commits

anothergene  committed f03a6be

a second try at the remove torrents script. taking a new approach.

  • Participants
  • Parent commits 24d1091

Comments (0)

Files changed (1)

File transmission-removedone2.py

+#!/usr/bin/env python
+# encoding: utf-8
+"""
+untitled.py
+
+Created by Gene Moreau on 2011-02-09.
+Copyright (c) 2011 __MyCompanyName__. All rights reserved.
+"""
+
+import sys
+import argparse
+import transmissionrpc
+
+
+help_message = '''
+help me.
+'''
+
+
+def main(argv=None):
+
+    options = argparse.ArgumentParser(description='options passed to progream')
+    options.parse_args()
+    
+    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__":
+    sys.exit(main())