mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 01:36:11 +00:00
Follow up - apply limit to the artists and albums
This commit is contained in:
parent
59aaa4d42b
commit
de0690833e
2 changed files with 48 additions and 3 deletions
|
@ -494,7 +494,7 @@ class LibrarySync(threading.Thread):
|
|||
allKodiArtistIds = list()
|
||||
allEmbyArtistIds = list()
|
||||
|
||||
allEmbyArtists = ReadEmbyDB().getMusicArtists()
|
||||
allEmbyArtists = ReadEmbyDB().getMusicArtistsTotal()
|
||||
allKodiArtists = ReadKodiDB().getKodiMusicArtists(connection, cursor)
|
||||
|
||||
for kodiartist in allKodiArtists:
|
||||
|
@ -540,7 +540,7 @@ class LibrarySync(threading.Thread):
|
|||
allKodiAlbumIds = list()
|
||||
allEmbyAlbumIds = list()
|
||||
|
||||
allEmbyAlbums = ReadEmbyDB().getMusicAlbums()
|
||||
allEmbyAlbums = ReadEmbyDB().getMusicAlbumsTotal()
|
||||
allKodiAlbums = ReadKodiDB().getKodiMusicAlbums(connection, cursor)
|
||||
|
||||
for kodialbum in allKodiAlbums:
|
||||
|
|
|
@ -77,6 +77,25 @@ class ReadEmbyDB():
|
|||
result = self.filterbyId(result, itemList)
|
||||
|
||||
return result
|
||||
|
||||
def getMusicArtistsTotal(self):
|
||||
|
||||
result = []
|
||||
|
||||
url = "{server}/Artists?Limit=1&Recursive=true&Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&UserId={UserId}&format=json"
|
||||
jsondata = self.doUtils.downloadUrl(url)
|
||||
|
||||
total = jsondata['TotalRecordCount']
|
||||
index = 1
|
||||
jump = 200
|
||||
|
||||
while index < total:
|
||||
url = "{server}/Artists?StartIndex=%s&Limit=%s&Recursive=true&Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&UserId={UserId}&format=json" % (index, jump)
|
||||
jsondata = self.doUtils.downloadUrl(url)
|
||||
result.extend(jsondata['Items'])
|
||||
index += jump
|
||||
|
||||
return result
|
||||
|
||||
def getMusicSongs(self, itemList = []):
|
||||
|
||||
|
@ -112,7 +131,7 @@ class ReadEmbyDB():
|
|||
url = "{server}/mediabrowser/Users/{UserId}/Items?StartIndex=%s&Limit=%s&Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&IncludeItemTypes=Audio&format=json" % (index, jump)
|
||||
jsondata = self.doUtils.downloadUrl(url)
|
||||
result.extend(jsondata['Items'])
|
||||
index += 200
|
||||
index += jump
|
||||
|
||||
return result
|
||||
|
||||
|
@ -142,6 +161,32 @@ class ReadEmbyDB():
|
|||
|
||||
return result
|
||||
|
||||
def getMusicAlbumsTotal(self):
|
||||
|
||||
result = []
|
||||
|
||||
url = "{server}/mediabrowser/Users/{UserId}/Items?Limit=1&Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&IncludeItemTypes=MusicAlbum&format=json"
|
||||
jsondata = self.doUtils.downloadUrl(url)
|
||||
|
||||
total = jsondata['TotalRecordCount']
|
||||
index = 1
|
||||
jump = 200
|
||||
|
||||
while index < total:
|
||||
url = "{server}/mediabrowser/Users/{UserId}/Items?StartIndex=%s&Limit=%s&Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&IncludeItemTypes=MusicAlbum&format=json" % (index, jump)
|
||||
jsondata = self.doUtils.downloadUrl(url)
|
||||
|
||||
tempresult = []
|
||||
# Only return valid albums - which have artists
|
||||
for item in jsondata['Items']:
|
||||
if item['AlbumArtists']:
|
||||
tempresult.append(item)
|
||||
|
||||
result.extend(tempresult)
|
||||
index += jump
|
||||
|
||||
return result
|
||||
|
||||
def getTvShows(self, parentId, itemList = []):
|
||||
|
||||
result = []
|
||||
|
|
Loading…
Reference in a new issue