Fix episode information not working
This commit is contained in:
parent
48cc6e3471
commit
60c122523b
2 changed files with 45 additions and 49 deletions
|
@ -299,7 +299,7 @@ class Movies(Items):
|
|||
|
||||
# add/retrieve pathid and fileid
|
||||
# if the path or file already exists, the calls return current value
|
||||
pathid = self.kodi_db.addPath(path)
|
||||
pathid = self.kodi_db.add_video_path(path)
|
||||
fileid = self.kodi_db.addFile(filename, pathid)
|
||||
|
||||
# UPDATE THE MOVIE #####
|
||||
|
@ -610,10 +610,10 @@ class TVShows(Items):
|
|||
path = "%s%s/" % (toplevelpath, itemid)
|
||||
|
||||
# Add top path
|
||||
toppathid = self.kodi_db.addPath(toplevelpath)
|
||||
toppathid = self.kodi_db.add_video_path(toplevelpath)
|
||||
# add/retrieve pathid and fileid
|
||||
# if the path or file already exists, the calls return current value
|
||||
pathid = self.kodi_db.addPath(path)
|
||||
pathid = self.kodi_db.add_video_path(path)
|
||||
# UPDATE THE TVSHOW #####
|
||||
if update_item:
|
||||
LOG.info("UPDATE tvshow itemid: %s - Title: %s", itemid, title)
|
||||
|
@ -924,7 +924,7 @@ class TVShows(Items):
|
|||
if do_indirect:
|
||||
# Set plugin path - do NOT use "intermediate" paths for the show
|
||||
# as with direct paths!
|
||||
path = 'plugin://%s.tvshows/' % v.ADDON_ID
|
||||
path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, series_id)
|
||||
params = {
|
||||
'plex_id': itemid,
|
||||
'plex_type': v.PLEX_TYPE_EPISODE,
|
||||
|
@ -932,10 +932,11 @@ class TVShows(Items):
|
|||
}
|
||||
filename = "%s?%s" % (path, urlencode(params))
|
||||
playurl = filename
|
||||
parent_path_id = self.kodi_db.getParentPathId(path)
|
||||
|
||||
# add/retrieve pathid and fileid
|
||||
# if the path or file already exists, the calls return current value
|
||||
pathid = self.kodi_db.addPath(path)
|
||||
pathid = self.kodi_db.add_video_path(path)
|
||||
fileid = self.kodi_db.addFile(filename, pathid)
|
||||
|
||||
# UPDATE THE EPISODE #####
|
||||
|
@ -1700,7 +1701,7 @@ class Music(Items):
|
|||
LOG.info("ADD song itemid: %s - Title: %s", itemid, title)
|
||||
|
||||
# Add path
|
||||
pathid = self.kodi_db.addPath(path, strHash="123")
|
||||
pathid = self.kodi_db.add_music_path(path, strHash="123")
|
||||
|
||||
try:
|
||||
# Get the album
|
||||
|
|
|
@ -6,7 +6,7 @@ from ntpath import dirname
|
|||
from sqlite3 import IntegrityError
|
||||
|
||||
import artwork
|
||||
from utils import kodi_sql, try_decode
|
||||
from utils import kodi_sql, try_decode, unix_timestamp, unix_date_to_kodi
|
||||
import variables as v
|
||||
|
||||
###############################################################################
|
||||
|
@ -113,59 +113,54 @@ class KodiDBMethods(object):
|
|||
parentpath = "%s/" % dirname(dirname(path))
|
||||
pathid = self.getPath(parentpath)
|
||||
if pathid is None:
|
||||
self.cursor.execute("select coalesce(max(idPath),0) from path")
|
||||
self.cursor.execute("SELECT COALESCE(MAX(idPath),0) FROM path")
|
||||
pathid = self.cursor.fetchone()[0] + 1
|
||||
query = ' '.join((
|
||||
"INSERT INTO path(idPath, strPath)",
|
||||
"VALUES (?, ?)"
|
||||
))
|
||||
self.cursor.execute(query, (pathid, parentpath))
|
||||
parentPathid = self.getParentPathId(parentpath)
|
||||
query = ' '.join((
|
||||
"UPDATE path",
|
||||
"SET idParentPath = ?",
|
||||
"WHERE idPath = ?"
|
||||
))
|
||||
self.cursor.execute(query, (parentPathid, pathid))
|
||||
datetime = unix_date_to_kodi(unix_timestamp())
|
||||
query = '''
|
||||
INSERT INTO path(idPath, strPath, dateAdded)
|
||||
VALUES (?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (pathid, parentpath, datetime))
|
||||
parent_path_id = self.getParentPathId(parentpath)
|
||||
query = 'UPDATE path SET idParentPath = ? WHERE idPath = ?'
|
||||
self.cursor.execute(query, (parent_path_id, pathid))
|
||||
return pathid
|
||||
|
||||
def addPath(self, path, strHash=None):
|
||||
def add_video_path(self, path):
|
||||
# SQL won't return existing paths otherwise
|
||||
if path is None:
|
||||
path = ""
|
||||
query = ' '.join((
|
||||
|
||||
"SELECT idPath",
|
||||
"FROM path",
|
||||
"WHERE strPath = ?"
|
||||
))
|
||||
path = ''
|
||||
query = 'SELECT idPath FROM path WHERE strPath = ?'
|
||||
self.cursor.execute(query, (path,))
|
||||
try:
|
||||
pathid = self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
self.cursor.execute("select coalesce(max(idPath),0) from path")
|
||||
self.cursor.execute("SELECT COALESCE(MAX(idPath),0) FROM path")
|
||||
pathid = self.cursor.fetchone()[0] + 1
|
||||
if strHash is None:
|
||||
query = (
|
||||
'''
|
||||
INSERT INTO path(
|
||||
idPath, strPath)
|
||||
|
||||
VALUES (?, ?)
|
||||
'''
|
||||
)
|
||||
self.cursor.execute(query, (pathid, path))
|
||||
else:
|
||||
query = (
|
||||
'''
|
||||
INSERT INTO path(
|
||||
idPath, strPath, strHash)
|
||||
|
||||
datetime = unix_date_to_kodi(unix_timestamp())
|
||||
query = '''
|
||||
INSERT INTO path(idPath, strPath, dateAdded)
|
||||
VALUES (?, ?, ?)
|
||||
'''
|
||||
)
|
||||
self.cursor.execute(query, (pathid, path, strHash))
|
||||
self.cursor.execute(query, (pathid, path, datetime))
|
||||
return pathid
|
||||
|
||||
def add_music_path(self, path, strHash=None):
|
||||
# SQL won't return existing paths otherwise
|
||||
if path is None:
|
||||
path = ''
|
||||
query = 'SELECT idPath FROM path WHERE strPath = ?'
|
||||
self.cursor.execute(query, (path,))
|
||||
try:
|
||||
pathid = self.cursor.fetchone()[0]
|
||||
except TypeError:
|
||||
self.cursor.execute("SELECT COALESCE(MAX(idPath),0) FROM path")
|
||||
pathid = self.cursor.fetchone()[0] + 1
|
||||
query = '''
|
||||
INSERT INTO path(idPath, strPath, strHash)
|
||||
VALUES (?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (pathid, path, strHash))
|
||||
return pathid
|
||||
|
||||
def getPath(self, path):
|
||||
|
|
Loading…
Reference in a new issue