From 9e32a1521de8449d8d5caa1afdfe82f056eb592f Mon Sep 17 00:00:00 2001 From: JackDandy Date: Thu, 13 Jul 2017 20:20:00 +0100 Subject: [PATCH] Fix "Server failed to return anything useful" when should be using cached .torrent file. Fix displayShow 'Unaired' episode rows change state where appropriate. Change displayShow to stop requiring an airdate for checkboxes. --- CHANGES.md | 9 ++++- gui/slick/css/dark.css | 1 + gui/slick/css/style.css | 38 +++++++++---------- .../interfaces/default/inc_displayShow.tmpl | 25 ++++++------ sickbeard/providers/generic.py | 25 ++++++------ 5 files changed, 55 insertions(+), 43 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 4c81b645..73c0f668 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,4 +1,11 @@ -### 0.12.21 (2017-06-19 23:35:00 UTC) +### 0.12.22 (2017-07-13 20:20:00 UTC) + +* Fix "Server failed to return anything useful" when should be using cached .torrent file +* Fix displayShow 'Unaired' episode rows change state where appropriate +* Change displayShow to stop requiring an airdate for checkboxes + + +### 0.12.21 (2017-06-19 23:35:00 UTC) * Change provider Bit-HDTV user/pass to cookie diff --git a/gui/slick/css/dark.css b/gui/slick/css/dark.css index c0113931..543313b4 100644 --- a/gui/slick/css/dark.css +++ b/gui/slick/css/dark.css @@ -315,6 +315,7 @@ home_newShow.tmpl #addRootDirTable td label .filepath, .grey-text{color:#999} .highlight-text{color:#fff} +#display-show.back-art.pro.ii .tablesorter tr .grey-text{color:#555} #newShowPortal #displayText .show-name, #newShowPortal #displayText .show-dest, diff --git a/gui/slick/css/style.css b/gui/slick/css/style.css index 0b1a3da6..5a539bf4 100644 --- a/gui/slick/css/style.css +++ b/gui/slick/css/style.css @@ -1780,6 +1780,25 @@ a.service img{ vertical-align:-2px } +.airdate-never, +#display-show .tablesorter tr.airdate-never{ + background-color:#eae2c8; + color:#666 +} +#display-show.back-art.pro.ii .tablesorter tr.airdate-never{ + background-color:rgba(234,226,200,0.7); + color:#666 +} + +.unaired, +#display-show .tablesorter tr.unaired{ + background-color:#f5f1e4 +} +#display-show.back-art.pro.ii .tablesorter tr.unaired{ + background-color:rgba(245,241,228,0.7); + color:#584b20 +} + .good, #display-show .tablesorter tr.good{ background-color:#c3e3c8 @@ -1840,25 +1859,6 @@ a.service img{ color:#295730 } -.airdate-never, -#display-show .tablesorter tr.airdate-never{ - background-color:#eae2c8; - color:#666 -} -#display-show.back-art.pro.ii .tablesorter tr.airdate-never{ - background-color:rgba(234,226,200,0.7); - color:#666 -} - -.unaired, -#display-show .tablesorter tr.unaired{ - background-color:#f5f1e4 -} -#display-show.back-art.pro.ii .tablesorter tr.unaired{ - background-color:rgba(245,241,228,0.7); - color:#584b20 -} - span.good{ color:#295730; border:1px solid #295730 diff --git a/gui/slick/interfaces/default/inc_displayShow.tmpl b/gui/slick/interfaces/default/inc_displayShow.tmpl index 52975a2e..2d93098c 100644 --- a/gui/slick/interfaces/default/inc_displayShow.tmpl +++ b/gui/slick/interfaces/default/inc_displayShow.tmpl @@ -23,17 +23,17 @@ #set $ep_str = '%sx%s' % ($ep['season'], $ep['episode']) #set $epLoc = $ep['location'] #set never_aired = 0 < int($ep['season']) and 1 == int($ep['airdate']) - + - #if $UNAIRED != int($ep['status']) and not $never_aired + #if $UNAIRED != int($ep['status']) #end if #set $nfo, $nfo_img = (('No', '-no'), ('Yes', ''))[int($ep['hasnfo'])] #set $tbn, $tbn_img = (('No', '-no'), ('Yes', ''))[int($ep['hastbn'])] - $nfo
- $tbn + $nfo
+ $tbn #if $epLoc and $show._location and $epLoc.lower().startswith($show._location.lower()) #set $epLoc = $epLoc[len($show._location)+1:] @@ -76,14 +76,15 @@ #else value="" #end if - style="padding:0; text-align:center; max-width:60px" /> + style="padding:0; text-align:center; max-width:60px"> #end if #slurp - ' %\ - ('None opacity40', ('" id="plot_info_%s_%s_%s' % ($show.indexerid, $ep['season'], $ep['episode'])))[None is not $ep['description'] and '' != $ep['description']]# - #if not $ep['name'] or 'TBA' == $ep['name']#TBA#else#$ep['name']#end if# + + #set $cls = (' class="tba grey-text"', '')['good' == $Overview.overviewStrings[$ep_cats[$ep_str]]] + #if not $ep['name'] or 'TBA' == $ep['name']#TBA#else#$ep['name']#end if# @@ -95,7 +96,7 @@ #if $ep['subtitles'] #for $sub_lang in subliminal.language.language_list($ep['subtitles'].split(',')) #if '' != sub_lang.alpha2 - ${sub_lang} + ${sub_lang} #end if #end for #end if @@ -111,14 +112,14 @@ #if 0 != int($ep['season']) #if (int($ep['status']) in $Quality.SNATCHED or int($ep['status']) in $Quality.DOWNLOADED) and $sg_var('USE_FAILED_DOWNLOADS') - retry + retry #else - search + search #end if #end if #slurp #if $sg_var('USE_SUBTITLES') and $show.subtitles and len(set(str($ep['subtitles']).split(',')).intersection(set($subtitles.wantedLanguages()))) < len($subtitles.wantedLanguages()) and $ep['location'] - search subtitles + search subtitles #end if diff --git a/sickbeard/providers/generic.py b/sickbeard/providers/generic.py index 5c4a585c..de2b295e 100644 --- a/sickbeard/providers/generic.py +++ b/sickbeard/providers/generic.py @@ -190,9 +190,8 @@ class GenericProvider: return False urls = ['http%s://%s/torrent/%s.torrent' % (u + (btih.upper(),)) - for u in (('s', 'itorrents.org'), ('s', 'torra.pro'), ('s', 'torrasave.site'), - ('s', 'torrage.info'), ('', 'reflektor.karmorra.info'), - ('s', 'torrentproject.se'), ('', 'thetorrent.org'))] + for u in (('s', 'itorrents.org'), ('s', 'torrage.info'), ('', 'reflektor.karmorra.info'), + ('s', 'torrentproject.se'), ('', 'thetorrent.org'), ('s', 'torcache.to'))] except (StandardError, Exception): link_type = 'torrent' urls = [result.url] @@ -210,20 +209,24 @@ class GenericProvider: for url in urls: cache_dir = sickbeard.CACHE_DIR or helpers._getTempDir() base_name = '%s.%s' % (helpers.sanitizeFileName(result.name), self.providerType) + final_file = ek.ek(os.path.join, final_dir, base_name) + cached = getattr(result, 'cache_file', None) + if cached and ek.ek(os.path.isfile, cached): + base_name = ek.ek(os.path.basename, cached) cache_file = ek.ek(os.path.join, cache_dir, base_name) self.session.headers['Referer'] = url - if getattr(result, 'cache_file', None) or helpers.download_file(url, cache_file, session=self.session): + if cached or helpers.download_file(url, cache_file, session=self.session): if self._verify_download(cache_file): logger.log(u'Downloaded %s result from %s' % (self.name, url)) - final_file = ek.ek(os.path.join, final_dir, base_name) try: helpers.moveFile(cache_file, final_file) msg = 'moved' except (OSError, Exception): msg = 'copied cached file' - logger.log(u'Saved %s link and %s to %s' % (link_type, msg, final_file)) + logger.log(u'Saved .%s data and %s to %s' % ( + (link_type, 'torrent cache')['magnet' == link_type], msg, final_file)) saved = True break @@ -236,9 +239,7 @@ class GenericProvider: del(self.session.headers['Referer']) if not saved and 'magnet' == link_type: - logger.log(u'All torrent cache servers failed to return a downloadable result', logger.ERROR) - logger.log(u'Advice: in search settings, change from method blackhole to direct torrent client connect', - logger.ERROR) + logger.log(u'All torrent cache servers failed to return a downloadable result', logger.DEBUG) final_file = ek.ek(os.path.join, final_dir, '%s.%s' % (helpers.sanitizeFileName(result.name), link_type)) try: with open(final_file, 'wb') as fp: @@ -246,9 +247,11 @@ class GenericProvider: fp.flush() os.fsync(fp.fileno()) logger.log(u'Saved magnet link to file as some clients (or plugins) support this, %s' % final_file) - + if 'blackhole' == sickbeard.TORRENT_METHOD: + logger.log('Tip: If your client fails to load magnet in files, ' + + 'change blackhole to a client connection method in search settings') except (StandardError, Exception): - pass + logger.log(u'Failed to save magnet link to file, %s' % final_file) elif not saved: logger.log(u'Server failed to return anything useful', logger.ERROR)