Remove library_check wrapper

This commit is contained in:
Matt 2020-08-02 17:00:34 -04:00
parent 0ee5b616a5
commit eca9630918
9 changed files with 129 additions and 188 deletions

View file

@ -270,7 +270,7 @@ class FullSync(object):
for items in server.get_items(library['Id'], "Movie", False, self.sync['RestorePoint'].get('params')):
with self.video_database_locks() as (videodb, jellyfindb):
obj = Movies(self.server, jellyfindb, videodb, self.direct_path)
obj = Movies(self.server, jellyfindb, videodb, self.direct_path, library)
self.sync['RestorePoint'] = items['RestorePoint']
start_index = items['RestorePoint']['params']['StartIndex']
@ -280,11 +280,11 @@ class FullSync(object):
dialog.update(int((float(start_index + index) / float(items['TotalRecordCount'])) * 100),
heading="%s: %s" % (translate('addon_name'), library['Name']),
message=movie['Name'])
obj.movie(movie, library=library)
obj.movie(movie)
processed_ids.append(movie['Id'])
with self.video_database_locks() as (videodb, jellyfindb):
obj = Movies(self.server, jellyfindb, videodb, self.direct_path)
obj = Movies(self.server, jellyfindb, videodb, self.direct_path, library)
obj.item_ids = processed_ids
if self.update_library:
@ -313,7 +313,7 @@ class FullSync(object):
for items in server.get_items(library['Id'], "Series", False, self.sync['RestorePoint'].get('params')):
with self.video_database_locks() as (videodb, jellyfindb):
obj = TVShows(self.server, jellyfindb, videodb, self.direct_path, True)
obj = TVShows(self.server, jellyfindb, videodb, self.direct_path, library, True)
self.sync['RestorePoint'] = items['RestorePoint']
start_index = items['RestorePoint']['params']['StartIndex']
@ -324,7 +324,7 @@ class FullSync(object):
message = show['Name']
dialog.update(percent, heading="%s: %s" % (translate('addon_name'), library['Name']), message=message)
if obj.tvshow(show, library=library) is not False:
if obj.tvshow(show) is not False:
for episodes in server.get_episode_by_show(show['Id']):
for episode in episodes['Items']:
@ -334,7 +334,7 @@ class FullSync(object):
processed_ids.append(show['Id'])
with self.video_database_locks() as (videodb, jellyfindb):
obj = TVShows(self.server, jellyfindb, videodb, self.direct_path, True)
obj = TVShows(self.server, jellyfindb, videodb, self.direct_path, library, True)
obj.item_ids = processed_ids
if self.update_library:
self.tvshows_compare(library, obj, jellyfindb)
@ -365,7 +365,7 @@ class FullSync(object):
for items in server.get_items(library['Id'], "MusicVideo", False, self.sync['RestorePoint'].get('params')):
with self.video_database_locks() as (videodb, jellyfindb):
obj = MusicVideos(self.server, jellyfindb, videodb, self.direct_path)
obj = MusicVideos(self.server, jellyfindb, videodb, self.direct_path, library)
self.sync['RestorePoint'] = items['RestorePoint']
start_index = items['RestorePoint']['params']['StartIndex']
@ -375,11 +375,11 @@ class FullSync(object):
dialog.update(int((float(start_index + index) / float(items['TotalRecordCount'])) * 100),
heading="%s: %s" % (translate('addon_name'), library['Name']),
message=mvideo['Name'])
obj.musicvideo(mvideo, library=library)
obj.musicvideo(mvideo)
processed_ids.append(mvideo['Id'])
with self.video_database_locks() as (videodb, jellyfindb):
obj = MusicVideos(self.server, jellyfindb, videodb, self.direct_path)
obj = MusicVideos(self.server, jellyfindb, videodb, self.direct_path, library)
obj.item_ids = processed_ids
if self.update_library:
self.musicvideos_compare(library, obj, jellyfindb)
@ -405,9 +405,11 @@ class FullSync(object):
with self.library.music_database_lock:
with Database('music') as musicdb:
with Database('jellyfin') as jellyfindb:
obj = Music(self.server, jellyfindb, musicdb, self.direct_path)
obj = Music(self.server, jellyfindb, musicdb, self.direct_path, library)
library_id = library['Id']
# Get all items in the library to process locally
artists_data = server.get_artists(library_id)
artists = artists_data['Items']
num_artists = artists_data['TotalRecordCount']
@ -417,53 +419,27 @@ class FullSync(object):
for index, artist in enumerate(artists):
artist_name = artist.get('Name')
# Update percentage dialog
percent = int((float(index) / float(num_artists)) * 100)
message = artist_name
dialog.update(percent, heading="%s: %s" % (translate('addon_name'), library['Name']), message=message)
obj.artist(artist, library=library)
# Add artist to database
obj.artist(artist)
# Get all albums for each artist
artist_albums = [ album for album in albums if artist_name in album.get('Artists') ]
for album in artist_albums:
# Add album to database
obj.album(album)
album_id = album.get('Id')
# Get all songs in each album
album_songs = [ song for song in songs if album_id == song.get('AlbumId') ]
for song in album_songs:
dialog.update(percent,
message="%s/%s/%s" % (message, album['Name'][:7], song['Name'][:7]))
# Add song to database
obj.song(song)
# for items in server.get_artists(library['Id'], False, self.sync['RestorePoint'].get('params')):
#
# self.sync['RestorePoint'] = items['RestorePoint']
# start_index = items['RestorePoint']['params']['StartIndex']
#
# for index, artist in enumerate(items['Items']):
#
# percent = int((float(start_index + index) / float(items['TotalRecordCount'])) * 100)
# message = artist['Name']
# dialog.update(percent, heading="%s: %s" % (translate('addon_name'), library['Name']), message=message)
# obj.artist(artist, library=library)
#
# import web_pdb; web_pdb.set_trace()
# for albums in server.get_albums_by_artist(artist['Id']):
#
# for album in albums['Items']:
# obj.album(album)
#
# for songs in server.get_items(album['Id'], "Audio"):
# for song in songs['Items']:
#
# dialog.update(percent,
# message="%s/%s/%s" % (message, album['Name'][:7], song['Name'][:7]))
# obj.song(song)
#
# for songs in server.get_songs_by_artist(artist['Id']):
# for song in songs['Items']:
#
# dialog.update(percent, message="%s/%s" % (message, song['Name']))
# obj.song(song)
#
if self.update_library:
self.music_compare(library, obj, jellyfindb)
@ -492,7 +468,7 @@ class FullSync(object):
for items in server.get_items(library_id, "BoxSet", False, self.sync['RestorePoint'].get('params')):
with self.video_database_locks() as (videodb, jellyfindb):
obj = Movies(self.server, jellyfindb, videodb, self.direct_path)
obj = Movies(self.server, jellyfindb, videodb, self.direct_path, library)
self.sync['RestorePoint'] = items['RestorePoint']
start_index = items['RestorePoint']['params']['StartIndex']
@ -509,7 +485,7 @@ class FullSync(object):
''' Delete all exisitng boxsets and re-add.
'''
with self.video_database_locks() as (videodb, jellyfindb):
obj = Movies(self.server, jellyfindb, videodb, self.direct_path)
obj = Movies(self.server, jellyfindb, videodb, self.direct_path, library)
obj.boxsets_reset()
self.boxsets(None)
@ -542,7 +518,7 @@ class FullSync(object):
movies = [x for x in items if x[1] == 'Movie']
tvshows = [x for x in items if x[1] == 'Series']
obj = Movies(self.server, jellyfindb, kodidb, direct_path).remove
obj = Movies(self.server, jellyfindb, kodidb, direct_path, library).remove
for item in movies:
@ -550,7 +526,7 @@ class FullSync(object):
dialog.update(int((float(count) / float(len(items)) * 100)), heading="%s: %s" % (translate('addon_name'), library[0]))
count += 1
obj = TVShows(self.server, jellyfindb, kodidb, direct_path).remove
obj = TVShows(self.server, jellyfindb, kodidb, direct_path, library).remove
for item in tvshows:

View file

@ -27,4 +27,3 @@ from .utils import get_filesystem_encoding
from .wrapper import progress
from .wrapper import stop
from .wrapper import jellyfin_item
from .wrapper import library_check

View file

@ -21,6 +21,7 @@ from kodi_six import xbmc, xbmcaddon, xbmcgui, xbmcvfs
from . import LazyLogger
from .translate import translate
#################################################################################################
LOG = LazyLogger(__name__)
@ -535,3 +536,18 @@ def get_filesystem_encoding():
enc = 'utf-8'
return enc
def find_library(server, item):
from database import get_sync
sync = get_sync()
ancestors = server.jellyfin.get_ancestors(item['Id'])
for ancestor in ancestors:
if ancestor['Id'] in sync['Whitelist']:
LOG.info('Ancestor Found')
return ancestor
LOG.error('No ancestor found, not syncing item with ID: {}'.format(item['Id']))
return {}

View file

@ -77,60 +77,3 @@ def jellyfin_item(func):
return func(self, item, e_item=e_item, *args, **kwargs)
return wrapper
def library_check(func):
''' Wrapper to retrieve the library
'''
def wrapper(self, item, *args, **kwargs):
''' TODO: Rethink this one... songs and albums cannot be found by library. expensive.
'''
from database import get_sync
if kwargs.get('library') is None:
sync = get_sync()
if 'e_item' in kwargs:
try:
view_id = kwargs['e_item'][6]
view_name = self.jellyfin_db.get_view_name(view_id)
view = {'Name': view_name, 'Id': view_id}
except Exception:
view = None
if view is None:
ancestors = self.server.jellyfin.get_ancestors(item['Id'])
if not ancestors:
if item['Type'] == 'MusicArtist':
try:
views = self.jellyfin_db.get_views_by_media('music')[0]
except Exception as error:
LOG.exception(error)
return
view = {'Id': views[0], 'Name': views[1]}
else: # Grab the first music library
return
else:
for ancestor in ancestors:
if ancestor['Type'] == 'CollectionFolder':
view = self.jellyfin_db.get_view_name(ancestor['Id'])
view = {'Id': None, 'Name': None} if view is None else {'Name': ancestor['Name'], 'Id': ancestor['Id']}
break
if view['Id'] not in [x.replace('Mixed:', "") for x in sync['Whitelist'] + sync['Libraries']]:
LOG.info("Library %s is not synced. Skip update.", view['Id'])
return
kwargs['library'] = view
return func(self, item, *args, **kwargs)
return wrapper

