From d2b8ffebad228861ab6482e211dcea71d9f2a991 Mon Sep 17 00:00:00 2001 From: evilhero Date: Tue, 5 Sep 2017 21:27:54 -0400 Subject: [PATCH] FIX:(#1702) Fix for WWT domain change as well as a quick patch for future domain changes --- mylar/__init__.py | 10 +++++++++- mylar/helpers.py | 8 ++++---- mylar/rsscheck.py | 38 +++++++++++++++++++------------------- 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/mylar/__init__.py b/mylar/__init__.py index 54c7e7a8..92cfd8bd 100644 --- a/mylar/__init__.py +++ b/mylar/__init__.py @@ -396,6 +396,9 @@ SEEDBOX_WATCHDIR = None ENABLE_TORRENT_SEARCH = 0 ENABLE_TPSE = 0 +WWTURL = None +DEMURL = None +TPSEURL = None TPSE_PROXY = None TPSE_VERIFY = True @@ -515,7 +518,7 @@ def initialize(): ENABLE_META, CMTAGGER_PATH, CBR2CBZ_ONLY, CT_TAG_CR, CT_TAG_CBL, CT_CBZ_OVERWRITE, UNRAR_CMD, CT_SETTINGSPATH, CMTAG_VOLUME, CMTAG_START_YEAR_AS_VOLUME, UPDATE_ENDED, INDIE_PUB, BIGGIE_PUB, IGNORE_HAVETOTAL, SNATCHED_HAVETOTAL, PROVIDER_ORDER, TMP_PROV, \ dbUpdateScheduler, searchScheduler, RSSScheduler, WeeklyScheduler, VersionScheduler, FolderMonitorScheduler, \ ALLOW_PACKS, ENABLE_TORRENTS, TORRENT_DOWNLOADER, MINSEEDS, USE_WATCHDIR, TORRENT_LOCAL, LOCAL_WATCHDIR, TORRENT_SEEDBOX, SEEDBOX_HOST, SEEDBOX_PORT, SEEDBOX_USER, SEEDBOX_PASS, SEEDBOX_WATCHDIR, \ - ENABLE_RSS, RSS_CHECKINTERVAL, RSS_LASTRUN, FAILED_DOWNLOAD_HANDLING, FAILED_AUTO, ENABLE_TORRENT_SEARCH, ENABLE_TPSE, TPSE_PROXY, TPSE_VERIFY, ENABLE_32P, SEARCH_32P, MODE_32P, KEYS_32P, RSSFEED_32P, USERNAME_32P, PASSWORD_32P, AUTHKEY_32P, PASSKEY_32P, FEEDINFO_32P, VERIFY_32P, SNATCHEDTORRENT_NOTIFY, \ + ENABLE_RSS, RSS_CHECKINTERVAL, RSS_LASTRUN, FAILED_DOWNLOAD_HANDLING, FAILED_AUTO, ENABLE_TORRENT_SEARCH, ENABLE_TPSE, WWTURL, DEMURL, TPSEURL, TPSE_PROXY, TPSE_VERIFY, ENABLE_32P, SEARCH_32P, MODE_32P, KEYS_32P, RSSFEED_32P, USERNAME_32P, PASSWORD_32P, AUTHKEY_32P, PASSKEY_32P, FEEDINFO_32P, VERIFY_32P, SNATCHEDTORRENT_NOTIFY, \ PROWL_ENABLED, PROWL_PRIORITY, PROWL_KEYS, PROWL_ONSNATCH, NMA_ENABLED, NMA_APIKEY, NMA_PRIORITY, NMA_ONSNATCH, PUSHOVER_ENABLED, PUSHOVER_PRIORITY, PUSHOVER_APIKEY, PUSHOVER_USERKEY, PUSHOVER_ONSNATCH, BOXCAR_ENABLED, BOXCAR_ONSNATCH, BOXCAR_TOKEN, \ PUSHBULLET_ENABLED, PUSHBULLET_APIKEY, PUSHBULLET_DEVICEID, PUSHBULLET_CHANNEL_TAG, PUSHBULLET_ONSNATCH, LOCMOVE, NEWCOM_DIR, FFTONEWCOM_DIR, \ PREFERRED_QUALITY, MOVE_FILES, RENAME_FILES, LOWERCASE_FILENAMES, USE_MINSIZE, MINSIZE, USE_MAXSIZE, MAXSIZE, CORRECT_METADATA, \ @@ -1253,6 +1256,11 @@ def initialize(): #set the default URL for ComicVine API here. CVURL = 'https://comicvine.gamespot.com/api/' + #set default URL for Public trackers (just in case it changes more frequently) + WWTURL = 'https://worldwidetorrents.me/' + DEMURL = 'https://dnoid.me/' + TPSEURL = 'https://torrentproject.se/' + #comictagger - force to use included version if option is enabled. if ENABLE_META: CMTAGGER_PATH = PROG_DIR diff --git a/mylar/helpers.py b/mylar/helpers.py index 953b6de8..803a6873 100755 --- a/mylar/helpers.py +++ b/mylar/helpers.py @@ -2172,13 +2172,13 @@ def torrent_create(site, linkid, alt=None): pass elif site == 'TPSE': if alt is None: - url = 'http://torrentproject.se/torrent/' + str(linkid) + '.torrent' + url = mylar.TPSEURL + 'torrent/' + str(linkid) + '.torrent' else: - url = 'http://torrentproject.se/torrent/' + str(linkid) + '.torrent' + url = mylar.TPSEURL + 'torrent/' + str(linkid) + '.torrent' elif site == 'DEM': - url = 'https://www.dnoid.me/files/download/' + str(linkid) + '/' + url = mylar.DEMURL + 'files/download/' + str(linkid) + '/' elif site == 'WWT': - url = 'https://worldwidetorrents.eu/download.php' + url = mylar.WWTURL + 'download.php' return url diff --git a/mylar/rsscheck.py b/mylar/rsscheck.py index 3557a62b..66110859 100755 --- a/mylar/rsscheck.py +++ b/mylar/rsscheck.py @@ -53,7 +53,7 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None): tpse_url = mylar.TPSE_PROXY + '/' else: #switched to https. - tpse_url = 'https://torrentproject.se/' + tpse_url = mylar.TPSEURL #this is for the public trackers included thus far in order to properly cycle throught the correct ones depending on the search request # TPSE = search only @@ -87,7 +87,7 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None): pickfeed = '6' #DEM RSS elif lp == 1 and loopit == 2: pickfeed = '999' #WWT RSS - + feedtype = None if pickfeed == "1" and mylar.ENABLE_32P: # 32pages new releases feed. @@ -112,14 +112,14 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None): continue return elif pickfeed == "5" and srchterm is not None: # demonoid search / non-RSS - feed = 'https://www.dnoid.me/' + "files/?category=10&subcategory=All&language=0&seeded=2&external=2&query=" + str(srchterm) + "&uid=0&out=rss" + feed = mylar.DEMURL + "files/?category=10&subcategory=All&language=0&seeded=2&external=2&query=" + str(srchterm) + "&uid=0&out=rss" verify = bool(mylar.TPSE_VERIFY) elif pickfeed == "6": # demonoid rss feed - feed = 'https://www.dnoid.me/rss/10.xml' + feed = mylar.DEMURL + 'rss/10.xml' feedtype = ' from the New Releases RSS Feed from Demonoid' verify = bool(mylar.TPSE_VERIFY) elif pickfeed == "999": #WWT rss feed - feed = 'https://www.worldwidetorrents.eu/rss.php?cat=132,50' + feed = mylar.WWTURL + 'rss.php?cat=132,50' feedtype = ' from the New Releases RSS Feed from WorldWideTorrents' elif int(pickfeed) >= 7 and feedinfo is not None: #personal 32P notification feeds. @@ -134,7 +134,7 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None): if pickfeed == '2' or pickfeed == '3': picksite = 'TPSE' #if pickfeed == '2': - # feedme = tpse. + # feedme = tpse. elif pickfeed == '5' or pickfeed == '6': picksite = 'DEM' #if pickfeed == '5': @@ -233,7 +233,7 @@ def torrents(pickfeed=None, seriesname=None, issue=None, feedinfo=None): logger.warn('Unable to retrieve results - probably just hitting it too fast...') continue id = urlparse.urlparse(feedme.entries[i].link).path.rpartition('/')[0] - + torthetpse.append({ 'site': picksite, 'title': feedme.entries[i].title, @@ -842,7 +842,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): if any([mylar.USE_UTORRENT, mylar.USE_RTORRENT, mylar.USE_TRANSMISSION, mylar.USE_DELUGE, mylar.USE_QBITTORRENT]): filepath = os.path.join(mylar.CACHE_DIR, filename) logger.fdebug('filename for torrent set to : ' + filepath) - + elif mylar.USE_WATCHDIR: if mylar.TORRENT_LOCAL and mylar.LOCAL_WATCHDIR is not None: filepath = os.path.join(mylar.LOCAL_WATCHDIR, filename) @@ -932,9 +932,9 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): url = helpers.torrent_create('DEM', linkit) if url.startswith('https'): - dem_referrer = 'https://www.dnoid.me/files/download/' + dem_referrer = mylar.DEMURL + 'files/download/' else: - dem_referrer = 'http://www.dnoid.me/files/download/' + dem_referrer = 'http' + mylar.DEMURL[5:] + 'files/download/' headers = {'Accept-encoding': 'gzip', 'User-Agent': str(mylar.USER_AGENT), @@ -949,9 +949,9 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): url = helpers.torrent_create('WWT', linkit) if url.startswith('https'): - wwt_referrer = 'https://worldwidetorrents.eu' + wwt_referrer = mylar.WWTURL else: - wwt_referrer = 'http://worldwidetorrent.eu' + wwt_referrer = 'http' + mylar.WWTURL[5:] headers = {'Accept-encoding': 'gzip', 'User-Agent': str(mylar.USER_AGENT), @@ -1001,7 +1001,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): if site == '32P': logger.info('[TOR2CLIENT-32P] Retrying with 32P') if mylar.MODE_32P == 1: - + logger.info('[TOR2CLIENT-32P] Attempting to re-authenticate against 32P and poll new keys as required.') feed32p = auth32p.info32p(reauthenticate=True) feedinfo = feed32p.authenticate() @@ -1010,12 +1010,12 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): mylar.ENABLE_32P = 0 mylar.config_write() return "fail" - + logger.debug('[TOR2CLIENT-32P] Creating CF Scraper') scraper = cfscrape.create_scraper() logger.debug('[TOR2CLIENT-32P] payload: %s \n verify %s \n headers %s \n', payload, verify, headers) - + try: r = scraper.get(url, params=payload, verify=verify, allow_redirects=True) except Exception, e: @@ -1046,7 +1046,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): cf_cookievalue, cf_user_agent = cfscrape.get_cookie_string(url) headers = {'Accept-encoding': 'gzip', 'User-Agent': cf_user_agent} - + r = scraper.get(url, verify=verify, cookies=cf_cookievalue, stream=True, headers=headers) except Exception, e: return "fail" @@ -1091,7 +1091,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): import test rp = test.RTorrent() - torrent_info = rp.main(filepath=filepath) + torrent_info = rp.main(filepath=filepath) if torrent_info: torrent_info['clientmode'] = 'rtorrent' @@ -1135,7 +1135,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): except Exception as e: logger.error(e) return "fail" - + elif mylar.USE_QBITTORRENT: try: qc = qbittorrent.TorrentClient() @@ -1156,7 +1156,7 @@ def torsend2client(seriesname, issue, seriesyear, linkit, site): except Exception as e: logger.error(e) return "fail" - + elif mylar.USE_WATCHDIR: if mylar.TORRENT_LOCAL: #get the hash so it doesn't mess up...