diff --git a/resources/lib/kodiutils.py b/resources/lib/kodiutils.py index 6717930..673299f 100644 --- a/resources/lib/kodiutils.py +++ b/resources/lib/kodiutils.py @@ -44,6 +44,7 @@ HTML_MAPPING = [ (re.compile(r'
  • ', re.I), '- '), (re.compile(r']+)>', re.I), '\n'), (re.compile(r']+)>', re.I), ''), + (re.compile(r'
    ', re.I), '\n'), # Remove newlines (re.compile('( \n){2,}', re.I), '\n'), # Remove repeating non-blocking spaced newlines (re.compile(' +', re.I), ' '), # Remove double spaces ] diff --git a/resources/lib/modules/catalog.py b/resources/lib/modules/catalog.py index e283a3d..66ca7da 100644 --- a/resources/lib/modules/catalog.py +++ b/resources/lib/modules/catalog.py @@ -87,7 +87,9 @@ class Catalog: title='* %s' % kodiutils.localize(30204), # * All seasons path=kodiutils.url_for('show_catalog_program_season', program=program_id, season='-1'), art_dict={ - 'fanart': program.background, + 'fanart': program.fanart, + 'poster': program.poster, + 'landscape': program.thumb, }, info_dict={ 'tvshowtitle': program.title, @@ -105,7 +107,9 @@ class Catalog: title=season.title, # kodiutils.localize(30205, season=season.number), # Season {season} path=kodiutils.url_for('show_catalog_program_season', program=program_id, season=season.uuid), art_dict={ - 'fanart': program.background, + 'fanart': program.fanart, + 'poster': program.poster, + 'landscape': program.thumb, }, info_dict={ 'tvshowtitle': program.title, @@ -123,7 +127,9 @@ class Catalog: title=kodiutils.localize(30059, program=program.title), # Clips for {program} path=kodiutils.url_for('show_catalog_program_clips', program=program_id), art_dict={ - 'fanart': program.background, + 'fanart': program.fanart, + 'poster': program.poster, + 'landscape': program.thumb, }, info_dict={ 'tvshowtitle': program.title, diff --git a/resources/lib/modules/iptvmanager.py b/resources/lib/modules/iptvmanager.py index 6f45efe..eb84fec 100644 --- a/resources/lib/modules/iptvmanager.py +++ b/resources/lib/modules/iptvmanager.py @@ -83,7 +83,7 @@ class IPTVManager: episode='S%sE%s' % (program.season, program.number) if program.season and program.number else None, genre=program.genre, genre_id=program.genre_id, - image=program.cover, + image=program.thumb, stream=kodiutils.url_for('play_from_page', channel=key, page=quote(program.video_url, safe='')) if program.video_url else None) diff --git a/resources/lib/modules/menu.py b/resources/lib/modules/menu.py index 338d880..04a3d8b 100644 --- a/resources/lib/modules/menu.py +++ b/resources/lib/modules/menu.py @@ -100,11 +100,6 @@ class Menu: :type item: Union[Program, Episode] :rtype TitleItem """ - art_dict = { - 'thumb': item.cover, - 'cover': item.cover, - 'fanart': item.background or item.cover, - } info_dict = { 'title': item.title, 'plot': item.description, @@ -121,6 +116,13 @@ class Menu: 'season': len(item.seasons) if item.seasons else None, }) + art_dict = { + 'poster': item.poster, + 'landscape': item.thumb, + 'thumb': item.thumb, + 'fanart': item.fanart, + } + visible = True if isinstance(item.episodes, list) and not item.episodes: # We know that we don't have episodes @@ -171,6 +173,12 @@ class Menu: 'episode': item.number, }) + art_dict = { + 'landscape': item.thumb, + 'thumb': item.thumb, + 'fanart': item.thumb, + } + stream_dict = STREAM_DICT.copy() stream_dict.update({ 'duration': item.duration, diff --git a/resources/lib/modules/tvguide.py b/resources/lib/modules/tvguide.py index c6908f5..13ef1c6 100644 --- a/resources/lib/modules/tvguide.py +++ b/resources/lib/modules/tvguide.py @@ -154,8 +154,7 @@ class TvGuide: TitleItem(title=title, path=path, art_dict={ - 'icon': program.cover, - 'thumb': program.cover, + 'thumb': program.thumb, }, info_dict=info_dict, stream_dict=stream_dict, diff --git a/resources/lib/viervijfzes/content.py b/resources/lib/viervijfzes/content.py index 1cf1a77..386e1e6 100644 --- a/resources/lib/viervijfzes/content.py +++ b/resources/lib/viervijfzes/content.py @@ -45,7 +45,8 @@ class GeoblockedException(Exception): class Program: """ Defines a Program. """ - def __init__(self, uuid=None, path=None, channel=None, title=None, description=None, aired=None, cover=None, background=None, seasons=None, episodes=None, + def __init__(self, uuid=None, path=None, channel=None, title=None, description=None, aired=None, poster=None, thumb=None, fanart=None, seasons=None, + episodes=None, clips=None, my_list=False): """ :type uuid: str @@ -54,8 +55,9 @@ class Program: :type title: str :type description: str :type aired: datetime - :type cover: str - :type background: str + :type poster: str + :type thumb: str + :type fanart: str :type seasons: list[Season] :type episodes: list[Episode] :type clips: list[Episode] @@ -67,8 +69,9 @@ class Program: self.title = title self.description = description self.aired = aired - self.cover = cover - self.background = background + self.poster = poster + self.thumb = thumb + self.fanart = fanart self.seasons = seasons self.episodes = episodes self.clips = clips @@ -81,14 +84,13 @@ class Program: class Season: """ Defines a Season. """ - def __init__(self, uuid=None, path=None, channel=None, title=None, description=None, cover=None, number=None): + def __init__(self, uuid=None, path=None, channel=None, title=None, description=None, number=None): """ :type uuid: str :type path: str :type channel: str :type title: str :type description: str - :type cover: str :type number: int """ @@ -97,7 +99,6 @@ class Season: self.channel = channel self.title = title self.description = description - self.cover = cover self.number = number def __repr__(self): @@ -107,8 +108,8 @@ class Season: class Episode: """ Defines an Episode. """ - def __init__(self, uuid=None, nodeid=None, path=None, channel=None, program_title=None, title=None, description=None, cover=None, background=None, - duration=None, season=None, season_uuid=None, number=None, rating=None, aired=None, expiry=None, stream=None): + def __init__(self, uuid=None, nodeid=None, path=None, channel=None, program_title=None, title=None, description=None, thumb=None, duration=None, + season=None, season_uuid=None, number=None, rating=None, aired=None, expiry=None, stream=None): """ :type uuid: str :type nodeid: str @@ -117,8 +118,7 @@ class Episode: :type program_title: str :type title: str :type description: str - :type cover: str - :type background: str + :type thumb: str :type duration: int :type season: int :type season_uuid: str @@ -135,8 +135,7 @@ class Episode: self.program_title = program_title self.title = title self.description = description - self.cover = cover - self.background = background + self.thumb = thumb self.duration = duration self.season = season self.season_uuid = season_uuid @@ -501,7 +500,7 @@ class ContentApi: programs.append(Program( path=path.lstrip('/'), title=unescape(item.group('title')), - cover=unescape(item.group('image')), + poster=unescape(item.group('image')), )) return programs @@ -579,7 +578,7 @@ class ContentApi: description=html_to_kodi(description), duration=episode_duration, uuid=episode_video_id, - cover=episode_image, + thumb=episode_image, program_title=episode_program, )) @@ -599,8 +598,9 @@ class ContentApi: title=data['title'], description=html_to_kodi(data['description']), aired=datetime.fromtimestamp(data.get('pageInfo', {}).get('publishDate')), - cover=data['images']['poster'], - background=data['images']['hero'], + poster=data['images']['poster'], + thumb=data['images']['teaser'], + fanart=data['images']['hero'], ) # Create Season info @@ -651,8 +651,7 @@ class ContentApi: program_title=data.get('program', {}).get('title') if data.get('program') else data.get('title'), title=data.get('title'), description=html_to_kodi(data.get('description')), - cover=data.get('image'), - background=data.get('image'), + thumb=data.get('image'), duration=data.get('duration'), season=data.get('seasonNumber'), season_uuid=season_uuid, diff --git a/resources/lib/viervijfzes/epg.py b/resources/lib/viervijfzes/epg.py index 7153438..7bc2e30 100644 --- a/resources/lib/viervijfzes/epg.py +++ b/resources/lib/viervijfzes/epg.py @@ -37,7 +37,7 @@ class EpgProgram: # pylint: disable=invalid-name def __init__(self, channel, program_title, episode_title, episode_title_original, number, season, genre, start, - won_id, won_program_id, program_description, description, duration, program_url, video_url, cover, + won_id, won_program_id, program_description, description, duration, program_url, video_url, thumb, airing): self.channel = channel self.program_title = program_title @@ -54,7 +54,7 @@ class EpgProgram: self.duration = duration self.program_url = program_url self.video_url = video_url - self.cover = cover + self.thumb = thumb self.airing = airing if GENRE_MAPPING.get(self.genre): @@ -86,7 +86,7 @@ class EpgApi: :type channel: str :type date: str :rtype list[EpgProgram] - """ + """ if channel not in self.EPG_ENDPOINTS: raise Exception('Unknown channel %s' % channel) @@ -127,10 +127,10 @@ class EpgApi: # Only allow direct playing if the linked video is the actual program if data.get('video_node', {}).get('latest_video'): video_url = (data.get('video_node', {}).get('url') or '').lstrip('/') - cover = data.get('video_node', {}).get('image') + thumb = data.get('video_node', {}).get('image') else: video_url = None - cover = None + thumb = None return EpgProgram( channel=channel, @@ -148,7 +148,7 @@ class EpgApi: duration=duration, program_url=(data.get('program_node', {}).get('url') or '').lstrip('/'), video_url=video_url, - cover=cover, + thumb=thumb, airing=airing, ) diff --git a/resources/lib/viervijfzes/search.py b/resources/lib/viervijfzes/search.py index 4f1fd17..7a26237 100644 --- a/resources/lib/viervijfzes/search.py +++ b/resources/lib/viervijfzes/search.py @@ -56,7 +56,7 @@ class SearchApi: path=path, title=hit['_source']['title'], description=hit['_source']['intro'], - cover=hit['_source']['img'], + poster=hit['_source']['img'], )) return results diff --git a/resources/logos/play4.png b/resources/logos/play4.png index 3b5b639..8607ace 100644 Binary files a/resources/logos/play4.png and b/resources/logos/play4.png differ diff --git a/resources/logos/play5.png b/resources/logos/play5.png index aa2fe74..2dfac1e 100644 Binary files a/resources/logos/play5.png and b/resources/logos/play5.png differ diff --git a/resources/logos/play6.png b/resources/logos/play6.png index 534a7d7..a727649 100644 Binary files a/resources/logos/play6.png and b/resources/logos/play6.png differ diff --git a/tests/test_api.py b/tests/test_api.py index c850a15..f53a8ed 100644 --- a/tests/test_api.py +++ b/tests/test_api.py @@ -75,7 +75,7 @@ class TestApi(unittest.TestCase): @unittest.skipUnless(kodiutils.get_setting('username') and kodiutils.get_setting('password'), 'Skipping since we have no credentials.') def test_get_drm_stream(self): - resolved_stream = self._api.get_stream_by_uuid('f6d2f756-e0bf-4caa-822c-7ff0d10cc8dd') # Hawaii Five-O 8x25 + resolved_stream = self._api.get_stream_by_uuid('01998ce7-b2ad-4524-a786-33d419a29d7b') # CSI 12x22 self.assertIsInstance(resolved_stream, ResolvedStream)