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.
This commit is contained in:
JackDandy 2017-07-13 20:20:00 +01:00
parent 46b2a69644
commit 9e32a1521d
5 changed files with 55 additions and 43 deletions

View file

@ -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

View file

@ -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,

View file

@ -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

View file

@ -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'])
<tr class="#echo ($Overview.overviewStrings[$ep_cats[$ep_str]], 'airdate-never')[$never_aired]##echo ('', ' archived')[ARCHIVED == int($ep['status'])]#">
<tr class="#echo ' '.join([$Overview.overviewStrings[$ep_cats[$ep_str]], ('', 'airdate-never')[$never_aired], ('', 'archived')[ARCHIVED == int($ep['status'])]])#">
<td class="col-checkbox">
#if $UNAIRED != int($ep['status']) and not $never_aired
#if $UNAIRED != int($ep['status'])
<input type="checkbox" class="epCheck" id="$ep_str" name="$ep_str">
#end if
</td>
#set $nfo, $nfo_img = (('No', '-no'), ('Yes', ''))[int($ep['hasnfo'])]
#set $tbn, $tbn_img = (('No', '-no'), ('Yes', ''))[int($ep['hastbn'])]
<td align="center" class="meta"><img src="$sbRoot/images/nfo${nfo_img}.gif" alt="$nfo" title="$nfo" width="23" height="11" /><br />
<img src="$sbRoot/images/tbn${tbn_img}.gif" alt="$tbn" title="$tbn" width="23" height="11" /></td>
<td align="center" class="meta"><img src="$sbRoot/images/nfo${nfo_img}.gif" alt="$nfo" title="$nfo" width="23" height="11"><br />
<img src="$sbRoot/images/tbn${tbn_img}.gif" alt="$tbn" title="$tbn" width="23" height="11"></td>
#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">
</td>
#end if
#slurp
<td class="col-name">
<img src="$sbRoot/images/info32.png" width="16" height="16" alt="" class="plotInfo#echo '%s" />' %\
('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']#<em class="tba grey-text">TBA</em>#else#$ep['name']#end if#
<img src="$sbRoot/images/info32.png" width="16" height="16" alt="" class="plotInfo#echo '%s' %\
('None opacity40', ('" id="plot_info_%s_%s_%s' % ($show.indexerid, $ep['season'], $ep['episode'])))[None is not $ep['description'] and '' != $ep['description']]#">
#set $cls = (' class="tba grey-text"', '')['good' == $Overview.overviewStrings[$ep_cats[$ep_str]]]
#if not $ep['name'] or 'TBA' == $ep['name']#<em${cls}>TBA</em>#else#$ep['name']#end if#
</td>
<td class="col-airdate">
@ -95,7 +96,7 @@
#if $ep['subtitles']
#for $sub_lang in subliminal.language.language_list($ep['subtitles'].split(','))
#if '' != sub_lang.alpha2
<img src="$sbRoot/images/flags/${sub_lang.alpha2}.png" width="16" height="11" alt="${sub_lang}" />
<img src="$sbRoot/images/flags/${sub_lang.alpha2}.png" width="16" height="11" alt="${sub_lang}">
#end if
#end for
#end if
@ -111,14 +112,14 @@
<td class="col-search">
#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')
<a class="epRetry" id="$ep_str" name="$ep_str" href="$sbRoot/home/retryEpisode?show=$show.indexerid&amp;season=$ep['season']&amp;episode=$ep['episode']"><img src="$sbRoot/images/search16.png" height="16" alt="retry" title="Retry download" /></a>
<a class="epRetry" id="$ep_str" name="$ep_str" href="$sbRoot/home/retryEpisode?show=$show.indexerid&amp;season=$ep['season']&amp;episode=$ep['episode']"><img src="$sbRoot/images/search16.png" height="16" alt="retry" title="Retry download"></a>
#else
<a class="epSearch" id="$ep_str" name="$ep_str" href="$sbRoot/home/searchEpisode?show=$show.indexerid&amp;season=$ep['season']&amp;episode=$ep['episode']"><img src="$sbRoot/images/search16.png" width="16" height="16" alt="search" title="Manual search" /></a>
<a class="epSearch" id="$ep_str" name="$ep_str" href="$sbRoot/home/searchEpisode?show=$show.indexerid&amp;season=$ep['season']&amp;episode=$ep['episode']"><img src="$sbRoot/images/search16.png" width="16" height="16" alt="search" title="Manual search"></a>
#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']
<a class="epSubtitlesSearch" href="$sbRoot/home/searchEpisodeSubtitles?show=$show.indexerid&amp;season=$ep['season']&amp;episode=$ep['episode']"><img src="$sbRoot/images/closed_captioning.png" height="16" alt="search subtitles" title="Search subtitles" /></a>
<a class="epSubtitlesSearch" href="$sbRoot/home/searchEpisodeSubtitles?show=$show.indexerid&amp;season=$ep['season']&amp;episode=$ep['episode']"><img src="$sbRoot/images/closed_captioning.png" height="16" alt="search subtitles" title="Search subtitles"></a>
#end if
</td>
</tr>

View file

@ -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)