mirror of
https://github.com/anxdpanic/plugin.video.youtube.git
synced 2025-12-05 18:20:41 -08:00
commit
9e99f7c688
5 changed files with 44 additions and 32 deletions
|
|
@ -1,5 +1,5 @@
|
|||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
||||
<addon id="plugin.video.youtube" name="YouTube" version="6.8.4~alpha1" provider-name="anxdpanic, bromix">
|
||||
<addon id="plugin.video.youtube" name="YouTube" version="6.8.4~beta1" provider-name="anxdpanic, bromix">
|
||||
<requires>
|
||||
<import addon="xbmc.python" version="2.20.0"/>
|
||||
<import addon="script.module.six" version="1.11.0"/>
|
||||
|
|
@ -13,6 +13,7 @@
|
|||
<extension point="xbmc.python.module" library="resources/lib/"/>
|
||||
<extension point="xbmc.addon.metadata">
|
||||
<news>
|
||||
[fix] searching, no longer require remote safe search
|
||||
[fix] notifications for some languages
|
||||
</news>
|
||||
<assets>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
6.8.4
|
||||
[fix] searching, no longer require remote safe search
|
||||
[fix] notifications for some languages
|
||||
|
||||
6.8.3
|
||||
|
|
|
|||
|
|
@ -8,10 +8,11 @@
|
|||
See LICENSES/GPL-2.0-only for more information.
|
||||
"""
|
||||
|
||||
import json
|
||||
import re
|
||||
|
||||
import xbmc
|
||||
import xbmcplugin
|
||||
from six.moves.urllib_parse import quote
|
||||
from six.moves.urllib_parse import unquote
|
||||
|
||||
from .exceptions import KodionException
|
||||
from . import items
|
||||
|
|
@ -20,6 +21,7 @@ from . import constants
|
|||
|
||||
class AbstractProvider(object):
|
||||
RESULT_CACHE_TO_DISC = 'cache_to_disc' # (bool)
|
||||
RESULT_UPDATE_LISTING = 'update_listing'
|
||||
|
||||
def __init__(self):
|
||||
self._local_map = {
|
||||
|
|
@ -35,6 +37,8 @@ class AbstractProvider(object):
|
|||
# map for regular expression (path) to method (names)
|
||||
self._dict_path = {}
|
||||
|
||||
self._data_cache = None
|
||||
|
||||
# register some default paths
|
||||
self.register_path(r'^/$', '_internal_root')
|
||||
self.register_path(r''.join(['^/', constants.paths.WATCH_LATER, '/(?P<command>add|remove|list)/?$']),
|
||||
|
|
@ -187,6 +191,15 @@ class AbstractProvider(object):
|
|||
# do something
|
||||
pass
|
||||
|
||||
@property
|
||||
def data_cache(self):
|
||||
return self._data_cache
|
||||
|
||||
@data_cache.setter
|
||||
def data_cache(self, context):
|
||||
if not self._data_cache:
|
||||
self._data_cache = context.get_data_cache()
|
||||
|
||||
def _internal_search(self, context, re_match):
|
||||
params = context.get_params()
|
||||
|
||||
|
|
@ -210,47 +223,44 @@ class AbstractProvider(object):
|
|||
context.get_ui().refresh_container()
|
||||
return True
|
||||
elif command == 'input':
|
||||
if '/query/' in context.get_ui().get_info_label('Container.FolderPath'):
|
||||
self.data_cache = context
|
||||
query = None
|
||||
if re.match('.+/(?:query|input)/.*', context.get_ui().get_info_label('Container.FolderPath')):
|
||||
cached_query = self.data_cache.get_item(self.data_cache.ONE_DAY, 'search_query')
|
||||
# came from page 1 of search query by '..'/back, user doesn't want to input on this path
|
||||
return False
|
||||
if cached_query and cached_query.get('search_query', {}).get('query'):
|
||||
query = unquote(cached_query.get('search_query', {}).get('query'))
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
result, input_query = context.get_ui().on_keyboard_input(context.localize(constants.localize.SEARCH_TITLE))
|
||||
if result:
|
||||
query = input_query
|
||||
|
||||
result, query = context.get_ui().on_keyboard_input(context.localize(constants.localize.SEARCH_TITLE))
|
||||
incognito = str(context.get_param('incognito', False)).lower() == 'true'
|
||||
channel_id = context.get_param('channel_id', '')
|
||||
addon_id = context.get_param('addon_id', '')
|
||||
item_params = {'q': query}
|
||||
if addon_id:
|
||||
item_params.update({'addon_id': addon_id})
|
||||
if incognito:
|
||||
item_params.update({'incognito': incognito})
|
||||
if channel_id:
|
||||
item_params.update({'channel_id': channel_id})
|
||||
|
||||
if result:
|
||||
if not context.get_settings().remote_friendly_search():
|
||||
xbmcplugin.endOfDirectory(context.get_handle(), succeeded=True)
|
||||
xbmc.sleep(500)
|
||||
context.execute('Container.Update(%s)' % context.create_uri([constants.paths.SEARCH, 'query'], item_params))
|
||||
else:
|
||||
if query:
|
||||
self._data_cache.set('search_query', json.dumps({'query': quote(query)}))
|
||||
if not incognito and not channel_id:
|
||||
try:
|
||||
if not incognito and not channel_id:
|
||||
search_history.update(query)
|
||||
context.set_path('/kodion/search/query/')
|
||||
return self.on_search(query, context, re_match)
|
||||
search_history.update(query)
|
||||
except:
|
||||
return list()
|
||||
pass
|
||||
context.set_path('/kodion/search/query/')
|
||||
return self.on_search(query, context, re_match)
|
||||
|
||||
return True
|
||||
elif command == 'query':
|
||||
incognito = str(context.get_param('incognito', False)).lower() == 'true'
|
||||
channel_id = context.get_param('channel_id', '')
|
||||
try:
|
||||
query = params['q']
|
||||
if not incognito and not channel_id:
|
||||
query = params['q']
|
||||
if not incognito and not channel_id:
|
||||
try:
|
||||
search_history.update(query)
|
||||
return self.on_search(query, context, re_match)
|
||||
except:
|
||||
return list()
|
||||
except:
|
||||
pass
|
||||
return self.on_search(query, context, re_match)
|
||||
else:
|
||||
context.set_content_type(constants.content_type.FILES)
|
||||
result = []
|
||||
|
|
|
|||
|
|
@ -64,6 +64,7 @@ class XbmcRunner(AbstractProviderRunner):
|
|||
|
||||
xbmcplugin.endOfDirectory(
|
||||
self.handle, succeeded=True,
|
||||
updateListing=options.get(AbstractProvider.RESULT_UPDATE_LISTING, False),
|
||||
cacheToDisc=options.get(AbstractProvider.RESULT_CACHE_TO_DISC, True))
|
||||
else:
|
||||
# handle exception
|
||||
|
|
|
|||
|
|
@ -94,7 +94,6 @@
|
|||
<setting id="kodion.support.alternative_player" type="bool" label="30036" default="false"/>
|
||||
<setting id="kodion.alternative_player.web.urls" type="bool" label="30704" default="false" subsetting="true" enable="eq(-1,true)"/>
|
||||
<setting id="youtube.view.description.show_channel_name" type="bool" label="30541" default="true"/>
|
||||
<setting id="youtube.search.remote.friendly" type="bool" label="30729" default="false"/>
|
||||
<setting type="sep"/>
|
||||
<setting id="kodion.playback.history" type="bool" label="30675" default="false"/>
|
||||
<setting type="sep"/>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue