mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-05-28 20:06:12 +00:00
Increase amount of logging
This commit is contained in:
parent
c321b266f0
commit
9ae99de8dd
30 changed files with 641 additions and 620 deletions
|
@ -765,7 +765,7 @@ def on_play(data, server):
|
|||
try:
|
||||
file = player.getPlayingFile()
|
||||
except Exception as error:
|
||||
LOG.error(error)
|
||||
LOG.exception(error)
|
||||
|
||||
return
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ class Artwork(object):
|
|||
return text
|
||||
|
||||
def single_urlencode(self, text):
|
||||
|
||||
|
||||
''' urlencode needs a utf-string.
|
||||
return the result as unicode
|
||||
'''
|
||||
|
@ -211,8 +211,8 @@ class GetArtworkWorker(threading.Thread):
|
|||
prep.url = "http://%s:%s/image/image://%s" % (self.kodi['host'], self.kodi['port'], url)
|
||||
s.send(prep, timeout=(0.01, 0.01))
|
||||
s.content # release the connection
|
||||
except Exception:
|
||||
pass
|
||||
except Exception as error:
|
||||
LOG.exception(error)
|
||||
|
||||
self.queue.task_done()
|
||||
|
||||
|
@ -361,11 +361,11 @@ class Artwork(object):
|
|||
def _cache_all_music_entries(self, pdialog):
|
||||
|
||||
with Database('music') as cursor_music:
|
||||
|
||||
|
||||
cursor_music.execute("SELECT url FROM art")
|
||||
result = cursor_music.fetchall()
|
||||
total = len(result)
|
||||
|
||||
|
||||
log.info("Image cache sync about to process %s images", total)
|
||||
|
||||
count = 0
|
||||
|
|
|
@ -35,6 +35,7 @@ class Movies(KodiDb):
|
|||
KodiDb.__init__(self, videodb.cursor)
|
||||
|
||||
def __getitem__(self, key):
|
||||
LOG.debug("__getitem__(%r)", key)
|
||||
|
||||
if key == 'Movie':
|
||||
return self.movie
|
||||
|
@ -49,7 +50,7 @@ class Movies(KodiDb):
|
|||
@jellyfin_item()
|
||||
@library_check()
|
||||
def movie(self, item, e_item, library):
|
||||
|
||||
|
||||
''' If item does not exist, entry will be added.
|
||||
If item exists, entry will be updated.
|
||||
'''
|
||||
|
@ -175,7 +176,7 @@ class Movies(KodiDb):
|
|||
obj['Trailer'] = "plugin://plugin.video.youtube/play/?video_id=%s" % obj['Trailer'].rsplit('=', 1)[1]
|
||||
except Exception as error:
|
||||
|
||||
LOG.error("Failed to get trailer: %s", error)
|
||||
LOG.exception("Failed to get trailer: %s", error)
|
||||
obj['Trailer'] = None
|
||||
|
||||
def get_path_filename(self, obj):
|
||||
|
@ -205,7 +206,7 @@ class Movies(KodiDb):
|
|||
@stop()
|
||||
@jellyfin_item()
|
||||
def boxset(self, item, e_item):
|
||||
|
||||
|
||||
''' If item does not exist, entry will be added.
|
||||
If item exists, entry will be updated.
|
||||
|
||||
|
@ -286,7 +287,7 @@ class Movies(KodiDb):
|
|||
@stop()
|
||||
@jellyfin_item()
|
||||
def userdata(self, item, e_item):
|
||||
|
||||
|
||||
''' This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks
|
||||
Poster with progress bar
|
||||
'''
|
||||
|
@ -339,7 +340,7 @@ class Movies(KodiDb):
|
|||
elif obj['Media'] == 'set':
|
||||
|
||||
for movie in self.jellyfin_db.get_item_by_parent_id(*values(obj, QUEM.get_item_by_parent_movie_obj)):
|
||||
|
||||
|
||||
temp_obj = dict(obj)
|
||||
temp_obj['MovieId'] = movie[1]
|
||||
temp_obj['Movie'] = movie[0]
|
||||
|
|
|
@ -35,6 +35,7 @@ class Music(KodiDb):
|
|||
KodiDb.__init__(self, musicdb.cursor)
|
||||
|
||||
def __getitem__(self, key):
|
||||
LOG.debug("__getitem__(%r)", key)
|
||||
|
||||
if key in ('MusicArtist', 'AlbumArtist'):
|
||||
return self.artist
|
||||
|
@ -100,7 +101,7 @@ class Music(KodiDb):
|
|||
self.item_ids.append(obj['Id'])
|
||||
|
||||
def artist_add(self, obj):
|
||||
|
||||
|
||||
''' Add object to kodi.
|
||||
|
||||
safety checks: It looks like Jellyfin supports the same artist multiple times.
|
||||
|
@ -168,7 +169,7 @@ class Music(KodiDb):
|
|||
self.item_ids.append(obj['Id'])
|
||||
|
||||
def album_add(self, obj):
|
||||
|
||||
|
||||
''' Add object to kodi.
|
||||
'''
|
||||
obj['AlbumId'] = self.get_album(*values(obj, QU.get_album_obj))
|
||||
|
@ -176,7 +177,7 @@ class Music(KodiDb):
|
|||
LOG.info("ADD album [%s] %s: %s", obj['AlbumId'], obj['Title'], obj['Id'])
|
||||
|
||||
def album_update(self, obj):
|
||||
|
||||
|
||||
''' Update object to kodi.
|
||||
'''
|
||||
self.jellyfin_db.update_reference(*values(obj, QUEM.update_reference_obj))
|
||||
|
@ -219,7 +220,7 @@ class Music(KodiDb):
|
|||
self.artist(self.server['api'].get_item(temp_obj['Id']), library=None)
|
||||
temp_obj['ArtistId'] = self.jellyfin_db.get_item_by_id(*values(temp_obj, QUEM.get_item_obj))[0]
|
||||
except Exception as error:
|
||||
LOG.error(error)
|
||||
LOG.exception(error)
|
||||
continue
|
||||
|
||||
self.update_artist_name(*values(temp_obj, QU.update_artist_name_obj))
|
||||
|
@ -301,7 +302,7 @@ class Music(KodiDb):
|
|||
return not update
|
||||
|
||||
def song_add(self, obj):
|
||||
|
||||
|
||||
''' Add object to kodi.
|
||||
|
||||
Verify if there's an album associated.
|
||||
|
@ -327,7 +328,7 @@ class Music(KodiDb):
|
|||
LOG.debug("ADD song [%s/%s/%s] %s: %s", obj['PathId'], obj['AlbumId'], obj['SongId'], obj['Id'], obj['Title'])
|
||||
|
||||
def song_update(self, obj):
|
||||
|
||||
|
||||
''' Update object to kodi.
|
||||
'''
|
||||
self.update_path(*values(obj, QU.update_path_obj))
|
||||
|
@ -337,7 +338,7 @@ class Music(KodiDb):
|
|||
LOG.info("UPDATE song [%s/%s/%s] %s: %s", obj['PathId'], obj['AlbumId'], obj['SongId'], obj['Id'], obj['Title'])
|
||||
|
||||
def get_song_path_filename(self, obj, api):
|
||||
|
||||
|
||||
''' Get the path and filename and build it into protocol://path
|
||||
'''
|
||||
obj['Path'] = api.get_file_path(obj['Path'])
|
||||
|
@ -355,7 +356,7 @@ class Music(KodiDb):
|
|||
obj['Filename'] = "stream.%s?static=true" % obj['Container']
|
||||
|
||||
def song_artist_discography(self, obj):
|
||||
|
||||
|
||||
''' Update the artist's discography.
|
||||
'''
|
||||
artists = []
|
||||
|
@ -375,7 +376,7 @@ class Music(KodiDb):
|
|||
self.artist(self.server['api'].get_item(temp_obj['Id']), library=None)
|
||||
temp_obj['ArtistId'] = self.jellyfin_db.get_item_by_id(*values(temp_obj, QUEM.get_item_obj))[0]
|
||||
except Exception as error:
|
||||
LOG.error(error)
|
||||
LOG.exception(error)
|
||||
continue
|
||||
|
||||
self.link(*values(temp_obj, QU.update_link_obj))
|
||||
|
@ -390,7 +391,7 @@ class Music(KodiDb):
|
|||
obj['AlbumArtists'] = artists
|
||||
|
||||
def song_artist_link(self, obj):
|
||||
|
||||
|
||||
''' Assign main artists to song.
|
||||
Artist does not exist in jellyfin database, create the reference.
|
||||
'''
|
||||
|
@ -409,7 +410,7 @@ class Music(KodiDb):
|
|||
self.artist(self.server['api'].get_item(temp_obj['Id']), library=None)
|
||||
temp_obj['ArtistId'] = self.jellyfin_db.get_item_by_id(*values(temp_obj, QUEM.get_item_obj))[0]
|
||||
except Exception as error:
|
||||
LOG.error(error)
|
||||
LOG.exception(error)
|
||||
continue
|
||||
|
||||
self.link_song_artist(*values(temp_obj, QU.update_song_artist_obj))
|
||||
|
@ -424,7 +425,7 @@ class Music(KodiDb):
|
|||
@stop()
|
||||
@jellyfin_item()
|
||||
def userdata(self, item, e_item):
|
||||
|
||||
|
||||
''' This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks
|
||||
Poster with progress bar
|
||||
'''
|
||||
|
@ -452,7 +453,7 @@ class Music(KodiDb):
|
|||
@stop()
|
||||
@jellyfin_item()
|
||||
def remove(self, item_id, e_item):
|
||||
|
||||
|
||||
''' This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks
|
||||
Poster with progress bar
|
||||
|
||||
|
@ -468,7 +469,7 @@ class Music(KodiDb):
|
|||
return
|
||||
|
||||
if obj['Media'] == 'song':
|
||||
|
||||
|
||||
self.remove_song(obj['KodiId'], obj['Id'])
|
||||
self.jellyfin_db.remove_wild_item(obj['id'])
|
||||
|
||||
|
@ -513,19 +514,19 @@ class Music(KodiDb):
|
|||
self.jellyfin_db.remove_item(*values(obj, QUEM.delete_item_obj))
|
||||
|
||||
def remove_artist(self, kodi_id, item_id):
|
||||
|
||||
|
||||
self.artwork.delete(kodi_id, "artist")
|
||||
self.delete(kodi_id)
|
||||
LOG.info("DELETE artist [%s] %s", kodi_id, item_id)
|
||||
|
||||
def remove_album(self, kodi_id, item_id):
|
||||
|
||||
|
||||
self.artwork.delete(kodi_id, "album")
|
||||
self.delete_album(kodi_id)
|
||||
LOG.info("DELETE album [%s] %s", kodi_id, item_id)
|
||||
|
||||
def remove_song(self, kodi_id, item_id):
|
||||
|
||||
|
||||
self.artwork.delete(kodi_id, "song")
|
||||
self.delete_song(kodi_id)
|
||||
LOG.info("DELETE song [%s] %s", kodi_id, item_id)
|
||||
|
|
|
@ -35,6 +35,7 @@ class MusicVideos(KodiDb):
|
|||
KodiDb.__init__(self, videodb.cursor)
|
||||
|
||||
def __getitem__(self, key):
|
||||
LOG.debug("__getitem__(%r)", key)
|
||||
|
||||
if key == 'MusicVideo':
|
||||
return self.musicvideo
|
||||
|
@ -142,7 +143,7 @@ class MusicVideos(KodiDb):
|
|||
return not update
|
||||
|
||||
def musicvideo_add(self, obj):
|
||||
|
||||
|
||||
''' Add object to kodi.
|
||||
'''
|
||||
obj['PathId'] = self.add_path(*values(obj, QU.add_path_obj))
|
||||
|
@ -153,7 +154,7 @@ class MusicVideos(KodiDb):
|
|||
LOG.info("ADD mvideo [%s/%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['MvideoId'], obj['Id'], obj['Title'])
|
||||
|
||||
def musicvideo_update(self, obj):
|
||||
|
||||
|
||||
''' Update object to kodi.
|
||||
'''
|
||||
self.update(*values(obj, QU.update_musicvideo_obj))
|
||||
|
@ -161,7 +162,7 @@ class MusicVideos(KodiDb):
|
|||
LOG.info("UPDATE mvideo [%s/%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['MvideoId'], obj['Id'], obj['Title'])
|
||||
|
||||
def get_path_filename(self, obj):
|
||||
|
||||
|
||||
''' Get the path and filename and build it into protocol://path
|
||||
'''
|
||||
obj['Filename'] = obj['Path'].rsplit('\\', 1)[1] if '\\' in obj['Path'] else obj['Path'].rsplit('/', 1)[1]
|
||||
|
@ -187,7 +188,7 @@ class MusicVideos(KodiDb):
|
|||
@stop()
|
||||
@jellyfin_item()
|
||||
def userdata(self, item, e_item):
|
||||
|
||||
|
||||
''' This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks
|
||||
Poster with progress bar
|
||||
'''
|
||||
|
@ -220,7 +221,7 @@ class MusicVideos(KodiDb):
|
|||
@jellyfin_item()
|
||||
def remove(self, item_id, e_item):
|
||||
|
||||
''' Remove mvideoid, fileid, pathid, jellyfin reference.
|
||||
''' Remove mvideoid, fileid, pathid, jellyfin reference.
|
||||
'''
|
||||
obj = {'Id': item_id}
|
||||
|
||||
|
|
|
@ -38,6 +38,7 @@ class TVShows(KodiDb):
|
|||
KodiDb.__init__(self, videodb.cursor)
|
||||
|
||||
def __getitem__(self, key):
|
||||
LOG.debug("__getitem__(%r)", key)
|
||||
|
||||
if key == 'Series':
|
||||
return self.tvshow
|
||||
|
@ -152,7 +153,7 @@ class TVShows(KodiDb):
|
|||
self.jellyfin_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.jellyfin_db.get_item_by_id(season['Id'])[0]
|
||||
self.item_ids.append(season['Id'])
|
||||
|
@ -188,7 +189,7 @@ class TVShows(KodiDb):
|
|||
LOG.info("ADD tvshow [%s/%s/%s] %s: %s", obj['TopPathId'], obj['PathId'], obj['ShowId'], obj['Title'], obj['Id'])
|
||||
|
||||
def tvshow_update(self, obj):
|
||||
|
||||
|
||||
''' Update object to kodi.
|
||||
'''
|
||||
obj['RatingId'] = self.get_rating_id(*values(obj, QU.get_unique_id_tvshow_obj))
|
||||
|
@ -363,7 +364,7 @@ class TVShows(KodiDb):
|
|||
return not update
|
||||
|
||||
def episode_add(self, obj):
|
||||
|
||||
|
||||
''' Add object to kodi.
|
||||
'''
|
||||
obj['RatingId'] = self.create_entry_rating()
|
||||
|
@ -388,9 +389,9 @@ class TVShows(KodiDb):
|
|||
LOG.debug("ADD episode [%s/%s] %s: %s", obj['PathId'], obj['FileId'], obj['Id'], obj['Title'])
|
||||
|
||||
def episode_update(self, obj):
|
||||
|
||||
|
||||
''' Update object to kodi.
|
||||
'''
|
||||
'''
|
||||
obj['RatingId'] = self.get_rating_id(*values(obj, QU.get_rating_episode_obj))
|
||||
self.update_ratings(*values(obj, QU.update_rating_episode_obj))
|
||||
|
||||
|
@ -451,7 +452,7 @@ class TVShows(KodiDb):
|
|||
@stop()
|
||||
@jellyfin_item()
|
||||
def userdata(self, item, e_item):
|
||||
|
||||
|
||||
''' This updates: Favorite, LastPlayedDate, Playcount, PlaybackPositionTicks
|
||||
Poster with progress bar
|
||||
|
||||
|
@ -476,7 +477,7 @@ class TVShows(KodiDb):
|
|||
self.remove_tag(*values(obj, QU.delete_tag_episode_obj))
|
||||
|
||||
elif obj['Media'] == "episode":
|
||||
|
||||
|
||||
obj['Resume'] = API.adjust_resume((obj['Resume'] or 0) / 10000000.0)
|
||||
obj['Runtime'] = round(float((obj['Runtime'] or 0) / 10000000.0), 6)
|
||||
obj['PlayCount'] = API.get_playcount(obj['Played'], obj['PlayCount'])
|
||||
|
@ -511,7 +512,7 @@ class TVShows(KodiDb):
|
|||
@stop()
|
||||
@jellyfin_item()
|
||||
def remove(self, item_id, e_item):
|
||||
|
||||
|
||||
''' Remove showid, fileid, pathid, jellyfin reference.
|
||||
There's no episodes left, delete show and any possible remaining seasons
|
||||
'''
|
||||
|
@ -558,7 +559,7 @@ class TVShows(KodiDb):
|
|||
obj['ParentId'] = obj['KodiId']
|
||||
|
||||
for season in self.jellyfin_db.get_item_by_parent_id(*values(obj, QUEM.get_item_by_parent_season_obj)):
|
||||
|
||||
|
||||
temp_obj = dict(obj)
|
||||
temp_obj['ParentId'] = season[1]
|
||||
|
||||
|
@ -594,7 +595,7 @@ class TVShows(KodiDb):
|
|||
self.jellyfin_db.remove_item(*values(obj, QUEM.delete_item_obj))
|
||||
|
||||
def remove_tvshow(self, kodi_id, item_id):
|
||||
|
||||
|
||||
self.artwork.delete(kodi_id, "tvshow")
|
||||
self.delete_tvshow(kodi_id)
|
||||
LOG.debug("DELETE tvshow [%s] %s", kodi_id, item_id)
|
||||
|
@ -630,7 +631,7 @@ class TVShows(KodiDb):
|
|||
obj['ParentId'] = obj['KodiId']
|
||||
|
||||
for season in self.jellyfin_db.get_item_by_parent_id(*values(obj, QUEM.get_item_by_parent_season_obj)):
|
||||
|
||||
|
||||
temp_obj = dict(obj)
|
||||
temp_obj['ParentId'] = season[1]
|
||||
child.append(season[0])
|
||||
|
|
|
@ -12,6 +12,7 @@ LOG = logging.getLogger("JELLYFIN."+__name__)
|
|||
|
||||
#################################################################################################
|
||||
|
||||
|
||||
def get_play_action():
|
||||
|
||||
''' I could not figure out a way to listen to kodi setting changes?
|
||||
|
@ -22,16 +23,14 @@ def get_play_action():
|
|||
try:
|
||||
return options[result['result']['value']]
|
||||
except Exception as error:
|
||||
log.error("Returning play action due to error: %s", error)
|
||||
LOG.exception("Returning play action due to error: %s", error)
|
||||
|
||||
return options[1]
|
||||
|
||||
|
||||
def get_grouped_set():
|
||||
|
||||
''' Get if boxsets should be grouped
|
||||
'''
|
||||
result = JSONRPC('Settings.GetSettingValue').execute({'setting': "videolibrary.groupmoviesets"})
|
||||
try:
|
||||
return result['result']['value']
|
||||
except Exception as error:
|
||||
return False
|
||||
return result.get('result', {}).get('value', False)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue