summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Anderson <ejona86@gmail.com>2010-08-13 16:51:31 -0500
committerEric Anderson <ejona86@gmail.com>2010-08-13 16:51:31 -0500
commit775247e1ea09a18d47046f847e0aee4c733a7182 (patch)
tree19b7380b1e4f587e18e7d757abfe88bfa07705e7
downloadfeed-transmission-775247e1ea09a18d47046f847e0aee4c733a7182.tar.gz
feed-transmission-775247e1ea09a18d47046f847e0aee4c733a7182.zip
Quick RSS checker to filter torrents and inform transmission
-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()
+