2015-03-17 18:41:26 +00:00
|
|
|
#################################################################################################
|
|
|
|
# ReadKodiDB
|
|
|
|
#################################################################################################
|
|
|
|
|
|
|
|
|
|
|
|
import xbmc
|
|
|
|
import xbmcgui
|
|
|
|
import xbmcaddon
|
|
|
|
import json
|
2015-03-18 15:47:55 +00:00
|
|
|
import os
|
|
|
|
|
2015-04-01 19:07:29 +00:00
|
|
|
import Utils as utils
|
|
|
|
|
2015-03-17 18:41:26 +00:00
|
|
|
|
2015-03-19 10:13:49 +00:00
|
|
|
#sleepval is used to throttle the calls to the xbmc json API
|
|
|
|
sleepVal = 15
|
|
|
|
|
2015-03-17 18:41:26 +00:00
|
|
|
class ReadKodiDB():
|
|
|
|
|
2015-05-02 00:26:06 +00:00
|
|
|
|
2015-05-01 11:30:21 +00:00
|
|
|
def getKodiMovies(self, connection, cursor):
|
2015-03-28 16:42:38 +00:00
|
|
|
#returns all movies in Kodi db
|
2015-05-02 00:26:06 +00:00
|
|
|
cursor.execute("SELECT kodi_id, emby_id, checksum FROM emby WHERE media_type='movie'")
|
2015-05-01 11:30:21 +00:00
|
|
|
allmovies = cursor.fetchall()
|
|
|
|
#this will return a list with tuples of all items returned from the database
|
|
|
|
return allmovies
|
2015-03-20 10:08:22 +00:00
|
|
|
|
2015-05-01 11:30:21 +00:00
|
|
|
def getKodiTvShows(self, connection, cursor):
|
2015-05-02 00:26:06 +00:00
|
|
|
cursor.execute("SELECT kodi_id, emby_id, checksum FROM emby WHERE media_type='tvshow'")
|
2015-05-01 11:30:21 +00:00
|
|
|
allshows = cursor.fetchall()
|
|
|
|
#this will return a list with tuples of all items returned from the database
|
|
|
|
return allshows
|
2015-03-21 13:31:30 +00:00
|
|
|
|
2015-05-02 00:26:06 +00:00
|
|
|
def getKodiEpisodes(self, connection, cursor, showid=None):
|
2015-03-21 13:31:30 +00:00
|
|
|
|
2015-05-02 00:26:06 +00:00
|
|
|
if showid == None:
|
|
|
|
cursor.execute("SELECT kodi_id, emby_id, checksum FROM emby WHERE media_type=?",("episode",))
|
2015-03-21 13:31:30 +00:00
|
|
|
else:
|
2015-05-02 00:26:06 +00:00
|
|
|
cursor.execute("SELECT kodi_id, emby_id, checksum FROM emby WHERE media_type=? AND parent_id=?",("episode", showid))
|
|
|
|
allepisodes = cursor.fetchall()
|
|
|
|
#this will return a list with tuples of all items returned from the database
|
|
|
|
return allepisodes
|
2015-03-21 13:31:30 +00:00
|
|
|
|