Fix getting Metadata for streaming

This commit is contained in:
tomkat83 2016-01-02 09:28:31 +01:00
parent 3e1d3ff1cc
commit e0ccaf16ad
2 changed files with 47 additions and 15 deletions

View file

@ -1333,6 +1333,18 @@ class API():
localdate = time.strftime('%Y-%m-%d', date_time)
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):
"""
Returns a string, not int!
@ -1565,7 +1577,10 @@ class API():
# json
except KeyError:
pass
try:
title = item['title']
except:
title = 'Missing Title Name'
try:
sorttitle = item['titleSort']
except KeyError:
@ -1580,7 +1595,10 @@ class API():
# json
except KeyError:
pass
try:
plot = item['summary']
except:
plot = None
return plot
def getTagline(self):
@ -1619,7 +1637,10 @@ class API():
# json
except KeyError:
pass
try:
year = item['year']
except:
year = None
return year
def getRuntime(self):
@ -1677,6 +1698,19 @@ class API():
country.append(child.attrib['tag'])
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):
item = self.item
studio = []

View file

@ -327,24 +327,22 @@ class PlaybackUtils():
def setListItem(self, listItem):
item = self.item
type = item['Type']
API = self.API
type = API.getType()
people = API.getPeople()
studios = API.getStudios()
metadata = {
'title': item.get('Name', "Missing name"),
'year': item.get('ProductionYear'),
'plot': API.getOverview(),
'director': people.get('Director'),
'writer': people.get('Writer'),
'title': API.getTitle()[0],
'year': API.getYear(),
'plot': API.getPlot(),
'director': API.joinList(people.get('Director')),
'writer': API.joinList(people.get('Writer')),
'mpaa': API.getMpaa(),
'genre': " / ".join(item['Genres']),
'studio': " / ".join(studios),
'genre': API.joinList(API.getGenres()),
'studio': API.joinList(API.getStudios()),
'aired': API.getPremiereDate(),
'rating': item.get('CommunityRating'),
'votes': item.get('VoteCount')
'rating': API.getAudienceRating(),
'votes': None
}
if "Episode" in type: