From 812e3090a55bf7bca82dc309df1f5f6228b15de8 Mon Sep 17 00:00:00 2001 From: Marcel van der Veldt Date: Sun, 3 May 2015 00:44:35 +0200 Subject: [PATCH] added support for 3d format in streamdetails --- resources/lib/API.py | 5 ++++- resources/lib/WriteKodiDB.py | 24 ++++++++++++------------ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/resources/lib/API.py b/resources/lib/API.py index 6f297024..85f16956 100644 --- a/resources/lib/API.py +++ b/resources/lib/API.py @@ -84,6 +84,7 @@ class API(): width = '' aspectratio = '1:1' aspectfloat = 1.85 + Video3DFormat = '' if mediaSources == True: mediaSources = item.get("MediaSources") @@ -102,6 +103,7 @@ class API(): height = int(mediaStream.get("Height")) width = int(mediaStream.get("Width")) aspectratio = mediaStream.get("AspectRatio") + Video3DFormat = item.get("Video3DFormat") if aspectratio != None and len(aspectratio) >= 3: try: aspectwidth,aspectheight = aspectratio.split(':') @@ -116,7 +118,8 @@ class API(): 'audiocodec' : audiocodec, 'height' : height, 'width' : width, - 'aspectratio' : aspectfloat + 'aspectratio' : aspectfloat, + '3dformat' : Video3DFormat } def getChecksum(self, item): diff --git a/resources/lib/WriteKodiDB.py b/resources/lib/WriteKodiDB.py index eaa402e3..cc65050f 100644 --- a/resources/lib/WriteKodiDB.py +++ b/resources/lib/WriteKodiDB.py @@ -162,10 +162,7 @@ class WriteKodiDB(): #create the reference in emby table pathsql = "INSERT into emby(emby_id, kodi_id, media_type, checksum) values(?, ?, ?, ?)" cursor.execute(pathsql, (MBitem["Id"], movieid, "movie", API().getChecksum(MBitem))) - - #add streamdetails - self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor) - + #### UPDATE THE MOVIE ##### else: utils.logMsg("UPDATE movie to Kodi library","Id: %s - Title: %s" % (embyId, title)) @@ -194,6 +191,9 @@ class WriteKodiDB(): #update studios self.AddStudiosToMedia(movieid, studios, "movie", cursor) + #add streamdetails + self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor) + #set resume point resume = int(round(float(timeInfo.get("ResumeTime"))))*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(?, ?, ?, ?)" cursor.execute(pathsql, (MBitem["Id"], idMVideo, "musicvideo", API().getChecksum(MBitem))) - #add streamdetails - self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor) - #### UPDATE THE VIDEO ##### else: utils.logMsg("UPDATE musicvideo to Kodi library","Id: %s - Title: %s" % (embyId, title)) @@ -328,6 +325,9 @@ class WriteKodiDB(): #update studios self.AddStudiosToMedia(idMVideo, studios, "musicvideo", cursor) + #add streamdetails + self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor) + #set resume point resume = int(round(float(timeInfo.get("ResumeTime"))))*60 total = int(round(float(timeInfo.get("TotalTime"))))*60 @@ -637,9 +637,6 @@ class WriteKodiDB(): #create the reference in emby table 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)) - - #add streamdetails - self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor) # UPDATE THE EPISODE IN KODI (for now, we just send in all data) else: @@ -659,6 +656,9 @@ class WriteKodiDB(): total = int(round(float(timeInfo.get("TotalTime"))))*60 self.setKodiResumePoint(fileid, resume, total, cursor) + #add streamdetails + self.AddStreamDetailsToMedia(API().getMediaStreams(MBitem), fileid, cursor) + #update artwork self.addOrUpdateArt(API().getArtwork(MBitem, "Primary"), episodeid, "episode", "thumb", cursor) @@ -990,8 +990,8 @@ class WriteKodiDB(): cursor.execute("delete FROM streamdetails WHERE idFile = ?", (fileid,)) if streamdetails: #video details - sql="insert into streamdetails(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, iVideoHeight) values(?, ?, ?, ?, ?, ?)" - cursor.execute(sql, (fileid,0,streamdetails.get("videocodec"),streamdetails.get("aspectratio"),streamdetails.get("width"),streamdetails.get("height"))) + 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"))) #audio details sql="insert into streamdetails(idFile, iStreamType, strAudioCodec, iAudioChannels) values(?, ?, ?, ?)" cursor.execute(sql, (fileid,1,streamdetails.get("audiocodec"),streamdetails.get("channels")))