Delete tags from Kodi DB

This commit is contained in:
croneter 2018-02-25 18:31:45 +01:00
parent 652f5757cf
commit 1a2e8bf6ee
2 changed files with 12 additions and 0 deletions

View file

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

View file

@ -858,6 +858,16 @@ class KodiDBMethods(object):
for tag in tags:
self.addTag(kodiid, tag, mediatype)
def delete_tags(self, kodi_id, kodi_type):
"""
Removes the genre links as well as orphaned genres from the Kodi DB
"""
self._delete_from_link_and_table(kodi_id,
kodi_type,
'tag_link',
'tag',
'tag_id')
def addTag(self, kodiid, tag, mediatype):
query = ' '.join((