added streamdetails
This commit is contained in:
parent
b4dd9f58bd
commit
42c7256f54
2 changed files with 23 additions and 4 deletions
|
@ -99,8 +99,8 @@ class API():
|
||||||
for mediaStream in MediaStreams:
|
for mediaStream in MediaStreams:
|
||||||
if(mediaStream.get("Type") == "Video"):
|
if(mediaStream.get("Type") == "Video"):
|
||||||
videocodec = mediaStream.get("Codec")
|
videocodec = mediaStream.get("Codec")
|
||||||
height = str(mediaStream.get("Height"))
|
height = int(mediaStream.get("Height"))
|
||||||
width = str(mediaStream.get("Width"))
|
width = int(mediaStream.get("Width"))
|
||||||
aspectratio = mediaStream.get("AspectRatio")
|
aspectratio = mediaStream.get("AspectRatio")
|
||||||
if aspectratio != None and len(aspectratio) >= 3:
|
if aspectratio != None and len(aspectratio) >= 3:
|
||||||
try:
|
try:
|
||||||
|
@ -116,7 +116,7 @@ class API():
|
||||||
'audiocodec' : audiocodec,
|
'audiocodec' : audiocodec,
|
||||||
'height' : height,
|
'height' : height,
|
||||||
'width' : width,
|
'width' : width,
|
||||||
'aspectratio' : str(aspectfloat)
|
'aspectratio' : aspectfloat
|
||||||
}
|
}
|
||||||
|
|
||||||
def getChecksum(self, item):
|
def getChecksum(self, item):
|
||||||
|
|
|
@ -157,6 +157,9 @@ 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:
|
||||||
pathsql="update movie SET c00 = ?, c01 = ?, c02 = ?, c05 = ?, c06 = ?, c07 = ?, c09 = ? c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?, c16 = ?, c18 = ?, c19 = ? WHERE idMovie = ?"
|
pathsql="update movie SET c00 = ?, c01 = ?, c02 = ?, c05 = ?, c06 = ?, c07 = ?, c09 = ? c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?, c16 = ?, c18 = ?, c19 = ? WHERE idMovie = ?"
|
||||||
|
@ -501,6 +504,9 @@ class WriteKodiDB():
|
||||||
#create the reference in emby table
|
#create the reference in emby table
|
||||||
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:
|
||||||
|
@ -850,7 +856,20 @@ class WriteKodiDB():
|
||||||
utils.logMsg("AddTagToMedia", "Processing : " + tag)
|
utils.logMsg("AddTagToMedia", "Processing : " + tag)
|
||||||
sql="INSERT OR REPLACE into taglinks(idTag, idMedia, media_type) values(?, ?, ?)"
|
sql="INSERT OR REPLACE into taglinks(idTag, idMedia, media_type) values(?, ?, ?)"
|
||||||
cursor.execute(sql, (idTag, id, mediatype))
|
cursor.execute(sql, (idTag, id, mediatype))
|
||||||
|
|
||||||
|
def AddStreamDetailsToMedia(self, streamdetails, fileid, cursor):
|
||||||
|
|
||||||
|
#first remove any existing entries
|
||||||
|
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")))
|
||||||
|
#audio details
|
||||||
|
sql="insert into streamdetails(idFile, iStreamType, strAudioCodec, iAudioChannels) values(?, ?, ?, ?)"
|
||||||
|
cursor.execute(sql, (fileid,1,streamdetails.get("audiocodec"),streamdetails.get("channels")))
|
||||||
|
|
||||||
|
|
||||||
def addBoxsetToKodiLibrary(self, boxset, connection, cursor):
|
def addBoxsetToKodiLibrary(self, boxset, connection, cursor):
|
||||||
|
|
||||||
strSet = boxset["Name"]
|
strSet = boxset["Name"]
|
||||||
|
|
Loading…
Reference in a new issue