url and log

This commit is contained in:
SpootDev 2016-03-31 13:18:49 -05:00
parent 1768bd0e4c
commit c6ba6d6f51

View file

@ -125,7 +125,6 @@ class Read_EmbyServer():
return [viewName, viewId, mediatype] return [viewName, viewId, mediatype]
def getFilteredSection(self, parentid, itemtype=None, sortby="SortName", recursive=True, limit=None, sortorder="Ascending", filter=""): def getFilteredSection(self, parentid, itemtype=None, sortby="SortName", recursive=True, limit=None, sortorder="Ascending", filter=""):
url = "{server}/emby/Users/{UserId}/Items?format=json"
params = { params = {
'ParentId': parentid, 'ParentId': parentid,
@ -144,10 +143,9 @@ class Read_EmbyServer():
"CriticRating,CriticRatingSummary,Etag,ShortOverview,ProductionLocations," "CriticRating,CriticRatingSummary,Etag,ShortOverview,ProductionLocations,"
"Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers") "Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers")
} }
return self.doUtils(url, parameters=params) return self.doUtils("{server}/emby/Users/{UserId}/Items?format=json", parameters=params)
def getTvChannels(self): def getTvChannels(self):
url = "{server}/emby/LiveTv/Channels/?userid={UserId}&format=json"
params = { params = {
'EnableImages': True, 'EnableImages': True,
@ -157,10 +155,9 @@ class Read_EmbyServer():
"CriticRating,CriticRatingSummary,Etag,ShortOverview,ProductionLocations," "CriticRating,CriticRatingSummary,Etag,ShortOverview,ProductionLocations,"
"Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers") "Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers")
} }
return self.doUtils(url, parameters=params) return self.doUtils("{server}/emby/LiveTv/Channels/?userid={UserId}&format=json", parameters=params)
def getTvRecordings(self, groupid): def getTvRecordings(self, groupid):
url = "{server}/emby/LiveTv/Recordings/?userid={UserId}&format=json"
if groupid == "root": groupid = "" if groupid == "root": groupid = ""
params = { params = {
@ -172,12 +169,10 @@ class Read_EmbyServer():
"CriticRating,CriticRatingSummary,Etag,ShortOverview,ProductionLocations," "CriticRating,CriticRatingSummary,Etag,ShortOverview,ProductionLocations,"
"Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers") "Tags,ProviderIds,ParentId,RemoteTrailers,SpecialEpisodeNumbers")
} }
return self.doUtils(url, parameters=params) return self.doUtils("{server}/emby/LiveTv/Recordings/?userid={UserId}&format=json", parameters=params)
def getSection(self, parentid, itemtype=None, sortby="SortName", basic=False, dialog=None): def getSection(self, parentid, itemtype=None, sortby="SortName", basic=False, dialog=None):
log = self.logMsg
items = { items = {
'Items': [], 'Items': [],
@ -202,7 +197,7 @@ class Read_EmbyServer():
items['TotalRecordCount'] = total items['TotalRecordCount'] = total
except TypeError: # Failed to retrieve except TypeError: # Failed to retrieve
log("%s:%s Failed to retrieve the server response." % (url, params), 2) self.logMsg("%s:%s Failed to retrieve the server response." % (url, params), 2)
else: else:
index = 0 index = 0
@ -244,27 +239,27 @@ class Read_EmbyServer():
# Something happened to the connection # Something happened to the connection
if not throttled: if not throttled:
throttled = True throttled = True
log("Throttle activated.", 1) self.logMsg("Throttle activated.", 1)
if jump == highestjump: if jump == highestjump:
# We already tried with the highestjump, but it failed. Reset value. # We already tried with the highestjump, but it failed. Reset value.
log("Reset highest value.", 1) self.logMsg("Reset highest value.", 1)
highestjump = 0 highestjump = 0
# Lower the number by half # Lower the number by half
if highestjump: if highestjump:
throttled = False throttled = False
jump = highestjump jump = highestjump
log("Throttle deactivated.", 1) self.logMsg("Throttle deactivated.", 1)
else: else:
jump = int(jump/4) jump = int(jump/4)
log("Set jump limit to recover: %s" % jump, 2) self.logMsg("Set jump limit to recover: %s" % jump, 2)
retry = 0 retry = 0
while utils.window('emby_online') != "true": while utils.window('emby_online') != "true":
# Wait server to come back online # Wait server to come back online
if retry == 5: if retry == 5:
log("Unable to reconnect to server. Abort process.", 1) self.logMsg("Unable to reconnect to server. Abort process.", 1)
return items return items
retry += 1 retry += 1
@ -292,7 +287,7 @@ class Read_EmbyServer():
increment = 10 increment = 10
jump += increment jump += increment
log("Increase jump limit to: %s" % jump, 1) self.logMsg("Increase jump limit to: %s" % jump, 1)
return items return items
def getViews(self, mediatype="", root=False, sortedlist=False): def getViews(self, mediatype="", root=False, sortedlist=False):