Re-introduce dependency add-ons, part 1
We need them in order to keep the Kodi DB straight
This commit is contained in:
parent
faacbc6108
commit
be5c1e6b8a
5 changed files with 67 additions and 73 deletions
|
@ -3,6 +3,8 @@
|
|||
<requires>
|
||||
<import addon="xbmc.python" version="2.1.0"/>
|
||||
<import addon="script.module.requests" version="2.3.0" />
|
||||
<import addon="plugin.video.plexkodiconnect.movies" version="2.0.0" />
|
||||
<import addon="plugin.video.plexkodiconnect.tvshows" version="2.0.0" />
|
||||
</requires>
|
||||
<extension point="xbmc.python.pluginsource" library="default.py">
|
||||
<provides>video audio image</provides>
|
||||
|
|
|
@ -259,7 +259,7 @@ class Movies(Items):
|
|||
|
||||
trailer = api.trailer_id()
|
||||
if trailer:
|
||||
trailer = ('plugin://%s/movies/?plex_id=%s&plex_type=%s&mode=play'
|
||||
trailer = ('plugin://%s.movies/?plex_id=%s&plex_type=%s&mode=play'
|
||||
% (v.ADDON_ID, trailer, v.PLEX_TYPE_CLIP))
|
||||
|
||||
# GET THE FILE AND PATH #####
|
||||
|
@ -283,7 +283,7 @@ class Movies(Items):
|
|||
path = playurl.replace(filename, "")
|
||||
if do_indirect:
|
||||
# Set plugin path and media flags using real filename
|
||||
path = 'plugin://%s/movies/' % v.ADDON_ID
|
||||
path = 'plugin://%s.movies/' % v.ADDON_ID
|
||||
params = {
|
||||
'mode': 'play',
|
||||
'plex_id': itemid,
|
||||
|
@ -588,7 +588,7 @@ class TVShows(Items):
|
|||
toplevelpath = "%s/" % dirname(dirname(path))
|
||||
if do_indirect:
|
||||
# Set plugin path
|
||||
toplevelpath = "plugin://%s/tvshows/" % v.ADDON_ID
|
||||
toplevelpath = "plugin://%s.tvshows/" % v.ADDON_ID
|
||||
path = "%s%s/" % (toplevelpath, itemid)
|
||||
|
||||
# Add top path
|
||||
|
@ -910,7 +910,7 @@ class TVShows(Items):
|
|||
filename = playurl.rsplit('/', 1)[1]
|
||||
else:
|
||||
filename = 'file_not_found.mkv'
|
||||
path = 'plugin://%s/tvshows/%s/' % (v.ADDON_ID, series_id)
|
||||
path = 'plugin://%s.tvshows/%s/' % (v.ADDON_ID, series_id)
|
||||
params = {
|
||||
'plex_id': itemid,
|
||||
'plex_type': v.PLEX_TYPE_EPISODE,
|
||||
|
@ -918,7 +918,7 @@ class TVShows(Items):
|
|||
}
|
||||
filename = "%s?%s" % (path, urlencode(params))
|
||||
playurl = filename
|
||||
parent_path_id = self.kodi_db.addPath('plugin://%s/tvshows/'
|
||||
parent_path_id = self.kodi_db.addPath('plugin://%s.tvshows/'
|
||||
% v.ADDON_ID)
|
||||
|
||||
# add/retrieve pathid and fileid
|
||||
|
@ -1101,7 +1101,7 @@ class TVShows(Items):
|
|||
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/'
|
||||
temppathid = self.kodi_db.getPath('plugin://%s.tvshows/'
|
||||
% v.ADDON_ID)
|
||||
tempfileid = self.kodi_db.addFile(filename, temppathid)
|
||||
query = '''
|
||||
|
|
|
@ -53,69 +53,49 @@ class Kodidb_Functions():
|
|||
For some reason, Kodi ignores this if done via itemtypes while e.g.
|
||||
adding or updating items. (addPath method does NOT work)
|
||||
"""
|
||||
root_path_id = self.getPath('plugin://%s/' % v.ADDON_ID)
|
||||
if root_path_id is not None:
|
||||
return
|
||||
# add the very root plugin://plugin.video.plexkodiconnect to paths
|
||||
self.cursor.execute("select coalesce(max(idPath),0) from path")
|
||||
root_path_id = self.cursor.fetchone()[0] + 1
|
||||
query = '''
|
||||
INSERT INTO path(idPath,
|
||||
strPath,
|
||||
useFolderNames,
|
||||
noUpdate,
|
||||
exclude)
|
||||
VALUES (?, ?, ?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (root_path_id,
|
||||
'plugin://%s/' % v.ADDON_ID,
|
||||
False,
|
||||
True,
|
||||
True))
|
||||
# Now add the root folders for movies
|
||||
self.cursor.execute("select coalesce(max(idPath),0) from path")
|
||||
path_id = self.cursor.fetchone()[0] + 1
|
||||
query = '''
|
||||
INSERT INTO path(idPath,
|
||||
strPath,
|
||||
strContent,
|
||||
strScraper,
|
||||
useFolderNames,
|
||||
noUpdate,
|
||||
exclude,
|
||||
idParentPath)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (path_id,
|
||||
'plugin://%s/movies/' % v.ADDON_ID,
|
||||
'movies',
|
||||
'metadata.local',
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
root_path_id))
|
||||
path_id = self.getPath('plugin://%s.movies/' % v.ADDON_ID)
|
||||
if path_id is None:
|
||||
self.cursor.execute("select coalesce(max(idPath),0) from path")
|
||||
path_id = self.cursor.fetchone()[0] + 1
|
||||
query = '''
|
||||
INSERT INTO path(idPath,
|
||||
strPath,
|
||||
strContent,
|
||||
strScraper,
|
||||
useFolderNames,
|
||||
noUpdate,
|
||||
exclude)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (path_id,
|
||||
'plugin://%s.movies/' % v.ADDON_ID,
|
||||
'movies',
|
||||
'metadata.local',
|
||||
0,
|
||||
1,
|
||||
1))
|
||||
# And TV shows
|
||||
self.cursor.execute("select coalesce(max(idPath),0) from path")
|
||||
path_id = self.cursor.fetchone()[0] + 1
|
||||
query = '''
|
||||
INSERT INTO path(idPath,
|
||||
strPath,
|
||||
strContent,
|
||||
strScraper,
|
||||
useFolderNames,
|
||||
noUpdate,
|
||||
exclude,
|
||||
idParentPath)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (path_id,
|
||||
'plugin://%s/tvshows/' % v.ADDON_ID,
|
||||
'tvshows',
|
||||
'metadata.local',
|
||||
False,
|
||||
True,
|
||||
True,
|
||||
root_path_id))
|
||||
path_id = self.getPath('plugin://%s.tvshows/' % v.ADDON_ID)
|
||||
if path_id is None:
|
||||
self.cursor.execute("select coalesce(max(idPath),0) from path")
|
||||
path_id = self.cursor.fetchone()[0] + 1
|
||||
query = '''
|
||||
INSERT INTO path(idPath,
|
||||
strPath,
|
||||
strContent,
|
||||
strScraper,
|
||||
useFolderNames,
|
||||
noUpdate,
|
||||
exclude)
|
||||
VALUES (?, ?, ?, ?, ?, ?, ?)
|
||||
'''
|
||||
self.cursor.execute(query, (path_id,
|
||||
'plugin://%s.tvshows/' % v.ADDON_ID,
|
||||
'tvshows',
|
||||
'metadata.local',
|
||||
0,
|
||||
1,
|
||||
1))
|
||||
|
||||
def getParentPathId(self, path):
|
||||
"""
|
||||
|
|
|
@ -164,8 +164,15 @@ def _prep_playlist_stack(xml):
|
|||
'plex_id': api.plex_id(),
|
||||
'plex_type': api.plex_type()
|
||||
}
|
||||
path = ('plugin://plugin.video.plexkodiconnect?%s'
|
||||
% urlencode(params))
|
||||
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'
|
||||
% (v.ADDON_TYPE[api.plex_type()],
|
||||
urlencode(params)))
|
||||
listitem = api.create_listitem()
|
||||
listitem.setPath(try_encode(path))
|
||||
else:
|
||||
|
|
|
@ -171,9 +171,6 @@ KODI_TYPE_MUSICVIDEO = 'musicvideo'
|
|||
|
||||
KODI_TYPE_PHOTO = 'photo'
|
||||
|
||||
|
||||
# Translation tables
|
||||
|
||||
KODI_VIDEOTYPES = (
|
||||
KODI_TYPE_VIDEO,
|
||||
KODI_TYPE_MOVIE,
|
||||
|
@ -189,6 +186,14 @@ KODI_AUDIOTYPES = (
|
|||
KODI_TYPE_ARTIST,
|
||||
)
|
||||
|
||||
# Translation tables
|
||||
|
||||
ADDON_TYPE = {
|
||||
PLEX_TYPE_MOVIE: 'plugin.video.plexkodiconnect.movies',
|
||||
PLEX_TYPE_CLIP: 'plugin.video.plexkodiconnect.movies',
|
||||
PLEX_TYPE_EPISODE: 'plugin.video.plexkodiconnect.tvshows'
|
||||
}
|
||||
|
||||
ITEMTYPE_FROM_PLEXTYPE = {
|
||||
PLEX_TYPE_MOVIE: 'Movies',
|
||||
PLEX_TYPE_SEASON: 'TVShows',
|
||||
|
|
Loading…
Reference in a new issue