Fix lastplayed

This commit is contained in:
angelblue05 2018-09-25 04:07:13 -05:00
parent 2a1a4b8a7c
commit 285b242a7f
5 changed files with 11 additions and 23 deletions

View file

@ -295,9 +295,7 @@ class Actions(object):
if obj['Premiere']: if obj['Premiere']:
obj['Premiere'] = obj['Premiere'].split('T')[0] obj['Premiere'] = obj['Premiere'].split('T')[0]
if not obj['Played']: if obj['DatePlayed']:
obj['DatePlayed'] = None
elif obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
metadata = { metadata = {

View file

@ -88,7 +88,7 @@ class Movies(KodiDb):
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'] = obj['DateAdded'].split('.')[0].replace('T', " ")
obj['DatePlayed'] = None if not obj['Played'] else (obj['DatePlayed'] or obj['DateAdded']).split('.')[0].replace('T', " ") obj['DatePlayed'] = None if not obj['DatePlayed'] else 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'])
@ -300,9 +300,7 @@ class Movies(KodiDb):
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6) obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
if not obj['Played']: if obj['DatePlayed']:
obj['DatePlayed'] = None
elif obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
if obj['Favorite']: if obj['Favorite']:

View file

@ -270,10 +270,8 @@ class Music(KodiDb):
if obj['DateAdded']: if obj['DateAdded']:
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ") obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ")
if not obj['Played']: if obj['DatePlayed']:
obj['DatePlayed'] = None obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
elif obj['DateAdded'] or obj['DatePlayed']:
obj['DatePlayed'] = (obj['DatePlayed'] or obj['DateAdded']).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']
@ -323,7 +321,7 @@ class Music(KodiDb):
self.add_song(*values(obj, QU.add_song_obj)) self.add_song(*values(obj, QU.add_song_obj))
self.emby_db.add_reference(*values(obj, QUEM.add_reference_song_obj)) self.emby_db.add_reference(*values(obj, QUEM.add_reference_song_obj))
LOG.debug("ADD song [%s/%s/%s] %s: %s", obj['PathId'], obj['AlbumId'], obj['SongId'], obj['Id'], obj['Title']) LOG.info("ADD song [%s/%s/%s] %s: %s", obj['PathId'], obj['AlbumId'], obj['SongId'], obj['Id'], obj['Title'])
def song_update(self, obj): def song_update(self, obj):
@ -436,9 +434,7 @@ class Music(KodiDb):
if obj['Media'] == 'song': if obj['Media'] == 'song':
if not obj['Played']: if obj['DatePlayed']:
obj['DatePlayed'] = None
elif obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = 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

@ -80,7 +80,7 @@ class MusicVideos(KodiDb):
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'] = obj['DateAdded'].split('.')[0].replace('T', " ")
obj['DatePlayed'] = None if not obj['Played'] else (obj['DatePlayed'] or obj['DateAdded']).split('.')[0].replace('T', " ") obj['DatePlayed'] = None if not obj['DatePlayed'] else 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)
@ -200,9 +200,7 @@ class MusicVideos(KodiDb):
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6) obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
if not obj['Played']: if obj['DatePlayed']:
obj['DatePlayed'] = None
elif obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
if obj['Favorite']: if obj['Favorite']:

View file

@ -290,7 +290,7 @@ class TVShows(KodiDb):
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'] = obj['DateAdded'].split('.')[0].replace('T', " ")
obj['DatePlayed'] = None if not obj['Played'] else (obj['DatePlayed'] or obj['DateAdded']).split('.')[0].replace('T', " ") obj['DatePlayed'] = None if not obj['DatePlayed'] else 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'])
@ -455,9 +455,7 @@ class TVShows(KodiDb):
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6) obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount']) obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
if not obj['Played']: if obj['DatePlayed']:
obj['DatePlayed'] = None
elif obj['DatePlayed']:
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ") obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
if obj['DateAdded']: if obj['DateAdded']: