start of kodi uniqueid

This commit is contained in:
im85288 2016-12-29 21:04:22 +00:00
parent 863919d696
commit 87501eedea
3 changed files with 32 additions and 1 deletions

View file

@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.emby" <addon id="plugin.video.emby"
name="Emby" name="Emby"
version="2.3.26" version="2.3.27"
provider-name="Emby.media"> provider-name="Emby.media">
<requires> <requires>
<import addon="xbmc.python" version="2.19.0"/> <import addon="xbmc.python" version="2.19.0"/>

View file

@ -21,6 +21,12 @@ class KodiMovies(KodiItems):
KodiItems.__init__(self) KodiItems.__init__(self)
def create_entry_uniqueid(self):
self.cursor.execute("select coalesce(max(uniqueid_id),0) from uniqueid")
kodi_id = self.cursor.fetchone()[0] + 1
return kodi_id
def create_entry_rating(self): def create_entry_rating(self):
self.cursor.execute("select coalesce(max(rating_id),0) from rating") self.cursor.execute("select coalesce(max(rating_id),0) from rating")
kodi_id = self.cursor.fetchone()[0] + 1 kodi_id = self.cursor.fetchone()[0] + 1
@ -128,6 +134,26 @@ class KodiMovies(KodiItems):
)) ))
self.cursor.execute(query, (args)) self.cursor.execute(query, (args))
def add_uniqueid(self, *args):
query = (
'''
INSERT INTO uniqueid(
uniqueid_id, media_id, media_type, value, type)
VALUES (?, ?, ?, ?, ?)
'''
)
self.cursor.execute(query, (args))
def update_uniqueid(self, *args):
query = ' '.join((
"UPDATE uniqueid",
"SET media_id = ?, media_type = ?, value = ?, type = ?",
"WHERE uniqueid_id = ?"
))
self.cursor.execute(query, (args))
def add_countries(self, kodi_id, countries): def add_countries(self, kodi_id, countries):
if self.kodi_version > 14: if self.kodi_version > 14:

View file

@ -315,6 +315,11 @@ class Movies(Items):
self.kodi_db.add_ratings(ratingid, movieid, "movie", "default", rating, votecount) self.kodi_db.add_ratings(ratingid, movieid, "movie", "default", rating, votecount)
# update new uniqueid Kodi 17 - todo get uniqueid_id for updates from embydb
if self.kodi_version > 16:
uniqueid = self.kodi_db.create_entry_uniqueid()
self.kodi_db.add_uniqueid(uniqueid, movieid, "movie", imdb, "imdb")
return True return True
def add_updateBoxset(self, boxset): def add_updateBoxset(self, boxset):