From 673a24f92f86b5a6235b5b5931a94a37c647d101 Mon Sep 17 00:00:00 2001 From: Correl Roush Date: Sat, 17 Sep 2011 20:45:11 -0400 Subject: [PATCH] Added TorrentReactor.net search --- resources/language/English/strings.xml | 7 ++++--- resources/lib/gui.py | 1 + resources/lib/search.py | 17 +++++++++++++++++ 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/resources/language/English/strings.xml b/resources/language/English/strings.xml index f77bf20..208966f 100644 --- a/resources/language/English/strings.xml +++ b/resources/language/English/strings.xml @@ -1,11 +1,11 @@ Transmission - + Connecting to Transmission Transmission Error Open settings dialog? - + Add Remove @@ -14,12 +14,13 @@ Pause All Start All Exit - + Browse for torrent file Search BTJunkie.org Search ThePirateBay.org Search Mininova.org + Search Torrentreactor.net Searching... No results found Could not connect to search site diff --git a/resources/lib/gui.py b/resources/lib/gui.py index 43db6f6..a528d11 100644 --- a/resources/lib/gui.py +++ b/resources/lib/gui.py @@ -113,6 +113,7 @@ class TransmissionGUI(xbmcgui.WindowXMLDialog): (_(201), search.BTJunkie), (_(202), search.TPB), (_(203), search.Mininova), + (_(204), search.TorrentReactor), ] selected = xbmcgui.Dialog().select(_(0), [i[0] for i in engines]) if selected < 0: diff --git a/resources/lib/search.py b/resources/lib/search.py index ee80b13..ba1f34c 100644 --- a/resources/lib/search.py +++ b/resources/lib/search.py @@ -71,6 +71,23 @@ class TPB(Search): 'leechers': leechers, }) return torrents +class TorrentReactor(Search): + def __init__(self): + self.search_uri = 'http://www.torrentreactor.net/rss.php?search=%s' + def search(self, terms): + torrents = [] + url = self.search_uri % '+'.join(terms.split(' ')) + f = urlopen(url) + soup = BeautifulStoneSoup(f.read()) + for item in soup.findAll('item'): + (seeds, leechers) = re.findall('Status: (\d+) seeders, (\d+) leecher', item.description.text)[0] + torrents.append({ + 'url': item.enclosure['url'], + 'name': item.title.text, + 'seeds': int(seeds), + 'leechers': int(leechers), + }) + return torrents if __name__ == '__main__': s = TPB()