SickGear/gui/slick/interfaces/default/displayShow.tmpl
Prinz23 0a1673d66a Change how show URLs are made for TV info sources.
Change add ID format to show_url in indexer_config.
Change display/edit show, episode view, and add new/existing, for URL creation.
Change revert temporary copying show_obj solution.
Change image download error to warning.
2018-05-08 00:19:33 +01:00

521 lines
23 KiB
Cheetah

#import sickbeard
#from sickbeard import indexerApi, indexermapper, network_timezones
#from sickbeard.common import Overview, qualityPresets, qualityPresetStrings, \
Quality, statusStrings, WANTED, SKIPPED, ARCHIVED, IGNORED, FAILED, DOWNLOADED
#from sickbeard.helpers import anon_url, get_size, human, maybe_plural
#from sickbeard.indexers.indexer_config import INDEXER_TVDB, INDEXER_IMDB
<% def sg_var(varname, default=False): return getattr(sickbeard, varname, default) %>#slurp#
<% def sg_str(varname, default=''): return getattr(sickbeard, varname, default) %>#slurp#
##
#set global $title = $show.name
#set global $topmenu = 'home'
#set $exceptions_string = ', '.join($show.exceptions)
#set $css = $getVar('css', 'reg')
#set $has_art = $getVar('has_art', None)
#set $restart = 'Restart SickGear for new features on this page'
#set $show_message = ($show_message, $restart)[None is $has_art]
#set global $page_body_attr = 'display-show" class="' + $css
#set theme_suffix = ('', '-dark')['dark' == $sg_str('THEME_NAME', 'dark')]
##
#import os.path, os, re
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_top.tmpl')
<input type="hidden" id="sbRoot" value="$sbRoot">
<script>
<!--
var config = {
hasArt: #echo ('!0', '!1')[not $has_art]#,
TVShowList: [${tvshow_id_csv}],
useIMDbInfo: #echo ('!1', '!0')[$sg_var('USE_IMDB_INFO')]
}
\$.SickGear.config = {
useFuzzy: #echo ('!1', '!0')[$sg_var('FUZZY_DATING')]#,
#if $sg_var('FUZZY_DATING')##slurp#
dateFormat: '$sg_str('DATE_PRESET', '%x')',
timeFormat: '$sg_str('TIME_PRESET', '%I:%M %p')',
fuzzyTrimZero: #echo ('!1', '!0')[$sg_var('TRIM_ZERO')]#
#end if##slurp#
}
//-->
</script>
<script type="text/javascript" src="$sbRoot/js/displayShow.js?v=$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/plotTooltip.js?v=$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/sceneExceptionsTooltip.js?v=$sbPID"></script>
#if $sg_var('USE_IMDB_INFO')
<script type="text/javascript" src="$sbRoot/js/ratingTooltip.js?v=$sbPID"></script>
#end if
<script type="text/javascript" src="$sbRoot/js/ajaxEpSearch.js?v=$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/ajaxEpSubtitles.js?v=$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/lib/jquery.bookmarkscroll.js?v=$sbPID"></script>
<script type="text/javascript" src="$sbRoot/js/lib/jquery.collapser.min.js?v=$sbPID"></script>
<style>
.bfr{position:absolute;left:-999px;top:-999px}.bfr img{width:16px;height:16px}.spinner{display:inline-block;width:16px;height:16px;background:url(${sbRoot}/images/loading16${theme_suffix}.gif) no-repeat 0 0}
.images i{margin-right:6px;margin-top:5px}.hide{display:none}
.tvshowImg {border:1px solid transparent;min-width:226px;min-hieght:332px}
</style>
<div class="bfr"><img src="$sbRoot/images/loading16${theme_suffix}.gif" /></div>
<div id="background-container">
#if $has_art
<ul>
#for $k, ($image, $rating) in enumerate($fanart)
<li class="#echo ' '.join((x for x in ({10:'group', 20:'fave', 30:'avoid'}.get($rating, ''), ('', 'background first-load')[$start_image == $k]) if x)) #" style="background-image:url($sbRoot/showPoster/?show=$show.indexerid&which=fanart_$image)"></li>
#end for
</ul>
#end if
</div>
<div class="displayshow-wrapper">
<div id="change-show" class="pull-left form-inline">
Change show:
#set $displayshowlist = []
#set $cur_sel = 0
#for $curShowList in $sortedShowLists
#set $curShowType = $curShowList[0]
#set $curShowList = $curShowList[1]
#if 1 < len($sortedShowLists)
#set void = $displayshowlist.append('\t\t\t<optgroup label="%s">' % $curShowType)
#end if
#for $curShow in $curShowList
#set $show_ended = '' != $curShow.status and $curShow.status in ['ended', 'Ended', 'Canceled']
#set void = $displayshowlist.append('\t\t\t<option %svalue="%s"%s>%s</option>' % (('', 'class="ended" ')[$show_ended], $curShow.indexerid, ('', ' selected="selected"')[$curShow == $show], $curShow.name))
#end for
#if 1 < len($sortedShowLists)
#set void = $displayshowlist.append('\t\t\t</optgroup>')
#end if
#end for
##
<div id="prevShow" class="navShow addQTip" title="$prev_title">&nbsp;</div>
<select id="pickShow" class="form-control form-control-inline input-sm">
#echo '\n'.join($displayshowlist)#
</select>
<div id="nextShow" class="navShow addQTip" title="$next_title">&nbsp;</div>
</div>
<div class="clearfix" style="margin-bottom:15px"></div>
#if $show_message
<div class="alert alert-info">
$show_message
</div>
#end if
<div class="display-show-container">
<div id="posterCol" class="hidden-xs">
<a href="$sbRoot/showPoster/?show=$show.indexerid&amp;which=poster" rel="dialog">
<img src="$sbRoot/showPoster/?show=$show.indexerid&amp;which=poster_thumb" title="View poster for $show.name" class="tvshowImg addQTip" alt="">
</a>
</div>
<div id="showCol">
#if int($show.paused)
<div class="paused paused-highlight">
<i class="sgicon-pause paused-outline"></i>
</div>
#end if
<div class="details-wrapper">
<div class="details-right top">
#if 0 < len($seasons)
#set $show_ended = '' != $show.status and $show.status in ['ended', 'Ended', 'Canceled']
<div>
#if $getVar('has_special', 0 == $seasons[-1][0])
<span class="details-title">Specials</span>
<span class="details-info">#if $sg_var('DISPLAY_SHOW_SPECIALS')#<a href="#season-0">View</a><span style="margin:0 7px">-</span>#end if#<a class="inner" href="$sbRoot/toggleDisplayShowSpecials/?show=$show.indexerid">#echo ('Show', 'Hide')[$sg_var('DISPLAY_SHOW_SPECIALS')]#</a></span>
#end if
</div>
#set $many_seasons = 12 < len($seasons)
<div class="details-seasons">
<span class="details-title#echo ('', ' combo-seasons')[$many_seasons]#">Season</span>
<span class="details-info">
#set $season_list = [s[0] for s in $seasons]
#if $many_seasons
<select id="seasonJump" class="form-control form-control-inline input-sm">
<option value="jump">Jump to season</option>
#for $number in $season_list
#if 0 != $number
<option value="#season-$number">Season $number</option>
#end if
#end for
</select>
#else
#for $number in $season_list
#if 0 != $number
<a href="#season-$number">$number</a>
#end if
#end for
#end if
</span>
</div>
#end if
</div>
<div id="details-top">
<div id="showtitle" data-showname="$show.name">
<h2 class="title" id="scene_exception_$show.indexerid"><span>$show.name</span>#echo ('', '<em id="title-status"> (ended)</em>')[$show_ended]#</h2>
#set $genres_done = False
#if $sg_var('USE_IMDB_INFO') and 'genres' in $show.imdb_info and '' != $show.imdb_info['genres']
#for $imdbgenre in $show.imdb_info['genres'].split('|')
#set $genres_done = True
<span class="label"><a href="<%= anon_url('http://www.imdb.com/search/title?at=0&genres=', imdbgenre.lower().replace('-','_'),'&amp;sort=moviemeter,asc&amp;title_type=tv_series') %>" target="_blank" title="View other popular $imdbgenre shows on imdb.com" class="addQTip">$imdbgenre.replace('Sci-Fi','Science-Fiction')</a></span>
#end for
#end if
#if not $genres_done and $show.genre
#for $genre in $show.genre[1:-1].split('|')
#set $genres_done = True
<span class="label">$genre</span>
#end for#
#end if
#if not $genres_done
<span class="label">No genres</span>
#end if
</div>
</div>
</div>
<div class="details-wrapper">
<div class="details-right">
<div>
<span class="details-title">Links</span>
<span class="details-info">
#set $tvdb_id = None
#for $src_id, $src_name in $indexerApi().all_indexers.iteritems()
#if $indexerApi($src_id).config.get('defunct') and $src_id != $show.indexer
#continue
#end if
#if $src_id in $show.ids and $show.ids[$src_id].get('id', 0) > 0 and $indexermapper.MapStatus.NOT_FOUND != $show.ids[$src_id]['status']
#if $INDEXER_TVDB == $src_id
#set $tvdb_id = $show.ids[$src_id]['id']
#end if
#if $INDEXER_IMDB == $src_id and not $sg_var('USE_IMDB_INFO')
#continue
#end if
#if not $indexerApi($src_id).config.get('defunct')
<a class="service addQTip" href="$anon_url($indexerApi($src_id).config['show_url'] % $show.ids[$src_id]['id'])" rel="noreferrer" onclick="window.open(this.href, '_blank'); return !1;" title="View $src_name info in new tab">
#else#
<a class="service addQTip" href="$sbRoot/home/editShow?show=$show.indexerid#core-component-group3" title="Edit related show IDs">
#end if#
<img alt="$src_name" height="16" width="16" src="$sbRoot/images/$indexerApi($src_id).config['icon']" />
</a>
#end if
#end for
#if $has_art and $tvdb_id
<a class="service addQTip" href="$anon_url('https://fanart.tv/series/', $tvdb_id)" rel="noreferrer" onclick="window.open(this.href, '_blank'); return !1;" title="View Fanart.tv info in new tab">
<img alt="Fanart.tv" height="16" width="16" src="$sbRoot/images/fanart.png" />
</a>
#end if
#if $xem_numbering or $xem_absolute_numbering
<a class="service addQTip" href="$anon_url('http://thexem.de/search?q=', $show.name)" rel="noreferrer" onclick="window.open(this.href, '_blank'); return !1;" title="View XEM info in new tab"><img alt="[xem]" height="16" width="16" src="$sbRoot/images/xem.png" /></a>
#end if
</span>
</div>
#set $startyear, $flags, $runtime = (None, False, None)
#if $sg_var('USE_IMDB_INFO') and $show.imdbid
#if 'year' in $show.imdb_info
#set $startyear = $show.imdb_info['year'] or None
#end if
#set $flags = 'country_codes' in $show.imdb_info and '' != $show.imdb_info['country_codes']
#if 'runtimes' in $show.imdb_info
#set $runtime = $show.imdb_info['runtimes']
#end if
#end if
#if None is $startyear and $show.startyear
#set $startyear = $show.startyear
#end if
#if None is $runtime and $show.runtime
#set $runtime = $show.runtime
#end if
#if $startyear or $flags
<div>
<span class="details-title">Premiered</span>
<span class="details-info">
<span class="space-right">#echo ($startyear, 'Unknown')[None is $startyear]#</span>
#if $flags
#for $country in $show.imdb_info['country_codes'].split('|')
<img class="flag space-right" src="$sbRoot/images/flags/${$country}.png" width="16" height="11" />
#end for
#end if
</span>
</div>
#end if
#if $show.airs
#set $showairs = '%s%s' % ($show.airs.replace('y', 'y,'),
('', ' <span class="red-text" style="font-weight:bold">(invalid timeformat)</span>')[not $network_timezones.test_timeformat($show.airs)])
<div>
<span class="details-title">Air#echo ('s', 'ed')[$show_ended]#</span>
<span class="details-info">$showairs</span>
</div>
#end if
#if $show.network
<div>
<span class="details-title">Network</span>
<span class="details-info">$show.network</span>
</div>
#end if
#if None is not $runtime
<div>
<span class="details-title">Runtime</span>
<span class="details-info">$runtime minutes</span>
</div>
#end if
#if $show.status
<div>
<span class="details-title">Status</span>
<span class="details-info">$show.status</span>
</div>
#end if
#if $sg_var('USE_IMDB_INFO') and 'rating' in $show.imdb_info
<div>
<span class="details-title">IMDb rating</span>
<span class="details-info">
#if $show.imdb_info['votes']
#set $rating_tip = '%s of 10 stars<br />%s votes' % (str($show.imdb_info['rating']), str($show.imdb_info['votes']))
<span class="imdbstars" qtip-content="$rating_tip">$show.imdb_info['rating']</span>
#else
<span>No votes available</span>
#end if
</span>
</div>
#end if
#set $anyQualities, $bestQualities = $Quality.splitQuality(int($show.quality))
#if $show.quality in $qualityPresets
<div>
<span class="details-title">Quality</span>
<span class="details-info">
<span class="quality $qualityPresetStrings[$show.quality]">$qualityPresetStrings[$show.quality]</span>
</span>
</div>
#else
#if $anyQualities
<div>
<span class="details-title">Qualities</span>
<span class="details-info">
#echo ', '.join([$Quality.get_quality_ui($x) for $x in sorted($anyQualities)])#
</span>
</div>
#end if
#if $bestQualities
<div>
<span class="details-title">Upgrade to</span>
<span class="details-info">
#echo ', '.join([$Quality.get_quality_ui($x) for $x in sorted($bestQualities)])#
</span>
</div>
#end if
#end if
</div>
<div id="details-left">
#set $has_overview = '' != $show.overview
#set $ep_tally = ('', '(<span class="hint">%s episodes</span>)' % $ep_counts['eps_all'])[0 < $ep_counts['eps_all']]
<div class="#echo ('no', 'details')[$has_overview]#-plot">
$ep_tally
#if $has_overview
$show.overview
#else
#echo ('', '<br /><br />')[any($ep_tally)]
#if $show_ended
#if $varExists('force_update')
A <a href="$sbRoot/$force_update" title="Trigger force full update">force full update</a> may return a plot overview for this ended show
#else
Restart SickGear to get a new link here for this ended show
#end if
#else
No plot overview available
#end if
#end if
</div>
<div id="details-bottom">
<span class="label addQTip" title="Info language, $show.lang"><img src="$sbRoot/images/flags/${show.lang}.png" width="16" height="11" alt="" style="margin-top:-1px" /></span>
<span class="label addQTip" title="Location#echo (' no longer exists" style="background-color:#8f1515"', '"')[$showLoc[1]]#>$showLoc[0]</span>
<span class="label addQTip" title="Size">$human($get_size($showLoc[0]))</span>
#set $filecount = sum([$c for $k, $c in $ep_counts['videos'].items()])
<span class="label addQTip" title="Videos">#echo ('No', $filecount)[0 < $filecount]# file$maybe_plural($filecount)</span>
#if $show.paused
<span class="label label-paused">Paused</span>
#end if
#if ($anyQualities + $bestQualities) and int($show.upgrade_once)
<span class="label">Upgrade once</span>
#end if
#if $show.exceptions
<span class="label addQTip" title="$exceptions_string.replace(', ', '<br />')">Scene names</span>
#end if
#if $show.rls_ignore_words
<span class="label addQTip" title="#echo $show.rls_ignore_words.replace(',', '<br />')#">Ignored words</span>
#end if
#if $show.rls_require_words
<span class="label addQTip" title="#echo $show.rls_require_words.replace(',', '<br />')#">Required words</span>
#end if
#if $show.flatten_folders or $sg_var('NAMING_FORCE_FOLDERS')
<span class="label">Flat folders</span>
#end if
#if int($show.air_by_date)
<span class="label">Air by date</span>
#end if
#if int($show.dvdorder)
<span class="label">DVD order</span>
#end if
#if int($show.scene)
<span class="label">Scene numbering</span>
#end if
#if $sg_var('USE_SUBTITLES') and int($show.subtitles)
<span class="label">Subtitles</span>
#end if
#if int($show.is_sports)
<span class="label">Sports</span>
#end if
#if int($show.is_anime)
<span class="label">Anime</span>
#end if
#if $bwl and $bwl.whitelist
<span class="label addQTip" title="#echo ', '.join($bwl.whitelist).replace(',', '<br />')#">Wanted group$maybe_plural(len($bwl.whitelist))</span>
#end if
#if $bwl and $bwl.blacklist
<span class="label addQTip" title="#echo ', '.join($bwl.blacklist).replace(',', '<br />')#">Unwanted group$maybe_plural(len($bwl.blacklist))</span>
#end if
</div>
</div>
</div>
</div>
</div>
<div class="clearfix"></div>
<div id="change-status" class="pull-left">
<p style="margin-bottom:5px">Change selected episodes to</p>
<select id="statusSelect" class="form-control form-control-inline input-sm showlist-select">
#for $curStatus in [$WANTED, $SKIPPED, $IGNORED, $FAILED]
<option value="$curStatus">$statusStrings[$curStatus]</option>
#end for
<optgroup label="Downloaded">
#for $curStatus in sorted($Quality.DOWNLOADED)
#if $DOWNLOADED != $curStatus
<option value="$curStatus">$re.sub('Downloaded\s*\(([^\)]+)\)', r'\1', $statusStrings[$curStatus].replace('SD DVD', 'SD DVD/BR/BD'))</option>
#end if
#end for
<option value="$DOWNLOADED">with archived quality</option>
</optgroup>
<optgroup label="Archived with">
<option value="$ARCHIVED">downloaded quality</option>
<option value="-$ARCHIVED">default ($min_initial)</option>
</optgroup>
</select>
<input type="hidden" id="showID" value="$show.indexerid">
<input type="hidden" id="indexer" value="$show.indexer">
<input class="btn btn-inline" type="button" id="changeStatus" value="Go">
</div>
<div class="pull-right clearfix" id="checkboxControls">
<div style="padding-bottom:5px" class="addQTip" title="Filter Episodes">
<label for="good"><span class="good"><input type="checkbox" id="good" checked="checked"> Downloaded: <b>$ep_counts[$Overview.GOOD]</b></span></label>
<label for="snatched"><span class="snatched"><input type="checkbox" id="snatched" checked="checked"> Snatched: <b>$ep_counts[$Overview.SNATCHED]</b></span></label>
<label for="wanted"><span class="wanted"><input type="checkbox" id="wanted" checked="checked"> Wanted: <b>$ep_counts[$Overview.WANTED]</b></span></label>
<label for="qual"><span class="qual"><input type="checkbox" id="qual" checked="checked"> Low Quality: <b>$ep_counts[$Overview.QUAL]</b></span></label>
<label for="skipped"><span class="skipped"><input type="checkbox" id="skipped" checked="checked"> Skipped: <b>$ep_counts[$Overview.SKIPPED]</b></span></label>
</div>
<div class="pull-right" >
<button class="btn btn-xs seriesCheck">Select filtered episodes</button>
<button class="btn btn-xs clearAll">Clear all</button>
</div>
</div>
<div class="clearfix"></div>
#if not len($seasons)
<div id="no-episode-data">
<h3>No episode details at TV info source
<a class="service" href="$anon_url($indexerApi($show.indexer).config['show_url'] % $show.indexerid)" onclick="window.open(this.href, '_blank'); return !1;" title="View $indexerApi($show.indexer).name info in new tab">$indexerApi($show.indexer).name</a>
</h3>
</div>
#else
#set $working_season = -1
#set $odd = 0
#set $scene, $scene_anime = (False, False)
#if not $show.air_by_date and not $show.is_sports and not $show.is_anime and $show.is_scene
#set $scene = True
#elif not $show.air_by_date and not $show.is_sports and $show.is_anime and $show.is_scene
#set $scene_anime = True
#end if
#for $season, $episodes in $seasons
#for $ep in $episodes
#if None is not $ep
#set $ep_str = '%sx%s' % ($season, $ep['episode'])
#if $ep_str not in $ep_cats or (0 == $season and not $sg_var('DISPLAY_SHOW_SPECIALS'))
#continue
#end if
#end if
#if $working_season != $season
#if 0 <= $working_season
</tbody>
</table>
#end if
#set $working_season = $season
#set $human_season = ('Season %s' % $season, 'Specials')[0 == $season]
## one off variable migration, on next version apply... (s/$getVar('display_seasons', [])/[]/),
<table class="sickbeardTable#echo '%s%s%s' % (('', ' season-min')[$season in $getVar('season_min', $getVar('display_seasons', []))], ('', ' latest-season')[$latest_season == $season], ('', ' open')[$season in $getVar('other_seasons', [])])#">
<thead>
<tr>
<th class="row-seasonheader" colspan="13">
#if None is $has_art#<span class="red-text pull-right">Restart SickGear to reveal new options here</span>
#elif not (1 == $lowest_season and 1 == $latest_season and $latest_season >= $highest_season)
<button id="showseason-$season" type="button" class="btn btn-default pull-right"><span class="onshow">Show $human_season.lower()<i class="sgicon-arrowdown"></i></span><span class="onhide">Hide $human_season.lower()<i class="sgicon-arrowup"></i></span></button>
<button type="button" class="btn btn-default pull-right allseasons"><span class="onshow">Show all</span><span class="onhide">Hide most</span><i class="icon-glyph"></i></button>
<span class="images pull-right hide"><i class="spinner"></i></span>
#end if
#set $videos = $ep_counts['videos'].get($season, '0')
#set $season_stats = $ep_counts['status'].get($season, {})
#set $snatched = $season_stats.get($Overview.SNATCHED, None)
#set $wanted = $season_stats.get($Overview.WANTED, None)
#set $qual = $season_stats.get($Overview.QUAL, None)
#set $good = $season_stats.get($Overview.GOOD, '0')
#set $archived = False if $season not in $ep_counts['archived'] else $ep_counts['archived'][$season]
<h3>$human_season<a id="season-$season" name="season-$season"></a>
#if None is not $has_art
<span class="season-status"><span class="good status-badge">&nbsp;D: <strong>$good</strong>&nbsp;</span>#if snatched#<span class="snatched status-badge">&nbsp;S: <strong>$snatched</strong>&nbsp;</span>#end if##if $wanted#<span class="wanted status-badge">&nbsp;W: <strong>$wanted</strong>&nbsp;</span>#end if##if $qual#<span class="qual status-badge">&nbsp;LQ: <strong>$qual</strong>&nbsp;</span>#end if#&nbsp;of&nbsp;<span class="footerhighlight">$ep_counts['totals'][$season]</span>#if 0 < $archived#&nbsp;with <span class="footerhighlight">$archived</span> archived#end if##if int($videos)#&nbsp;#echo ('with', 'and')[0 < $archived]#&nbsp;<span class="footerhighlight">$videos</span> file$maybe_plural($videos)#end if#</span>
#end if
</h3>
</th>
</tr>
#set $attr_title_ep = ('', ' (Anime #)')[$show.is_anime]
<tr id="season-$season-cols" class="seasoncols collapse tablesorter-headerRow">
<td class="col-checkbox tablesorter-no-sort"><input type="checkbox" class="seasonCheck" id="$season"></td>
<th class="col-metadata tablesorter-no-sort">Meta</th>
<th class="col-ep tablesorter-ep-num"><span title="Ep #$attr_title_ep">#</span></th>#if $scene or $scene_anime
<th class="col-ep tablesorter-ep-scene" style="padding-right:18px">Scene#if $scene_anime# absolute#end if#</th>#end if#
<th class="col-name">Name</th>
<th class="col-airdate tablesorter-airdate">Air Date</th>#if $sg_var('USE_SUBTITLES') and $show.subtitles
<th class="col-subtitles tablesorter-no-sort">Subtitles</th>#end if
<th class="col-status">Status</th>
<th class="col-search tablesorter-no-sort">Search</th>
</tr>
</thead>
<tbody class="collapse">
#end if
#if None is $ep
</tbody>
#continue
#end if
#set global $episode = $ep
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_displayShow.tmpl')
#end for
#end for
</tbody>
</table>
#end if
</div>
#if None is not $has_art
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_livepanel.tmpl')
#end if
#include $os.path.join($sg_str('PROG_DIR'), 'gui/slick/interfaces/default/inc_bottom.tmpl')