Fix getting Metadata for streaming
This commit is contained in:
parent
3e1d3ff1cc
commit
e0ccaf16ad
2 changed files with 47 additions and 15 deletions
|
@ -1333,6 +1333,18 @@ class API():
|
||||||
localdate = time.strftime('%Y-%m-%d', date_time)
|
localdate = time.strftime('%Y-%m-%d', date_time)
|
||||||
return localdate
|
return localdate
|
||||||
|
|
||||||
|
def getType(self):
|
||||||
|
item = self.item
|
||||||
|
# Include a letter to prohibit saving as an int!
|
||||||
|
# xml
|
||||||
|
try:
|
||||||
|
item = item[0].attrib
|
||||||
|
# json
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
itemtype = item['type']
|
||||||
|
return itemtype
|
||||||
|
|
||||||
def getChecksum(self):
|
def getChecksum(self):
|
||||||
"""
|
"""
|
||||||
Returns a string, not int!
|
Returns a string, not int!
|
||||||
|
@ -1565,7 +1577,10 @@ class API():
|
||||||
# json
|
# json
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
title = item['title']
|
try:
|
||||||
|
title = item['title']
|
||||||
|
except:
|
||||||
|
title = 'Missing Title Name'
|
||||||
try:
|
try:
|
||||||
sorttitle = item['titleSort']
|
sorttitle = item['titleSort']
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -1580,7 +1595,10 @@ class API():
|
||||||
# json
|
# json
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
plot = item['summary']
|
try:
|
||||||
|
plot = item['summary']
|
||||||
|
except:
|
||||||
|
plot = None
|
||||||
return plot
|
return plot
|
||||||
|
|
||||||
def getTagline(self):
|
def getTagline(self):
|
||||||
|
@ -1619,7 +1637,10 @@ class API():
|
||||||
# json
|
# json
|
||||||
except KeyError:
|
except KeyError:
|
||||||
pass
|
pass
|
||||||
year = item['year']
|
try:
|
||||||
|
year = item['year']
|
||||||
|
except:
|
||||||
|
year = None
|
||||||
return year
|
return year
|
||||||
|
|
||||||
def getRuntime(self):
|
def getRuntime(self):
|
||||||
|
@ -1677,6 +1698,19 @@ class API():
|
||||||
country.append(child.attrib['tag'])
|
country.append(child.attrib['tag'])
|
||||||
return country
|
return country
|
||||||
|
|
||||||
|
def getPremiereDate(self):
|
||||||
|
item = self.item
|
||||||
|
try:
|
||||||
|
item = item[0].attrib
|
||||||
|
# json
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
try:
|
||||||
|
premiere = item['originallyAvailableAt']
|
||||||
|
except:
|
||||||
|
premiere = None
|
||||||
|
return premiere
|
||||||
|
|
||||||
def getStudios(self):
|
def getStudios(self):
|
||||||
item = self.item
|
item = self.item
|
||||||
studio = []
|
studio = []
|
||||||
|
|
|
@ -327,24 +327,22 @@ class PlaybackUtils():
|
||||||
def setListItem(self, listItem):
|
def setListItem(self, listItem):
|
||||||
|
|
||||||
item = self.item
|
item = self.item
|
||||||
type = item['Type']
|
|
||||||
API = self.API
|
API = self.API
|
||||||
|
type = API.getType()
|
||||||
people = API.getPeople()
|
people = API.getPeople()
|
||||||
studios = API.getStudios()
|
|
||||||
|
|
||||||
metadata = {
|
metadata = {
|
||||||
|
'title': API.getTitle()[0],
|
||||||
'title': item.get('Name', "Missing name"),
|
'year': API.getYear(),
|
||||||
'year': item.get('ProductionYear'),
|
'plot': API.getPlot(),
|
||||||
'plot': API.getOverview(),
|
'director': API.joinList(people.get('Director')),
|
||||||
'director': people.get('Director'),
|
'writer': API.joinList(people.get('Writer')),
|
||||||
'writer': people.get('Writer'),
|
|
||||||
'mpaa': API.getMpaa(),
|
'mpaa': API.getMpaa(),
|
||||||
'genre': " / ".join(item['Genres']),
|
'genre': API.joinList(API.getGenres()),
|
||||||
'studio': " / ".join(studios),
|
'studio': API.joinList(API.getStudios()),
|
||||||
'aired': API.getPremiereDate(),
|
'aired': API.getPremiereDate(),
|
||||||
'rating': item.get('CommunityRating'),
|
'rating': API.getAudienceRating(),
|
||||||
'votes': item.get('VoteCount')
|
'votes': None
|
||||||
}
|
}
|
||||||
|
|
||||||
if "Episode" in type:
|
if "Episode" in type:
|
||||||
|
|
Loading…
Add table
Reference in a new issue