summaryrefslogtreecommitdiff
path: root/feed-transmission.py
diff options
context:
space:
mode:
Diffstat (limited to 'feed-transmission.py')
-rwxr-xr-xfeed-transmission.py42
1 files changed, 42 insertions, 0 deletions
diff --git a/feed-transmission.py b/feed-transmission.py
new file mode 100755
index 0000000..07fb620
--- /dev/null
+++ b/feed-transmission.py
@@ -0,0 +1,42 @@
+#!/usr/bin/env python
+
+import feedparser
+import re
+import time
+import subprocess
+
+POLL_DELAY = 60 * 60
+
+threads = [
+ "Some thread",
+]
+
+downloadables = re.compile(r".*Thread: (?:%s)" % "|".join(threads))
+
+def find_relavant():
+ d = feedparser.parse('https://example.com/rss.php')
+ found = []
+ for i in d['items']:
+ if not downloadables.match(i.title):
+ continue
+ found.append(i.link)
+ return found
+
+def main():
+ downloaded = []
+ while True:
+ downloaded = downloaded[-100:]
+ found = find_relavant()
+ for i in found:
+ if i in downloaded:
+ continue
+ downloaded.append(i)
+ print i
+ ret = subprocess.call("transmissioncli", "localhost", "-a", i)
+ if ret:
+ print "Error adding torrent"
+ time.sleep(POLL_DELAY)
+
+if __name__ == "__main__":
+ main()
+