Fix add-on paths for tv shows
This commit is contained in:
parent
be5c1e6b8a
commit
b62a7a1a1d
2 changed files with 16 additions and 48 deletions
|
@ -815,7 +815,6 @@ class TVShows(Items):
|
||||||
# episodeid
|
# episodeid
|
||||||
kodicursor.execute("select coalesce(max(idEpisode),0) from episode")
|
kodicursor.execute("select coalesce(max(idEpisode),0) from episode")
|
||||||
episodeid = kodicursor.fetchone()[0] + 1
|
episodeid = kodicursor.fetchone()[0] + 1
|
||||||
|
|
||||||
else:
|
else:
|
||||||
# Verification the item is still in Kodi
|
# Verification the item is still in Kodi
|
||||||
query = "SELECT * FROM episode WHERE idEpisode = ?"
|
query = "SELECT * FROM episode WHERE idEpisode = ?"
|
||||||
|
@ -902,15 +901,9 @@ class TVShows(Items):
|
||||||
path = playurl.replace(filename, "")
|
path = playurl.replace(filename, "")
|
||||||
parent_path_id = self.kodi_db.getParentPathId(path)
|
parent_path_id = self.kodi_db.getParentPathId(path)
|
||||||
if do_indirect:
|
if do_indirect:
|
||||||
# Set plugin path and media flags using real filename
|
# Set plugin path - do NOT use "intermediate" paths for the show
|
||||||
if playurl is not None:
|
# as with direct paths!
|
||||||
if '\\' in playurl:
|
path = 'plugin://%s.tvshows/' % v.ADDON_ID
|
||||||
filename = playurl.rsplit('\\', 1)[1]
|
|
||||||
else:
|
|
||||||
filename = playurl.rsplit('/', 1)[1]
|
|
||||||
else:
|
|
||||||
filename = 'file_not_found.mkv'
|
|
||||||
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,
|
||||||
|
@ -918,8 +911,6 @@ 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.addPath('plugin://%s.tvshows/'
|
|
||||||
% v.ADDON_ID)
|
|
||||||
|
|
||||||
# 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
|
||||||
|
@ -1060,15 +1051,16 @@ class TVShows(Items):
|
||||||
checksum=checksum,
|
checksum=checksum,
|
||||||
view_id=viewid)
|
view_id=viewid)
|
||||||
|
|
||||||
# Update the path
|
# Update the path for Direct Paths only
|
||||||
query = ' '.join((
|
if not do_indirect:
|
||||||
|
query = '''
|
||||||
"UPDATE path",
|
UPDATE path
|
||||||
"SET strPath = ?, strContent = ?, strScraper = ?, noUpdate = ?, ",
|
SET strPath = ?, strContent = ?, strScraper = ?, noUpdate = ?,
|
||||||
"idParentPath = ?"
|
idParentPath = ?
|
||||||
"WHERE idPath = ?"
|
WHERE idPath = ?
|
||||||
))
|
'''
|
||||||
kodicursor.execute(query, (path, None, None, 1, parent_path_id, pathid))
|
kodicursor.execute(query, (path, None, None, 1, parent_path_id,
|
||||||
|
pathid))
|
||||||
# Update the file
|
# Update the file
|
||||||
query = ' '.join((
|
query = ' '.join((
|
||||||
|
|
||||||
|
@ -1098,24 +1090,6 @@ class TVShows(Items):
|
||||||
runtime,
|
runtime,
|
||||||
playcount,
|
playcount,
|
||||||
dateplayed)
|
dateplayed)
|
||||||
if not state.DIRECT_PATHS and resume:
|
|
||||||
# Create additional entry for widgets. This is only required for
|
|
||||||
# plugin/episode.
|
|
||||||
temppathid = self.kodi_db.getPath('plugin://%s.tvshows/'
|
|
||||||
% v.ADDON_ID)
|
|
||||||
tempfileid = self.kodi_db.addFile(filename, temppathid)
|
|
||||||
query = '''
|
|
||||||
UPDATE files
|
|
||||||
SET idPath = ?, strFilename = ?, dateAdded = ?
|
|
||||||
WHERE idFile = ?
|
|
||||||
'''
|
|
||||||
kodicursor.execute(query,
|
|
||||||
(temppathid, filename, dateadded, tempfileid))
|
|
||||||
self.kodi_db.addPlaystate(tempfileid,
|
|
||||||
resume,
|
|
||||||
runtime,
|
|
||||||
playcount,
|
|
||||||
dateplayed)
|
|
||||||
|
|
||||||
def remove(self, itemid):
|
def remove(self, itemid):
|
||||||
"""
|
"""
|
||||||
|
|
|
@ -164,12 +164,6 @@ def _prep_playlist_stack(xml):
|
||||||
'plex_id': api.plex_id(),
|
'plex_id': api.plex_id(),
|
||||||
'plex_type': api.plex_type()
|
'plex_type': api.plex_type()
|
||||||
}
|
}
|
||||||
if api.plex_type() == v.PLEX_TYPE_EPISODE:
|
|
||||||
path = ('plugin://%s/%s/?%s'
|
|
||||||
% (v.ADDON_TYPE[api.plex_type()],
|
|
||||||
api.grandparent_id(),
|
|
||||||
urlencode(params)))
|
|
||||||
else:
|
|
||||||
path = ('plugin://%s/?%s'
|
path = ('plugin://%s/?%s'
|
||||||
% (v.ADDON_TYPE[api.plex_type()],
|
% (v.ADDON_TYPE[api.plex_type()],
|
||||||
urlencode(params)))
|
urlencode(params)))
|
||||||
|
|
Loading…
Reference in a new issue