Update Krypton objects

This commit is contained in:
angelblue05 2019-01-14 17:51:18 -06:00
parent d555079221
commit 05e8a2eb5d
9 changed files with 71 additions and 51 deletions

View file

@ -1,4 +1,4 @@
version = "171076022" version = "171076025"
from movies import Movies from movies import Movies
from musicvideos import MusicVideos from musicvideos import MusicVideos

View file

@ -176,9 +176,13 @@ class Actions(object):
''' '''
item = items[0] item = items[0]
playlist = self.get_playlist(item) playlist = self.get_playlist(item)
player = xbmc.Player()
if clear: if clear:
playlist.clear() if player.isPlaying():
player.stop()
xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
index = 0 index = 0
else: else:
index = max(playlist.getposition(), 0) + 1 # Can return -1 index = max(playlist.getposition(), 0) + 1 # Can return -1
@ -201,14 +205,16 @@ class Actions(object):
index += 1 index += 1
if clear: if clear:
xbmc.Player().play(playlist) xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
player.play(playlist)
for item in items[1:]: for item in items[1:]:
listitem = xbmcgui.ListItem() listitem = xbmcgui.ListItem()
LOG.info("[ playlist/%s ]", item) LOG.info("[ playlist/%s ]", item)
path = "plugin://plugin.video.emby/?mode=play&id=%s&playlist=true" % item
path = "plugin://plugin.video.emby/?mode=play&id=%s&playlist=true" % item
listitem.setPath(path) listitem.setPath(path)
playlist.add(path, listitem, index) playlist.add(path, listitem, index)
index += 1 index += 1
@ -334,13 +340,15 @@ class Actions(object):
'dbid': obj['DbId'] 'dbid': obj['DbId']
} }
listitem.setCast(API.get_actors()) listitem.setCast(API.get_actors())
if obj['Type'] == 'Video':
listitem.setIconImage('DefaultVideo.png')
listitem.setThumbnailImage(obj['Artwork']['Primary'] or obj['Artwork']['Thumb'])
else:
listitem.setIconImage(obj['Artwork']['Thumb']) listitem.setIconImage(obj['Artwork']['Thumb'])
listitem.setThumbnailImage(obj['Artwork']['Primary']) listitem.setThumbnailImage(obj['Artwork']['Primary'])
self.set_artwork(obj['Artwork'], listitem, obj['Type']) self.set_artwork(obj['Artwork'], listitem, obj['Type'])
if obj['Artwork']['Primary']:
listitem.setThumbnailImage(obj['Artwork']['Primary'])
if not obj['Artwork']['Backdrop']: if not obj['Artwork']['Backdrop']:
listitem.setArt({'fanart': obj['Artwork']['Primary']}) listitem.setArt({'fanart': obj['Artwork']['Primary']})
@ -374,9 +382,14 @@ class Actions(object):
listitem.setProperty('IsFolder', 'true') listitem.setProperty('IsFolder', 'true')
elif obj['Type'] == 'Series': elif obj['Type'] == 'Series':
if obj['Status'] != 'Ended':
obj['Status'] = None
metadata.update({ metadata.update({
'mediatype': "tvshow", 'mediatype': "tvshow",
'tvshowtitle': obj['Title'] 'tvshowtitle': obj['Title'],
'status': obj['Status']
}) })
listitem.setProperty('TotalSeasons', str(obj['ChildCount'])) listitem.setProperty('TotalSeasons', str(obj['ChildCount']))
listitem.setProperty('TotalEpisodes', str(obj['RecursiveCount'])) listitem.setProperty('TotalEpisodes', str(obj['RecursiveCount']))
@ -389,7 +402,8 @@ class Actions(object):
'mediatype': "movie", 'mediatype': "movie",
'imdbnumber': obj['UniqueId'], 'imdbnumber': obj['UniqueId'],
'lastplayed': obj['DatePlayed'], 'lastplayed': obj['DatePlayed'],
'duration': obj['Runtime'] 'duration': obj['Runtime'],
'userrating': obj['CriticRating']
}) })
elif obj['Type'] == 'MusicVideo': elif obj['Type'] == 'MusicVideo':
@ -550,8 +564,6 @@ class Actions(object):
} }
listitem.setProperty('path', obj['Artwork']['Primary']) listitem.setProperty('path', obj['Artwork']['Primary'])
listitem.setThumbnailImage(obj['Artwork']['Primary']) listitem.setThumbnailImage(obj['Artwork']['Primary'])
listitem.setIconImage(obj['Artwork']['Primary'] or "special://home/addons/plugin.video.emby/icon.png")
listitem.setArt({'fanart': obj['Artwork']['Primary'] or "special://home/addons/plugin.video.emby/fanart.jpg"})
if obj['Type'] == 'Photo': if obj['Type'] == 'Photo':
metadata.update({ metadata.update({
@ -567,11 +579,10 @@ class Actions(object):
}) })
listitem.setProperty('plot', obj['Overview']) listitem.setProperty('plot', obj['Overview'])
listitem.setProperty('IsFolder', 'false') listitem.setProperty('IsFolder', 'false')
listitem.setIconImage('DefaultPicture.png')
else: else:
if obj['Artwork']['Backdrop']:
listitem.setArt({'fanart': obj['Artwork']['Backdrop'][0]})
listitem.setProperty('IsFolder', 'true') listitem.setProperty('IsFolder', 'true')
listitem.setIconImage('DefaultFolder.png')
listitem.setProperty('IsPlayable', 'false') listitem.setProperty('IsPlayable', 'false')
listitem.setLabel(obj['Title']) listitem.setLabel(obj['Title'])

View file

@ -151,7 +151,7 @@ class Artwork(object):
if thread.is_done: if thread.is_done:
self.threads.remove(thread) self.threads.remove(thread)
if self.queue.qsize() and len(self.threads) < 3: if self.queue.qsize() and len(self.threads) < 2:
new_thread = GetArtworkWorker(self.kodi, self.queue) new_thread = GetArtworkWorker(self.kodi, self.queue)
new_thread.start() new_thread.start()

View file

@ -279,13 +279,13 @@ add_art = """ INSERT INTO art(media_id, media_type, type, url)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?)
""" """
add_movie = """ INSERT INTO movie(idMovie, idFile, c00, c01, c02, c03, c04, c05, c06, c07, add_movie = """ INSERT INTO movie(idMovie, idFile, c00, c01, c02, c03, c04, c05, c06, c07,
c09, c10, c11, c12, c14, c15, c16, c18, c19, c21, premiered) c09, c10, c11, c12, c14, c15, c16, c18, c19, c21, userrating, premiered)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""" """
add_movie_obj = [ "{MovieId}","{FileId}","{Title}","{Plot}","{ShortPlot}","{Tagline}", add_movie_obj = [ "{MovieId}","{FileId}","{Title}","{Plot}","{ShortPlot}","{Tagline}",
"{Votes}","{RatingId}","{Writers}","{Year}","{Unique}","{SortTitle}", "{Votes}","{RatingId}","{Writers}","{Year}","{Unique}","{SortTitle}",
"{Runtime}","{Mpaa}","{Genre}","{Directors}","{Title}","{Studio}", "{Runtime}","{Mpaa}","{Genre}","{Directors}","{Title}","{Studio}",
"{Trailer}","{Country}","{Year}" "{Trailer}","{Country}","{CriticRating}","{Year}"
] ]
add_rating = """ INSERT INTO rating(rating_id, media_id, media_type, rating_type, rating, votes) add_rating = """ INSERT INTO rating(rating_id, media_id, media_type, rating_type, rating, votes)
VALUES (?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?)
@ -320,10 +320,10 @@ add_musicvideo = """ INSERT INTO musicvideo(idMVideo,idFile, c00, c04, c05,
add_musicvideo_obj = [ "{MvideoId}","{FileId}","{Title}","{Runtime}","{Directors}","{Studio}","{Year}", add_musicvideo_obj = [ "{MvideoId}","{FileId}","{Title}","{Runtime}","{Directors}","{Studio}","{Year}",
"{Plot}","{Album}","{Artists}","{Genre}","{Index}","{Premiere}" "{Plot}","{Album}","{Artists}","{Genre}","{Index}","{Premiere}"
] ]
add_tvshow = """ INSERT INTO tvshow(idShow, c00, c01, c04, c05, c08, c09, c12, c13, c14, c15) add_tvshow = """ INSERT INTO tvshow(idShow, c00, c01, c02, c04, c05, c08, c09, c12, c13, c14, c15)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
""" """
add_tvshow_obj = [ "{ShowId}","{Title}","{Plot}","{RatingId}","{Premiere}","{Genre}","{Title}", add_tvshow_obj = [ "{ShowId}","{Title}","{Plot}","{Status}","{RatingId}","{Premiere}","{Genre}","{Title}",
"{Unique}","{Mpaa}","{Studio}","{SortTitle}" "{Unique}","{Mpaa}","{Studio}","{SortTitle}"
] ]
add_season = """ INSERT INTO seasons(idSeason, idShow, season) add_season = """ INSERT INTO seasons(idSeason, idShow, season)
@ -392,13 +392,13 @@ update_link = """ INSERT OR REPLACE INTO {LinkType}(actor_id, media_id, medi
update_movie = """ UPDATE movie update_movie = """ UPDATE movie
SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?, SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?,
c07 = ?, c09 = ?, c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?, c07 = ?, c09 = ?, c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?,
c16 = ?, c18 = ?, c19 = ?, c21 = ?, premiered = ? c16 = ?, c18 = ?, c19 = ?, c21 = ?, userrating = ?, premiered = ?
WHERE idMovie = ? WHERE idMovie = ?
""" """
update_movie_obj = [ "{Title}","{Plot}","{ShortPlot}","{Tagline}","{Votes}","{RatingId}", update_movie_obj = [ "{Title}","{Plot}","{ShortPlot}","{Tagline}","{Votes}","{RatingId}",
"{Writers}","{Year}","{Unique}","{SortTitle}","{Runtime}", "{Writers}","{Year}","{Unique}","{SortTitle}","{Runtime}",
"{Mpaa}","{Genre}","{Directors}","{Title}","{Studio}","{Trailer}", "{Mpaa}","{Genre}","{Directors}","{Title}","{Studio}","{Trailer}",
"{Country}","{Year}","{MovieId}" "{Country}","{CriticRating}","{Year}","{MovieId}"
] ]
update_rating = """ UPDATE rating update_rating = """ UPDATE rating
SET media_id = ?, media_type = ?, rating_type = ?, rating = ?, votes = ? SET media_id = ?, media_type = ?, rating_type = ?, rating = ?, votes = ?
@ -446,11 +446,11 @@ update_musicvideo_obj = [ "{Title}","{Runtime}","{Directors}","{Studio}","
"{Artists}","{Genre}","{Index}","{Premiere}","{MvideoId}" "{Artists}","{Genre}","{Index}","{Premiere}","{MvideoId}"
] ]
update_tvshow = """ UPDATE tvshow update_tvshow = """ UPDATE tvshow
SET c00 = ?, c01 = ?, c04 = ?, c05 = ?, c08 = ?, c09 = ?, SET c00 = ?, c01 = ?, c02 = ?, c04 = ?, c05 = ?, c08 = ?, c09 = ?,
c12 = ?, c13 = ?, c14 = ?, c15 = ? c12 = ?, c13 = ?, c14 = ?, c15 = ?
WHERE idShow = ? WHERE idShow = ?
""" """
update_tvshow_obj = [ "{Title}","{Plot}","{RatingId}","{Premiere}","{Genre}","{Title}", update_tvshow_obj = [ "{Title}","{Plot}","{Status}","{RatingId}","{Premiere}","{Genre}","{Title}",
"{Unique}","{Mpaa}","{Studio}","{SortTitle}","{ShowId}" "{Unique}","{Mpaa}","{Studio}","{SortTitle}","{ShowId}"
] ]
update_tvshow_link = """ INSERT OR REPLACE INTO tvshowlinkpath(idShow, idPath) update_tvshow_link = """ INSERT OR REPLACE INTO tvshowlinkpath(idShow, idPath)

View file

@ -10,7 +10,7 @@ import downloader as server
from obj import Objects from obj import Objects
from kodi import Movies as KodiDb, queries as QU from kodi import Movies as KodiDb, queries as QU
from database import emby_db, queries as QUEM from database import emby_db, queries as QUEM
from helper import api, catch, stop, validate, emby_item, library_check, values from helper import api, catch, stop, validate, emby_item, library_check, values, settings, Local
################################################################################################## ##################################################################################################
@ -72,6 +72,8 @@ class Movies(KodiDb):
update = False update = False
LOG.info("MovieId %s missing from kodi. repairing the entry.", obj['MovieId']) LOG.info("MovieId %s missing from kodi. repairing the entry.", obj['MovieId'])
if not settings('syncRottenTomatoes.bool'):
obj['CriticRating'] = None
obj['Path'] = API.get_file_path(obj['Path']) obj['Path'] = API.get_file_path(obj['Path'])
obj['LibraryId'] = library['Id'] obj['LibraryId'] = library['Id']
@ -87,8 +89,8 @@ class Movies(KodiDb):
obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0) obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0)
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6) obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
obj['People'] = API.get_people_artwork(obj['People']) obj['People'] = API.get_people_artwork(obj['People'])
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ") obj['DateAdded'] = Local(obj['DateAdded']).split('.')[0].replace('T', " ")
obj['DatePlayed'] = None if not obj['DatePlayed'] else obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = None if not obj['DatePlayed'] else Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork')) obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork'))
obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container']) obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container'])
@ -302,7 +304,7 @@ class Movies(KodiDb):
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
if obj['DatePlayed']: if obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
if obj['Favorite']: if obj['Favorite']:
self.get_tag(*values(obj, QU.get_tag_movie_obj)) self.get_tag(*values(obj, QU.get_tag_movie_obj))

View file

@ -10,7 +10,7 @@ import urllib
from obj import Objects from obj import Objects
from kodi import Music as KodiDb, queries_music as QU from kodi import Music as KodiDb, queries_music as QU
from database import emby_db, queries as QUEM from database import emby_db, queries as QUEM
from helper import api, catch, stop, validate, emby_item, values, library_check from helper import api, catch, stop, validate, emby_item, values, library_check, settings, Local
################################################################################################## ##################################################################################################
@ -268,10 +268,10 @@ class Music(KodiDb):
obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'ArtworkMusic'), True) obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'ArtworkMusic'), True)
if obj['DateAdded']: if obj['DateAdded']:
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ") obj['DateAdded'] = Local(obj['DateAdded']).split('.')[0].replace('T', " ")
if obj['DatePlayed']: if obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
if obj['Disc'] != 1: if obj['Disc'] != 1:
obj['Index'] = obj['Disc'] * 2 ** 16 + obj['Index'] obj['Index'] = obj['Disc'] * 2 ** 16 + obj['Index']
@ -442,7 +442,7 @@ class Music(KodiDb):
if obj['Media'] == 'song': if obj['Media'] == 'song':
if obj['DatePlayed']: if obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
self.rate_song(*values(obj, QU.update_song_rating_obj)) self.rate_song(*values(obj, QU.update_song_rating_obj))

View file

@ -10,7 +10,7 @@ import urllib
from obj import Objects from obj import Objects
from kodi import MusicVideos as KodiDb, queries as QU from kodi import MusicVideos as KodiDb, queries as QU
from database import emby_db, queries as QUEM from database import emby_db, queries as QUEM
from helper import api, catch, stop, validate, library_check, emby_item, values from helper import api, catch, stop, validate, library_check, emby_item, values, Local
################################################################################################## ##################################################################################################
@ -80,12 +80,12 @@ class MusicVideos(KodiDb):
obj['ArtistItems'] = obj['ArtistItems'] or [] obj['ArtistItems'] = obj['ArtistItems'] or []
obj['Studios'] = [API.validate_studio(studio) for studio in (obj['Studios'] or [])] obj['Studios'] = [API.validate_studio(studio) for studio in (obj['Studios'] or [])]
obj['Plot'] = API.get_overview(obj['Plot']) obj['Plot'] = API.get_overview(obj['Plot'])
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ") obj['DateAdded'] = Local(obj['DateAdded']).split('.')[0].replace('T', " ")
obj['DatePlayed'] = None if not obj['DatePlayed'] else obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = None if not obj['DatePlayed'] else Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0) obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0)
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6) obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
obj['Premiere'] = obj['Premiere'] or datetime.date(obj['Year'] or 2021, 1, 1) obj['Premiere'] = Local(obj['Premiere']) if obj['Premiere'] else datetime.date(obj['Year'] or 2021, 1, 1)
obj['Genre'] = " / ".join(obj['Genres']) obj['Genre'] = " / ".join(obj['Genres'])
obj['Studio'] = " / ".join(obj['Studios']) obj['Studio'] = " / ".join(obj['Studios'])
obj['Artists'] = " / ".join(obj['Artists'] or []) obj['Artists'] = " / ".join(obj['Artists'] or [])
@ -205,7 +205,7 @@ class MusicVideos(KodiDb):
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
if obj['DatePlayed']: if obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
if obj['Favorite']: if obj['Favorite']:
self.get_tag(*values(obj, QU.get_tag_mvideo_obj)) self.get_tag(*values(obj, QU.get_tag_mvideo_obj))

View file

@ -40,7 +40,8 @@
"Audio": "MediaSources/0/MediaStreams:?Type=Audio", "Audio": "MediaSources/0/MediaStreams:?Type=Audio",
"Video": "MediaSources/0/MediaStreams:?Type=Video", "Video": "MediaSources/0/MediaStreams:?Type=Video",
"Container": "MediaSources/0/Container", "Container": "MediaSources/0/Container",
"EmbyParentId": "ParentId" "EmbyParentId": "ParentId",
"CriticRating": "CriticRating"
}, },
"MovieUserData": { "MovieUserData": {
"Id": "Id", "Id": "Id",
@ -76,7 +77,8 @@
"Tags": "Tags", "Tags": "Tags",
"Favorite": "UserData/IsFavorite", "Favorite": "UserData/IsFavorite",
"RecursiveCount": "RecursiveItemCount", "RecursiveCount": "RecursiveItemCount",
"EmbyParentId": "ParentId" "EmbyParentId": "ParentId",
"Status": "Status"
}, },
"Season": { "Season": {
"Id": "Id", "Id": "Id",
@ -299,7 +301,9 @@
"Unwatched": "UserData/UnplayedItemCount", "Unwatched": "UserData/UnplayedItemCount",
"ChildCount": "ChildCount", "ChildCount": "ChildCount",
"RecursiveCount": "RecursiveItemCount", "RecursiveCount": "RecursiveItemCount",
"MediaType": "MediaType" "MediaType": "MediaType",
"CriticRating": "CriticRating",
"Status": "Status"
}, },
"BrowseAudio": { "BrowseAudio": {
"Id": "Id", "Id": "Id",

View file

@ -12,7 +12,7 @@ from obj import Objects
from kodi import TVShows as KodiDb, queries as QU from kodi import TVShows as KodiDb, queries as QU
import downloader as server import downloader as server
from database import emby_db, queries as QUEM from database import emby_db, queries as QUEM
from helper import api, catch, stop, validate, emby_item, library_check, settings, values from helper import api, catch, stop, validate, emby_item, library_check, settings, values, Local
################################################################################################## ##################################################################################################
@ -101,10 +101,13 @@ class TVShows(KodiDb):
obj['Studio'] = " / ".join(obj['Studios']) obj['Studio'] = " / ".join(obj['Studios'])
obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork')) obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork'))
if obj['Status'] != 'Ended':
obj['Status'] = None
self.get_path_filename(obj) self.get_path_filename(obj)
if obj['Premiere']: if obj['Premiere']:
obj['Premiere'] = str(obj['Premiere']).split('.')[0].replace('T', " ") obj['Premiere'] = str(Local(obj['Premiere'])).split('.')[0].replace('T', " ")
tags = [] tags = []
tags.extend(obj['Tags'] or []) tags.extend(obj['Tags'] or [])
@ -299,8 +302,8 @@ class TVShows(KodiDb):
obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0) obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0)
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6) obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
obj['People'] = API.get_people_artwork(obj['People'] or []) obj['People'] = API.get_people_artwork(obj['People'] or [])
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ") obj['DateAdded'] = Local(obj['DateAdded']).split('.')[0].replace('T', " ")
obj['DatePlayed'] = None if not obj['DatePlayed'] else obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = None if not obj['DatePlayed'] else Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork')) obj['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork'))
obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container']) obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container'])
@ -310,7 +313,7 @@ class TVShows(KodiDb):
self.get_episode_path_filename(obj) self.get_episode_path_filename(obj)
if obj['Premiere']: if obj['Premiere']:
obj['Premiere'] = obj['Premiere'].split('.')[0].replace('T', " ") obj['Premiere'] = Local(obj['Premiere']).split('.')[0].replace('T', " ")
if obj['Season'] is None: if obj['Season'] is None:
if obj['AbsoluteNumber']: if obj['AbsoluteNumber']:
@ -479,10 +482,10 @@ class TVShows(KodiDb):
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
if obj['DatePlayed']: if obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
if obj['DateAdded']: if obj['DateAdded']:
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ") obj['DateAdded'] = Local(obj['DateAdded']).split('.')[0].replace('T', " ")
self.add_playstate(*values(obj, QU.add_bookmark_obj)) self.add_playstate(*values(obj, QU.add_bookmark_obj))