mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-12-24 09:46:11 +00:00
Adjust mpaa rating and quick fix for ratio
This commit is contained in:
parent
ef927d6b3b
commit
fee8b958de
2 changed files with 24 additions and 19 deletions
|
@ -142,9 +142,10 @@ class API():
|
||||||
videotrack['height'] = mediaStream.get('Height')
|
videotrack['height'] = mediaStream.get('Height')
|
||||||
videotrack['width'] = mediaStream.get('Width')
|
videotrack['width'] = mediaStream.get('Width')
|
||||||
videotrack['Video3DFormat'] = item.get('Video3DFormat')
|
videotrack['Video3DFormat'] = item.get('Video3DFormat')
|
||||||
try:# Metadata aspect ratio
|
if item.get('AspectRatio'):
|
||||||
|
# Metadata aspect ratio
|
||||||
videotrack['aspectratio'] = item['AspectRatio']
|
videotrack['aspectratio'] = item['AspectRatio']
|
||||||
except: # File aspect ratio
|
else: # File aspect ratio
|
||||||
videotrack['aspectratio'] = mediaStream.get('AspectRatio', "0")
|
videotrack['aspectratio'] = mediaStream.get('AspectRatio', "0")
|
||||||
if len(videotrack['aspectratio']) >= 3:
|
if len(videotrack['aspectratio']) >= 3:
|
||||||
try:
|
try:
|
||||||
|
@ -296,40 +297,35 @@ class API():
|
||||||
|
|
||||||
def getDateCreated(self, item):
|
def getDateCreated(self, item):
|
||||||
|
|
||||||
dateadded = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
dateadded = item['DateCreated']
|
dateadded = item['DateCreated']
|
||||||
dateadded = dateadded.split('.')[0].replace('T', " ")
|
dateadded = dateadded.split('.')[0].replace('T', " ")
|
||||||
except: pass
|
except:
|
||||||
|
dateadded = None
|
||||||
|
|
||||||
return dateadded
|
return dateadded
|
||||||
|
|
||||||
def getPremiereDate(self, item):
|
def getPremiereDate(self, item):
|
||||||
|
|
||||||
premiere = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
premiere = item['PremiereDate']
|
premiere = item['PremiereDate']
|
||||||
premiere = premiere.split('.')[0].replace('T', " ")
|
premiere = premiere.split('.')[0].replace('T', " ")
|
||||||
except: pass
|
except:
|
||||||
|
premiere = None
|
||||||
|
|
||||||
return premiere
|
return premiere
|
||||||
|
|
||||||
def getTagline(self, item):
|
def getTagline(self, item):
|
||||||
|
|
||||||
tagline = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
tagline = item['Taglines'][0]
|
tagline = item['Taglines'][0]
|
||||||
except: pass
|
except:
|
||||||
|
tagline = None
|
||||||
|
|
||||||
return tagline
|
return tagline
|
||||||
|
|
||||||
def getProvider(self, item, providername):
|
def getProvider(self, item, providername):
|
||||||
# Provider Name: imdb or tvdb
|
# Provider Name: imdb or tvdb
|
||||||
provider = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if "imdb" in providername:
|
if "imdb" in providername:
|
||||||
provider = item['ProviderIds']['Imdb']
|
provider = item['ProviderIds']['Imdb']
|
||||||
|
@ -341,20 +337,29 @@ class API():
|
||||||
provider = item['ProviderIds']['MusicBrainzAlbum']
|
provider = item['ProviderIds']['MusicBrainzAlbum']
|
||||||
elif "musicBrainzTrackId" in providername:
|
elif "musicBrainzTrackId" in providername:
|
||||||
provider = item['ProviderIds']['MusicBrainzTrackId']
|
provider = item['ProviderIds']['MusicBrainzTrackId']
|
||||||
except: pass
|
except:
|
||||||
|
provider = None
|
||||||
|
|
||||||
return provider
|
return provider
|
||||||
|
|
||||||
def getCountry(self, item):
|
def getCountry(self, item):
|
||||||
|
|
||||||
country = None
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
country = item['ProductionLocations'][0]
|
country = item['ProductionLocations'][0]
|
||||||
except: pass
|
except:
|
||||||
|
country = None
|
||||||
|
|
||||||
return country
|
return country
|
||||||
|
|
||||||
|
def getMpaa(self, item):
|
||||||
|
# Convert more complex cases
|
||||||
|
mpaa = item.get('OfficialRating', "")
|
||||||
|
if "NR" in mpaa:
|
||||||
|
# Kodi seems to not like NR, but will accept Rated Not Rated
|
||||||
|
mpaa = "Rated Not Rated"
|
||||||
|
|
||||||
|
return mpaa
|
||||||
|
|
||||||
def getArtworks(self, data, type, mediaType = "", index = "0", getAll = False):
|
def getArtworks(self, data, type, mediaType = "", index = "0", getAll = False):
|
||||||
|
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -114,7 +114,7 @@ class WriteKodiVideoDB():
|
||||||
imdb = API().getProvider(MBitem, "imdb")
|
imdb = API().getProvider(MBitem, "imdb")
|
||||||
sorttitle = MBitem['SortName']
|
sorttitle = MBitem['SortName']
|
||||||
runtime = timeInfo.get('TotalTime')
|
runtime = timeInfo.get('TotalTime')
|
||||||
mpaa = MBitem.get('OfficialRating')
|
mpaa = API().getMpaa(MBitem)
|
||||||
genre = " / ".join(genres)
|
genre = " / ".join(genres)
|
||||||
director = " / ".join(people.get('Director'))
|
director = " / ".join(people.get('Director'))
|
||||||
studio = " / ".join(studios)
|
studio = " / ".join(studios)
|
||||||
|
@ -469,7 +469,7 @@ class WriteKodiVideoDB():
|
||||||
premieredate = API().getPremiereDate(MBitem)
|
premieredate = API().getPremiereDate(MBitem)
|
||||||
genre = " / ".join(genres)
|
genre = " / ".join(genres)
|
||||||
tvdb = API().getProvider(MBitem, "tvdb")
|
tvdb = API().getProvider(MBitem, "tvdb")
|
||||||
mpaa = MBitem.get('OfficialRating')
|
mpaa = API().getMpaa(MBitem)
|
||||||
studio = " / ".join(studios)
|
studio = " / ".join(studios)
|
||||||
sorttitle = MBitem['SortName']
|
sorttitle = MBitem['SortName']
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue