self cursor
This commit is contained in:
parent
47beade09a
commit
75414f5f07
1 changed files with 303 additions and 324 deletions
|
@ -25,7 +25,6 @@ class Embydb_Functions():
|
||||||
|
|
||||||
def getViews(self):
|
def getViews(self):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
views = []
|
views = []
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
@ -33,8 +32,8 @@ class Embydb_Functions():
|
||||||
"SELECT view_id",
|
"SELECT view_id",
|
||||||
"FROM view"
|
"FROM view"
|
||||||
))
|
))
|
||||||
embycursor.execute(query)
|
self.embycursor.execute(query)
|
||||||
rows = embycursor.fetchall()
|
rows = self.embycursor.fetchall()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
views.append(row[0])
|
views.append(row[0])
|
||||||
|
|
||||||
|
@ -42,7 +41,6 @@ class Embydb_Functions():
|
||||||
|
|
||||||
def getView_byId(self, viewid):
|
def getView_byId(self, viewid):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
|
@ -50,14 +48,13 @@ class Embydb_Functions():
|
||||||
"FROM view",
|
"FROM view",
|
||||||
"WHERE view_id = ?"
|
"WHERE view_id = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (viewid,))
|
self.embycursor.execute(query, (viewid,))
|
||||||
view = embycursor.fetchone()
|
view = self.embycursor.fetchone()
|
||||||
|
|
||||||
return view
|
return view
|
||||||
|
|
||||||
def getView_byType(self, mediatype):
|
def getView_byType(self, mediatype):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
views = []
|
views = []
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
@ -66,8 +63,8 @@ class Embydb_Functions():
|
||||||
"FROM view",
|
"FROM view",
|
||||||
"WHERE media_type = ?"
|
"WHERE media_type = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (mediatype,))
|
self.embycursor.execute(query, (mediatype,))
|
||||||
rows = embycursor.fetchall()
|
rows = self.embycursor.fetchall()
|
||||||
for row in rows:
|
for row in rows:
|
||||||
views.append({
|
views.append({
|
||||||
|
|
||||||
|
@ -79,17 +76,15 @@ class Embydb_Functions():
|
||||||
|
|
||||||
def getView_byName(self, tagname):
|
def getView_byName(self, tagname):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT view_id",
|
"SELECT view_id",
|
||||||
"FROM view",
|
"FROM view",
|
||||||
"WHERE view_name = ?"
|
"WHERE view_name = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (tagname,))
|
self.embycursor.execute(query, (tagname,))
|
||||||
try:
|
try:
|
||||||
view = embycursor.fetchone()[0]
|
view = self.embycursor.fetchone()[0]
|
||||||
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
view = None
|
view = None
|
||||||
|
@ -129,8 +124,6 @@ class Embydb_Functions():
|
||||||
|
|
||||||
def getItem_byId(self, embyid):
|
def getItem_byId(self, embyid):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT kodi_id, kodi_fileid, kodi_pathid, parent_id, media_type, emby_type",
|
"SELECT kodi_id, kodi_fileid, kodi_pathid, parent_id, media_type, emby_type",
|
||||||
|
@ -138,45 +131,39 @@ class Embydb_Functions():
|
||||||
"WHERE emby_id = ?"
|
"WHERE emby_id = ?"
|
||||||
))
|
))
|
||||||
try:
|
try:
|
||||||
embycursor.execute(query, (embyid,))
|
self.embycursor.execute(query, (embyid,))
|
||||||
item = embycursor.fetchone()
|
item = self.embycursor.fetchone()
|
||||||
return item
|
return item
|
||||||
except: return None
|
except: return None
|
||||||
|
|
||||||
def getItem_byWildId(self, embyid):
|
def getItem_byWildId(self, embyid):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT kodi_id, media_type",
|
"SELECT kodi_id, media_type",
|
||||||
"FROM emby",
|
"FROM emby",
|
||||||
"WHERE emby_id LIKE ?"
|
"WHERE emby_id LIKE ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (embyid+"%",))
|
self.embycursor.execute(query, (embyid+"%",))
|
||||||
items = embycursor.fetchall()
|
items = self.embycursor.fetchall()
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def getItem_byView(self, mediafolderid):
|
def getItem_byView(self, mediafolderid):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT kodi_id",
|
"SELECT kodi_id",
|
||||||
"FROM emby",
|
"FROM emby",
|
||||||
"WHERE media_folder = ?"
|
"WHERE media_folder = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (mediafolderid,))
|
self.embycursor.execute(query, (mediafolderid,))
|
||||||
items = embycursor.fetchall()
|
items = self.embycursor.fetchall()
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def getItem_byKodiId(self, kodiid, mediatype):
|
def getItem_byKodiId(self, kodiid, mediatype):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT emby_id, parent_id",
|
"SELECT emby_id, parent_id",
|
||||||
|
@ -184,15 +171,13 @@ class Embydb_Functions():
|
||||||
"WHERE kodi_id = ?",
|
"WHERE kodi_id = ?",
|
||||||
"AND media_type = ?"
|
"AND media_type = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (kodiid, mediatype,))
|
self.embycursor.execute(query, (kodiid, mediatype,))
|
||||||
item = embycursor.fetchone()
|
item = self.embycursor.fetchone()
|
||||||
|
|
||||||
return item
|
return item
|
||||||
|
|
||||||
def getItem_byParentId(self, parentid, mediatype):
|
def getItem_byParentId(self, parentid, mediatype):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT emby_id, kodi_id, kodi_fileid",
|
"SELECT emby_id, kodi_id, kodi_fileid",
|
||||||
|
@ -200,15 +185,13 @@ class Embydb_Functions():
|
||||||
"WHERE parent_id = ?",
|
"WHERE parent_id = ?",
|
||||||
"AND media_type = ?"
|
"AND media_type = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (parentid, mediatype,))
|
self.embycursor.execute(query, (parentid, mediatype,))
|
||||||
items = embycursor.fetchall()
|
items = self.embycursor.fetchall()
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def getItemId_byParentId(self, parentid, mediatype):
|
def getItemId_byParentId(self, parentid, mediatype):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT emby_id, kodi_id",
|
"SELECT emby_id, kodi_id",
|
||||||
|
@ -216,39 +199,35 @@ class Embydb_Functions():
|
||||||
"WHERE parent_id = ?",
|
"WHERE parent_id = ?",
|
||||||
"AND media_type = ?"
|
"AND media_type = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (parentid, mediatype,))
|
self.embycursor.execute(query, (parentid, mediatype,))
|
||||||
items = embycursor.fetchall()
|
items = self.embycursor.fetchall()
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def getChecksum(self, mediatype):
|
def getChecksum(self, mediatype):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT emby_id, checksum",
|
"SELECT emby_id, checksum",
|
||||||
"FROM emby",
|
"FROM emby",
|
||||||
"WHERE emby_type = ?"
|
"WHERE emby_type = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (mediatype,))
|
self.embycursor.execute(query, (mediatype,))
|
||||||
items = embycursor.fetchall()
|
items = self.embycursor.fetchall()
|
||||||
|
|
||||||
return items
|
return items
|
||||||
|
|
||||||
def getMediaType_byId(self, embyid):
|
def getMediaType_byId(self, embyid):
|
||||||
|
|
||||||
embycursor = self.embycursor
|
|
||||||
|
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
"SELECT emby_type",
|
"SELECT emby_type",
|
||||||
"FROM emby",
|
"FROM emby",
|
||||||
"WHERE emby_id = ?"
|
"WHERE emby_id = ?"
|
||||||
))
|
))
|
||||||
embycursor.execute(query, (embyid,))
|
self.embycursor.execute(query, (embyid,))
|
||||||
try:
|
try:
|
||||||
itemtype = embycursor.fetchone()[0]
|
itemtype = self.embycursor.fetchone()[0]
|
||||||
|
|
||||||
except TypeError:
|
except TypeError:
|
||||||
itemtype = None
|
itemtype = None
|
||||||
|
|
Loading…
Reference in a new issue