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))