Optimize code
This commit is contained in:
parent
6d39adbd8c
commit
b4e132af85
1 changed files with 16 additions and 31 deletions
|
@ -38,37 +38,22 @@ 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')):
|
||||||
if path_id is None:
|
path_id = self.get_path(path)
|
||||||
query = '''
|
if path_id is None:
|
||||||
INSERT INTO path(strPath,
|
query = '''
|
||||||
strContent,
|
INSERT INTO path(strPath,
|
||||||
strScraper,
|
strContent,
|
||||||
noUpdate,
|
strScraper,
|
||||||
exclude)
|
noUpdate,
|
||||||
VALUES (?, ?, ?, ?, ?)
|
exclude)
|
||||||
'''
|
VALUES (?, ?, ?, ?, ?)
|
||||||
self.cursor.execute(query, (MOVIE_PATH,
|
'''
|
||||||
'movies',
|
self.cursor.execute(query, (path,
|
||||||
'metadata.local',
|
kind,
|
||||||
1,
|
'metadata.local',
|
||||||
0))
|
1,
|
||||||
# And TV shows
|
0))
|
||||||
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',
|
|
||||||
1,
|
|
||||||
0))
|
|
||||||
|
|
||||||
@db.catch_operationalerrors
|
@db.catch_operationalerrors
|
||||||
def parent_path_id(self, path):
|
def parent_path_id(self, path):
|
||||||
|
|
Loading…
Reference in a new issue