mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
Use collections instead of views for tags
This commit is contained in:
parent
6566e21fe1
commit
a3b42a0447
1 changed files with 49 additions and 1 deletions
|
@ -186,7 +186,6 @@ class ReadEmbyDB():
|
||||||
result = result['Items']
|
result = result['Items']
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def getCollections(self, type):
|
def getCollections(self, type):
|
||||||
#Build a list of the user views
|
#Build a list of the user views
|
||||||
userid = DownloadUtils().getUserId()
|
userid = DownloadUtils().getUserId()
|
||||||
|
@ -194,6 +193,55 @@ class ReadEmbyDB():
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
|
downloadUtils = DownloadUtils()
|
||||||
|
|
||||||
|
try:
|
||||||
|
jsonData = downloadUtils.downloadUrl("http://" + server + "/mediabrowser/Users/" + userid + "/Items/Root?format=json")
|
||||||
|
except Exception, msg:
|
||||||
|
error = "Get connect : " + str(msg)
|
||||||
|
xbmc.log (error)
|
||||||
|
return []
|
||||||
|
|
||||||
|
if(jsonData == ""):
|
||||||
|
return []
|
||||||
|
|
||||||
|
result = json.loads(jsonData)
|
||||||
|
|
||||||
|
parentid = result.get("Id")
|
||||||
|
|
||||||
|
htmlpath = ("http://%s/mediabrowser/Users/" % server)
|
||||||
|
jsonData = downloadUtils.downloadUrl(htmlpath + userid + "/items?ParentId=" + parentid + "&Sortby=SortName&format=json")
|
||||||
|
collections=[]
|
||||||
|
|
||||||
|
if(jsonData == ""):
|
||||||
|
printDebug("No Json data")
|
||||||
|
return []
|
||||||
|
|
||||||
|
result = json.loads(jsonData)
|
||||||
|
result = result.get("Items")
|
||||||
|
|
||||||
|
for item in result:
|
||||||
|
if(item.get("RecursiveItemCount") != 0):
|
||||||
|
Temp = item.get("Name")
|
||||||
|
Name = Temp.encode('utf-8')
|
||||||
|
section = item.get("CollectionType")
|
||||||
|
type = item.get("CollectionType")
|
||||||
|
if type == None:
|
||||||
|
type = "None" # User may not have declared the type
|
||||||
|
if type == type:
|
||||||
|
collections.append( {'title' : item.get("Name"),
|
||||||
|
'type' : type,
|
||||||
|
'id' : item.get("Id")})
|
||||||
|
print "paco!" + str (collections)
|
||||||
|
return collections
|
||||||
|
|
||||||
|
def getViewCollections(self, type):
|
||||||
|
#Build a list of the user views
|
||||||
|
userid = DownloadUtils().getUserId()
|
||||||
|
addon = xbmcaddon.Addon(id='plugin.video.mb3sync')
|
||||||
|
port = addon.getSetting('port')
|
||||||
|
host = addon.getSetting('ipaddress')
|
||||||
|
server = host + ":" + port
|
||||||
|
|
||||||
viewsUrl = server + "/mediabrowser/Users/" + userid + "/Views?format=json&ImageTypeLimit=1"
|
viewsUrl = server + "/mediabrowser/Users/" + userid + "/Views?format=json&ImageTypeLimit=1"
|
||||||
jsonData = DownloadUtils().downloadUrl(viewsUrl, suppress=True, popup=0 )
|
jsonData = DownloadUtils().downloadUrl(viewsUrl, suppress=True, popup=0 )
|
||||||
|
|
Loading…
Reference in a new issue