close con when needed

This commit is contained in:
Marcel van der Veldt 2015-05-06 16:17:33 +02:00
parent cdd6239736
commit 6997c7f79a
1 changed files with 5 additions and 0 deletions

View File

@ -49,8 +49,13 @@ class ReadKodiDB():
if not connection: if not connection:
connection = utils.KodiSQL() connection = utils.KodiSQL()
cursor = connection.cursor() cursor = connection.cursor()
closeCon = True
else:
closeCon = False
cursor.execute("SELECT emby_id FROM emby WHERE media_type=? AND kodi_id=?",(type,id)) cursor.execute("SELECT emby_id FROM emby WHERE media_type=? AND kodi_id=?",(type,id))
result = cursor.fetchone() result = cursor.fetchone()
if closeCon:
connection.close()
if result: if result:
return result[0] return result[0]
else: else: