Skip to content

Commit

Permalink
Merge pull request #742 from GregoireDruant/fix/music-video-db-update
Browse files Browse the repository at this point in the history
Fix music video db update
  • Loading branch information
oddstr13 authored Aug 18, 2023
2 parents eadcc46 + 9bfbe7e commit dd4b996
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
4 changes: 2 additions & 2 deletions jellyfin_kodi/objects/kodi/kodi.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ def add_thumbnail(person_id, person, person_type):
bulk_updates.setdefault(sql, []).append((person_id,) + args)

elif person['Type'] == 'Artist':
sql = QU.update_link.replace("{LinkType}", 'actor_link')
bulk_updates.setdefault(sql, []).append((person_id,) + args)
sql = QU.insert_link_if_not_exists.replace("{LinkType}", 'actor_link')
bulk_updates.setdefault(sql, []).append((person_id,) + args + (person_id,) + args)

add_thumbnail(person_id, person, person['Type'])

Expand Down
7 changes: 7 additions & 0 deletions jellyfin_kodi/objects/kodi/queries.py
Original file line number Diff line number Diff line change
Expand Up @@ -395,6 +395,13 @@
INSERT OR REPLACE INTO {LinkType}(actor_id, media_id, media_type)
VALUES (?, ?, ?)
"""
# update_link does not work for actor_link as not all values from unique index are provided
# Resulting in duplicates
insert_link_if_not_exists = """
INSERT INTO {LinkType}(actor_id, media_id, media_type)
SELECT ?, ?, ?
WHERE NOT EXISTS(SELECT 1 FROM {LinkType} WHERE actor_id = ? AND media_id = ? AND media_type = ?)
"""
update_movie = """
UPDATE movie
SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?,
Expand Down
2 changes: 0 additions & 2 deletions jellyfin_kodi/objects/musicvideos.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,6 @@ def musicvideo(self, item, e_item):
obj['Year'] = int(str(obj['Year'])[:4])

obj['Path'] = API.get_file_path(obj['Path'])
obj['LibraryId'] = self.library['Id']
obj['LibraryName'] = self.library['Name']
obj['Genres'] = obj['Genres'] or []
obj['ArtistItems'] = obj['ArtistItems'] or []
obj['Studios'] = [API.validate_studio(studio) for studio in (obj['Studios'] or [])]
Expand Down

0 comments on commit dd4b996

Please sign in to comment.