Skip to content

Commit

Permalink
Fix ratings being appended to Kodi table instead of being replaced wh…
Browse files Browse the repository at this point in the history
…en a video item is updated
  • Loading branch information
Croneter authored and Croneter committed Feb 25, 2023
1 parent 72ea332 commit 984d90c
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion resources/lib/kodi_db/video.py
Original file line number Diff line number Diff line change
Expand Up @@ -864,8 +864,13 @@ def update_ratings(self, *args):
"""
Feed with media_id, media_type, rating_type, rating, votes, rating_id
"""
# Delete existing entries first
self.cursor.execute('''
INSERT OR REPLACE INTO
DELETE FROM rating WHERE media_id = ? AND media_type = ?
''', (args[0], args[1]))
# Then add the new one
self.cursor.execute('''
INSERT INTO
rating(media_id, media_type, rating_type, rating, votes)
VALUES (?, ?, ?, ?, ?)
''', (args))
Expand Down

0 comments on commit 984d90c

Please sign in to comment.