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