mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Update Krypton objects
This commit is contained in:
parent
d555079221
commit
05e8a2eb5d
9 changed files with 71 additions and 51 deletions
|
@ -1,4 +1,4 @@
|
|||
version = "171076022"
|
||||
version = "171076025"
|
||||
|
||||
from movies import Movies
|
||||
from musicvideos import MusicVideos
|
||||
|
|
|
@ -176,9 +176,13 @@ class Actions(object):
|
|||
'''
|
||||
item = items[0]
|
||||
playlist = self.get_playlist(item)
|
||||
player = xbmc.Player()
|
||||
|
||||
if clear:
|
||||
playlist.clear()
|
||||
if player.isPlaying():
|
||||
player.stop()
|
||||
|
||||
xbmc.executebuiltin('ActivateWindow(busydialognocancel)')
|
||||
index = 0
|
||||
else:
|
||||
index = max(playlist.getposition(), 0) + 1 # Can return -1
|
||||
|
@ -201,14 +205,16 @@ class Actions(object):
|
|||
index += 1
|
||||
|
||||
if clear:
|
||||
xbmc.Player().play(playlist)
|
||||
xbmc.executebuiltin('Dialog.Close(busydialognocancel)')
|
||||
player.play(playlist)
|
||||
|
||||
for item in items[1:]:
|
||||
listitem = xbmcgui.ListItem()
|
||||
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)
|
||||
|
||||
playlist.add(path, listitem, index)
|
||||
index += 1
|
||||
|
||||
|
@ -334,15 +340,17 @@ class Actions(object):
|
|||
'dbid': obj['DbId']
|
||||
}
|
||||
listitem.setCast(API.get_actors())
|
||||
listitem.setIconImage(obj['Artwork']['Thumb'])
|
||||
listitem.setThumbnailImage(obj['Artwork']['Primary'])
|
||||
self.set_artwork(obj['Artwork'], listitem, obj['Type'])
|
||||
|
||||
if obj['Artwork']['Primary']:
|
||||
if obj['Type'] == 'Video':
|
||||
listitem.setIconImage('DefaultVideo.png')
|
||||
listitem.setThumbnailImage(obj['Artwork']['Primary'] or obj['Artwork']['Thumb'])
|
||||
else:
|
||||
listitem.setIconImage(obj['Artwork']['Thumb'])
|
||||
listitem.setThumbnailImage(obj['Artwork']['Primary'])
|
||||
self.set_artwork(obj['Artwork'], listitem, obj['Type'])
|
||||
|
||||
if not obj['Artwork']['Backdrop']:
|
||||
listitem.setArt({'fanart': obj['Artwork']['Primary']})
|
||||
if not obj['Artwork']['Backdrop']:
|
||||
listitem.setArt({'fanart': obj['Artwork']['Primary']})
|
||||
|
||||
if obj['Premiere']:
|
||||
metadata['premieredate'] = obj['Premiere']
|
||||
|
@ -374,9 +382,14 @@ class Actions(object):
|
|||
listitem.setProperty('IsFolder', 'true')
|
||||
|
||||
elif obj['Type'] == 'Series':
|
||||
|
||||
if obj['Status'] != 'Ended':
|
||||
obj['Status'] = None
|
||||
|
||||
metadata.update({
|
||||
'mediatype': "tvshow",
|
||||
'tvshowtitle': obj['Title']
|
||||
'tvshowtitle': obj['Title'],
|
||||
'status': obj['Status']
|
||||
})
|
||||
listitem.setProperty('TotalSeasons', str(obj['ChildCount']))
|
||||
listitem.setProperty('TotalEpisodes', str(obj['RecursiveCount']))
|
||||
|
@ -389,7 +402,8 @@ class Actions(object):
|
|||
'mediatype': "movie",
|
||||
'imdbnumber': obj['UniqueId'],
|
||||
'lastplayed': obj['DatePlayed'],
|
||||
'duration': obj['Runtime']
|
||||
'duration': obj['Runtime'],
|
||||
'userrating': obj['CriticRating']
|
||||
})
|
||||
|
||||
elif obj['Type'] == 'MusicVideo':
|
||||
|
@ -550,8 +564,6 @@ class Actions(object):
|
|||
}
|
||||
listitem.setProperty('path', 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':
|
||||
metadata.update({
|
||||
|
@ -567,11 +579,10 @@ class Actions(object):
|
|||
})
|
||||
listitem.setProperty('plot', obj['Overview'])
|
||||
listitem.setProperty('IsFolder', 'false')
|
||||
listitem.setIconImage('DefaultPicture.png')
|
||||
else:
|
||||
if obj['Artwork']['Backdrop']:
|
||||
listitem.setArt({'fanart': obj['Artwork']['Backdrop'][0]})
|
||||
|
||||
listitem.setProperty('IsFolder', 'true')
|
||||
listitem.setIconImage('DefaultFolder.png')
|
||||
|
||||
listitem.setProperty('IsPlayable', 'false')
|
||||
listitem.setLabel(obj['Title'])
|
||||
|
|
|
@ -151,7 +151,7 @@ class Artwork(object):
|
|||
if thread.is_done:
|
||||
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.start()
|
||||
|
|
|
@ -279,13 +279,13 @@ add_art = """ INSERT INTO art(media_id, media_type, type, url)
|
|||
VALUES (?, ?, ?, ?)
|
||||
"""
|
||||
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)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
c09, c10, c11, c12, c14, c15, c16, c18, c19, c21, userrating, premiered)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
"""
|
||||
add_movie_obj = [ "{MovieId}","{FileId}","{Title}","{Plot}","{ShortPlot}","{Tagline}",
|
||||
"{Votes}","{RatingId}","{Writers}","{Year}","{Unique}","{SortTitle}",
|
||||
"{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)
|
||||
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}",
|
||||
"{Plot}","{Album}","{Artists}","{Genre}","{Index}","{Premiere}"
|
||||
]
|
||||
add_tvshow = """ INSERT INTO tvshow(idShow, c00, c01, c04, c05, c08, c09, c12, c13, c14, c15)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
|
||||
add_tvshow = """ INSERT INTO tvshow(idShow, c00, c01, c02, c04, c05, c08, c09, c12, c13, c14, c15)
|
||||
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}"
|
||||
]
|
||||
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
|
||||
SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?,
|
||||
c07 = ?, c09 = ?, c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?,
|
||||
c16 = ?, c18 = ?, c19 = ?, c21 = ?, premiered = ?
|
||||
c16 = ?, c18 = ?, c19 = ?, c21 = ?, userrating = ?, premiered = ?
|
||||
WHERE idMovie = ?
|
||||
"""
|
||||
update_movie_obj = [ "{Title}","{Plot}","{ShortPlot}","{Tagline}","{Votes}","{RatingId}",
|
||||
"{Writers}","{Year}","{Unique}","{SortTitle}","{Runtime}",
|
||||
"{Mpaa}","{Genre}","{Directors}","{Title}","{Studio}","{Trailer}",
|
||||
"{Country}","{Year}","{MovieId}"
|
||||
"{Country}","{CriticRating}","{Year}","{MovieId}"
|
||||
]
|
||||
update_rating = """ UPDATE rating
|
||||
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}"
|
||||
]
|
||||
update_tvshow = """ UPDATE tvshow
|
||||
SET c00 = ?, c01 = ?, c04 = ?, c05 = ?, c08 = ?, c09 = ?,
|
||||
SET c00 = ?, c01 = ?, c02 = ?, c04 = ?, c05 = ?, c08 = ?, c09 = ?,
|
||||
c12 = ?, c13 = ?, c14 = ?, c15 = ?
|
||||
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}"
|
||||
]
|
||||
update_tvshow_link = """ INSERT OR REPLACE INTO tvshowlinkpath(idShow, idPath)
|
||||
|
|
|
@ -10,7 +10,7 @@ import downloader as server
|
|||
from obj import Objects
|
||||
from kodi import Movies as KodiDb, queries as QU
|
||||
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
|
||||
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['LibraryId'] = library['Id']
|
||||
|
@ -87,8 +89,8 @@ class Movies(KodiDb):
|
|||
obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0)
|
||||
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
|
||||
obj['People'] = API.get_people_artwork(obj['People'])
|
||||
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ")
|
||||
obj['DatePlayed'] = None if not obj['DatePlayed'] else obj['DatePlayed'].split('.')[0].replace('T', " ")
|
||||
obj['DateAdded'] = Local(obj['DateAdded']).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['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork'))
|
||||
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'])
|
||||
|
||||
if obj['DatePlayed']:
|
||||
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
|
||||
obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
|
||||
|
||||
if obj['Favorite']:
|
||||
self.get_tag(*values(obj, QU.get_tag_movie_obj))
|
||||
|
|
|
@ -10,7 +10,7 @@ import urllib
|
|||
from obj import Objects
|
||||
from kodi import Music as KodiDb, queries_music as QU
|
||||
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)
|
||||
|
||||
if obj['DateAdded']:
|
||||
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ")
|
||||
obj['DateAdded'] = Local(obj['DateAdded']).split('.')[0].replace('T', " ")
|
||||
|
||||
if obj['DatePlayed']:
|
||||
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
|
||||
obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
|
||||
|
||||
if obj['Disc'] != 1:
|
||||
obj['Index'] = obj['Disc'] * 2 ** 16 + obj['Index']
|
||||
|
@ -442,7 +442,7 @@ class Music(KodiDb):
|
|||
if obj['Media'] == 'song':
|
||||
|
||||
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))
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import urllib
|
|||
from obj import Objects
|
||||
from kodi import MusicVideos as KodiDb, queries as QU
|
||||
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['Studios'] = [API.validate_studio(studio) for studio in (obj['Studios'] or [])]
|
||||
obj['Plot'] = API.get_overview(obj['Plot'])
|
||||
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ")
|
||||
obj['DatePlayed'] = None if not obj['DatePlayed'] else obj['DatePlayed'].split('.')[0].replace('T', " ")
|
||||
obj['DateAdded'] = Local(obj['DateAdded']).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['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0)
|
||||
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['Studio'] = " / ".join(obj['Studios'])
|
||||
obj['Artists'] = " / ".join(obj['Artists'] or [])
|
||||
|
@ -205,7 +205,7 @@ class MusicVideos(KodiDb):
|
|||
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
|
||||
|
||||
if obj['DatePlayed']:
|
||||
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
|
||||
obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
|
||||
|
||||
if obj['Favorite']:
|
||||
self.get_tag(*values(obj, QU.get_tag_mvideo_obj))
|
||||
|
|
|
@ -40,7 +40,8 @@
|
|||
"Audio": "MediaSources/0/MediaStreams:?Type=Audio",
|
||||
"Video": "MediaSources/0/MediaStreams:?Type=Video",
|
||||
"Container": "MediaSources/0/Container",
|
||||
"EmbyParentId": "ParentId"
|
||||
"EmbyParentId": "ParentId",
|
||||
"CriticRating": "CriticRating"
|
||||
},
|
||||
"MovieUserData": {
|
||||
"Id": "Id",
|
||||
|
@ -76,7 +77,8 @@
|
|||
"Tags": "Tags",
|
||||
"Favorite": "UserData/IsFavorite",
|
||||
"RecursiveCount": "RecursiveItemCount",
|
||||
"EmbyParentId": "ParentId"
|
||||
"EmbyParentId": "ParentId",
|
||||
"Status": "Status"
|
||||
},
|
||||
"Season": {
|
||||
"Id": "Id",
|
||||
|
@ -299,7 +301,9 @@
|
|||
"Unwatched": "UserData/UnplayedItemCount",
|
||||
"ChildCount": "ChildCount",
|
||||
"RecursiveCount": "RecursiveItemCount",
|
||||
"MediaType": "MediaType"
|
||||
"MediaType": "MediaType",
|
||||
"CriticRating": "CriticRating",
|
||||
"Status": "Status"
|
||||
},
|
||||
"BrowseAudio": {
|
||||
"Id": "Id",
|
||||
|
|
|
@ -12,7 +12,7 @@ from obj import Objects
|
|||
from kodi import TVShows as KodiDb, queries as QU
|
||||
import downloader as server
|
||||
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['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork'))
|
||||
|
||||
if obj['Status'] != 'Ended':
|
||||
obj['Status'] = None
|
||||
|
||||
self.get_path_filename(obj)
|
||||
|
||||
if obj['Premiere']:
|
||||
obj['Premiere'] = str(obj['Premiere']).split('.')[0].replace('T', " ")
|
||||
obj['Premiere'] = str(Local(obj['Premiere'])).split('.')[0].replace('T', " ")
|
||||
|
||||
tags = []
|
||||
tags.extend(obj['Tags'] or [])
|
||||
|
@ -299,8 +302,8 @@ class TVShows(KodiDb):
|
|||
obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0)
|
||||
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
|
||||
obj['People'] = API.get_people_artwork(obj['People'] or [])
|
||||
obj['DateAdded'] = obj['DateAdded'].split('.')[0].replace('T', " ")
|
||||
obj['DatePlayed'] = None if not obj['DatePlayed'] else obj['DatePlayed'].split('.')[0].replace('T', " ")
|
||||
obj['DateAdded'] = Local(obj['DateAdded']).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['Artwork'] = API.get_all_artwork(self.objects.map(item, 'Artwork'))
|
||||
obj['Video'] = API.video_streams(obj['Video'] or [], obj['Container'])
|
||||
|
@ -310,7 +313,7 @@ class TVShows(KodiDb):
|
|||
self.get_episode_path_filename(obj)
|
||||
|
||||
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['AbsoluteNumber']:
|
||||
|
@ -479,10 +482,10 @@ class TVShows(KodiDb):
|
|||
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
|
||||
|
||||
if obj['DatePlayed']:
|
||||
obj['DatePlayed'] = obj['DatePlayed'].split('.')[0].replace('T', " ")
|
||||
obj['DatePlayed'] = Local(obj['DatePlayed']).split('.')[0].replace('T', " ")
|
||||
|
||||
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))
|
||||
|
||||
|
|
Loading…
Reference in a new issue