Delete playstates from Kodi DB

This commit is contained in:
croneter 2018-02-26 09:33:13 +01:00
parent 725132131c
commit e21c16f846
2 changed files with 11 additions and 3 deletions

View file

@ -487,6 +487,7 @@ class Movies(Items):
self.kodi_db.delete_studios(kodi_id, kodi_type) self.kodi_db.delete_studios(kodi_id, kodi_type)
self.kodi_db.delete_tags(kodi_id, kodi_type) self.kodi_db.delete_tags(kodi_id, kodi_type)
self.kodi_db.modify_streams(file_id) self.kodi_db.modify_streams(file_id)
self.kodi_db.delete_playstate(file_id)
# 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,))
@ -1232,17 +1233,18 @@ class TVShows(Items):
(kodi_id,)) (kodi_id,))
LOG.info("Removed season: %s.", kodi_id) LOG.info("Removed season: %s.", kodi_id)
def removeEpisode(self, kodi_id, fileid): def removeEpisode(self, kodi_id, file_id):
""" """
Remove an episode, and episode only Remove an episode, and episode only
""" """
kodicursor = self.kodicursor kodicursor = self.kodicursor
self.kodi_db.delete_people(kodi_id, v.KODI_TYPE_EPISODE) self.kodi_db.delete_people(kodi_id, v.KODI_TYPE_EPISODE)
self.kodi_db.modify_streams(fileid) self.kodi_db.modify_streams(file_id)
self.kodi_db.delete_playstate(file_id)
self.artwork.deleteArtwork(kodi_id, "episode", kodicursor) self.artwork.deleteArtwork(kodi_id, "episode", kodicursor)
kodicursor.execute("DELETE FROM episode WHERE idEpisode = ?", kodicursor.execute("DELETE FROM episode WHERE idEpisode = ?",
(kodi_id,)) (kodi_id,))
kodicursor.execute("DELETE FROM files WHERE idFile = ?", (fileid,)) kodicursor.execute("DELETE FROM files WHERE idFile = ?", (file_id,))
if v.KODIVERSION >= 17: if v.KODIVERSION >= 17:
self.kodi_db.remove_uniqueid(kodi_id, v.KODI_TYPE_EPISODE) self.kodi_db.remove_uniqueid(kodi_id, v.KODI_TYPE_EPISODE)
self.kodi_db.remove_ratings(kodi_id, v.KODI_TYPE_EPISODE) self.kodi_db.remove_ratings(kodi_id, v.KODI_TYPE_EPISODE)

View file

@ -846,6 +846,12 @@ class KodiDBMethods(object):
'', '',
1)) 1))
def delete_playstate(self, file_id):
"""
Removes all playstates/bookmarks for the file with file_id
"""
self.cursor.execute('DELETE FROM bookmark where idFile = ?', (file_id,))
def addTags(self, kodiid, tags, mediatype): def addTags(self, kodiid, tags, mediatype):
# First, delete any existing tags associated to the id # First, delete any existing tags associated to the id
query = ' '.join(( query = ' '.join((