mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 12:16:12 +00:00
Aspect ratio fix
Handle missing aspect ratio with closest value. Also defined codecs such as dvix, xvid and avc1.
This commit is contained in:
parent
2968638220
commit
4f677ea310
1 changed files with 12 additions and 8 deletions
|
@ -128,25 +128,29 @@ class API():
|
||||||
|
|
||||||
if "Video" in type:
|
if "Video" in type:
|
||||||
videotrack = {}
|
videotrack = {}
|
||||||
videotrack['videocodec'] = mediaStream.get('Codec')
|
videotrack['videocodec'] = mediaStream.get('Codec', "").lower()
|
||||||
if "mpeg4" in videotrack['videocodec']:
|
container = item['MediaSources'][0].get('Container', "").lower()
|
||||||
profile = mediaStream.get('Profile', "")
|
if "msmpeg4" in videotrack['videocodec']:
|
||||||
if "Advanced" in profile:
|
videotrack['videocodec'] = "divx"
|
||||||
|
elif "mpeg4" in videotrack['videocodec']:
|
||||||
|
profile = mediaStream.get('Profile', "").lower()
|
||||||
|
if "simple profile" in profile:
|
||||||
videotrack['videocodec'] = "xvid"
|
videotrack['videocodec'] = "xvid"
|
||||||
elif "h264" in videotrack['videocodec']:
|
elif "h264" in videotrack['videocodec']:
|
||||||
container = item['MediaSources'][0].get('Container', "")
|
if container in ("mp4", "mov", "m4v"):
|
||||||
if "mp4" in container:
|
|
||||||
videotrack['videocodec'] = "avc1"
|
videotrack['videocodec'] = "avc1"
|
||||||
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')
|
||||||
videotrack['aspectratio'] = mediaStream.get('AspectRatio', "1:1")
|
videotrack['aspectratio'] = mediaStream.get('AspectRatio', "0")
|
||||||
if len(videotrack['aspectratio']) >= 3:
|
if len(videotrack['aspectratio']) >= 3:
|
||||||
try:
|
try:
|
||||||
aspectwidth, aspectheight = videotrack['aspectratio'].split(':')
|
aspectwidth, aspectheight = videotrack['aspectratio'].split(':')
|
||||||
videotrack['aspectratio'] = round(float(aspectwidth) / float(aspectheight), 6)
|
videotrack['aspectratio'] = round(float(aspectwidth) / float(aspectheight), 6)
|
||||||
except:
|
except:
|
||||||
videotrack['aspectratio'] = 1.85
|
videotrack['aspectratio'] = round(float(videotrack['width'] / videotrack['height']), 6)
|
||||||
|
else:
|
||||||
|
videotrack['aspectratio'] = round(float(videotrack['width'] / videotrack['height']), 6)
|
||||||
videotracks.append(videotrack)
|
videotracks.append(videotrack)
|
||||||
|
|
||||||
elif "Audio" in type:
|
elif "Audio" in type:
|
||||||
|
|
Loading…
Reference in a new issue