mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-12-13 02:23:18 +00:00
Remove library_check wrapper
This commit is contained in:
parent
0ee5b616a5
commit
eca9630918
9 changed files with 129 additions and 188 deletions
|
|
@ -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 []
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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 [])]
|
||||
|
|
|
|||
|
|
@ -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'])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue