Skip to content

Commit

Permalink
Change magnet to use 1 api
Browse files Browse the repository at this point in the history
  • Loading branch information
duramato committed Apr 26, 2016
1 parent 6ac2d37 commit a220d60
Showing 1 changed file with 2 additions and 23 deletions.
25 changes: 2 additions & 23 deletions sickbeard/providers/torrentproject.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# coding=utf-8
# Author: Gonçalo M. (aka duramato/supergonkas) <supergonkas@gmail.com>
#

#
# This file is part of SickRage.
#
Expand Down Expand Up @@ -104,28 +103,8 @@ def search(self, search_strings, age=0, ep_obj=None): # pylint: disable=too-man
t_hash = torrents[i].get("torrent_hash")
torrent_size = torrents[i].get("torrent_size")
size = convert_size(torrent_size) or -1

try:
assert seeders < 10
assert mode != 'RSS'
logger.log(u"Torrent has less than 10 seeds getting dyn trackers: " + title, logger.DEBUG)

if self.custom_url:
if not validators.url(self.custom_url):
logger.log("Invalid custom url set, please check your settings", logger.WARNING)
return results
trackers_url = self.custom_url
else:
trackers_url = self.url

trackers_url = urljoin(trackers_url, t_hash)
trackers_url = urljoin(trackers_url, "/trackers_json")
jdata = self.get_url(trackers_url, returns='json')

assert jdata != "maintenance"
download_url = "magnet:?xt=urn:btih:" + t_hash + "&dn=" + title + "".join(["&tr=" + s for s in jdata])
except (Exception, AssertionError):
download_url = "magnet:?xt=urn:btih:" + t_hash + "&dn=" + title + self._custom_trackers
download_url = torrents[i].get("magnet") + self._custom_trackers
pubdate = '' #TBA

if not all([title, download_url]):
continue
Expand Down

0 comments on commit a220d60

Please sign in to comment.