added support for 3d format in streamdetails

This commit is contained in:
Marcel van der Veldt 2015-05-03 00:44:35 +02:00
parent d69e474f3e
commit 812e3090a5
2 changed files with 16 additions and 13 deletions

View file

@ -84,6 +84,7 @@ class API():
width = '' width = ''
aspectratio = '1:1' aspectratio = '1:1'
aspectfloat = 1.85 aspectfloat = 1.85
Video3DFormat = ''
if mediaSources == True: if mediaSources == True:
mediaSources = item.get("MediaSources") mediaSources = item.get("MediaSources")
@ -102,6 +103,7 @@ class API():
height = int(mediaStream.get("Height")) height = int(mediaStream.get("Height"))
width = int(mediaStream.get("Width")) width = int(mediaStream.get("Width"))
aspectratio = mediaStream.get("AspectRatio") aspectratio = mediaStream.get("AspectRatio")
Video3DFormat = item.get("Video3DFormat")
if aspectratio != None and len(aspectratio) >= 3: if aspectratio != None and len(aspectratio) >= 3:
try: try:
aspectwidth,aspectheight = aspectratio.split(':') aspectwidth,aspectheight = aspectratio.split(':')
@ -116,7 +118,8 @@ class API():
'audiocodec' : audiocodec, 'audiocodec' : audiocodec,
'height' : height, 'height' : height,
'width' : width, 'width' : width,
'aspectratio' : aspectfloat 'aspectratio' : aspectfloat,
'3dformat' : Video3DFormat
} }
def getChecksum(self, item): def getChecksum(self, item):

View file

@ -163,9 +163,6 @@ class WriteKodiDB():
pathsql = "INSERT into emby(emby_id, kodi_id, media_type, checksum) values(?, ?, ?, ?)" pathsql = "INSERT into emby(emby_id, kodi_id, media_type, checksum) values(?, ?, ?, ?)"
cursor.execute(pathsql, (MBitem["Id"], movieid, "movie", API().getChecksum(MBitem))) cursor.execute(pathsql, (MBitem["Id"], movieid, "movie", API().getChecksum(MBitem)))
#add streamdetails
self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor)
#### UPDATE THE MOVIE ##### #### UPDATE THE MOVIE #####
else: else:
utils.logMsg("UPDATE movie to Kodi library","Id: %s - Title: %s" % (embyId, title)) utils.logMsg("UPDATE movie to Kodi library","Id: %s - Title: %s" % (embyId, title))
@ -194,6 +191,9 @@ class WriteKodiDB():
#update studios #update studios
self.AddStudiosToMedia(movieid, studios, "movie", cursor) self.AddStudiosToMedia(movieid, studios, "movie", cursor)
#add streamdetails
self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor)
#set resume point #set resume point
resume = int(round(float(timeInfo.get("ResumeTime"))))*60 resume = int(round(float(timeInfo.get("ResumeTime"))))*60
total = int(round(float(timeInfo.get("TotalTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60
@ -297,9 +297,6 @@ class WriteKodiDB():
pathsql = "INSERT into emby(emby_id, kodi_id, media_type, checksum) values(?, ?, ?, ?)" pathsql = "INSERT into emby(emby_id, kodi_id, media_type, checksum) values(?, ?, ?, ?)"
cursor.execute(pathsql, (MBitem["Id"], idMVideo, "musicvideo", API().getChecksum(MBitem))) cursor.execute(pathsql, (MBitem["Id"], idMVideo, "musicvideo", API().getChecksum(MBitem)))
#add streamdetails
self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor)
#### UPDATE THE VIDEO ##### #### UPDATE THE VIDEO #####
else: else:
utils.logMsg("UPDATE musicvideo to Kodi library","Id: %s - Title: %s" % (embyId, title)) utils.logMsg("UPDATE musicvideo to Kodi library","Id: %s - Title: %s" % (embyId, title))
@ -328,6 +325,9 @@ class WriteKodiDB():
#update studios #update studios
self.AddStudiosToMedia(idMVideo, studios, "musicvideo", cursor) self.AddStudiosToMedia(idMVideo, studios, "musicvideo", cursor)
#add streamdetails
self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor)
#set resume point #set resume point
resume = int(round(float(timeInfo.get("ResumeTime"))))*60 resume = int(round(float(timeInfo.get("ResumeTime"))))*60
total = int(round(float(timeInfo.get("TotalTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60
@ -638,9 +638,6 @@ class WriteKodiDB():
pathsql = "INSERT into emby(emby_id, kodi_id, media_type, checksum, parent_id) values(?, ?, ?, ?, ?)" pathsql = "INSERT into emby(emby_id, kodi_id, media_type, checksum, parent_id) values(?, ?, ?, ?, ?)"
cursor.execute(pathsql, (MBitem["Id"], episodeid, "episode", API().getChecksum(MBitem), showid)) cursor.execute(pathsql, (MBitem["Id"], episodeid, "episode", API().getChecksum(MBitem), showid))
#add streamdetails
self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor)
# UPDATE THE EPISODE IN KODI (for now, we just send in all data) # UPDATE THE EPISODE IN KODI (for now, we just send in all data)
else: else:
utils.logMsg("UPDATE episode to Kodi library","Id: %s - Title: %s" % (embyId, title)) utils.logMsg("UPDATE episode to Kodi library","Id: %s - Title: %s" % (embyId, title))
@ -659,6 +656,9 @@ class WriteKodiDB():
total = int(round(float(timeInfo.get("TotalTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60
self.setKodiResumePoint(fileid, resume, total, cursor) self.setKodiResumePoint(fileid, resume, total, cursor)
#add streamdetails
self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor)
#update artwork #update artwork
self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), episodeid, "episode", "thumb", cursor) self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), episodeid, "episode", "thumb", cursor)
@ -990,8 +990,8 @@ class WriteKodiDB():
cursor.execute("delete FROM streamdetails WHERE idFile = ?", (fileid,)) cursor.execute("delete FROM streamdetails WHERE idFile = ?", (fileid,))
if streamdetails: if streamdetails:
#video details #video details
sql="insert into streamdetails(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight) 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"))) 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) values(?, ?, ?, ?)"
cursor.execute(sql, (fileid,1,streamdetails.get("audiocodec"),streamdetails.get("channels"))) cursor.execute(sql, (fileid,1,streamdetails.get("audiocodec"),streamdetails.get("channels")))