Fix widget navigating to entire TV show not working
This commit is contained in:
parent
79d87c5b01
commit
bb15f62648
5 changed files with 45 additions and 2 deletions
|
@ -4,7 +4,7 @@
|
||||||
<import addon="xbmc.python" version="2.1.0"/>
|
<import addon="xbmc.python" version="2.1.0"/>
|
||||||
<import addon="script.module.requests" version="2.9.1" />
|
<import addon="script.module.requests" version="2.9.1" />
|
||||||
<import addon="plugin.video.plexkodiconnect.movies" version="2.0.0" />
|
<import addon="plugin.video.plexkodiconnect.movies" version="2.0.0" />
|
||||||
<import addon="plugin.video.plexkodiconnect.tvshows" version="2.0.0" />
|
<import addon="plugin.video.plexkodiconnect.tvshows" version="2.0.1" />
|
||||||
</requires>
|
</requires>
|
||||||
<extension point="xbmc.python.pluginsource" library="default.py">
|
<extension point="xbmc.python.pluginsource" library="default.py">
|
||||||
<provides>video audio image</provides>
|
<provides>video audio image</provides>
|
||||||
|
|
|
@ -57,6 +57,8 @@ class Monitor_Window(Thread):
|
||||||
elif value.startswith('CONTEXT_menu?'):
|
elif value.startswith('CONTEXT_menu?'):
|
||||||
queue.put('dummy?mode=context_menu&%s'
|
queue.put('dummy?mode=context_menu&%s'
|
||||||
% value.replace('CONTEXT_menu?', ''))
|
% value.replace('CONTEXT_menu?', ''))
|
||||||
|
elif value.startswith('NAVIGATE'):
|
||||||
|
queue.put(value.replace('NAVIGATE-', ''))
|
||||||
else:
|
else:
|
||||||
raise NotImplementedError('%s not implemented' % value)
|
raise NotImplementedError('%s not implemented' % value)
|
||||||
else:
|
else:
|
||||||
|
|
|
@ -496,3 +496,11 @@ def ping():
|
||||||
Pings the JSON RPC interface
|
Pings the JSON RPC interface
|
||||||
"""
|
"""
|
||||||
return JsonRPC('JSONRPC.Ping').execute()
|
return JsonRPC('JSONRPC.Ping').execute()
|
||||||
|
|
||||||
|
|
||||||
|
def activate_window(window, parameters):
|
||||||
|
"""
|
||||||
|
Pass the parameters as str/unicode to open the corresponding window
|
||||||
|
"""
|
||||||
|
return JsonRPC('GUI.ActivateWindow').execute({'window': window,
|
||||||
|
'parameters': [parameters]})
|
||||||
|
|
|
@ -223,6 +223,24 @@ class KodiDBMethods(object):
|
||||||
self.cursor.execute('DELETE FROM stacktimes WHERE idFile = ?',
|
self.cursor.execute('DELETE FROM stacktimes WHERE idFile = ?',
|
||||||
(file[0],))
|
(file[0],))
|
||||||
|
|
||||||
|
def show_id_from_path(self, path):
|
||||||
|
"""
|
||||||
|
Returns the idShow for path [unicode] or None
|
||||||
|
"""
|
||||||
|
self.cursor.execute('SELECT idPath FROM path WHERE strPath = ? LIMIT 1',
|
||||||
|
(path, ))
|
||||||
|
try:
|
||||||
|
path_id = self.cursor.fetchone()[0]
|
||||||
|
except TypeError:
|
||||||
|
return
|
||||||
|
query = 'SELECT idShow FROM tvshowlinkpath WHERE idPath = ? LIMIT 1'
|
||||||
|
self.cursor.execute(query, (path_id, ))
|
||||||
|
try:
|
||||||
|
show_id = self.cursor.fetchone()[0]
|
||||||
|
except TypeError:
|
||||||
|
show_id = None
|
||||||
|
return show_id
|
||||||
|
|
||||||
def remove_file(self, file_id):
|
def remove_file(self, file_id):
|
||||||
"""
|
"""
|
||||||
Removes the entry for file_id from the files table. Will also delete
|
Removes the entry for file_id from the files table. Will also delete
|
||||||
|
|
|
@ -7,6 +7,9 @@ from urlparse import parse_qsl
|
||||||
import playback
|
import playback
|
||||||
from context_entry import ContextMenu
|
from context_entry import ContextMenu
|
||||||
import state
|
import state
|
||||||
|
import json_rpc as js
|
||||||
|
from pickler import pickle_me, Playback_Successful
|
||||||
|
import kodidb_functions as kodidb
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
|
@ -20,7 +23,19 @@ class Playback_Starter(Thread):
|
||||||
Processes new plays
|
Processes new plays
|
||||||
"""
|
"""
|
||||||
def triage(self, item):
|
def triage(self, item):
|
||||||
|
try:
|
||||||
_, params = item.split('?', 1)
|
_, params = item.split('?', 1)
|
||||||
|
except ValueError:
|
||||||
|
# e.g. when plugin://...tvshows is called for entire season
|
||||||
|
with kodidb.GetKodiDB('video') as kodi_db:
|
||||||
|
show_id = kodi_db.show_id_from_path(item)
|
||||||
|
if show_id:
|
||||||
|
js.activate_window('videos',
|
||||||
|
'videodb://tvshows/titles/%s' % show_id)
|
||||||
|
else:
|
||||||
|
LOG.error('Could not find tv show id for %s', item)
|
||||||
|
pickle_me(Playback_Successful())
|
||||||
|
return
|
||||||
params = dict(parse_qsl(params))
|
params = dict(parse_qsl(params))
|
||||||
mode = params.get('mode')
|
mode = params.get('mode')
|
||||||
LOG.debug('Received mode: %s, params: %s', mode, params)
|
LOG.debug('Received mode: %s, params: %s', mode, params)
|
||||||
|
|
Loading…
Reference in a new issue