More explicit coding
This commit is contained in:
parent
d9b83065e3
commit
e1bb74c341
1 changed files with 5 additions and 5 deletions
|
@ -18,20 +18,20 @@ log = logging.getLogger("PLEX."+__name__)
|
||||||
|
|
||||||
class GetKodiDB():
|
class GetKodiDB():
|
||||||
"""
|
"""
|
||||||
Usage: with GetKodiDB(itemType) as kodi_db:
|
Usage: with GetKodiDB(db_type) as kodi_db:
|
||||||
do stuff with kodi_db
|
do stuff with kodi_db
|
||||||
|
|
||||||
Parameters:
|
Parameters:
|
||||||
itemType: itemtype for Kodi DB, e.g. 'video', 'music'
|
db_type: DB to open: 'video', 'music', 'plex', 'texture'
|
||||||
|
|
||||||
On exiting "with" (no matter what), commits get automatically committed
|
On exiting "with" (no matter what), commits get automatically committed
|
||||||
and the db gets closed
|
and the db gets closed
|
||||||
"""
|
"""
|
||||||
def __init__(self, itemType):
|
def __init__(self, db_type):
|
||||||
self.itemType = itemType
|
self.db_type = db_type
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
self.kodiconn = kodiSQL(self.itemType)
|
self.kodiconn = kodiSQL(self.db_type)
|
||||||
kodi_db = Kodidb_Functions(self.kodiconn.cursor())
|
kodi_db = Kodidb_Functions(self.kodiconn.cursor())
|
||||||
return kodi_db
|
return kodi_db
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue