mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-25 02:06:09 +00:00
Support mixed content and undefined collection
Undefined collection - when rich presentation is disabled.
This commit is contained in:
parent
09966b25bb
commit
c92454bb92
3 changed files with 39 additions and 8 deletions
|
@ -236,6 +236,15 @@ class LibrarySync(threading.Thread):
|
|||
allEmbyMovies = ReadEmbyDB().getMovies(view.get('id'))
|
||||
allKodiMovies = ReadKodiDB().getKodiMovies(connection, cursor)
|
||||
|
||||
for kodimovie in allKodiMovies:
|
||||
allKodiMovieIds.append(kodimovie[1])
|
||||
|
||||
title = view.get('title')
|
||||
content = view.get('content')
|
||||
|
||||
if content == "mixed":
|
||||
title = "%s - Movies" % title
|
||||
|
||||
for kodimovie in allKodiMovies:
|
||||
allKodiMovieIds.append(kodimovie[1])
|
||||
|
||||
|
@ -263,10 +272,10 @@ class LibrarySync(threading.Thread):
|
|||
kodiMovie = kodimovie
|
||||
|
||||
if kodiMovie == None:
|
||||
WriteKodiVideoDB().addOrUpdateMovieToKodiLibrary(item["Id"],connection, cursor, view.get('title'))
|
||||
WriteKodiVideoDB().addOrUpdateMovieToKodiLibrary(item["Id"],connection, cursor, title)
|
||||
else:
|
||||
if kodiMovie[2] != API().getChecksum(item):
|
||||
WriteKodiVideoDB().addOrUpdateMovieToKodiLibrary(item["Id"],connection, cursor, view.get('title'))
|
||||
WriteKodiVideoDB().addOrUpdateMovieToKodiLibrary(item["Id"],connection, cursor, title)
|
||||
|
||||
|
||||
|
||||
|
@ -367,6 +376,12 @@ class LibrarySync(threading.Thread):
|
|||
allEmbyTvShows = ReadEmbyDB().getTvShows(view.get('id'))
|
||||
allKodiTvShows = ReadKodiDB().getKodiTvShows(connection, cursor)
|
||||
|
||||
title = view.get('title')
|
||||
content = view.get('content')
|
||||
|
||||
if content == "mixed":
|
||||
title = "%s - TV Shows" % title
|
||||
|
||||
total = len(allEmbyTvShows) + 1
|
||||
count = 1
|
||||
|
||||
|
@ -396,11 +411,11 @@ class LibrarySync(threading.Thread):
|
|||
|
||||
if kodiShow == None:
|
||||
# Tv show doesn't exist in Kodi yet so proceed and add it
|
||||
WriteKodiVideoDB().addOrUpdateTvShowToKodiLibrary(item["Id"],connection, cursor, view.get('title'))
|
||||
WriteKodiVideoDB().addOrUpdateTvShowToKodiLibrary(item["Id"],connection, cursor, title)
|
||||
else:
|
||||
# If there are changes to the item, perform a full sync of the item
|
||||
if kodiShow[2] != API().getChecksum(item):
|
||||
WriteKodiVideoDB().addOrUpdateTvShowToKodiLibrary(item["Id"],connection, cursor, view.get('title'))
|
||||
WriteKodiVideoDB().addOrUpdateTvShowToKodiLibrary(item["Id"],connection, cursor, title)
|
||||
|
||||
#### PROCESS EPISODES ######
|
||||
self.EpisodesFullSync(connection,cursor,item["Id"])
|
||||
|
|
|
@ -291,13 +291,21 @@ class ReadEmbyDB():
|
|||
for item in result:
|
||||
if item['RecursiveItemCount']:
|
||||
name = item['Name']
|
||||
itemtype = item.get('CollectionType', "movies")
|
||||
itemtype = item.get('CollectionType')
|
||||
content = itemtype
|
||||
|
||||
if itemtype is None and type in ("movies", "tvshows"):
|
||||
# Mixed content or rich presentation is disabled
|
||||
itemtype = type
|
||||
content = "mixed"
|
||||
|
||||
if itemtype == type and name != "Collections":
|
||||
collections.append({
|
||||
|
||||
'title': name,
|
||||
'type': itemtype,
|
||||
'id': item['Id']
|
||||
'id': item['Id'],
|
||||
'content': content
|
||||
})
|
||||
|
||||
return collections
|
||||
|
|
|
@ -331,13 +331,21 @@ class VideoNodes():
|
|||
views_movies = ReadEmbyDB().getCollections("movies")
|
||||
if views_movies:
|
||||
for view in views_movies:
|
||||
self.buildVideoNodeForView(view.get('title'), "movies", totalNodesCount)
|
||||
title = view.get('title')
|
||||
content = view.get('content')
|
||||
if content == "mixed":
|
||||
title = "%s - Movies" % title
|
||||
self.buildVideoNodeForView(title, "movies", totalNodesCount)
|
||||
totalNodesCount +=1
|
||||
|
||||
views_shows = ReadEmbyDB().getCollections("tvshows")
|
||||
if views_shows:
|
||||
for view in views_shows:
|
||||
self.buildVideoNodeForView(view.get('title'), "tvshows", totalNodesCount)
|
||||
title = view.get('title')
|
||||
content = view.get('content')
|
||||
if content == "mixed":
|
||||
title = "%s - TV Shows" % title
|
||||
self.buildVideoNodeForView(title, "tvshows", totalNodesCount)
|
||||
totalNodesCount +=1
|
||||
|
||||
#create tag node for emby channels
|
||||
|
|
Loading…
Reference in a new issue