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()
|
allKodiArtistIds = list()
|
||||||
allEmbyArtistIds = list()
|
allEmbyArtistIds = list()
|
||||||
|
|
||||||
allEmbyArtists = ReadEmbyDB().getMusicArtists()
|
allEmbyArtists = ReadEmbyDB().getMusicArtistsTotal()
|
||||||
allKodiArtists = ReadKodiDB().getKodiMusicArtists(connection, cursor)
|
allKodiArtists = ReadKodiDB().getKodiMusicArtists(connection, cursor)
|
||||||
|
|
||||||
for kodiartist in allKodiArtists:
|
for kodiartist in allKodiArtists:
|
||||||
|
@ -540,7 +540,7 @@ class LibrarySync(threading.Thread):
|
||||||
allKodiAlbumIds = list()
|
allKodiAlbumIds = list()
|
||||||
allEmbyAlbumIds = list()
|
allEmbyAlbumIds = list()
|
||||||
|
|
||||||
allEmbyAlbums = ReadEmbyDB().getMusicAlbums()
|
allEmbyAlbums = ReadEmbyDB().getMusicAlbumsTotal()
|
||||||
allKodiAlbums = ReadKodiDB().getKodiMusicAlbums(connection, cursor)
|
allKodiAlbums = ReadKodiDB().getKodiMusicAlbums(connection, cursor)
|
||||||
|
|
||||||
for kodialbum in allKodiAlbums:
|
for kodialbum in allKodiAlbums:
|
||||||
|
|
|
@ -78,6 +78,25 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
return result
|
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 = []):
|
def getMusicSongs(self, itemList = []):
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
@ -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)
|
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)
|
jsondata = self.doUtils.downloadUrl(url)
|
||||||
result.extend(jsondata['Items'])
|
result.extend(jsondata['Items'])
|
||||||
index += 200
|
index += jump
|
||||||
|
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
@ -142,6 +161,32 @@ class ReadEmbyDB():
|
||||||
|
|
||||||
return result
|
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 = []):
|
def getTvShows(self, parentId, itemList = []):
|
||||||
|
|
||||||
result = []
|
result = []
|
||||||
|
|
Loading…
Reference in a new issue