View file

@ -16,7 +16,7 @@ from full_sync import FullSync
from views import Views
from downloader import GetItemWorker
from helper import translate, api, stop, settings, window, dialog, event
from helper.utils import split_list, set_screensaver, get_screensaver
from helper.utils import split_list, set_screensaver, get_screensaver, find_library
from helper.exceptions import LibraryException
from jellyfin import Jellyfin
from helper import LazyLogger
@ -605,36 +605,39 @@ class UpdateWorker(threading.Thread):
except Queue.Empty:
break
default_args = (self.server, jellyfindb, kodidb, self.direct_path)
try:
if item['Type'] == 'Movie':
obj = Movies(*default_args).movie(item)
elif item['Type'] == 'BoxSet':
obj = Movies(*default_args).boxset(item)
elif item['Type'] == 'Series':
obj = TVShows(*default_args).tvshow(item)
elif item['Type'] == 'Season':
obj = TVShows(*default_args).season(item)
elif item['Type'] == 'Episode':
obj = TVShows(*default_args).episode(item)
elif item['Type'] == 'MusicVideo':
obj = MusicVideos(*default_args).musicvideo(item)
elif item['Type'] == 'MusicAlbum':
obj = Music(*default_args).album(item)
elif item['Type'] == 'MusicArtist':
obj = Music(*default_args).artist(item)
elif item['Type'] == 'AlbumArtist':
obj = Music(*default_args).albumartist(item)
elif item['Type'] == 'Audio':
obj = Music(*default_args).song(item)
# Verify that the updated item is in our local whitelist
library = find_library(self.server, item)
if library:
default_args = (self.server, jellyfindb, kodidb, self.direct_path, library)
try:
if item['Type'] == 'Movie':
obj = Movies(*default_args).movie(item)
elif item['Type'] == 'BoxSet':
obj = Movies(*default_args).boxset(item)
elif item['Type'] == 'Series':
obj = TVShows(*default_args).tvshow(item)
elif item['Type'] == 'Season':
obj = TVShows(*default_args).season(item)
elif item['Type'] == 'Episode':
obj = TVShows(*default_args).episode(item)
elif item['Type'] == 'MusicVideo':
obj = MusicVideos(*default_args).musicvideo(item)
elif item['Type'] == 'MusicAlbum':
obj = Music(*default_args).album(item)
elif item['Type'] == 'MusicArtist':
obj = Music(*default_args).artist(item)
elif item['Type'] == 'AlbumArtist':
obj = Music(*default_args).albumartist(item)
elif item['Type'] == 'Audio':
obj = Music(*default_args).song(item)
if self.notify:
self.notify_output.put((item['Type'], api.API(item).get_naming()))
except LibraryException as error:
if error.status == 'StopCalled':
break
except Exception as error:
LOG.exception(error)
if self.notify:
self.notify_output.put((item['Type'], api.API(item).get_naming()))
except LibraryException as error:
if error.status == 'StopCalled':
break
except Exception as error:
LOG.exception(error)
self.queue.task_done()
@ -667,24 +670,28 @@ class UserDataWorker(threading.Thread):
except Queue.Empty:
break
try:
if item['Type'] == 'Movie':
Movies(self.args[0], jellyfindb, kodidb, self.args[1]).userdata(item)
elif item['Type'] in ['Series', 'Season', 'Episode']:
TVShows(self.args[0], jellyfindb, kodidb, self.args[1]).userdata(item)
elif item['Type'] == 'MusicAlbum':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).album(item)
elif item['Type'] == 'MusicArtist':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).artist(item)
elif item['Type'] == 'AlbumArtist':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).albumartist(item)
elif item['Type'] == 'Audio':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).song(item)
except LibraryException as error:
if error.status == 'StopCalled':
break
except Exception as error:
LOG.exception(error)
# Verify that the updated item is in our local whitelist
library = find_library(self.server, item)
if library:
default_args = (self.server, jellyfindb, kodidb, self.direct_path, library)
try:
if item['Type'] == 'Movie':
Movies(self.args[0], jellyfindb, kodidb, self.args[1]).userdata(item)
elif item['Type'] in ['Series', 'Season', 'Episode']:
TVShows(self.args[0], jellyfindb, kodidb, self.args[1]).userdata(item)
elif item['Type'] == 'MusicAlbum':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).album(item)
elif item['Type'] == 'MusicArtist':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).artist(item)
elif item['Type'] == 'AlbumArtist':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).albumartist(item)
elif item['Type'] == 'Audio':
Music(self.args[0], jellyfindb, kodidb, self.args[1]).song(item)
except LibraryException as error:
if error.status == 'StopCalled':
break
except Exception as error:
LOG.exception(error)
self.queue.task_done()
@ -765,13 +772,13 @@ class RemovedWorker(threading.Thread):
break
if item['Type'] == 'Movie':
obj = Movies(self.args[0], jellyfindb, kodidb, self.args[1]).remove
obj = Movies(self.args[0], jellyfindb, kodidb, self.args[1], library).remove
elif item['Type'] in ['Series', 'Season', 'Episode']:
obj = TVShows(self.args[0], jellyfindb, kodidb, self.args[1]).remove
obj = TVShows(self.args[0], jellyfindb, kodidb, self.args[1], library).remove
elif item['Type'] in ['MusicAlbum', 'MusicArtist', 'AlbumArtist', 'Audio']:
obj = Music(self.args[0], jellyfindb, kodidb, self.args[1]).remove
obj = Music(self.args[0], jellyfindb, kodidb, self.args[1], library).remove
elif item['Type'] == 'MusicVideo':
obj = MusicVideos(self.args[0], jellyfindb, kodidb, self.args[1]).remove
obj = MusicVideos(self.args[0], jellyfindb, kodidb, self.args[1], library).remove
try:
obj(item['Id'])

View file

@ -8,7 +8,7 @@ from kodi_six.utils import py2_encode
import downloader as server
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, validate_bluray_dir, validate_dvd_dir, jellyfin_item, library_check, values, Local
from helper import api, stop, validate, validate_bluray_dir, validate_dvd_dir, jellyfin_item, values, Local
from helper import LazyLogger
from helper.exceptions import PathValidationException
@ -24,7 +24,7 @@ LOG = LazyLogger(__name__)
class Movies(KodiDb):
def __init__(self, server, jellyfindb, videodb, direct_path):
def __init__(self, server, jellyfindb, videodb, direct_path, library):
self.server = server
self.jellyfin = jellyfindb
@ -34,13 +34,13 @@ class Movies(KodiDb):
self.jellyfin_db = jellyfin_db.JellyfinDatabase(jellyfindb.cursor)
self.objects = Objects()
self.item_ids = []
self.library = library
KodiDb.__init__(self, videodb.cursor)
@stop
@jellyfin_item
@library_check
def movie(self, item, e_item, library):
def movie(self, item, e_item):
''' If item does not exist, entry will be added.
If item exists, entry will be updated.
@ -65,8 +65,8 @@ class Movies(KodiDb):
LOG.info("MovieId %s missing from kodi. repairing the entry.", obj['MovieId'])
obj['Path'] = API.get_file_path(obj['Path'])
obj['LibraryId'] = library['Id']
obj['LibraryName'] = library['Name']
obj['LibraryId'] = self.library['Id']
obj['LibraryName'] = self.library['Name']
obj['Genres'] = obj['Genres'] or []
obj['Studios'] = [API.validate_studio(studio) for studio in (obj['Studios'] or [])]
obj['People'] = obj['People'] or []

View file

@ -6,7 +6,7 @@ from __future__ import division, absolute_import, print_function, unicode_litera
import datetime
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, values, library_check, Local
from helper import api, stop, validate, jellyfin_item, values, Local
from helper import LazyLogger
from helper.exceptions import PathValidationException
@ -22,7 +22,7 @@ LOG = LazyLogger(__name__)
class Music(KodiDb):
def __init__(self, server, jellyfindb, musicdb, direct_path):
def __init__(self, server, jellyfindb, musicdb, direct_path, library):
self.server = server
self.jellyfin = jellyfindb
@ -32,13 +32,13 @@ class Music(KodiDb):
self.jellyfin_db = jellyfin_db.JellyfinDatabase(jellyfindb.cursor)
self.objects = Objects()
self.item_ids = []
self.library = library
KodiDb.__init__(self, musicdb.cursor)
@stop
@jellyfin_item
@library_check
def artist(self, item, e_item, library):
def artist(self, item, e_item):
''' If item does not exist, entry will be added.
If item exists, entry will be updated.
@ -60,8 +60,8 @@ class Music(KodiDb):
update = False
LOG.info("ArtistId %s missing from kodi. repairing the entry.", obj['ArtistId'])
obj['LibraryId'] = library['Id']
obj['LibraryName'] = library['Name']
obj['LibraryId'] = self.library['Id']
obj['LibraryName'] = self.library['Name']
obj['LastScraped'] = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S')
obj['ArtistType'] = "MusicArtist"
obj['Genre'] = " / ".join(obj['Genres'] or [])
@ -199,7 +199,7 @@ class Music(KodiDb):
except TypeError:
try:
self.artist(self.server.jellyfin.get_item(temp_obj['Id']), library=None)
self.artist(self.server.jellyfin.get_item(temp_obj['Id']))
temp_obj['ArtistId'] = self.jellyfin_db.get_item_by_id(*values(temp_obj, QUEM.get_item_obj))[0]
except Exception as error:
LOG.exception(error)
@ -209,8 +209,8 @@ class Music(KodiDb):
self.link(*values(temp_obj, QU.update_link_obj))
self.item_ids.append(temp_obj['Id'])
@stop()
@jellyfin_item()
@stop
@jellyfin_item
def song(self, item, e_item):
''' Update object to kodi.
@ -353,7 +353,7 @@ class Music(KodiDb):
except TypeError:
try:
self.artist(self.server.jellyfin.get_item(temp_obj['Id']), library=None)
self.artist(self.server.jellyfin.get_item(temp_obj['Id']))
temp_obj['ArtistId'] = self.jellyfin_db.get_item_by_id(*values(temp_obj, QUEM.get_item_obj))[0]
except Exception as error:
LOG.exception(error)
@ -387,7 +387,7 @@ class Music(KodiDb):
except TypeError:
try:
self.artist(self.server.jellyfin.get_item(temp_obj['Id']), library=None)
self.artist(self.server.jellyfin.get_item(temp_obj['Id']))
temp_obj['ArtistId'] = self.jellyfin_db.get_item_by_id(*values(temp_obj, QUEM.get_item_obj))[0]
except Exception as error:
LOG.exception(error)

View file

@ -10,7 +10,7 @@ from six.moves.urllib.parse import urlencode
from kodi_six.utils import py2_encode
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, library_check, jellyfin_item, values, Local
from helper import api, stop, validate, jellyfin_item, values, Local
from helper import LazyLogger
from helper.exceptions import PathValidationException
@ -26,7 +26,7 @@ LOG = LazyLogger(__name__)
class MusicVideos(KodiDb):
def __init__(self, server, jellyfindb, videodb, direct_path):
def __init__(self, server, jellyfindb, videodb, direct_path, library):
self.server = server
self.jellyfin = jellyfindb
@ -36,13 +36,13 @@ class MusicVideos(KodiDb):
self.jellyfin_db = jellyfin_db.JellyfinDatabase(jellyfindb.cursor)
self.objects = Objects()
self.item_ids = []
self.library = library
KodiDb.__init__(self, videodb.cursor)
@stop
@jellyfin_item
@library_check
def musicvideo(self, item, e_item, library):
def musicvideo(self, item, e_item):
''' If item does not exist, entry will be added.
If item exists, entry will be updated.
@ -70,8 +70,8 @@ class MusicVideos(KodiDb):
LOG.info("MvideoId %s missing from kodi. repairing the entry.", obj['MvideoId'])
obj['Path'] = API.get_file_path(obj['Path'])
obj['LibraryId'] = library['Id']
obj['LibraryName'] = library['Name']
obj['LibraryId'] = self.library['Id']
obj['LibraryName'] = self.library['Name']
obj['Genres'] = obj['Genres'] or []
obj['ArtistItems'] = obj['ArtistItems'] or []
obj['Studios'] = [API.validate_studio(studio) for studio in (obj['Studios'] or [])]

View file

@ -11,7 +11,7 @@ from kodi_six.utils import py2_encode
import downloader as server
from database import jellyfin_db, queries as QUEM
from helper import api, stop, validate, jellyfin_item, library_check, values, Local
from helper import api, stop, validate, jellyfin_item, values, Local
from helper import LazyLogger
from helper.exceptions import PathValidationException
@ -27,7 +27,7 @@ LOG = LazyLogger(__name__)
class TVShows(KodiDb):
def __init__(self, server, jellyfindb, videodb, direct_path, update_library=False):
def __init__(self, server, jellyfindb, videodb, direct_path, library, update_library=False):
self.server = server
self.jellyfin = jellyfindb
@ -38,13 +38,13 @@ class TVShows(KodiDb):
self.jellyfin_db = jellyfin_db.JellyfinDatabase(jellyfindb.cursor)
self.objects = Objects()
self.item_ids = []
self.library = library
KodiDb.__init__(self, videodb.cursor)
@stop
@jellyfin_item
@library_check
def tvshow(self, item, e_item, library):
def tvshow(self, item, e_item):
''' If item does not exist, entry will be added.
If item exists, entry will be updated.
@ -72,8 +72,8 @@ class TVShows(KodiDb):
LOG.info("ShowId %s missing from kodi. repairing the entry.", obj['ShowId'])
obj['Path'] = API.get_file_path(obj['Path'])
obj['LibraryId'] = library['Id']
obj['LibraryName'] = library['Name']
obj['LibraryId'] = self.library['Id']
obj['LibraryName'] = self.library['Name']
obj['Genres'] = obj['Genres'] or []
obj['People'] = obj['People'] or []
obj['Mpaa'] = API.get_mpaa(obj['Mpaa'])
@ -411,7 +411,7 @@ class TVShows(KodiDb):
if obj['ShowId'] is None:
try:
self.tvshow(self.server.jellyfin.get_item(obj['SeriesId']), library=None)
self.tvshow(self.server.jellyfin.get_item(obj['SeriesId']))
obj['ShowId'] = self.jellyfin_db.get_item_by_id(*values(obj, QUEM.get_item_series_obj))[0]
except (TypeError, KeyError) as error:
LOG.error("Unable to add series %s", obj['SeriesId'])