From 096af4dc7c74cc9d03a7d8f608be1c35e2c47cd0 Mon Sep 17 00:00:00 2001 From: croneter Date: Fri, 9 Nov 2018 07:42:47 +0100 Subject: [PATCH] Simplify code --- resources/lib/kodi_db/video.py | 24 +----------------------- 1 file changed, 1 insertion(+), 23 deletions(-) diff --git a/resources/lib/kodi_db/video.py b/resources/lib/kodi_db/video.py index 9e5bce47..3d8cf766 100644 --- a/resources/lib/kodi_db/video.py +++ b/resources/lib/kodi_db/video.py @@ -423,29 +423,7 @@ class KodiVideoDB(common.KodiDBBase): # Delete any associated artwork self.delete_artwork(person[0], 'actor') # Save new people to Kodi DB by iterating over the remaining entries - if kind == 'actor': - query = 'INSERT INTO actor_link VALUES (?, ?, ?, ?, ?)' - for person in people_list: - # Make sure the person entry in table actor exists - actor_id = self._get_actor_id(person[0], art_url=person[1]) - # Link the person with the media element - try: - self.cursor.execute(query, (actor_id, kodi_id, kodi_type, - person[2], person[3])) - except IntegrityError: - # With Kodi, an actor may have only one role, unlike Plex - pass - else: - query = 'INSERT INTO %s_link VALUES (?, ?, ?)' % kind - for person in people_list: - # Make sure the person entry in table actor exists: - actor_id = self._get_actor_id(person[0]) - # Link the person with the media element - try: - self.cursor.execute(query, (actor_id, kodi_id, kodi_type)) - except IntegrityError: - # Again, Kodi may have only one person assigned to a role - pass + self._add_people_kind(kodi_id, kodi_type, kind, people_list) def _get_actor_id(self, name, art_url=None): """