added stream language and subtitle language to streamdetails

This commit is contained in:
im85288 2015-06-12 20:49:07 +01:00
parent c71634d18c
commit d0325ba737
2 changed files with 34 additions and 11 deletions

View File

@ -81,6 +81,8 @@ class API():
channels = '' channels = ''
videocodec = '' videocodec = ''
audiocodec = '' audiocodec = ''
audiolanguage = ''
subtitlelanguage = ''
height = '' height = ''
width = '' width = ''
aspectratio = '1:1' aspectratio = '1:1'
@ -114,11 +116,32 @@ class API():
except: except:
aspectfloat = 1.85 aspectfloat = 1.85
if(mediaStream.get("Type") == "Audio"): if(mediaStream.get("Type") == "Audio"):
isdefault = mediaStream.get("IsDefault") == "true"
if audiocodec == '':
audiocodec = mediaStream.get("Codec")
if channels == '':
channels = mediaStream.get("Channels")
if audiolanguage == '':
audiolanguage = mediaStream.get("Language")
# only overwrite if default
if isdefault:
audiocodec = mediaStream.get("Codec") audiocodec = mediaStream.get("Codec")
channels = mediaStream.get("Channels") channels = mediaStream.get("Channels")
audiolanguage = mediaStream.get("Language")
if(mediaStream.get("Type") == "Subtitle"):
isdefault = mediaStream.get("IsDefault") == "true"
if subtitlelanguage == '':
subtitlelanguage = mediaStream.get("Language")
# only overwrite if default
if isdefault:
subtitlelanguage = mediaStream.get("Language")
return {'channels' : str(channels), return {'channels' : str(channels),
'videocodec' : videocodec, 'videocodec' : videocodec,
'audiocodec' : audiocodec, 'audiocodec' : audiocodec,
'audiolanguage' : audiolanguage,
'subtitlelanguage' : subtitlelanguage,
'height' : height, 'height' : height,
'width' : width, 'width' : width,
'aspectratio' : aspectfloat, 'aspectratio' : aspectfloat,

View File

@ -1116,8 +1116,8 @@ class WriteKodiVideoDB():
sql="insert into streamdetails(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight, strStereoMode) values(?, ?, ?, ?, ?, ?, ?)" sql="insert into streamdetails(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight, strStereoMode) values(?, ?, ?, ?, ?, ?, ?)"
cursor.execute(sql, (fileid,0,streamdetails.get("videocodec"),streamdetails.get("aspectratio"),streamdetails.get("width"),streamdetails.get("height"),streamdetails.get("3dformat"))) cursor.execute(sql, (fileid,0,streamdetails.get("videocodec"),streamdetails.get("aspectratio"),streamdetails.get("width"),streamdetails.get("height"),streamdetails.get("3dformat")))
#audio details #audio details
sql="insert into streamdetails(idFile, iStreamType, strAudioCodec, iAudioChannels) values(?, ?, ?, ?)" sql="insert into streamdetails(idFile, iStreamType, strAudioCodec, iAudioChannels, strAudioLanguage, strSubtitleLanguage) values(?, ?, ?, ?, ?, ?)"
cursor.execute(sql, (fileid,1,streamdetails.get("audiocodec"),streamdetails.get("channels"))) cursor.execute(sql, (fileid,1,streamdetails.get("audiocodec"),streamdetails.get("channels"),streamdetails.get("audiolanguage"),streamdetails.get("subtitlelanguage")))
def addBoxsetToKodiLibrary(self, boxset, connection, cursor): def addBoxsetToKodiLibrary(self, boxset, connection, cursor):