mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-28 19:10:32 +00:00
Refactor where the ancestor check takes place
This commit is contained in:
parent
75ac8ef1b8
commit
ae0dbc0400
5 changed files with 101 additions and 39 deletions
|
@ -13,6 +13,7 @@ import downloader as server
|
|||
from database import jellyfin_db, queries as QUEM
|
||||
from helper import api, stop, validate, jellyfin_item, values, Local
|
||||
from helper import LazyLogger
|
||||
from helper.utils import find_library
|
||||
from helper.exceptions import PathValidationException
|
||||
|
||||
from .obj import Objects
|
||||
|
@ -61,10 +62,20 @@ class TVShows(KodiDb):
|
|||
try:
|
||||
obj['ShowId'] = e_item[0]
|
||||
obj['PathId'] = e_item[2]
|
||||
obj['LibraryId'] = e_item[6]
|
||||
obj['LibraryName'] = self.jellyfin_db.get_view_name(obj['LibraryId'])
|
||||
except TypeError:
|
||||
update = False
|
||||
LOG.debug("ShowId %s not found", obj['Id'])
|
||||
|
||||
library = self.library or find_library(self.server, item)
|
||||
if not library:
|
||||
# This item doesn't belong to a whitelisted library
|
||||
return
|
||||
|
||||
obj['ShowId'] = self.create_entry()
|
||||
obj['LibraryId'] = library['Id']
|
||||
obj['LibraryName'] = library['Name']
|
||||
else:
|
||||
if self.get(*values(obj, QU.get_tvshow_obj)) is None:
|
||||
|
||||
|
@ -72,8 +83,6 @@ 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'] = 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'])
|
||||
|
@ -267,6 +276,12 @@ class TVShows(KodiDb):
|
|||
except TypeError:
|
||||
update = False
|
||||
LOG.debug("EpisodeId %s not found", obj['Id'])
|
||||
|
||||
library = self.library or find_library(self.server, item)
|
||||
if not library:
|
||||
# This item doesn't belong to a whitelisted library
|
||||
return
|
||||
|
||||
obj['EpisodeId'] = self.create_entry_episode()
|
||||
else:
|
||||
if self.get_episode(*values(obj, QU.get_episode_obj)) is None:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue