diff --git a/resources/lib/itemtypes/movies.py b/resources/lib/itemtypes/movies.py index 2527a753..409534d0 100644 --- a/resources/lib/itemtypes/movies.py +++ b/resources/lib/itemtypes/movies.py @@ -217,6 +217,7 @@ class Movie(ItemBase): self.plexdb.add_movie(plex_id=plex_id, checksum=api.checksum(), section_id=section.id, + section_uuid=section.uuid, kodi_id=kodi_id, kodi_fileid=file_id, kodi_pathid=kodi_pathid, diff --git a/resources/lib/itemtypes/music.py b/resources/lib/itemtypes/music.py index 81247a17..aa2ebda5 100644 --- a/resources/lib/itemtypes/music.py +++ b/resources/lib/itemtypes/music.py @@ -210,6 +210,7 @@ class Artist(MusicMixin, ItemBase): self.plexdb.add_artist(plex_id, api.checksum(), section.id, + section.uuid, kodi_id, self.last_sync) @@ -361,6 +362,7 @@ class Album(MusicMixin, ItemBase): self.plexdb.add_album(plex_id, api.checksum(), section.id, + section.uuid, artist_id, parent_id, kodi_id, @@ -653,6 +655,7 @@ class Song(MusicMixin, ItemBase): self.plexdb.add_song(plex_id, api.checksum(), section.id, + section.uuid, artist_id, grandparent_id, album_id, diff --git a/resources/lib/itemtypes/tvshows.py b/resources/lib/itemtypes/tvshows.py index 7d0de95f..fc616cdc 100644 --- a/resources/lib/itemtypes/tvshows.py +++ b/resources/lib/itemtypes/tvshows.py @@ -279,6 +279,7 @@ class Show(TvShowMixin, ItemBase): self.plexdb.add_show(plex_id=plex_id, checksum=api.checksum(), section_id=section.id, + section_uuid=section.uuid, kodi_id=kodi_id, kodi_pathid=kodi_pathid, last_sync=self.last_sync) @@ -344,6 +345,7 @@ class Season(TvShowMixin, ItemBase): self.plexdb.add_season(plex_id=plex_id, checksum=api.checksum(), section_id=section.id, + section_uuid=section.uuid, show_id=show_id, parent_id=parent_id, kodi_id=kodi_id, @@ -538,6 +540,7 @@ class Episode(TvShowMixin, ItemBase): self.plexdb.add_episode(plex_id=plex_id, checksum=api.checksum(), section_id=section.id, + section_uuid=section.uuid, show_id=show_id, grandparent_id=grandparent_id, season_id=season_id, @@ -614,6 +617,7 @@ class Episode(TvShowMixin, ItemBase): self.plexdb.add_episode(plex_id=plex_id, checksum=api.checksum(), section_id=section.id, + section_uuid=section.uuid, show_id=show_id, grandparent_id=grandparent_id, season_id=season_id, diff --git a/resources/lib/plex_db/common.py b/resources/lib/plex_db/common.py index bf7d3890..37264a08 100644 --- a/resources/lib/plex_db/common.py +++ b/resources/lib/plex_db/common.py @@ -205,6 +205,7 @@ def initialize(): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, kodi_id INTEGER, kodi_fileid INTEGER, kodi_pathid INTEGER, @@ -216,6 +217,7 @@ def initialize(): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, kodi_id INTEGER, kodi_pathid INTEGER, fanart_synced INTEGER, @@ -226,6 +228,7 @@ def initialize(): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, show_id INTEGER, parent_id INTEGER, kodi_id INTEGER, @@ -237,6 +240,7 @@ def initialize(): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, show_id INTEGER, grandparent_id INTEGER, season_id INTEGER, @@ -253,6 +257,7 @@ def initialize(): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, kodi_id INTEGER, last_sync INTEGER) ''') @@ -261,6 +266,7 @@ def initialize(): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, artist_id INTEGER, parent_id INTEGER, kodi_id INTEGER, @@ -271,6 +277,7 @@ def initialize(): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, artist_id INTEGER, grandparent_id INTEGER, album_id INTEGER, diff --git a/resources/lib/plex_db/movies.py b/resources/lib/plex_db/movies.py index 74ed360b..36c5aad7 100644 --- a/resources/lib/plex_db/movies.py +++ b/resources/lib/plex_db/movies.py @@ -5,8 +5,8 @@ from .. import variables as v class Movies(object): - def add_movie(self, plex_id, checksum, section_id, kodi_id, kodi_fileid, - kodi_pathid, last_sync): + def add_movie(self, plex_id, checksum, section_id, section_uuid, kodi_id, + kodi_fileid, kodi_pathid, last_sync): """ Appends or replaces an entry into the plex table for movies """ @@ -15,18 +15,20 @@ class Movies(object): plex_id, checksum, section_id, + section_uuid, kodi_id, kodi_fileid, kodi_pathid, fanart_synced, last_sync) - VALUES (?, ?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ''' self.cursor.execute( query, (plex_id, checksum, section_id, + section_uuid, kodi_id, kodi_fileid, kodi_pathid, @@ -39,6 +41,7 @@ class Movies(object): plex_id INTEGER PRIMARY KEY ASC, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, kodi_id INTEGER, kodi_fileid INTEGER, kodi_pathid INTEGER, @@ -61,9 +64,10 @@ class Movies(object): 'plex_id': entry[0], 'checksum': entry[1], 'section_id': entry[2], - 'kodi_id': entry[3], - 'kodi_fileid': entry[4], - 'kodi_pathid': entry[5], - 'fanart_synced': entry[6], - 'last_sync': entry[7] + 'section_uuid': entry[3], + 'kodi_id': entry[4], + 'kodi_fileid': entry[5], + 'kodi_pathid': entry[6], + 'fanart_synced': entry[7], + 'last_sync': entry[8] } diff --git a/resources/lib/plex_db/music.py b/resources/lib/plex_db/music.py index ca954ae4..5e3a7523 100644 --- a/resources/lib/plex_db/music.py +++ b/resources/lib/plex_db/music.py @@ -5,7 +5,8 @@ from .. import variables as v class Music(object): - def add_artist(self, plex_id, checksum, section_id, kodi_id, last_sync): + def add_artist(self, plex_id, checksum, section_id, section_uuid, kodi_id, + last_sync): """ Appends or replaces music artist entry into the plex table """ @@ -14,20 +15,22 @@ class Music(object): plex_id, checksum, section_id, + section_uuid, kodi_id, last_sync) - VALUES (?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?) ''' self.cursor.execute( query, (plex_id, checksum, section_id, + section_uuid, kodi_id, last_sync)) - def add_album(self, plex_id, checksum, section_id, artist_id, parent_id, - kodi_id, last_sync): + def add_album(self, plex_id, checksum, section_id, section_uuid, artist_id, + parent_id, kodi_id, last_sync): """ Appends or replaces an entry into the plex table """ @@ -36,24 +39,27 @@ class Music(object): plex_id, checksum, section_id, + section_uuid, artist_id, parent_id, kodi_id, last_sync) - VALUES (?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?) ''' self.cursor.execute( query, (plex_id, checksum, section_id, + section_uuid, artist_id, parent_id, kodi_id, last_sync)) - def add_song(self, plex_id, checksum, section_id, artist_id, grandparent_id, - album_id, parent_id, kodi_id, kodi_pathid, last_sync): + def add_song(self, plex_id, checksum, section_id, section_uuid, artist_id, + grandparent_id, album_id, parent_id, kodi_id, kodi_pathid, + last_sync): """ Appends or replaces an entry into the plex table """ @@ -62,6 +68,7 @@ class Music(object): plex_id, checksum, section_id, + section_uuid, artist_id, grandparent_id, album_id, @@ -69,13 +76,14 @@ class Music(object): kodi_id, kodi_pathid, last_sync) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ''' self.cursor.execute( query, (plex_id, checksum, section_id, + section_uuid, artist_id, grandparent_id, album_id, @@ -90,6 +98,7 @@ class Music(object): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, kodi_id INTEGER, last_sync INTEGER """ @@ -105,6 +114,7 @@ class Music(object): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, artist_id INTEGER, # plex_id of the parent artist parent_id INTEGER, # kodi_id of the parent artist kodi_id INTEGER, @@ -122,6 +132,7 @@ class Music(object): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, artist_id INTEGER, # plex_id of the parent artist grandparent_id INTEGER, # kodi_id of the parent artist album_id INTEGER, # plex_id of the parent album @@ -146,13 +157,14 @@ class Music(object): 'plex_id': entry[0], 'checksum': entry[1], 'section_id': entry[2], - 'artist_id': entry[3], - 'grandparent_id': entry[4], - 'album_id': entry[5], - 'parent_id': entry[6], - 'kodi_id': entry[7], - 'kodi_pathid': entry[8], - 'last_sync': entry[9] + 'section_uuid': entry[3], + 'artist_id': entry[4], + 'grandparent_id': entry[5], + 'album_id': entry[6], + 'parent_id': entry[7], + 'kodi_id': entry[8], + 'kodi_pathid': entry[9], + 'last_sync': entry[10] } @staticmethod @@ -165,10 +177,11 @@ class Music(object): 'plex_id': entry[0], 'checksum': entry[1], 'section_id': entry[2], - 'artist_id': entry[3], - 'parent_id': entry[4], - 'kodi_id': entry[5], - 'last_sync': entry[6] + 'section_uuid': entry[3], + 'artist_id': entry[4], + 'parent_id': entry[5], + 'kodi_id': entry[6], + 'last_sync': entry[7] } @staticmethod @@ -181,8 +194,9 @@ class Music(object): 'plex_id': entry[0], 'checksum': entry[1], 'section_id': entry[2], - 'kodi_id': entry[3], - 'last_sync': entry[4] + 'section_uuid': entry[3], + 'kodi_id': entry[4], + 'last_sync': entry[5] } def album_has_songs(self, plex_id): diff --git a/resources/lib/plex_db/tvshows.py b/resources/lib/plex_db/tvshows.py index ae643b0e..41af5fb3 100644 --- a/resources/lib/plex_db/tvshows.py +++ b/resources/lib/plex_db/tvshows.py @@ -5,8 +5,8 @@ from .. import variables as v class TVShows(object): - def add_show(self, plex_id, checksum, section_id, kodi_id, kodi_pathid, - last_sync): + def add_show(self, plex_id, checksum, section_id, section_uuid, kodi_id, + kodi_pathid, last_sync): """ Appends or replaces tv show entry into the plex table """ @@ -16,22 +16,24 @@ class TVShows(object): plex_id, checksum, section_id, + section_uuid, kodi_id, kodi_pathid, fanart_synced, last_sync) - VALUES (?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?) ''', (plex_id, checksum, section_id, + section_uuid, kodi_id, kodi_pathid, 0, last_sync)) - def add_season(self, plex_id, checksum, section_id, show_id, parent_id, - kodi_id, last_sync): + def add_season(self, plex_id, checksum, section_id, section_uuid, show_id, + parent_id, kodi_id, last_sync): """ Appends or replaces an entry into the plex table """ @@ -41,23 +43,25 @@ class TVShows(object): plex_id, checksum, section_id, + section_uuid, show_id, parent_id, kodi_id, fanart_synced, last_sync) - VALUES (?, ?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?) ''', (plex_id, checksum, section_id, + section_uuid, show_id, parent_id, kodi_id, 0, last_sync)) - def add_episode(self, plex_id, checksum, section_id, show_id, + def add_episode(self, plex_id, checksum, section_id, section_uuid, show_id, grandparent_id, season_id, parent_id, kodi_id, kodi_fileid, kodi_fileid_2, kodi_pathid, last_sync): """ @@ -69,6 +73,7 @@ class TVShows(object): plex_id, checksum, section_id, + section_uuid, show_id, grandparent_id, season_id, @@ -79,11 +84,12 @@ class TVShows(object): kodi_pathid, fanart_synced, last_sync) - VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) + VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) ''', (plex_id, checksum, section_id, + section_uuid, show_id, grandparent_id, season_id, @@ -101,6 +107,7 @@ class TVShows(object): plex_id INTEGER PRIMARY KEY ASC, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, kodi_id INTEGER, kodi_pathid INTEGER, fanart_synced INTEGER, @@ -118,6 +125,7 @@ class TVShows(object): plex_id INTEGER PRIMARY KEY, checksum INTEGER UNIQUE, section_id INTEGER, + section_uuid TEXT, show_id INTEGER, # plex_id of the parent show parent_id INTEGER, # kodi_id of the parent show kodi_id INTEGER, @@ -147,16 +155,17 @@ class TVShows(object): 'plex_id': entry[0], 'checksum': entry[1], 'section_id': entry[2], - 'show_id': entry[3], - 'grandparent_id': entry[4], - 'season_id': entry[5], - 'parent_id': entry[6], - 'kodi_id': entry[7], - 'kodi_fileid': entry[8], - 'kodi_fileid_2': entry[9], - 'kodi_pathid': entry[10], - 'fanart_synced': entry[11], - 'last_sync': entry[12] + 'section_uuid': entry[3], + 'show_id': entry[4], + 'grandparent_id': entry[5], + 'season_id': entry[6], + 'parent_id': entry[7], + 'kodi_id': entry[8], + 'kodi_fileid': entry[9], + 'kodi_fileid_2': entry[10], + 'kodi_pathid': entry[11], + 'fanart_synced': entry[12], + 'last_sync': entry[13] } @staticmethod @@ -169,10 +178,11 @@ class TVShows(object): 'plex_id': entry[0], 'checksum': entry[1], 'section_id': entry[2], - 'kodi_id': entry[3], - 'kodi_pathid': entry[4], - 'fanart_synced': entry[5], - 'last_sync': entry[6] + 'section_uuid': entry[3], + 'kodi_id': entry[4], + 'kodi_pathid': entry[5], + 'fanart_synced': entry[6], + 'last_sync': entry[7] } @staticmethod @@ -185,11 +195,12 @@ class TVShows(object): 'plex_id': entry[0], 'checksum': entry[1], 'section_id': entry[2], - 'show_id': entry[3], - 'parent_id': entry[4], - 'kodi_id': entry[5], - 'fanart_synced': entry[6], - 'last_sync': entry[7] + 'section_uuid': entry[3], + 'show_id': entry[4], + 'parent_id': entry[5], + 'kodi_id': entry[6], + 'fanart_synced': entry[7], + 'last_sync': entry[8] } def season_has_episodes(self, plex_id):