mirror of
https://github.com/SickGear/SickGear.git
synced 2024-11-15 01:15:05 +00:00
Fix py2 deprecation cleanups added exclusively by TvdbV4 code.
Refactor `timestamp_near` to `SGDatetime.timestamp_near` --- Simplify enforce_type + clean_data to clean_str. Change simplified all but one enforce_type use case. --- Add tvdb, trakt slug tvinfo search test cases Change direct tvdb slug search support via new api endpoint Fix origin_countries in tvdb_api_v4. --- Add new TV_Maze id to show obj ids in tvdb_api_v4. Fix a bug parsing social ids for tvshows in tvdb_api_v4. Change add language support to search API and tvdb_api_v4. Change add `updated_at` to artwork on tvdb_api_v4. Change add `finale` type to episodes. Change add method `get_top_rated` to tvdb_api_v4. optional params... - year=... argument to get only top rated of given year, if not it's all time Change returns result for shows until same day last year. Add youtube, reddit, fansite, tiktok, linkedin, wikidata to tv.py Add tiktok to indexer_config. Add fansite to tvdb_api_v4. Aadd fansite to TVInfoSocialIDs. Add source type parsing and add linkein to tvdb_api_v4. Add linkedin. Add tiktok parser to tvdb_api_v4. Change v4 to TVInfoIDs, TVInfoSocialIDs. Change add new id data. Add contentrating. Change fill in new fields to get_person results. ---- Change implement discover endpoint in tvdb_api_v4. Change filter '0000' year for firstaired field in tvdb_api_v4. Change use the default_season_type from api for website fallback. Change remove unneeded _auth_time. Add backup fetch for episode data. Change add multiple space remove to clean_data. Change move _get_tvdb_id to central function. Change fix minor warnings, code tidy + DRY. Change remove the show-edit option `Use DVD titles and numbers` until ready with multi TVInfo source. Add try_date and use to attempt conversion of unspecified date format types birthdate, deathdate, aired. Change tweaks, remove one warn, order imports. Change tidy up of other warnings, mismatched types, typos, a strange arg issue with deepcopy, and PEP8. Bug fix, bad key in get_item for TVInfoSocialIDs. Fix ambiguities of `show` used in sg versus external uses. Fix add data sanitisation of image field. Change make set_episode code more readable. Change fix final two warnings in api v4. Fix an API can return falsy as firstaired which crashes adding a show via load_from_tv_info() (The Andrew Marr Show@tvdbv4). Add cast, crew type mappings Only take Main Actors, Hosts, Interviewers, Presenters Change increase viewagble history menu items from 13 to 15.
This commit is contained in:
parent
79f0c829a7
commit
b55b29732b
10 changed files with 948 additions and 268 deletions
|
@ -342,7 +342,10 @@
|
|||
* 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 TVDb v4
|
||||
* Add menu Shows/"TVDb Cards"
|
||||
* Add menu Shows/"TMDB Cards"
|
||||
* Change increase viewable history menu items from 13 to 15
|
||||
* 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
|
||||
* Fix TVDb api episode issues
|
||||
|
@ -503,6 +506,8 @@
|
|||
* Change migrate Kodi addon to Kodi (Matrix), (Leia) and older can use repo source url /kodi-legacy
|
||||
* Change ensure XML header in Kodi nfo files
|
||||
* Change fix some typos
|
||||
* Add menu Shows/"TVDb Cards"
|
||||
* Add menu Shows/"TMDB Cards"
|
||||
|
||||
|
||||
### 0.25.60 (2023-01-03 13:30:00 UTC)
|
||||
|
@ -966,6 +971,7 @@
|
|||
* Change improve the search progress text
|
||||
* Add "Size" filter '<0' in history view to filter already deleted media
|
||||
* Change swap `Episode` and `Label` columns in history view
|
||||
* Change add TheTVDb v4 support
|
||||
|
||||
|
||||
### 0.24.17 (2021-08-31 01:00:00 UTC)
|
||||
|
|
|
@ -301,7 +301,7 @@ $(function() {
|
|||
var filterValue = this.value;
|
||||
if (-1 == filterValue.indexOf('trakt') && -1 == filterValue.indexOf('imdb') && -1 == filterValue.indexOf('mc_')
|
||||
&& -1 == filterValue.indexOf('tmdb_') && -1 == filterValue.indexOf('tvc_')
|
||||
&& -1 == filterValue.indexOf('tvm_')
|
||||
&& -1 == filterValue.indexOf('tvdb_') && -1 == filterValue.indexOf('tvm_')
|
||||
&& -1 == filterValue.indexOf('ne_') && -1 == filterValue.indexOf('_ne')
|
||||
&& -1 == filterValue.indexOf('default')) {
|
||||
var el$ = $('#container')
|
||||
|
@ -507,6 +507,14 @@ $(function() {
|
|||
<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 'TVDb' == $browse_type
|
||||
<optgroup label="TVDb">
|
||||
<option value="tvdb_upcoming"#echo ('', selected)['upcoming' == $mode]#>Upcoming</option>
|
||||
<option value="tvdb_toprated"#echo ('', selected)['toprated' == $mode and not $kwargs.get('year')]#>Top rated all time</option>
|
||||
#for $cur_y in $kwargs.get('rate_years') or []
|
||||
<option value="$cur_y[1]"#echo ('', selected)[$cur_y[0] == $kwargs.get('year')]#>$cur_y[2]</option>
|
||||
#end for
|
||||
</optgroup>
|
||||
#elif 'TVCalendar' == $browse_type
|
||||
<optgroup label="TVCalendar">
|
||||
#for $page in $kwargs.get('pages') or []
|
||||
|
|
|
@ -177,6 +177,10 @@
|
|||
<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 $tvdb_modes = dict(tvdb_upcoming='upcoming', tvdb_toprated='top rated')
|
||||
#set $tvdb_mode = $tvdb_modes.get($sg_var('TVDB_MRU'), 'upcoming')
|
||||
<li><a href="$sbRoot/add-shows/tvdb-default/" tabindex="$tab#set $tab += 1#"><i class="sgicon-addshow"></i>TVDb Cards
|
||||
<div class="menu-item-desc opacity60">$tvdb_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
|
||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -1809,7 +1809,7 @@ def is_virtualenv():
|
|||
def enforce_type(value, allowed_types, default):
|
||||
# type: (Any, Union[Type, Tuple[Type]], Any) -> Any
|
||||
"""
|
||||
enforces that value is given type(s)
|
||||
enforce value to supplied type(s)
|
||||
:param value: value to check
|
||||
:param allowed_types: type or tuple of types allowed
|
||||
:param default: value to return if other type
|
||||
|
@ -1817,3 +1817,12 @@ def enforce_type(value, allowed_types, default):
|
|||
if not isinstance(value, allowed_types):
|
||||
return default
|
||||
return value
|
||||
|
||||
|
||||
def clean_str(value):
|
||||
# type: (Any) -> AnyStr
|
||||
"""
|
||||
clean and enforced a value to a string type
|
||||
:param value: to process
|
||||
"""
|
||||
return enforce_type(clean_data(value), str, '')
|
||||
|
|
|
@ -625,6 +625,7 @@ MC_MRU = ''
|
|||
NE_MRU = ''
|
||||
TMDB_MRU = ''
|
||||
TVC_MRU = ''
|
||||
TVDB_MRU = ''
|
||||
TVM_MRU = ''
|
||||
|
||||
COOKIE_SECRET = b64encodestring(uuid.uuid4().bytes + uuid.uuid4().bytes)
|
||||
|
@ -773,7 +774,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, NE_MRU, TMDB_MRU, TVC_MRU, TVM_MRU, \
|
||||
MC_MRU, NE_MRU, TMDB_MRU, TVC_MRU, TVDB_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, \
|
||||
|
@ -1214,6 +1215,7 @@ def init_stage_1(console_logging):
|
|||
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', '')
|
||||
TVDB_MRU = check_setting_str(CFG, 'TVDb', 'tvdb_mru', '')
|
||||
TVM_MRU = check_setting_str(CFG, 'TVmaze', 'tvm_mru', '')
|
||||
|
||||
USE_PYTIVO = bool(check_setting_int(CFG, 'pyTivo', 'use_pytivo', 0))
|
||||
|
@ -1727,7 +1729,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'] = 13
|
||||
MEMCACHE['history_tab_limit'] = 15
|
||||
MEMCACHE['history_tab'] = History.menu_tab(MEMCACHE['history_tab_limit'])
|
||||
|
||||
try:
|
||||
|
@ -2298,6 +2300,9 @@ def _save_config(force=False, **kwargs):
|
|||
('TVCalendar', [
|
||||
('mru', TVC_MRU)
|
||||
]),
|
||||
('TVDb', [
|
||||
('mru', TVDB_MRU)
|
||||
]),
|
||||
('TVmaze', [
|
||||
('mru', TVM_MRU)
|
||||
]),
|
||||
|
|
|
@ -78,18 +78,23 @@ class TVInfoAPI(object):
|
|||
if sickgear.CACHE_DIR:
|
||||
return self.api_params['cache']
|
||||
|
||||
@staticmethod
|
||||
def _filter(condition):
|
||||
return dict([(int(x['id']), x['name']) for x in list(tvinfo_config.values()) if condition(x)])
|
||||
|
||||
@property
|
||||
def sources(self):
|
||||
# type: () -> Dict[int, AnyStr]
|
||||
return dict([(int(x['id']), x['name']) for x in list(tvinfo_config.values()) if not x['mapped_only'] and
|
||||
True is not x.get('fallback') and True is not x.get('people_only')])
|
||||
return self._filter(lambda x:
|
||||
not x['mapped_only'] and
|
||||
True is not x.get('fallback') and True is not x.get('people_only'))
|
||||
|
||||
@property
|
||||
def search_sources(self):
|
||||
# type: () -> Dict[int, AnyStr]
|
||||
return dict([(int(x['id']), x['name']) for x in list(tvinfo_config.values()) if not x['mapped_only'] and
|
||||
x.get('active') and not x.get('defunct') and True is not x.get('fallback')
|
||||
and True is not x.get('people_only')])
|
||||
return self._filter(lambda x:
|
||||
not x['mapped_only'] and x.get('active') and not x.get('defunct') and
|
||||
True is not x.get('fallback') and True is not x.get('people_only'))
|
||||
|
||||
@property
|
||||
def all_sources(self):
|
||||
|
@ -97,8 +102,8 @@ class TVInfoAPI(object):
|
|||
"""
|
||||
:return: return all indexers including mapped only indexers excluding fallback indexers
|
||||
"""
|
||||
return dict([(int(x['id']), x['name']) for x in list(tvinfo_config.values()) if True is not x.get('fallback')
|
||||
and True is not x.get('people_only')])
|
||||
return self._filter(lambda x:
|
||||
True is not x.get('fallback') and True is not x.get('people_only'))
|
||||
|
||||
@property
|
||||
def fallback_sources(self):
|
||||
|
@ -106,9 +111,9 @@ class TVInfoAPI(object):
|
|||
"""
|
||||
:return: return all fallback indexers
|
||||
"""
|
||||
return dict([(int(x['id']), x['name']) for x in list(tvinfo_config.values()) if True is x.get('fallback')])
|
||||
return self._filter(lambda x: True is x.get('fallback'))
|
||||
|
||||
@property
|
||||
def xem_supported_sources(self):
|
||||
# type: () -> Dict[int, AnyStr]
|
||||
return dict([(int(x['id']), x['name']) for x in list(tvinfo_config.values()) if x.get('xem_origin')])
|
||||
return self._filter(lambda x: x.get('xem_origin'))
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
from lib.api_tvdb.tvdb_api import Tvdb
|
||||
from lib.api_tvdb.tvdb_api_v4 import Tvdb_API_V4
|
||||
from lib.api_tvdb.tvdb_api_v4 import TvdbAPIv4
|
||||
import lib.api_tvdb.tvdb_api_v4
|
||||
from lib.api_trakt.indexerapiinterface import TraktIndexer
|
||||
from lib.api_tvmaze.tvmaze_api import TvMaze
|
||||
|
@ -25,7 +25,7 @@ tvinfo_config = {
|
|||
api_url='https://api.thetvdb.com/',
|
||||
id=TVINFO_TVDB,
|
||||
name='TheTVDB', slug='tvdb', kodi_slug='tvdb',
|
||||
module=Tvdb_API_V4,
|
||||
module=TvdbAPIv4,
|
||||
api_params=dict(apikey='6cfd6399fd2bee018a8793da976f6522',
|
||||
apikey_v4=b'm5uaxWhrm56TlWTGm5Jkk5uYZW-ea5uOnmqcmWmXZmVtxp2a', language='en'),
|
||||
active=True,
|
||||
|
|
|
@ -112,6 +112,7 @@ if False:
|
|||
# from api_imdb.imdb_api import IMDbIndexer
|
||||
from api_tmdb.tmdb_api import TmdbIndexer
|
||||
from api_trakt.indexerapiinterface import TraktIndexer
|
||||
from api_tvdb.tvdb_api_v4 import TvdbAPIv4 as TvdbIndexer
|
||||
from api_tvmaze.tvmaze_api import TvMaze as TvmazeIndexer
|
||||
|
||||
|
||||
|
@ -6036,6 +6037,120 @@ class AddShows(Home):
|
|||
|
||||
return self.new_show('|'.join(['', '', '', show_name]), use_show_name=True)
|
||||
|
||||
def tvdb_default(self):
|
||||
method = getattr(self, sickgear.TVDB_MRU, None)
|
||||
if not callable(method):
|
||||
return self.tvdb_upcoming()
|
||||
return method()
|
||||
|
||||
def tvdb_upcoming(self, **kwargs):
|
||||
return self.browse_tvdb(
|
||||
'Upcoming at TVDb', mode='upcoming', **kwargs)
|
||||
|
||||
def tvdb_toprated(self, **kwargs):
|
||||
return self.browse_tvdb(
|
||||
'Top rated at TVDb', mode='toprated', **kwargs)
|
||||
|
||||
def browse_tvdb(self, browse_title, **kwargs):
|
||||
|
||||
browse_type = 'TVDb'
|
||||
mode = kwargs.get('mode', '')
|
||||
|
||||
footnote = None
|
||||
filtered = []
|
||||
|
||||
tvid = TVINFO_TVDB
|
||||
tvinfo_config = sickgear.TVInfoAPI(tvid).api_params.copy()
|
||||
t = sickgear.TVInfoAPI(tvid).setup(**tvinfo_config) # type: Union[TvdbIndexer, TVInfoBase]
|
||||
|
||||
top_year = helpers.try_int(kwargs.get('year'), None)
|
||||
if 'upcoming' == mode:
|
||||
items = t.discover()
|
||||
else:
|
||||
items = t.get_top_rated(year=top_year,
|
||||
in_last_year=1 == datetime.date.today().month and 7 > datetime.date.today().day)
|
||||
|
||||
oldest, newest, oldest_dt, newest_dt, dedupe = None, None, 9999999, 0, []
|
||||
use_networks = False
|
||||
parseinfo = dateutil.parser.parserinfo(dayfirst=False, yearfirst=True)
|
||||
base_url = sickgear.TVInfoAPI(TVINFO_TVDB).config['show_url']
|
||||
for cur_show_info in items:
|
||||
if cur_show_info.id in dedupe or not cur_show_info.seriesname:
|
||||
continue
|
||||
dedupe += [cur_show_info.id]
|
||||
|
||||
try:
|
||||
airtime = cur_show_info.airs_time
|
||||
if not airtime or (0, 0) == (airtime.hour, airtime.minute):
|
||||
airtime = dateutil.parser.parse('23:59').time()
|
||||
dt = datetime.datetime.combine(
|
||||
dateutil.parser.parse(cur_show_info.firstaired, parseinfo).date(), airtime)
|
||||
ord_premiered, str_premiered, started_past, oldest_dt, newest_dt, oldest, newest, _, _, _, _ \
|
||||
= self.sanitise_dates(dt, oldest_dt, newest_dt, oldest, newest)
|
||||
|
||||
image = self._make_cache_image_url(tvid, cur_show_info)
|
||||
images = {} if not image else dict(poster=dict(thumb=image))
|
||||
|
||||
ids = dict(tvdb=cur_show_info.id)
|
||||
if cur_show_info.ids.imdb:
|
||||
ids['imdb'] = cur_show_info.ids.imdb
|
||||
|
||||
network_name = cur_show_info.network
|
||||
cc = 'US'
|
||||
if network_name:
|
||||
use_networks = True
|
||||
cc = cur_show_info.network_country_code or cc
|
||||
|
||||
language = ((cur_show_info.language and 'jap' in cur_show_info.language.lower())
|
||||
and 'jp' or 'en')
|
||||
|
||||
filtered.append(dict(
|
||||
ord_premiered=ord_premiered,
|
||||
str_premiered=str_premiered,
|
||||
started_past=started_past,
|
||||
episode_overview=helpers.xhtml_escape(cur_show_info.overview[:250:]).strip('*').strip(),
|
||||
episode_season=cur_show_info.season,
|
||||
genres=', '.join(cur_show_info.genre_list)
|
||||
or (cur_show_info.genre and (cur_show_info.genre.strip('|').replace('|', ', ')) or ''),
|
||||
ids=ids,
|
||||
images=images,
|
||||
overview=(helpers.xhtml_escape(cur_show_info.overview[:250:]).strip('*').strip()
|
||||
or 'No overview yet'),
|
||||
title=cur_show_info.seriesname,
|
||||
language=language,
|
||||
language_img=sickgear.MEMCACHE_FLAG_IMAGES.get(language, False),
|
||||
country=cc,
|
||||
country_img=sickgear.MEMCACHE_FLAG_IMAGES.get(cc.lower(), False),
|
||||
network=network_name,
|
||||
rating=False,
|
||||
url_src_db=base_url % cur_show_info.id,
|
||||
votes=cur_show_info.rating or 0,
|
||||
))
|
||||
except (BaseException, Exception):
|
||||
pass
|
||||
kwargs.update(dict(oldest=oldest, newest=newest, use_ratings=False, term_vote='Score'))
|
||||
|
||||
this_year = datetime.date.today().year
|
||||
years = [
|
||||
(this_year - cur_y,
|
||||
'tvdb_toprated?year=%s' % (this_year - cur_y),
|
||||
'Top %s releases' % (this_year - cur_y))
|
||||
for cur_y in range(0, 10)]
|
||||
kwargs.update(dict(footnote=footnote, use_networks=use_networks, year=top_year or '', rate_years=years))
|
||||
|
||||
if mode:
|
||||
func = 'tvdb_%s' % mode
|
||||
if callable(getattr(self, func, None)):
|
||||
sickgear.TVDB_MRU = func
|
||||
sickgear.save_config()
|
||||
return self.browse_shows(browse_type, browse_title, filtered, **kwargs)
|
||||
|
||||
# noinspection PyUnusedLocal
|
||||
def info_tvdb(self, ids, show_name):
|
||||
|
||||
if not list(filter(lambda tvid_prodid: helpers.find_show_by_id(tvid_prodid), ids.split(' '))):
|
||||
return self.new_show('|'.join(['', '', '', ' '.join([ids, show_name])]), use_show_name=True)
|
||||
|
||||
def tvm_default(self):
|
||||
method = getattr(self, sickgear.TVM_MRU, None)
|
||||
if not callable(method) or not self.allow_browse_mru(sickgear.TMDB_MRU):
|
||||
|
@ -6283,7 +6398,7 @@ class AddShows(Home):
|
|||
def browse_mru(browse_type, **kwargs):
|
||||
save_config = False
|
||||
if browse_type in ('AniDB', 'IMDb', 'Metacritic', 'Trakt', 'TVCalendar',
|
||||
'TMDB', 'TVmaze', 'Nextepisode'):
|
||||
'TMDB', 'TVDb', 'TVmaze', 'Nextepisode'):
|
||||
save_config = True
|
||||
if browse_type in ('TVmaze',) and kwargs.get('showfilter') and kwargs.get('showsort'):
|
||||
sickgear.BROWSELIST_MRU.setdefault(browse_type, dict()) \
|
||||
|
|
|
@ -20,7 +20,7 @@ sys.path.insert(1, os.path.abspath('..'))
|
|||
|
||||
import sickgear
|
||||
from sickgear.indexers.indexer_config import TVINFO_TVDB, TVINFO_TMDB, TVINFO_TVMAZE, TVINFO_TRAKT, TVINFO_IMDB, \
|
||||
TVINFO_TRAKT_SLUG
|
||||
TVINFO_TVDB_SLUG, TVINFO_TRAKT_SLUG
|
||||
from lib.tvinfo_base import TVInfoPerson as TVInfoPerson_lib, TVInfoImage as TVInfoImage_lib, \
|
||||
TVInfoSocialIDs as TVInfoSocialIDs_lib, TVInfoCharacter as TVInfoCharacter_lib, TVInfoShow as TVInfoShow_lib, \
|
||||
TVInfoIDs as TVInfoIDs_lib, CastList as CastList_lib, CrewList as CrewList_lib, \
|
||||
|
@ -29,7 +29,6 @@ from lib.tvinfo_base import TVInfoPerson as TVInfoPerson_lib, TVInfoImage as TVI
|
|||
from tvinfo_base import TVInfoPerson, TVInfoImage, TVInfoSocialIDs, TVInfoCharacter, TVInfoShow, TVInfoIDs, CastList, \
|
||||
CrewList, RoleTypes, TVInfoEpisode, TVInfoSeason, TVInfoNetwork
|
||||
import requests
|
||||
from lib.api_tvdb.tvdb_api import Tvdb
|
||||
|
||||
# noinspection PyUnreachableCode
|
||||
if False:
|
||||
|
@ -100,15 +99,9 @@ def _mock_post(*args, **kwargs):
|
|||
resp = requests.Response()
|
||||
resp.status_code = 200
|
||||
resp._content = ''
|
||||
resp.encoding = 'UTF-8'
|
||||
resp.headers['Content-Type'] = 'text/html; charset=utf-8'
|
||||
return resp
|
||||
|
||||
|
||||
def _mock_get_new_token(*args, **kwargs):
|
||||
return {'token': 'testtoken', 'datetime': datetime.datetime.now()}
|
||||
|
||||
|
||||
browse_start_date_filename = os.path.join(mock_data_dir, 'browse_start_date.data')
|
||||
if disable_content_creation:
|
||||
with open(browse_start_date_filename, 'rt', encoding='UTF-8') as f:
|
||||
|
@ -213,7 +206,7 @@ def _property_type_checker(obj, checked_objs=None):
|
|||
('social_ids', (TVInfoSocialIDs, TVInfoSocialIDs_lib), None),
|
||||
('characters', list, (TVInfoCharacter, TVInfoCharacter_lib)),
|
||||
('name', str, None),
|
||||
('id', (int, NoneType), None),
|
||||
('id', int, None),
|
||||
('image', (str, NoneType), None),
|
||||
('thumb_url', (str, NoneType), None),
|
||||
('gender', (int, NoneType), None),
|
||||
|
@ -434,7 +427,7 @@ def _property_type_checker(obj, checked_objs=None):
|
|||
('lastupdatedby', (int, str, NoneType), None),
|
||||
('airsafterseason', (int, NoneType), None),
|
||||
('airsbeforeseason', (int, NoneType), None),
|
||||
('airsbeforeepisode', (int, NoneType), None),
|
||||
('airsbeforeepisode', (bool, NoneType), None),
|
||||
('imdb_id', (str, NoneType), None),
|
||||
('contentrating', (str, NoneType), None),
|
||||
('thumbadded', (str, NoneType), None),
|
||||
|
@ -483,7 +476,7 @@ def _compare_helper(obj_a, obj_b):
|
|||
|
||||
|
||||
person_tests = [
|
||||
# {'p_id': 346941, 'tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
{'p_id': 346941, 'tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
{'p_id': 968006, 'tvid': TVINFO_TMDB}, # Katherine McNamara
|
||||
{'p_id': 15776, 'tvid': TVINFO_TVMAZE}, # Katherine McNamara
|
||||
{'p_id': 260345, 'tvid': TVINFO_TRAKT}, # Katherine McNamara
|
||||
|
@ -501,9 +494,10 @@ search_tests = [
|
|||
{'kwargs': {'name': 'Shadowhunters'}, 'search_tvid': TVINFO_TVDB}, # Shadowhunters
|
||||
{'kwargs': {'name': 'Wednesday'}, 'search_tvid': TVINFO_TVDB}, # Shadowhunters
|
||||
{'kwargs': {'ids': {TVINFO_TVDB: 295837}}, 'search_tvid': TVINFO_TVDB}, # Shadowhunters
|
||||
# {'kwargs': {'ids': {TVINFO_IMDB: 4145054}}, 'search_tvid': TVINFO_TVDB}, # Shadowhunters
|
||||
# {'kwargs': {'ids': {TVINFO_TMDB: 119051}}, 'search_tvid': TVINFO_TVDB}, # Wednesday
|
||||
# {'kwargs': {'ids': {TVINFO_TVMAZE: 53647}}, 'search_tvid': TVINFO_TVDB}, # Wednesday
|
||||
{'kwargs': {'ids': {TVINFO_IMDB: 4145054}}, 'search_tvid': TVINFO_TVDB}, # Shadowhunters
|
||||
{'kwargs': {'ids': {TVINFO_TMDB: 119051}}, 'search_tvid': TVINFO_TVDB}, # Wednesday
|
||||
{'kwargs': {'ids': {TVINFO_TVMAZE: 53647}}, 'search_tvid': TVINFO_TVDB}, # Wednesday
|
||||
{'kwargs': {'ids': {TVINFO_TVDB_SLUG: 'walker-independence'}}, 'search_tvid': TVINFO_TVDB}, # Walker: Independence
|
||||
# trakt tests
|
||||
{'kwargs': {'name': 'Shadowhunters'}, 'search_tvid': TVINFO_TRAKT}, # Shadowhunters
|
||||
{'kwargs': {'name': 'Wednesday'}, 'search_tvid': TVINFO_TRAKT}, # Shadowhunters
|
||||
|
@ -530,10 +524,10 @@ search_tests = [
|
|||
person_search_tests = [
|
||||
# tvdb tests
|
||||
{'kwargs': {'name': 'Katherine McNamara'}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
# {'kwargs': {'ids': {TVINFO_TVDB: 346941}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
# {'kwargs': {'ids': {TVINFO_IMDB: 3031063}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
# {'kwargs': {'ids': {TVINFO_TMDB: 968006}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
# {'kwargs': {'ids': {TVINFO_TVMAZE: 15776}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
{'kwargs': {'ids': {TVINFO_TVDB: 346941}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
{'kwargs': {'ids': {TVINFO_IMDB: 3031063}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
{'kwargs': {'ids': {TVINFO_TMDB: 968006}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
{'kwargs': {'ids': {TVINFO_TVMAZE: 15776}}, 'search_tvid': TVINFO_TVDB}, # Katherine McNamara
|
||||
# trakt tests
|
||||
{'kwargs': {'name': 'Katherine McNamara'}, 'search_tvid': TVINFO_TRAKT}, # Katherine McNamara
|
||||
# {'kwargs': {'ids': {TVINFO_TVDB: 346941}}, 'search_tvid': TVINFO_TRAKT}, # Katherine McNamara
|
||||
|
@ -586,7 +580,6 @@ class TVInfoTests(test.SickbeardTestDBCase):
|
|||
datetime.datetime = _FakeDateTime
|
||||
requests.sessions.Session.get = _mock_get
|
||||
if disable_content_creation:
|
||||
Tvdb.get_new_token = _mock_get_new_token
|
||||
requests.sessions.Session.post = _mock_post
|
||||
|
||||
@classmethod
|
||||
|
|
Loading…
Reference in a new issue