some code cleanup and small changes
fixed episode thumb
This commit is contained in:
parent
3077df6407
commit
c31b5ecebe
2 changed files with 28 additions and 75 deletions
|
@ -20,7 +20,7 @@ class ReadKodiDB():
|
||||||
def getKodiMovie(self, id):
|
def getKodiMovie(self, id):
|
||||||
#returns a single movie from Kodi db selected on MB item ID
|
#returns a single movie from Kodi db selected on MB item ID
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "lastplayed", "writer", "playcount", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "properties" : ["art", "rating", "thumbnail", "fanart", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "lastplayed", "writer", "playcount", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMovies"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
movie = None
|
movie = None
|
||||||
|
|
||||||
|
@ -76,7 +76,7 @@ class ReadKodiDB():
|
||||||
#returns all movies in Kodi db
|
#returns all movies in Kodi db
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
if fullInfo:
|
if fullInfo:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "properties" : ["art", "rating", "thumbnail", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "lastplayed", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"] }, "id": "libMovies"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "properties" : ["art", "rating", "thumbnail", "fanart", "resume", "runtime", "year", "genre", "cast", "trailer", "country", "lastplayed", "studio", "set", "imdbnumber", "mpaa", "tagline", "plotoutline","plot", "sorttitle", "director", "writer", "playcount", "tag", "file"] }, "id": "libMovies"}')
|
||||||
else:
|
else:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "properties" : ["resume", "playcount", "imdbnumber", "lastplayed", "file"] }, "id": "libMovies"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "properties" : ["resume", "playcount", "imdbnumber", "lastplayed", "file"] }, "id": "libMovies"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
|
@ -175,7 +175,7 @@ class ReadKodiDB():
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
episodes = None
|
episodes = None
|
||||||
if fullInfo:
|
if fullInfo:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["title", "playcount", "plot", "season", "episode", "showtitle", "file", "lastplayed", "rating", "resume", "art", "streamdetails", "firstaired", "runtime", "writer", "cast", "director", "dateadded","uniqueid"], "sort": {"method": "episode"}}, "id": 1}' %KodiTvShowId)
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["title", "playcount", "plot", "season", "episode", "showtitle", "file", "lastplayed", "rating", "resume", "art", "streamdetails", "firstaired", "runtime", "writer", "cast", "director", "dateadded", "uniqueid", "thumbnail", "fanart"], "sort": {"method": "episode"}}, "id": 1}' %KodiTvShowId)
|
||||||
else:
|
else:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["title", "playcount", "season", "episode", "lastplayed", "resume","file","uniqueid"], "sort": {"method": "episode"}}, "id": 1}' %KodiTvShowId)
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetEpisodes", "params": {"tvshowid": %d, "properties": ["title", "playcount", "season", "episode", "lastplayed", "resume","file","uniqueid"], "sort": {"method": "episode"}}, "id": 1}' %KodiTvShowId)
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
|
@ -228,7 +228,7 @@ class ReadKodiDB():
|
||||||
cursor.close()
|
cursor.close()
|
||||||
|
|
||||||
if musicvideoid != None:
|
if musicvideoid != None:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideosDetails", "params": { "musicvideoid": ' + musicvideoid + ', "properties" : ["art", "thumbnail", "resume", "runtime", "year", "genre", "studio", "artist", "album", "track","plot", "director", "playcount", "lastplayed", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMusicVideos"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideosDetails", "params": { "musicvideoid": ' + musicvideoid + ', "properties" : ["art", "thumbnail", "fanart", "resume", "runtime", "year", "genre", "studio", "artist", "album", "track","plot", "director", "playcount", "lastplayed", "tag", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": "libMusicVideos"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
musicvideo = None
|
musicvideo = None
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@ class ReadKodiDB():
|
||||||
#returns all musicvideos in Kodi db inserted by MB
|
#returns all musicvideos in Kodi db inserted by MB
|
||||||
xbmc.sleep(sleepVal)
|
xbmc.sleep(sleepVal)
|
||||||
if fullInfo:
|
if fullInfo:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "properties" : ["art", "thumbnail", "resume", "runtime", "year", "genre", "studio", "artist", "album", "track", "lastplayed", "plot", "director", "playcount", "tag", "file"] }, "id": "libMusicVideos"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "properties" : ["art", "thumbnail", "fanart", "resume", "runtime", "year", "genre", "studio", "artist", "album", "track", "lastplayed", "plot", "director", "playcount", "tag", "file"] }, "id": "libMusicVideos"}')
|
||||||
else:
|
else:
|
||||||
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "properties" : ["resume", "playcount", "lastplayed", "file", "track"] }, "id": "libMusicVideos"}')
|
json_response = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "VideoLibrary.GetMusicVideos", "params": { "properties" : ["resume", "playcount", "lastplayed", "file", "track"] }, "id": "libMusicVideos"}')
|
||||||
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
jsonobject = json.loads(json_response.decode('utf-8','replace'))
|
||||||
|
|
|
@ -359,8 +359,6 @@ class WriteKodiDB():
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
#downloadUtils = DownloadUtils()
|
|
||||||
#userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
people = API().getPeople(MBitem)
|
people = API().getPeople(MBitem)
|
||||||
|
@ -369,8 +367,6 @@ class WriteKodiDB():
|
||||||
mediaStreams=API().getMediaStreams(MBitem)
|
mediaStreams=API().getMediaStreams(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
|
|
||||||
thumbPath = API().getArtwork(MBitem, "Primary")
|
|
||||||
|
|
||||||
changes = False
|
changes = False
|
||||||
|
|
||||||
#update/check all artwork
|
#update/check all artwork
|
||||||
|
@ -378,7 +374,7 @@ class WriteKodiDB():
|
||||||
|
|
||||||
#set Filename (will update the filename in db if changed)
|
#set Filename (will update the filename in db if changed)
|
||||||
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
||||||
docleanup = self.setKodiFilename(KodiItem["episodeid"], KodiItem["file"], playurl, "episode", MBitem["Id"], connection, cursor)
|
self.setKodiFilename(KodiItem["episodeid"], KodiItem["file"], playurl, "episode", MBitem["Id"], connection, cursor)
|
||||||
|
|
||||||
#update common properties
|
#update common properties
|
||||||
if KodiItem["runtime"] == 0:
|
if KodiItem["runtime"] == 0:
|
||||||
|
@ -406,15 +402,13 @@ class WriteKodiDB():
|
||||||
episode = int(MBitem.get("IndexNumber"))
|
episode = int(MBitem.get("IndexNumber"))
|
||||||
changes |= self.updateProperty(KodiItem,"episode",episode,"episode")
|
changes |= self.updateProperty(KodiItem,"episode",episode,"episode")
|
||||||
|
|
||||||
#plot = utils.convertEncoding(API().getOverview(MBitem))
|
plot = utils.convertEncoding(API().getOverview(MBitem))
|
||||||
#changes |= self.updateProperty(KodiItem,"plot",plot,"episode")
|
changes |= self.updateProperty(KodiItem,"plot",plot,"episode")
|
||||||
title = utils.convertEncoding(MBitem["Name"])
|
title = utils.convertEncoding(MBitem["Name"])
|
||||||
changes |= self.updateProperty(KodiItem,"title",title,"episode")
|
changes |= self.updateProperty(KodiItem,"title",title,"episode")
|
||||||
|
|
||||||
changes |= self.updatePropertyArray(KodiItem,"writer",people.get("Writer"),"episode")
|
changes |= self.updatePropertyArray(KodiItem,"writer",people.get("Writer"),"episode")
|
||||||
changes |= self.updatePropertyArray(KodiItem,"director",people.get("Director"),"episode")
|
changes |= self.updatePropertyArray(KodiItem,"director",people.get("Director"),"episode")
|
||||||
|
|
||||||
|
|
||||||
#add actors
|
#add actors
|
||||||
changes |= self.AddActorsToMedia(KodiItem,MBitem.get("People"),"episode", connection, cursor)
|
changes |= self.AddActorsToMedia(KodiItem,MBitem.get("People"),"episode", connection, cursor)
|
||||||
|
|
||||||
|
@ -499,9 +493,10 @@ class WriteKodiDB():
|
||||||
changes = False
|
changes = False
|
||||||
|
|
||||||
artwork = {}
|
artwork = {}
|
||||||
artwork["poster"] = API().getArtwork(MBitem, "Primary")
|
artwork["thumb"] = API().getArtwork(MBitem, "Primary")
|
||||||
|
|
||||||
if(item_type != "Episode"):
|
if(item_type != "Episode"):
|
||||||
|
artwork["poster"] = API().getArtwork(MBitem, "Primary")
|
||||||
artwork["banner"] = API().getArtwork(MBitem, "Banner")
|
artwork["banner"] = API().getArtwork(MBitem, "Banner")
|
||||||
artwork["clearlogo"] = API().getArtwork(MBitem, "Logo")
|
artwork["clearlogo"] = API().getArtwork(MBitem, "Logo")
|
||||||
artwork["clearart"] = API().getArtwork(MBitem, "Art")
|
artwork["clearart"] = API().getArtwork(MBitem, "Art")
|
||||||
|
@ -696,12 +691,6 @@ class WriteKodiDB():
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
people = API().getPeople(MBitem)
|
|
||||||
genre = API().getGenre(MBitem)
|
|
||||||
studios = API().getStudios(MBitem)
|
|
||||||
mediaStreams=API().getMediaStreams(MBitem)
|
|
||||||
|
|
||||||
thumbPath = API().getArtwork(MBitem, "Primary")
|
|
||||||
|
|
||||||
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
||||||
playurl = utils.convertEncoding(playurl)
|
playurl = utils.convertEncoding(playurl)
|
||||||
|
@ -712,9 +701,6 @@ class WriteKodiDB():
|
||||||
else:
|
else:
|
||||||
dateadded = None
|
dateadded = None
|
||||||
|
|
||||||
#connection = utils.KodiSQL()
|
|
||||||
#cursor = connection.cursor()
|
|
||||||
|
|
||||||
# we need to store both the path and the filename seperately in the kodi db so we split them up
|
# we need to store both the path and the filename seperately in the kodi db so we split them up
|
||||||
if "\\" in playurl:
|
if "\\" in playurl:
|
||||||
filename = playurl.rsplit("\\",1)[-1]
|
filename = playurl.rsplit("\\",1)[-1]
|
||||||
|
@ -753,8 +739,6 @@ class WriteKodiDB():
|
||||||
|
|
||||||
runtime = int(timeInfo.get('Duration'))*60
|
runtime = int(timeInfo.get('Duration'))*60
|
||||||
plot = utils.convertEncoding(API().getOverview(MBitem))
|
plot = utils.convertEncoding(API().getOverview(MBitem))
|
||||||
thumb = "<thumb>" + API().getArtwork(MBitem, "Primary") + "</thumb>"
|
|
||||||
fanart = "<fanart>" + API().getArtwork(MBitem, "Backdrop") + "</fanart>"
|
|
||||||
title = utils.convertEncoding(MBitem["Name"])
|
title = utils.convertEncoding(MBitem["Name"])
|
||||||
sorttitle = utils.convertEncoding(MBitem["SortName"])
|
sorttitle = utils.convertEncoding(MBitem["SortName"])
|
||||||
year = MBitem.get("ProductionYear")
|
year = MBitem.get("ProductionYear")
|
||||||
|
@ -779,9 +763,9 @@ class WriteKodiDB():
|
||||||
cursor.execute("select coalesce(max(idMovie),0) as movieid from movie")
|
cursor.execute("select coalesce(max(idMovie),0) as movieid from movie")
|
||||||
movieid = cursor.fetchone()[0]
|
movieid = cursor.fetchone()[0]
|
||||||
movieid = movieid + 1
|
movieid = movieid + 1
|
||||||
pathsql="insert into movie(idMovie, idFile, c00, c01, c02, c05, c07, c08, c09, c10, c11, c16, c19, c20) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
pathsql="insert into movie(idMovie, idFile, c00, c01, c02, c05, c07, c09, c10, c11, c16, c19) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
|
|
||||||
cursor.execute(pathsql, (movieid, fileid, title, plot, shortplot, rating, year, thumb, MBitem["Id"], sorttitle, runtime, title, trailerUrl, fanart))
|
cursor.execute(pathsql, (movieid, fileid, title, plot, shortplot, rating, year, MBitem["Id"], sorttitle, runtime, title, trailerUrl))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
@ -799,17 +783,9 @@ class WriteKodiDB():
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
#downloadUtils = DownloadUtils()
|
|
||||||
#userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
people = API().getPeople(MBitem)
|
|
||||||
genre = API().getGenre(MBitem)
|
|
||||||
studios = API().getStudios(MBitem)
|
|
||||||
mediaStreams=API().getMediaStreams(MBitem)
|
|
||||||
|
|
||||||
thumbPath = API().getArtwork(MBitem, "Primary")
|
|
||||||
|
|
||||||
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
||||||
playurl = utils.convertEncoding(playurl)
|
playurl = utils.convertEncoding(playurl)
|
||||||
|
@ -820,9 +796,6 @@ class WriteKodiDB():
|
||||||
else:
|
else:
|
||||||
dateadded = None
|
dateadded = None
|
||||||
|
|
||||||
#connection = utils.KodiSQL()
|
|
||||||
#cursor = connection.cursor()
|
|
||||||
|
|
||||||
# we need to store both the path and the filename seperately in the kodi db so we split them up
|
# we need to store both the path and the filename seperately in the kodi db so we split them up
|
||||||
if "\\" in playurl:
|
if "\\" in playurl:
|
||||||
filename = playurl.rsplit("\\",1)[-1]
|
filename = playurl.rsplit("\\",1)[-1]
|
||||||
|
@ -861,15 +834,14 @@ class WriteKodiDB():
|
||||||
|
|
||||||
runtime = int(timeInfo.get('Duration'))*60
|
runtime = int(timeInfo.get('Duration'))*60
|
||||||
plot = utils.convertEncoding(API().getOverview(MBitem))
|
plot = utils.convertEncoding(API().getOverview(MBitem))
|
||||||
thumb = "<thumb>" + API().getArtwork(MBitem, "Primary") + "</thumb>"
|
|
||||||
title = utils.convertEncoding(MBitem["Name"])
|
title = utils.convertEncoding(MBitem["Name"])
|
||||||
|
|
||||||
#create the musicvideo
|
#create the musicvideo
|
||||||
cursor.execute("select coalesce(max(idMVideo),0) as musicvideoid from musicvideo")
|
cursor.execute("select coalesce(max(idMVideo),0) as musicvideoid from musicvideo")
|
||||||
musicvideoid = cursor.fetchone()[0]
|
musicvideoid = cursor.fetchone()[0]
|
||||||
musicvideoid = musicvideoid + 1
|
musicvideoid = musicvideoid + 1
|
||||||
pathsql="insert into musicvideo(idMVideo, idFile, c00, c01, c04, c08, c23) values(?, ?, ?, ?, ?, ?, ?)"
|
pathsql="insert into musicvideo(idMVideo, idFile, c00, c04, c08, c23) values(?, ?, ?, ?, ?, ?)"
|
||||||
cursor.execute(pathsql, (musicvideoid, fileid, title, thumb, runtime, plot, MBitem["Id"]))
|
cursor.execute(pathsql, (musicvideoid, fileid, title, runtime, plot, MBitem["Id"]))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
@ -894,17 +866,9 @@ class WriteKodiDB():
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
#downloadUtils = DownloadUtils()
|
|
||||||
#userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
people = API().getPeople(MBitem)
|
|
||||||
genre = API().getGenre(MBitem)
|
|
||||||
studios = API().getStudios(MBitem)
|
|
||||||
mediaStreams=API().getMediaStreams(MBitem)
|
|
||||||
|
|
||||||
thumbPath = API().getArtwork(MBitem, "Primary")
|
|
||||||
|
|
||||||
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
playurl = PlayUtils().getPlayUrl(server, MBitem["Id"], MBitem)
|
||||||
playurl = utils.convertEncoding(playurl)
|
playurl = utils.convertEncoding(playurl)
|
||||||
|
@ -920,9 +884,6 @@ class WriteKodiDB():
|
||||||
else:
|
else:
|
||||||
lastplayed = None
|
lastplayed = None
|
||||||
|
|
||||||
#connection = utils.KodiSQL()
|
|
||||||
#cursor = connection.cursor()
|
|
||||||
|
|
||||||
# we need to store both the path and the filename seperately in the kodi db so we split them up
|
# we need to store both the path and the filename seperately in the kodi db so we split them up
|
||||||
if "\\" in playurl:
|
if "\\" in playurl:
|
||||||
filename = playurl.rsplit("\\",1)[-1]
|
filename = playurl.rsplit("\\",1)[-1]
|
||||||
|
@ -973,16 +934,20 @@ class WriteKodiDB():
|
||||||
|
|
||||||
runtime = int(timeInfo.get('Duration'))*60
|
runtime = int(timeInfo.get('Duration'))*60
|
||||||
plot = utils.convertEncoding(API().getOverview(MBitem))
|
plot = utils.convertEncoding(API().getOverview(MBitem))
|
||||||
thumb = "<thumb>" + API().getArtwork(MBitem, "Primary") + "</thumb>"
|
|
||||||
title = utils.convertEncoding(MBitem["Name"])
|
title = utils.convertEncoding(MBitem["Name"])
|
||||||
rating = MBitem.get("CommunityRating")
|
rating = MBitem.get("CommunityRating")
|
||||||
|
if MBitem.get("PremiereDate") != None:
|
||||||
|
premieredatelist = (MBitem.get("PremiereDate")).split("T")
|
||||||
|
premieredate = premieredatelist[0]
|
||||||
|
else:
|
||||||
|
premieredate = None
|
||||||
|
|
||||||
#create the episode
|
#create the episode
|
||||||
cursor.execute("select coalesce(max(idEpisode),0) as episodeid from episode")
|
cursor.execute("select coalesce(max(idEpisode),0) as episodeid from episode")
|
||||||
episodeid = cursor.fetchone()[0]
|
episodeid = cursor.fetchone()[0]
|
||||||
episodeid = episodeid + 1
|
episodeid = episodeid + 1
|
||||||
pathsql="INSERT into episode(idEpisode, idFile, c00, c01, c03, c06, c09, c20, c12, c13, c14, idShow) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
pathsql="INSERT into episode(idEpisode, idFile, c00, c01, c03, c05, c09, c20, c12, c13, c14, idShow) values(?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
||||||
cursor.execute(pathsql, (episodeid, fileid, title, plot, rating, thumb, runtime, MBitem["Id"], season, episode, title, showid))
|
cursor.execute(pathsql, (episodeid, fileid, title, plot, rating, premieredate, runtime, MBitem["Id"], season, episode, title, showid))
|
||||||
|
|
||||||
try:
|
try:
|
||||||
connection.commit()
|
connection.commit()
|
||||||
|
@ -1022,15 +987,9 @@ class WriteKodiDB():
|
||||||
port = addon.getSetting('port')
|
port = addon.getSetting('port')
|
||||||
host = addon.getSetting('ipaddress')
|
host = addon.getSetting('ipaddress')
|
||||||
server = host + ":" + port
|
server = host + ":" + port
|
||||||
#downloadUtils = DownloadUtils()
|
|
||||||
#userid = downloadUtils.getUserId()
|
|
||||||
|
|
||||||
timeInfo = API().getTimeInfo(MBitem)
|
timeInfo = API().getTimeInfo(MBitem)
|
||||||
userData=API().getUserData(MBitem)
|
userData=API().getUserData(MBitem)
|
||||||
people = API().getPeople(MBitem)
|
|
||||||
genre = API().getGenre(MBitem)
|
|
||||||
studios = API().getStudios(MBitem)
|
|
||||||
mediaStreams=API().getMediaStreams(MBitem)
|
|
||||||
|
|
||||||
thumbPath = API().getArtwork(MBitem, "Primary")
|
thumbPath = API().getArtwork(MBitem, "Primary")
|
||||||
|
|
||||||
|
@ -1044,9 +1003,6 @@ class WriteKodiDB():
|
||||||
else:
|
else:
|
||||||
dateadded = None
|
dateadded = None
|
||||||
|
|
||||||
#connection = utils.KodiSQL()
|
|
||||||
#cursor = connection.cursor()
|
|
||||||
|
|
||||||
#create the tv show path
|
#create the tv show path
|
||||||
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
|
cursor.execute("select coalesce(max(idPath),0) as pathid from path")
|
||||||
pathid = cursor.fetchone()[0]
|
pathid = cursor.fetchone()[0]
|
||||||
|
@ -1073,8 +1029,6 @@ class WriteKodiDB():
|
||||||
|
|
||||||
runtime = int(timeInfo.get('Duration'))*60
|
runtime = int(timeInfo.get('Duration'))*60
|
||||||
plot = utils.convertEncoding(API().getOverview(MBitem))
|
plot = utils.convertEncoding(API().getOverview(MBitem))
|
||||||
thumb = "<thumb>" + API().getArtwork(MBitem, "Primary") + "</thumb>"
|
|
||||||
fanart = "<fanart>" + API().getArtwork(MBitem, "Backdrop") + "</fanart>"
|
|
||||||
title = utils.convertEncoding(MBitem["Name"])
|
title = utils.convertEncoding(MBitem["Name"])
|
||||||
sorttitle = utils.convertEncoding(MBitem["SortName"])
|
sorttitle = utils.convertEncoding(MBitem["SortName"])
|
||||||
rating = MBitem.get("CommunityRating")
|
rating = MBitem.get("CommunityRating")
|
||||||
|
@ -1083,8 +1037,8 @@ class WriteKodiDB():
|
||||||
cursor.execute("select coalesce(max(idShow),0) as showid from tvshow")
|
cursor.execute("select coalesce(max(idShow),0) as showid from tvshow")
|
||||||
showid = cursor.fetchone()[0]
|
showid = cursor.fetchone()[0]
|
||||||
showid = pathid + 1
|
showid = pathid + 1
|
||||||
pathsql="insert into tvshow(idShow, c00, c01, c04, c06, c09, c11, c12, c15) values(?, ?, ?, ?, ?, ?, ?, ?, ?)"
|
pathsql="insert into tvshow(idShow, c00, c01, c04, c09, c12, c15) values(?, ?, ?, ?, ?, ?, ?)"
|
||||||
cursor.execute(pathsql, (showid, title, plot, rating, thumb, title, fanart, MBitem["Id"], sorttitle))
|
cursor.execute(pathsql, (showid, title, plot, rating, title, MBitem["Id"], sorttitle))
|
||||||
|
|
||||||
#link the path
|
#link the path
|
||||||
pathsql="insert into tvshowlinkpath(idShow,idPath) values(?, ?)"
|
pathsql="insert into tvshowlinkpath(idShow,idPath) values(?, ?)"
|
||||||
|
@ -1137,7 +1091,6 @@ class WriteKodiDB():
|
||||||
cursor.execute("INSERT into art(media_id, media_type, type, url) values(?, ?, ?, ?)", (seasonid,"season","banner",API().getArtwork(season, "Banner")))
|
cursor.execute("INSERT into art(media_id, media_type, type, url) values(?, ?, ?, ?)", (seasonid,"season","banner",API().getArtwork(season, "Banner")))
|
||||||
|
|
||||||
connection.commit()
|
connection.commit()
|
||||||
#cursor.close()
|
|
||||||
|
|
||||||
def setKodiResumePoint(self, id, resume_seconds, total_seconds, fileType):
|
def setKodiResumePoint(self, id, resume_seconds, total_seconds, fileType):
|
||||||
#use sqlite to set the resume point while json api doesn't support this yet
|
#use sqlite to set the resume point while json api doesn't support this yet
|
||||||
|
|
Loading…
Reference in a new issue