mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2025-06-18 06:06:14 +00:00
add first support for music library sync
This commit is contained in:
parent
87681ee850
commit
8839b3b323
7 changed files with 760 additions and 13 deletions
|
@ -65,7 +65,83 @@ class ReadEmbyDB():
|
|||
result = newResult
|
||||
|
||||
return result
|
||||
|
||||
def getMusicArtists(self, itemList = []):
|
||||
|
||||
result = None
|
||||
doUtils = DownloadUtils()
|
||||
|
||||
#only get basic info for our sync-compares
|
||||
url = "{server}/Artists?Fields=Name,CumulativeRunTimeTicks,Etag&Recursive=true&format=json"
|
||||
|
||||
jsonData = doUtils.downloadUrl(url)
|
||||
if (jsonData == ""):
|
||||
return result
|
||||
|
||||
if (jsonData[u'Items'] != ""):
|
||||
result = jsonData[u'Items']
|
||||
|
||||
# Work around to only return items from the given list
|
||||
if (result != None and len(result) > 0 and len(itemList) > 0):
|
||||
newResult = []
|
||||
for item in result:
|
||||
if (item[u'Id'] in itemList):
|
||||
newResult.append(item)
|
||||
result = newResult
|
||||
|
||||
return result
|
||||
|
||||
def getMusicSongs(self, itemList = []):
|
||||
|
||||
result = None
|
||||
doUtils = DownloadUtils()
|
||||
|
||||
#only get basic info for our sync-compares
|
||||
url = "{server}/mediabrowser/Users/{UserId}/Items?Fields=Name,CumulativeRunTimeTicks,Etag&Recursive=true&IncludeItemTypes=Audio&format=json"
|
||||
|
||||
jsonData = doUtils.downloadUrl(url)
|
||||
if (jsonData == ""):
|
||||
return result
|
||||
|
||||
if (jsonData[u'Items'] != ""):
|
||||
result = jsonData[u'Items']
|
||||
|
||||
# Work around to only return items from the given list
|
||||
if (result != None and len(result) > 0 and len(itemList) > 0):
|
||||
newResult = []
|
||||
for item in result:
|
||||
if (item[u'Id'] in itemList):
|
||||
newResult.append(item)
|
||||
result = newResult
|
||||
|
||||
return result
|
||||
|
||||
def getMusicAlbums(self, itemList = []):
|
||||
|
||||
result = None
|
||||
doUtils = DownloadUtils()
|
||||
|
||||
#only get basic info for our sync-compares
|
||||
url = "{server}/mediabrowser/Users/{UserId}/Items?Fields=Name,CumulativeRunTimeTicks,Etag&Recursive=true&IncludeItemTypes=MusicAlbum&format=json"
|
||||
|
||||
jsonData = doUtils.downloadUrl(url)
|
||||
if (jsonData == ""):
|
||||
return result
|
||||
|
||||
if (jsonData[u'Items'] != ""):
|
||||
result = jsonData[u'Items']
|
||||
|
||||
# Work around to only return items from the given list
|
||||
if (result != None and len(result) > 0 and len(itemList) > 0):
|
||||
newResult = []
|
||||
for item in result:
|
||||
if (item[u'Id'] in itemList):
|
||||
newResult.append(item)
|
||||
result = newResult
|
||||
|
||||
return result
|
||||
|
||||
|
||||
def getItem(self, id):
|
||||
|
||||
result = None
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue