Optimize code
This commit is contained in:
parent
6d39adbd8c
commit
b4e132af85
1 changed files with 16 additions and 31 deletions
|
@ -38,7 +38,8 @@ class KodiVideoDB(common.KodiDBBase):
|
|||
For some reason, Kodi ignores this if done via itemtypes while e.g.
|
||||
adding or updating items. (addPath method does NOT work)
|
||||
"""
|
||||
path_id = self.get_path(MOVIE_PATH)
|
||||
for path, kind in ((MOVIE_PATH, 'movies'), (SHOW_PATH, 'tvshows')):
|
||||
path_id = self.get_path(path)
|
||||
if path_id is None:
|
||||
query = '''
|
||||
INSERT INTO path(strPath,
|
||||
|
@ -48,24 +49,8 @@ class KodiVideoDB(common.KodiDBBase):
|
|||
exclude)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (MOVIE_PATH,
|
||||
'movies',
|
||||
'metadata.local',
|
||||
1,
|
||||
0))
|
||||
# And TV shows
|
||||
path_id = self.get_path(SHOW_PATH)
|
||||
if path_id is None:
|
||||
query = '''
|
||||
INSERT INTO path(strPath,
|
||||
strContent,
|
||||
strScraper,
|
||||
noUpdate,
|
||||
exclude)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (SHOW_PATH,
|
||||
'tvshows',
|
||||
self.cursor.execute(query, (path,
|
||||
kind,
|
||||
'metadata.local',
|
||||
1,
|
||||
0))
|
||||
|
|
Loading…
Reference in a new issue