mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-23 21:35:05 +00:00
Add menu Shows/"TMDB Cards".
Add top rated, popular, trending today, trending this week, to TMDB cards. Change Shows/Add show... Trakt and IMDb card descriptions to be dynamic. Add network data to trakt cards. Add fallback for show cast when no suitable items are found in tvdb_api. Change refactor for trakt lib update. Change sanitise api response dates for cards (an invalid trakt date caused a UI glitch). Fix issue where trakt can return no tvdb id causing a card to not display. Change view-show TVDb genre links to use anon link setting. Change remove displayShow.tmpl code for '|' sep as it is a fixed list string at data source. Change add TVINFO_FANSITE placeholder icon. Change refactor api sg.`CMD_SickGearShowsBrowseTrakt`. --- Refactor date handling to make it's usage consistent from indexerapi Split when_past out to to started_past and return_past for UI. Fix trakt returning dates. Change bring properly into use, the proper new season returning date. Change remove PY2 unused import statements. --- Fix issue with Trakt cards where an incorrect cache image obscures the default card placeholder image. Simplify airtime for cards. Remove nonsense TMDB api overview text. Rearrange cards order on top menu. --- Remove unused vars and simplify regex use cases. Fix tv cards issue with Trakt and Tvmaze where show_info does not carry a first episode_info. Instantiate with TVInfoEpisode() instead of None, so that expected properties exist without a need for Nonetype tests. Change simplify `overview` and `airtime` use after lib output type is made trustable. Change cards view to not allow items with no seriesname.
This commit is contained in:
parent
7a6936823e
commit
fce8878fa9
13 changed files with 1167 additions and 953 deletions
|
@ -19,6 +19,9 @@
|
|||
* Add to config/media-process/File Handling, "Rename TBA" and "Rename any"
|
||||
* Add config to change media process log message if there is no media to process
|
||||
* Change view-show text "invalid timeformat" to "time unknown"
|
||||
* Add menu Shows/"TMDB Cards"
|
||||
* Add a persons available socials (Youtube, LinkedIn, Reddit, Fansite, TikTok, Wikidata)
|
||||
* Change use TVDb genres on view-show if config/General/Interface/"Enable IMDb info" is disabled
|
||||
|
||||
|
||||
### 3.28.0 (2023-04-12 13:05:00 UTC)
|
||||
|
|
|
@ -1439,12 +1439,16 @@ home_browseShows.tmpl
|
|||
padding-top:2px
|
||||
}
|
||||
|
||||
.show-card-inner .rating{
|
||||
margin-right:3px;
|
||||
}
|
||||
|
||||
.show-card-inner .heart.icon-glyph{
|
||||
display:inline-block;
|
||||
float:none;
|
||||
height:15px;
|
||||
width:15px;
|
||||
margin:0 -3px -2px 2px
|
||||
margin:0 -3px -2px -1px
|
||||
}
|
||||
|
||||
.show-card-inner p, .show-card-inner i{
|
||||
|
|
BIN
gui/slick/images/_placeholder16.png
Normal file
BIN
gui/slick/images/_placeholder16.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 227 B |
|
@ -168,7 +168,7 @@
|
|||
<h2 class="title" id="scene_exception_$show_obj.tvid_prodid"><span>$show_obj.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_obj.imdb_info and '' != $show_obj.imdb_info['genres']
|
||||
#for $imdbgenre in [$g for $g in $show_obj.imdb_info['genres'].split('|') if $g]
|
||||
#for $imdbgenre in $show_obj.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('-','_'),'&sort=moviemeter,asc&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
|
||||
|
@ -176,13 +176,10 @@
|
|||
#if not $genres_done and $show_obj.genre
|
||||
#for $genre in $show_obj.genre.split('|')
|
||||
#set $genres_done = True
|
||||
<span class="label">
|
||||
#if $TVINFO_TVDB == $show_obj.tvid
|
||||
<a href="https://thetvdb.com/genres/$genre" target="_blank" title="View other popular $genre shows on thetvdb.com" class="addQTip">$genre</a>
|
||||
#else
|
||||
$genre
|
||||
#end if
|
||||
</span>
|
||||
#if $TVINFO_TVDB == $show_obj.tvid
|
||||
#set $genre = '<a href="%s" target="_blank" title="View other popular %s shows on thetvdb.com" class="addQTip">%s</a>' % (anon_url('https://thetvdb.com/genres/', $genre), $genre, $genre)
|
||||
#end if
|
||||
<span class="label">$genre</span>
|
||||
#end for#
|
||||
#end if
|
||||
#if not $genres_done
|
||||
|
|
|
@ -10,8 +10,10 @@
|
|||
#set $mode = $kwargs and $kwargs.get('mode', '')
|
||||
#set $use_network = $kwargs.get('use_networks', False)
|
||||
#set $use_returning = 'returning' == mode
|
||||
#set $use_votes = $kwargs and $kwargs.get('use_votes', True)
|
||||
#set $use_filter = $kwargs and $kwargs.get('use_filter', True)
|
||||
#set $use_ratings = $kwargs and $kwargs.get('use_ratings', True)
|
||||
#set $use_votes = $kwargs and $kwargs.get('use_votes', True)
|
||||
#set $term_vote = $kwargs and $kwargs.get('term_vote', 'Votes')
|
||||
##
|
||||
#set global $title='Browse %s Shows' % $browse_type
|
||||
#set global $header='Browse Shows'
|
||||
|
@ -236,7 +238,8 @@ $(document).ready(function(){
|
|||
$('#showfilter').on('change', function(){
|
||||
var filterValue = this.value;
|
||||
if (-1 == filterValue.indexOf('trakt') && -1 == filterValue.indexOf('imdb') && -1 == filterValue.indexOf('mc_')
|
||||
&& -1 == filterValue.indexOf('tvc_') && -1 == filterValue.indexOf('tvm_')
|
||||
&& -1 == filterValue.indexOf('tmdb_') && -1 == filterValue.indexOf('tvc_')
|
||||
&& -1 == filterValue.indexOf('tvm_')
|
||||
&& -1 == filterValue.indexOf('ne_') && -1 == filterValue.indexOf('_ne')
|
||||
&& -1 == filterValue.indexOf('default')) {
|
||||
var el$ = $('#container')
|
||||
|
@ -322,16 +325,16 @@ $(document).ready(function(){
|
|||
</optgroup>
|
||||
<optgroup label="Sort by">
|
||||
<option value="by_name"#if 'by_name' in $saved_showsort_sortby and not $reset_showsort_sortby#$selected>> #else#>#end if#Name</option>
|
||||
## omit for TVMaze as original order == First Aired
|
||||
#if 'TVmaze' not in $browse_type
|
||||
## omit for TVMaze as original order == First Aired
|
||||
#if 'TVmaze' not in $browse_type
|
||||
<option value="by_order"#if 'by_order' in $saved_showsort_sortby or $reset_showsort_sortby#$selected>> #else#>#end if#Original</option>
|
||||
#end if
|
||||
#end if
|
||||
<option value="by_premiered"#if 'by_premiered' in $saved_showsort_sortby and not $reset_showsort_sortby#$selected>> #else#>#end if#First aired</option>
|
||||
#if $use_returning
|
||||
<option value="by_returning"#if 'by_returning' in $saved_showsort_sortby and not $reset_showsort_sortby#$selected>> #else#>#end if#Returning</option>
|
||||
#end if
|
||||
#if $use_votes
|
||||
<option value="by_votes"#if 'by_votes' in $saved_showsort_sortby#$selected>> #else#>#end if#Votes</option>
|
||||
<option value="by_votes"#if 'by_votes' in $saved_showsort_sortby#$selected>> #else#>#end if#$term_vote</option>
|
||||
#end if
|
||||
#if $use_ratings
|
||||
<option value="by_rating"#if 'by_rating' in $saved_showsort_sortby#$selected>> #else#>#end if#% Rating</option>
|
||||
|
@ -342,13 +345,13 @@ $(document).ready(function(){
|
|||
</optgroup>
|
||||
</select>
|
||||
|
||||
#if 'Ani' not in $browse_type
|
||||
#if 'Ani' not in $browse_type and $use_filter
|
||||
<select id="showfilter" class="form-control form-control-inline input-sm">
|
||||
#set $selected = ' class="selected" selected="selected"'
|
||||
#if 'Trakt' == $browse_type
|
||||
<optgroup label="Trakt">
|
||||
<option value="trakt_anticipated"#echo ('', selected)['anticipated' == $mode]#>Anticipating</option>
|
||||
<option value="trakt_newseasons"#echo ('', selected)['newseasons' == $mode]#>New Seasons</option>
|
||||
<option value="trakt_newseasons"#echo ('', selected)['returning' == $mode]#>New Seasons</option>
|
||||
<option value="trakt_newshows"#echo ('', selected)['newshows' == $mode]#>New Shows</option>
|
||||
<option value="trakt_popular"#echo ('', selected)['popular' == $mode]#>Popular</option>
|
||||
<option value="trakt_trending"#echo ('', selected)['trending' == $mode]#>Trending</option>
|
||||
|
@ -423,6 +426,14 @@ $(document).ready(function(){
|
|||
<option value="mc_newseries?more=1"#echo ('', selected + ' disabled')[mode.endswith('more')]#>... list more</option>
|
||||
#end if
|
||||
</optgroup>
|
||||
#elif 'TMDB' == $browse_type
|
||||
<optgroup label="TMDB">
|
||||
<option value="tmdb_upcoming"#echo ('', selected)['upcoming' == $mode]#>Upcoming</option>
|
||||
<option value="tmdb_popular"#echo ('', selected)['popular' == $mode]#>Popular</option>
|
||||
<option value="tmdb_toprated"#echo ('', selected)['toprated' == $mode]#>Top rated</option>
|
||||
<option value="tmdb_trending_today"#echo ('', selected)['trending_today' == $mode]#>Trending today</option>
|
||||
<option value="tmdb_trending_week"#echo ('', selected)['trending_week' == $mode]#>Trending this week</option>
|
||||
</optgroup>
|
||||
#elif 'TVCalendar' == $browse_type
|
||||
<optgroup label="TVCalendar">
|
||||
#for $page in $kwargs.get('pages') or []
|
||||
|
@ -466,10 +477,10 @@ $(document).ready(function(){
|
|||
#set $poster_id += 1
|
||||
|
||||
#set $title_html = $this_show['title'].replace('"', '"').replace("'", ''')
|
||||
#if 'newseasons' == $mode
|
||||
#if 'returning' == $mode
|
||||
#set $overview = '%s: %s' % (
|
||||
('Season %s' % $this_show['episode_season'], 'Brand-new')[1 == $this_show['episode_season']],
|
||||
($this_show['overview'], $this_show['episode_overview'])[any($this_show['episode_overview']) and 1 != $this_show['episode_season']])
|
||||
'Season %s' % $this_show['episode_season'],
|
||||
$this_show['episode_overview'] or $this_show['overview'])
|
||||
#else
|
||||
#set $overview = $this_show['overview']
|
||||
#end if
|
||||
|
@ -477,16 +488,18 @@ $(document).ready(function(){
|
|||
#set $show_id = $this_show.get('show_id')
|
||||
#set $known = ('not', '')[bool($this_show.get('indb'))]
|
||||
#set $hide = ('', '%shide ' % ('', 'to-')['.hide' in $saved_showsort_view])[bool($this_show.get('hide'))]
|
||||
#set $data_rating = $try_float($this_show['rating'])
|
||||
#if $use_ratings:
|
||||
#set $data_rating = $try_float($this_show['rating'])
|
||||
#end if
|
||||
|
||||
<div class="show-card ${hide}${known}inlibrary" data-name="#echo re.sub(r'([\'\"])', r'', $this_show['title'])#" data_id="$show_id"#if $use_ratings# data-rating="$data_rating"#end if##if $use_votes# data-votes="$this_show['votes']"#end if# data-premiered="$this_show['premiered']"#if $use_returning# data-returning="$this_show['returning']"#end if# data-order="$this_show['order']"#if $use_network# data-network="$this_show['network']"#end if#>
|
||||
<div class="show-card ${hide}${known}inlibrary" data-name="#echo re.sub(r'([\'\"])', r'', $this_show['title'])#" data_id="$show_id"#if $use_ratings# data-rating="$data_rating"#end if##if $use_votes# data-votes="$this_show['votes']"#end if# data-premiered="$this_show['ord_premiered']"#if $use_returning# data-returning="$this_show['ord_returning']"#end if# data-order="$this_show['order']"#if $use_network# data-network="$this_show['network']"#end if#>
|
||||
<div class="show-card-inner">
|
||||
<div class="browse-image">
|
||||
<a class="browse-image" href="<%= anon_url(this_show['url_src_db']) %>" target="_blank"
|
||||
title="<span style='color: rgb(66, 139, 202)'>$re.sub(r'(?m)\s+\((?:19|20)\d\d\)\s*$', '', $title_html)</span>
|
||||
|
||||
#if $this_show['genres']#<br><div style='font-weight:bold'>(<em>$this_show['genres']</em>)</div>#end if#
|
||||
#if $kwargs and $use_returning#<span style='display:block;clear:both;font-weight:bold;font-size:0.9em;color:#888'><em>Season $this_show['episode_season'] returns $this_show['returning_str']</em></span>#end if#
|
||||
#if $kwargs and $use_returning#<span style='display:block;clear:both;font-weight:bold;font-size:0.9em;color:#888'><em>Season $this_show['episode_season'] return#echo ('s', 'ed')[$this_show['return_past']]# $this_show['str_returning']</em></span>#end if#
|
||||
#if $this_show.get('country') or $this_show.get('language')
|
||||
<p style='line-height:15px;margin-bottom:2px'>
|
||||
#if $this_show.get('country')
|
||||
|
@ -498,7 +511,7 @@ $(document).ready(function(){
|
|||
</p>
|
||||
#end if
|
||||
<p style='margin:0 0 2px'>#echo re.sub(r'([,\.!][^,\.!]*?)$', '...', re.sub(r'([!\?\.])(?=\w)', r'\1 ', $overview)).replace('.....', '...')#</p>
|
||||
<p>#if $this_show['premiered_str']#<span style='font-weight:bold;font-size:0.9em;color:#888'><em>#if $kwargs and 'newseasons' == $mode#Air#else#First air#end if##echo ('s', 'ed')[$this_show['when_past']]#: $this_show['premiered_str']</em></span>#end if#
|
||||
<p>#if $this_show['str_premiered']#<span style='font-weight:bold;font-size:0.9em;color:#888'><em>#if 'Trakt' == $browse_type and $kwargs and 'returning' == $mode#Air#else#First air#end if##echo ('s', 'ed')[$this_show['started_past']]#: $this_show['str_premiered']</em></span>#end if#
|
||||
#if $this_show.get('ended_str')# - <span style='font-weight:bold;font-size:0.9em;color:#888'><em>Ended: $this_show['ended_str']</em></span>#end if#
|
||||
#if $this_show.get('network')#<span style='display:block;clear:both;font-weight:bold;font-size:0.9em;color:#888'><em>On: $this_show['network']</em></span>#end if#
|
||||
</p>
|
||||
|
@ -521,7 +534,7 @@ $(document).ready(function(){
|
|||
#end if
|
||||
<div class="clearfix">
|
||||
#if $use_ratings or $use_votes
|
||||
<p>#if $use_ratings#$this_show['rating']#if $re.search(r'^\d+(\.\d+)?$', (str($this_show['rating'])))#%#end if##end if##if $use_votes#<i class="heart icon-glyph"></i><i>$this_show['votes'] votes</i>#end if#</p>#slurp#
|
||||
<p>#if $use_ratings#<span class="rating">$this_show['rating']#if $re.search(r'^\d+(\.\d+)?$', (str($this_show['rating'])))#%</span>#end if##end if##if $use_votes#<i class="heart icon-glyph"></i><i>$this_show['votes'] $term_vote.lower()</i>#end if#</p>#slurp#
|
||||
#end if
|
||||
#if 'url_tvdb' in $this_show and $this_show['url_tvdb']
|
||||
<a class="service" href="<%= anon_url(this_show['url_tvdb']) %>" onclick="window.open(this.href, '_blank'); return false;"
|
||||
|
@ -539,7 +552,7 @@ $(document).ready(function(){
|
|||
</div>
|
||||
</div>
|
||||
<div class="ui-progressbar ui-widget ui-widget-content ui-corner-all">
|
||||
#set $state = 'progress-%s0" title="%s"' % (('2', 'Upcoming'), ('8', 'Started'))[$this_show['when_past']]
|
||||
#set $state = 'progress-%s0" title="%s"' % (('2', 'Upcoming'), ('8', 'Started'))[$this_show['started_past']]
|
||||
<div style="width:102%" class="ui-progressbar-value ui-widget-header ui-corner-left ui-corner-right $state></div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
#import sickgear
|
||||
#import datetime
|
||||
#import re
|
||||
#import urllib
|
||||
#from sickgear.common import Quality, SNATCHED_ANY, DOWNLOADED, ARCHIVED, FAILED
|
||||
#from sickgear.helpers import anon_url
|
||||
|
@ -176,10 +177,29 @@
|
|||
<li><a id="add-show-name" data-href="$sbRoot/add-shows/find/" tabindex="$tab#set $tab += 1#"><i class="sgicon-addshow"></i>
|
||||
<input class="form-control form-control-inline input-sm" type="text" placeholder="Search" tabindex="$tab#set $tab += 1#">
|
||||
<div class="menu-item-desc opacity60">find show at TV info source</div></a></li>
|
||||
#set $tvm_modes = dict(tvm_premieres='new shows', tvm_returning='returning')
|
||||
#set $tvm_mode = $tvm_modes.get($sg_var('TVM_MRU'), 'new shows')
|
||||
<li><a href="$sbRoot/add-shows/tvm-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-tvmaze"></i>TVmaze Cards
|
||||
<div class="menu-item-desc opacity60">$tvm_mode...</div></a></li>
|
||||
#set $tmdb_modes = dict(tmdb_upcoming='upcoming', tmdb_popular='popular', tmdb_toprated='top rated', tmdb_trending_today='trending today', tmdb_trending_week='trending this week')
|
||||
#set $tmdb_mode = $tmdb_modes.get($sg_var('TMDB_MRU'), 'upcoming')
|
||||
<li><a href="$sbRoot/add-shows/tmdb-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-addshow"></i>TMDB Cards
|
||||
<div class="menu-item-desc opacity60">$tmdb_mode...</div></a></li>
|
||||
#set $trakt_modes = dict(trakt_anticipated='anticipated', trakt_returning='returning', trakt_newshows='premieres', trakt_popular='popular', trakt_trending='trending',
|
||||
trakt_watched='most watched this month', trakt_watched_period_year='most watched this year',
|
||||
trakt_played='most played this month', trakt_played_period_year='most played this year',
|
||||
trakt_collected='most collected this month', trakt_collected_period_year='most collected this year',
|
||||
trakt_recommended='recommended', trakt_watchlist='watchlist')
|
||||
#set $trakt_mode = $trakt_modes.get(re.sub('[\?=]', '_', $sg_var('TRAKT_MRU')), 'trends, tailored suggestions')
|
||||
<li><a href="$sbRoot/add-shows/trakt-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-trakt"></i>Trakt Cards
|
||||
<div class="menu-item-desc opacity60">trends, tailored suggestions...</div></a></li>
|
||||
<div class="menu-item-desc opacity60">$trakt_mode...</div></a></li>
|
||||
#set $imdb_func = $sg_str('IMDB_MRU').split('-')
|
||||
#set $imdb_mru, $params = ($imdb_func[0], '') if 2 > len($imdb_func) else $imdb_func
|
||||
#set $period = ('', ' %s' % $params.replace(',', ' to '))['popular' == $imdb_mru]
|
||||
#set $imdb_modes = dict(popular='popular', watchlist='watchlist')
|
||||
#set $imdb_mode = $imdb_modes.get($imdb_mru, 'popular decades, watchlists...')
|
||||
<li><a href="$sbRoot/add-shows/imdb-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-imdb"></i>IMDb Cards
|
||||
<div class="menu-item-desc opacity60">popular decades, watchlists...</div></a></li>
|
||||
<div class="menu-item-desc opacity60">$imdb_mode$period...</div></a></li>
|
||||
#set $mc_modes = dict(mc_90days='last 90 days', mc_year='by year', mc_discussed='most discussed', mc_shared='most shared')
|
||||
#set $mc_mode = $mc_modes.get($sg_var('MC_MRU'), 'new seasons')
|
||||
<li><a href="$sbRoot/add-shows/mc-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-metac"></i>Metacritic Cards
|
||||
|
@ -188,10 +208,6 @@
|
|||
#set $tvc_mode = $tvc_modes.get($sg_var('TVC_MRU'), 'new shows')
|
||||
<li><a href="$sbRoot/add-shows/tvc-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-tvc"></i>TV Calendar Cards
|
||||
<div class="menu-item-desc opacity60">$tvc_mode...</div></a></li>
|
||||
#set $tvm_modes = dict(tvm_premieres='new shows', tvm_returning='returning')
|
||||
#set $tvm_mode = $tvm_modes.get($sg_var('TVM_MRU'), 'new shows')
|
||||
<li><a href="$sbRoot/add-shows/tvm-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-tvmaze"></i>TVmaze Cards
|
||||
<div class="menu-item-desc opacity60">$tvm_mode...</div></a></li>
|
||||
#set $ne_modes = dict(ne_newpop='new popular', ne_newtop='new top rated', ne_upcoming='upcoming', ne_trending='trending')
|
||||
#set $ne_mode = $ne_modes.get($sg_var('NE_MRU'), 'new popular')
|
||||
<li><a href="$sbRoot/add-shows/ne-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-ne"></i>Next Episode Cards
|
||||
|
|
|
@ -8,6 +8,7 @@ __api_version__ = '1.0.0'
|
|||
|
||||
import datetime
|
||||
import logging
|
||||
import re
|
||||
|
||||
from lib import tmdbsimple
|
||||
from lib.dateutil.parser import parser
|
||||
|
@ -191,7 +192,7 @@ class TmdbIndexer(TVInfoBase):
|
|||
ti_show.overview, ti_show.poster, ti_show.ids, ti_show.language, ti_show.popularity, ti_show.rating = \
|
||||
clean_data(s['name']), s['id'], s['id'], clean_data(s.get('first_air_date')) or None, \
|
||||
clean_data([self.tv_genres.get(g) for g in s.get('genre_ids') or []]), \
|
||||
enforce_type(clean_data(s.get('overview')), str, ''), s.get('poster_path') and '%s%s%s' % (
|
||||
self._enforce_text(s.get('overview')), s.get('poster_path') and '%s%s%s' % (
|
||||
self.img_base_url, self.size_map[TVInfoImageType.poster][TVInfoImageSize.original],
|
||||
s.get('poster_path')), \
|
||||
TVInfoIDs(tvdb=s.get('external_ids') and s['external_ids'].get('tvdb_id'),
|
||||
|
@ -327,7 +328,7 @@ class TmdbIndexer(TVInfoBase):
|
|||
ti_show.id = character.get('id')
|
||||
ti_show.ids = TVInfoIDs(ids={TVINFO_TMDB: ti_show.id})
|
||||
ti_show.seriesname = enforce_type(clean_data(character.get('original_name')), str, '')
|
||||
ti_show.overview = enforce_type(clean_data(character.get('overview')), str, '')
|
||||
ti_show.overview = self._enforce_text(character.get('overview'))
|
||||
ti_show.firstaired = clean_data(character.get('first_air_date'))
|
||||
ti_show.language = clean_data(character.get('original_language'))
|
||||
ti_show.genre_list = []
|
||||
|
@ -456,7 +457,7 @@ class TmdbIndexer(TVInfoBase):
|
|||
ti_show.seriesid = ti_show.id
|
||||
ti_show.language = clean_data(show_dict.get('original_language'))
|
||||
ti_show.spoken_languages = [_l['iso_639_1'] for _l in show_dict.get('spoken_languages') or []]
|
||||
ti_show.overview = enforce_type(clean_data(show_dict.get('overview')), str, '')
|
||||
ti_show.overview = self._enforce_text(show_dict.get('overview'))
|
||||
ti_show.status = clean_data(show_dict.get('status', ''))
|
||||
ti_show.show_type = clean_data((show_dict.get('type') and [show_dict['type']]) or [])
|
||||
ti_show.firstaired = clean_data(show_dict.get('first_air_date'))
|
||||
|
@ -845,3 +846,19 @@ class TmdbIndexer(TVInfoBase):
|
|||
else:
|
||||
TmdbIndexer._supported_languages = []
|
||||
TmdbIndexer._tmdb_lang_list = []
|
||||
|
||||
@staticmethod
|
||||
def _enforce_text(text):
|
||||
"""
|
||||
Set nonsense text to an enforced type
|
||||
:param text:
|
||||
:type text: AnyStr
|
||||
:return:
|
||||
:rtype: AnyStr
|
||||
"""
|
||||
text = enforce_type(clean_data(text), str, '').strip()
|
||||
tmp = text.lower()
|
||||
if 'details here' == tmp \
|
||||
or re.search(r'no(\s\w+){1,2}\savailable', tmp):
|
||||
return ''
|
||||
return text
|
||||
|
|
|
@ -10,8 +10,6 @@ from collections import deque
|
|||
from exceptions_helper import ex
|
||||
|
||||
from six import integer_types, iteritems, iterkeys, string_types, text_type
|
||||
from six import PY2 # deprecate after rebase ?
|
||||
from _23 import list_keys, list_items, list_values, izip # deprecate after rebase ?
|
||||
from typing import Callable
|
||||
|
||||
|
||||
|
@ -117,7 +115,7 @@ class ShowContainer(dict):
|
|||
|
||||
def cleanup_old(self):
|
||||
"""
|
||||
remove entries that are older then max_age
|
||||
remove entries that are older than max_age
|
||||
"""
|
||||
acquired_lock = self.lock.acquire(False)
|
||||
if acquired_lock:
|
||||
|
@ -190,7 +188,7 @@ class TVInfoIDs(object):
|
|||
|
||||
def __len__(self):
|
||||
counter = itertools.count()
|
||||
deque(izip(self.__iter__(), counter), maxlen=0) # (consume at C speed)
|
||||
deque(zip(self.__iter__(), counter), maxlen=0) # (consume at C speed)
|
||||
return next(counter)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -268,7 +266,7 @@ class TVInfoSocialIDs(object):
|
|||
|
||||
def __len__(self):
|
||||
counter = itertools.count()
|
||||
deque(izip(self.__iter__(), counter), maxlen=0) # (consume at C speed)
|
||||
deque(zip(self.__iter__(), counter), maxlen=0) # (consume at C speed)
|
||||
return next(counter)
|
||||
|
||||
def __str__(self):
|
||||
|
@ -1304,8 +1302,8 @@ class TVInfoBase(object):
|
|||
show_copy = copy.deepcopy(self.ti_shows[show_id]) # type: TVInfoShow
|
||||
# provide old call compatibility for dvd order
|
||||
if self.config.get('dvdorder') and TVInfoSeasonTypes.dvd in show_copy.alt_ep_numbering:
|
||||
org_seasons, dvd_seasons = list_keys(show_copy), \
|
||||
list_keys(show_copy.alt_ep_numbering[TVInfoSeasonTypes.dvd])
|
||||
org_seasons, dvd_seasons = list(show_copy), \
|
||||
list(show_copy.alt_ep_numbering[TVInfoSeasonTypes.dvd])
|
||||
for r_season in set(org_seasons) - set(dvd_seasons):
|
||||
try:
|
||||
del show_copy[r_season]
|
||||
|
|
|
@ -614,10 +614,12 @@ else:
|
|||
TRAKT_PIN_URL = 'https://trakt.tv/pin/6314'
|
||||
TRAKT_BASE_URL = 'https://api.trakt.tv/'
|
||||
|
||||
IMDB_MRU = ''
|
||||
MC_MRU = ''
|
||||
NE_MRU = ''
|
||||
TMDB_MRU = ''
|
||||
TVC_MRU = ''
|
||||
TVM_MRU = ''
|
||||
NE_MRU = ''
|
||||
|
||||
COOKIE_SECRET = b64encodestring(uuid.uuid4().bytes + uuid.uuid4().bytes)
|
||||
|
||||
|
@ -765,7 +767,7 @@ def init_stage_1(console_logging):
|
|||
global USE_TRAKT, TRAKT_CONNECTED_ACCOUNT, TRAKT_ACCOUNTS, TRAKT_MRU, TRAKT_VERIFY, \
|
||||
TRAKT_USE_WATCHLIST, TRAKT_REMOVE_WATCHLIST, TRAKT_TIMEOUT, TRAKT_METHOD_ADD, TRAKT_START_PAUSED, \
|
||||
TRAKT_SYNC, TRAKT_DEFAULT_INDEXER, TRAKT_REMOVE_SERIESLIST, TRAKT_UPDATE_COLLECTION, \
|
||||
MC_MRU, TVC_MRU, TVM_MRU, NE_MRU, \
|
||||
MC_MRU, NE_MRU, TMDB_MRU, TVC_MRU, TVM_MRU, \
|
||||
USE_SLACK, SLACK_NOTIFY_ONSNATCH, SLACK_NOTIFY_ONDOWNLOAD, SLACK_NOTIFY_ONSUBTITLEDOWNLOAD, \
|
||||
SLACK_CHANNEL, SLACK_AS_AUTHED, SLACK_BOT_NAME, SLACK_ICON_URL, SLACK_ACCESS_TOKEN, \
|
||||
USE_DISCORD, DISCORD_NOTIFY_ONSNATCH, DISCORD_NOTIFY_ONDOWNLOAD, \
|
||||
|
@ -1203,9 +1205,10 @@ def init_stage_1(console_logging):
|
|||
TRAKT_MRU = check_setting_str(CFG, 'Trakt', 'trakt_mru', '')
|
||||
|
||||
MC_MRU = check_setting_str(CFG, 'Metacritic', 'mc_mru', '')
|
||||
NE_MRU = check_setting_str(CFG, 'NextEpisode', 'ne_mru', '')
|
||||
TMDB_MRU = check_setting_str(CFG, 'TMDB', 'tmdb_mru', '')
|
||||
TVC_MRU = check_setting_str(CFG, 'TVCalendar', 'tvc_mru', '')
|
||||
TVM_MRU = check_setting_str(CFG, 'TVmaze', 'tvm_mru', '')
|
||||
NE_MRU = check_setting_str(CFG, 'NextEpisode', 'ne_mru', '')
|
||||
|
||||
USE_PYTIVO = bool(check_setting_int(CFG, 'pyTivo', 'use_pytivo', 0))
|
||||
PYTIVO_HOST = check_setting_str(CFG, 'pyTivo', 'pytivo_host', '')
|
||||
|
@ -1713,7 +1716,7 @@ def init_stage_2():
|
|||
background_mapping_task = threading.Thread(name='MAPPINGUPDATES', target=indexermapper.load_mapped_ids,
|
||||
kwargs={'load_all': True})
|
||||
|
||||
MEMCACHE['history_tab_limit'] = 11
|
||||
MEMCACHE['history_tab_limit'] = 13
|
||||
MEMCACHE['history_tab'] = History.menu_tab(MEMCACHE['history_tab_limit'])
|
||||
|
||||
try:
|
||||
|
@ -2241,15 +2244,18 @@ def save_config():
|
|||
('Metacritic', [
|
||||
('mru', MC_MRU)
|
||||
]),
|
||||
('NextEpisode', [
|
||||
('mru', NE_MRU)
|
||||
]),
|
||||
('TMDB', [
|
||||
('mru', TMDB_MRU)
|
||||
]),
|
||||
('TVCalendar', [
|
||||
('mru', TVC_MRU)
|
||||
]),
|
||||
('TVmaze', [
|
||||
('mru', TVM_MRU)
|
||||
]),
|
||||
('NextEpisode', [
|
||||
('mru', NE_MRU)
|
||||
]),
|
||||
('Slack', [
|
||||
('use_%s', int(USE_SLACK)),
|
||||
('channel', SLACK_CHANNEL),
|
||||
|
|
|
@ -189,7 +189,7 @@ tvinfo_config = {
|
|||
people_url='%s',
|
||||
show_url=None,
|
||||
people_only=True,
|
||||
icon='fansite16.png'
|
||||
icon='_placeholder16.png'
|
||||
),
|
||||
TVINFO_LINKEDIN: dict(
|
||||
id=TVINFO_LINKEDIN,
|
||||
|
|
|
@ -971,6 +971,7 @@ class QueueItemAdd(ShowQueueItem):
|
|||
try:
|
||||
|
||||
tvinfo_config = sickgear.TVInfoAPI(self.tvid).api_params.copy()
|
||||
kw = {}
|
||||
if self.lang:
|
||||
tvinfo_config['language'] = self.lang
|
||||
kw = {'language': self.lang}
|
||||
|
|
|
@ -4631,24 +4631,22 @@ class CMD_SickGearShowsBrowseTrakt(ApiCall):
|
|||
|
||||
def run(self):
|
||||
""" browse trakt shows in sickgear """
|
||||
urls = {'anticipated': 'shows/anticipated?limit=%s&' % 100,
|
||||
'newshows': '/calendars/all/shows/new/%s/%s?' % (SGDatetime.sbfdate(
|
||||
dt=datetime.datetime.now() + datetime.timedelta(days=-16), d_preset='%Y-%m-%d'), 32),
|
||||
'newseasons': '/calendars/all/shows/premieres/%s/%s?' % (SGDatetime.sbfdate(
|
||||
dt=datetime.datetime.now() + datetime.timedelta(days=-16), d_preset='%Y-%m-%d'), 32),
|
||||
'popular': 'shows/popular?limit=%s&' % 100,
|
||||
'trending': 'shows/trending?limit=%s&' % 100,
|
||||
'recommended': 'recommendations/shows?limit=%s&' % 100,
|
||||
}
|
||||
func = dict(anticipated='get_anticipated',
|
||||
newshows='get_new_shows',
|
||||
newseasons='get_new_seasons',
|
||||
popular='get_popular',
|
||||
trending='get_trending')
|
||||
kwargs = {}
|
||||
if self.type in ('recommended', 'watchlist'):
|
||||
if not self.account:
|
||||
return _responds(RESULT_FAILURE, msg='Need Trakt account')
|
||||
kwargs['send_oauth'] = self.account
|
||||
urls['watchlist'] = 'users/%s/watchlist/shows?limit=%s&' \
|
||||
% (sickgear.TRAKT_ACCOUNTS[self.account].slug, 100)
|
||||
func.update(dict(recommended='get_recommended_for_account',
|
||||
watchlist='get_watchlisted_for_account'))
|
||||
kwargs.update(dict(account=self.account, ignore_collected=True))
|
||||
if self.type in ('recommended',):
|
||||
kwargs.update(dict(ignore_watchlisted=True))
|
||||
try:
|
||||
data, oldest, newest = AddShows.get_trakt_data(urls[self.type], **kwargs)
|
||||
data, oldest, newest = AddShows.get_trakt_data(func[self.type], **kwargs)
|
||||
except Exception as e:
|
||||
return _responds(RESULT_FAILURE, msg=ex(e))
|
||||
return _responds(RESULT_SUCCESS, data)
|
||||
|
|
1941
sickgear/webserve.py
1941
sickgear/webserve.py
File diff suppressed because it is too large
Load diff
Loading…
Reference in a new issue