From 775247e1ea09a18d47046f847e0aee4c733a7182 Mon Sep 17 00:00:00 2001 From: Eric Anderson Date: Fri, 13 Aug 2010 16:51:31 -0500 Subject: Quick RSS checker to filter torrents and inform transmission --- feed-transmission.py | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) create mode 100755 feed-transmission.py 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() + -- cgit v1.2.3-54-g00ecf