mirror of
https://github.com/jellyfin/jellyfin-kodi.git
synced 2024-11-10 04:06:11 +00:00
fixed 'args' beiing provided as list for dict.get() method
before the people cache was never used, because the 'args' parameter in the 'self._people_cache.get(args)' call was a list/tuple object; but the people cache dictionary has only strings as keys -> so there were always database queries for the persons which slowed down the sync process also renamed 'args' to 'name', because basically a person gets searched only by its name (see queries.py)
This commit is contained in:
parent
ce5a74c3a8
commit
0359e0f80a
1 changed files with 10 additions and 9 deletions
|
@ -160,22 +160,23 @@ class Kodi(object):
|
|||
self.cursor.execute(QU.add_person, args)
|
||||
return self.cursor.lastrowid
|
||||
|
||||
def _get_person(self, *args):
|
||||
def _get_person(self, name):
|
||||
'''Retrieve person from the database, or add them if they don't exist
|
||||
'''
|
||||
resp = self.cursor.execute(QU.get_person, args).fetchone()
|
||||
resp = self.cursor.execute(QU.get_person, (name,)).fetchone()
|
||||
if resp is not None:
|
||||
return resp[0]
|
||||
else:
|
||||
return self.add_person(*args)
|
||||
return self.add_person(name)
|
||||
|
||||
def get_person(self, *args):
|
||||
def get_person(self, name):
|
||||
'''Retrieve person from cache, else forward to db query
|
||||
'''
|
||||
person_id = self._people_cache.get(args)
|
||||
if not person_id:
|
||||
person_id = self._get_person(*args)
|
||||
self._people_cache[args] = person_id
|
||||
if name in self._people_cache:
|
||||
return self._people_cache[name]
|
||||
else:
|
||||
person_id = self._get_person(name)
|
||||
self._people_cache[name] = person_id
|
||||
return person_id
|
||||
|
||||
def add_genres(self, genres, *args):
|
||||
|
|
Loading…
Reference in a new issue