mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
First attempt at fixing music
Pull the list of songs in batch of 200 items to prevent timeouts.
This commit is contained in:
parent
94055c952c
commit
59aaa4d42b
3 changed files with 21 additions and 2 deletions
|
@ -27,7 +27,7 @@ class DownloadUtils():
|
|||
|
||||
# Requests session
|
||||
s = None
|
||||
timeout = 30
|
||||
timeout = 60
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
|
|
@ -448,7 +448,7 @@ class LibrarySync(threading.Thread):
|
|||
allKodiSongIds = list()
|
||||
allEmbySongIds = list()
|
||||
|
||||
allEmbySongs = ReadEmbyDB().getMusicSongs()
|
||||
allEmbySongs = ReadEmbyDB().getMusicSongsTotal()
|
||||
allKodiSongs = ReadKodiDB().getKodiMusicSongs(connection, cursor)
|
||||
|
||||
for kodisong in allKodiSongs:
|
||||
|
|
|
@ -97,6 +97,25 @@ class ReadEmbyDB():
|
|||
|
||||
return result
|
||||
|
||||
def getMusicSongsTotal(self):
|
||||
|
||||
result = []
|
||||
|
||||
url = "{server}/mediabrowser/Users/{UserId}/Items?Index=1&Limit=1&Fields=Etag,Path,Genres,SortName,Studios,Writer,ProductionYear,Taglines,CommunityRating,OfficialRating,CumulativeRunTimeTicks,Metascore,AirTime,DateCreated,MediaStreams,People,Overview&Recursive=true&IncludeItemTypes=Audio&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=Audio&format=json" % (index, jump)
|
||||
jsondata = self.doUtils.downloadUrl(url)
|
||||
result.extend(jsondata['Items'])
|
||||
index += 200
|
||||
|
||||
return result
|
||||
|
||||
def getMusicAlbums(self, itemList = []):
|
||||
|
||||
result = []
|
||||
|
|
Loading…
Reference in a new issue