From 7ac7b1db3128f89b848d59bb0d6222b45a2ef8bb Mon Sep 17 00:00:00 2001 From: Matthew Schick Date: Mon, 16 May 2016 11:56:48 -0400 Subject: [PATCH] Quick hack to get sets working --- resources/lib/itemtypes.py | 2 ++ resources/lib/kodidb_functions.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/resources/lib/itemtypes.py b/resources/lib/itemtypes.py index 3d7465ba..f1a68a51 100644 --- a/resources/lib/itemtypes.py +++ b/resources/lib/itemtypes.py @@ -530,6 +530,8 @@ class Movies(Items): if userdata['Favorite']: tags.append("Favorite movies") self.kodi_db.addTags(movieid, tags, "movie") + # Add any sets from Plex collection tags + self.kodi_db.addSets(movieid, collections) # Process playstates self.kodi_db.addPlaystate(fileid, resume, runtime, playcount, dateplayed) diff --git a/resources/lib/kodidb_functions.py b/resources/lib/kodidb_functions.py index 29eee017..34953b1f 100644 --- a/resources/lib/kodidb_functions.py +++ b/resources/lib/kodidb_functions.py @@ -1181,6 +1181,11 @@ class Kodidb_Functions(): )) self.cursor.execute(query, (kodiid, mediatype, tag_id,)) + def addSets(self, movieid, collections): + for setname in collections: + setid = self.createBoxset(setname) + self.assignBoxset(setid, movieid) + def createBoxset(self, boxsetname): self.logMsg("Adding boxset: %s" % boxsetname, 2) @@ -1386,4 +1391,4 @@ class Kodidb_Functions(): self.cursor.execute(query, (genreid, genre)) query = "INSERT OR REPLACE INTO song_genre(idGenre, idSong) values(?, ?)" - self.cursor.execute(query, (genreid, kodiid)) \ No newline at end of file + self.cursor.execute(query, (genreid, kodiid))