mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-19 07:45:07 +00:00
Fix episodes for series pooling
This commit is contained in:
parent
8915773706
commit
d54aad726e
9 changed files with 120 additions and 24 deletions
|
@ -230,6 +230,12 @@ class Actions(object):
|
|||
obj['Artwork'] = API.get_all_artwork(objects.map(item, 'Artwork'))
|
||||
self.listitem_photo(obj, listitem, item)
|
||||
|
||||
elif item['Type'] in ('TvChannel'):
|
||||
|
||||
obj = objects.map(item, 'BrowseChannel')
|
||||
obj['Artwork'] = API.get_all_artwork(objects.map(item, 'Artwork'))
|
||||
self.listitem_channel(obj, listitem, item)
|
||||
|
||||
else:
|
||||
obj = objects.map(item, 'BrowseVideo')
|
||||
obj['DbId'] = db_id
|
||||
|
@ -428,6 +434,45 @@ class Actions(object):
|
|||
listitem.setInfo('video', metadata)
|
||||
listitem.setContentLookup(False)
|
||||
|
||||
def listitem_channel(self, obj, listitem, item):
|
||||
|
||||
''' Set listitem for channel content.
|
||||
'''
|
||||
API = api.API(item, self.server)
|
||||
|
||||
obj['Title'] = "%s - %s" % (obj['Title'], obj['ProgramName'])
|
||||
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
|
||||
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) or 0
|
||||
obj['Overlay'] = 7 if obj['Played'] else 6
|
||||
obj['Artwork']['Primary'] = obj['Artwork']['Primary'] or "special://home/addons/plugin.video.emby/icon.png"
|
||||
obj['Artwork']['Thumb'] = obj['Artwork']['Thumb'] or "special://home/addons/plugin.video.emby/fanart.jpg"
|
||||
obj['Artwork']['Backdrop'] = obj['Artwork']['Backdrop'] or ["special://home/addons/plugin.video.emby/fanart.jpg"]
|
||||
|
||||
|
||||
metadata = {
|
||||
'title': obj['Title'],
|
||||
'originaltitle': obj['Title'],
|
||||
'playcount': obj['PlayCount'],
|
||||
'overlay': obj['Overlay']
|
||||
}
|
||||
listitem.setIconImage(obj['Artwork']['Thumb'])
|
||||
listitem.setThumbnailImage(obj['Artwork']['Primary'])
|
||||
self.set_artwork(obj['Artwork'], listitem, obj['Type'])
|
||||
|
||||
if obj['Artwork']['Primary']:
|
||||
listitem.setThumbnailImage(obj['Artwork']['Primary'])
|
||||
|
||||
if not obj['Artwork']['Backdrop']:
|
||||
listitem.setArt({'fanart': obj['Artwork']['Primary']})
|
||||
|
||||
listitem.setProperty('totaltime', str(obj['Runtime']))
|
||||
listitem.setProperty('IsPlayable', 'true')
|
||||
listitem.setProperty('IsFolder', 'false')
|
||||
|
||||
listitem.setLabel(obj['Title'])
|
||||
listitem.setInfo('video', metadata)
|
||||
listitem.setContentLookup(False)
|
||||
|
||||
def listitem_music(self, obj, listitem, item):
|
||||
API = api.API(item, self.server)
|
||||
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
"Video": "MediaSources/0/MediaStreams:?Type=Video",
|
||||
"Container": "MediaSources/0/Container",
|
||||
"Location": "LocationType",
|
||||
"EmbyParentId": "ParentId"
|
||||
"EmbyParentId": "SeriesId,ParentId"
|
||||
},
|
||||
"EpisodeUserData": {
|
||||
"Id": "Id",
|
||||
|
@ -333,5 +333,15 @@
|
|||
"CameraModel": "CameraModel",
|
||||
"ExposureTime": "ExposureTime",
|
||||
"FocalLength": "FocalLength"
|
||||
},
|
||||
"BrowseChannel": {
|
||||
"Id": "Id",
|
||||
"Title": "Name",
|
||||
"Type": "Type",
|
||||
"ProgramName": "CurrentProgram/Name",
|
||||
"Played": "CurrentProgram/UserData/Played",
|
||||
"PlayCount": "CurrentProgram/UserData/PlayCount",
|
||||
"Runtime": "CurrentProgram/RunTimeTicks",
|
||||
"MediaType": "MediaType"
|
||||
}
|
||||
}
|
|
@ -127,7 +127,7 @@ class TVShows(KodiDb):
|
|||
self.add_studios(*values(obj, QU.add_studios_tvshow_obj))
|
||||
self.artwork.add(obj['Artwork'], obj['ShowId'], "tvshow")
|
||||
|
||||
season_episodes = []
|
||||
season_episodes = {}
|
||||
|
||||
for season in self.server['api'].get_seasons(obj['Id'])['Items']:
|
||||
|
||||
|
@ -140,19 +140,18 @@ class TVShows(KodiDb):
|
|||
|
||||
self.emby_db.add_reference(*values(obj, QUEM.add_reference_pool_obj))
|
||||
LOG.info("POOL %s [%s/%s]", obj['Title'], obj['Id'], obj['SeriesId'])
|
||||
|
||||
season_episodes[season['Id']] = season['SeriesId']
|
||||
|
||||
try:
|
||||
self.emby_db.get_item_by_id(season['Id'])[0]
|
||||
except TypeError:
|
||||
|
||||
self.season(season, obj['ShowId'])
|
||||
season_episodes.append(season['Id'])
|
||||
else:
|
||||
season_id = self.get_season(*values(obj, QU.get_season_special_obj))
|
||||
self.artwork.add(obj['Artwork'], season_id, "season")
|
||||
|
||||
for season in season_episodes:
|
||||
for episodes in server.get_items(season, "Episode"):
|
||||
for episodes in server.get_episode_by_season(season_episodes[season], season):
|
||||
|
||||
for episode in episodes['Items']:
|
||||
self.episode(episode)
|
||||
|
@ -562,6 +561,12 @@ class TVShows(KodiDb):
|
|||
self.remove_show(obj['ParentId'], obj['Id'])
|
||||
self.emby_db.remove_item_by_kodi_id(*values(obj, QUEM.delete_item_by_parent_tvshow_obj))
|
||||
|
||||
# Remove any series pooling episodes
|
||||
for episode in self.emby_db.get_media_by_parent_id(obj['Id']):
|
||||
self.remove_episode(episode[2], episode[3], obj['Id'])
|
||||
else:
|
||||
self.emby_db.remove_media_by_parent_id(obj['Id'])
|
||||
|
||||
self.emby_db.remove_item(*values(obj, QUEM.delete_item_obj))
|
||||
|
||||
def remove_tvshow(self, kodi_id, item_id):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue