Delete genres in Kodi DB

This commit is contained in:
croneter 2018-02-25 18:15:17 +01:00
parent eedabf5888
commit bad32e90ab
2 changed files with 12 additions and 0 deletions

View file

@ -482,6 +482,7 @@ class Movies(Items):
if kodi_type == v.KODI_TYPE_MOVIE:
self.kodi_db.delete_countries(kodi_id, kodi_type)
self.kodi_db.delete_people(kodi_id, kodi_type)
self.kodi_db.delete_genre(kodi_id, kodi_type)
# Delete kodi movie and file
kodicursor.execute("DELETE FROM movie WHERE idMovie = ?",
(kodi_id,))
@ -1205,6 +1206,7 @@ class TVShows(Items):
Remove a TV show, and only the show, no seasons or episodes
"""
kodicursor = self.kodicursor
self.kodi_db.delete_genre(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

@ -506,6 +506,16 @@ class KodiDBMethods(object):
'''
self.cursor.execute(query, (genre_id, kodi_id, kodi_type))
def delete_genre(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,
'genre_link',
'genre',
'genre_id')
def addStudios(self, kodiid, studios, mediatype):
for studio in studios:
query = ' '.join((