Delete studios from the Kodi DB

This commit is contained in:
croneter 2018-02-25 18:20:44 +01:00
parent bad32e90ab
commit 652f5757cf
2 changed files with 12 additions and 0 deletions

View file

@ -483,6 +483,7 @@ class Movies(Items):
self.kodi_db.delete_countries(kodi_id, kodi_type) self.kodi_db.delete_countries(kodi_id, kodi_type)
self.kodi_db.delete_people(kodi_id, kodi_type) self.kodi_db.delete_people(kodi_id, kodi_type)
self.kodi_db.delete_genre(kodi_id, kodi_type) self.kodi_db.delete_genre(kodi_id, kodi_type)
self.kodi_db.delete_studios(kodi_id, kodi_type)
# Delete kodi movie and file # Delete kodi movie and file
kodicursor.execute("DELETE FROM movie WHERE idMovie = ?", kodicursor.execute("DELETE FROM movie WHERE idMovie = ?",
(kodi_id,)) (kodi_id,))
@ -1207,6 +1208,7 @@ class TVShows(Items):
""" """
kodicursor = self.kodicursor kodicursor = self.kodicursor
self.kodi_db.delete_genre(kodi_id, v.KODI_TYPE_SHOW) self.kodi_db.delete_genre(kodi_id, v.KODI_TYPE_SHOW)
self.kodi_db.delete_studios(kodi_id, v.KODI_TYPE_SHOW)
self.artwork.deleteArtwork(kodi_id, v.KODI_TYPE_SHOW, kodicursor) self.artwork.deleteArtwork(kodi_id, v.KODI_TYPE_SHOW, kodicursor)
kodicursor.execute("DELETE FROM tvshow WHERE idShow = ?", (kodi_id,)) kodicursor.execute("DELETE FROM tvshow WHERE idShow = ?", (kodi_id,))
if v.KODIVERSION >= 17: if v.KODIVERSION >= 17:

View file

@ -548,6 +548,16 @@ class KodiDBMethods(object):
''') ''')
self.cursor.execute(query, (studioid, kodiid, mediatype)) self.cursor.execute(query, (studioid, kodiid, mediatype))
def delete_studios(self, kodi_id, kodi_type):
"""
Removes the studio links as well as orphaned studios from the Kodi DB
"""
self._delete_from_link_and_table(kodi_id,
kodi_type,
'studio_link',
'studio',
'studio_id')
def addStreams(self, fileid, streamdetails, runtime): def addStreams(self, fileid, streamdetails, runtime):
# First remove any existing entries # First remove any existing entries