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.
|
For some reason, Kodi ignores this if done via itemtypes while e.g.
|
||||||
adding or updating items. (addPath method does NOT work)
|
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:
|
if path_id is None:
|
||||||
query = '''
|
query = '''
|
||||||
INSERT INTO path(strPath,
|
INSERT INTO path(strPath,
|
||||||
|
@ -48,24 +49,8 @@ class KodiVideoDB(common.KodiDBBase):
|
||||||
exclude)
|
exclude)
|
||||||
VALUES (?, ?, ?, ?, ?)
|
VALUES (?, ?, ?, ?, ?)
|
||||||
'''
|
'''
|
||||||
self.cursor.execute(query, (MOVIE_PATH,
|
self.cursor.execute(query, (path,
|
||||||
'movies',
|
kind,
|
||||||
'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',
|
|
||||||
'metadata.local',
|
'metadata.local',
|
||||||
1,
|
1,
|
||||||
0))
|
0))
|
||||||
|
|
Loading…
Reference in a new issue