Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v7.1.0+beta.2 #899

Merged
merged 11 commits into from
Sep 14, 2024
Merged
2 changes: 1 addition & 1 deletion addon.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addon id="plugin.video.youtube" name="YouTube" version="7.1.0+beta.1" provider-name="anxdpanic, bromix, MoojMidge">
<addon id="plugin.video.youtube" name="YouTube" version="7.1.0+beta.2" provider-name="anxdpanic, bromix, MoojMidge">
<requires>
<import addon="xbmc.python" version="3.0.0"/>
<import addon="script.module.requests" version="2.27.1"/>
Expand Down
30 changes: 29 additions & 1 deletion changelog.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,33 @@
## v7.1.0+beta.2
### Fixed
- Fix possible regression causing 6s delay on first play
- Fix regression in building client details causing wrong referer to be used
- Only reroute to new window if container was not filled by the plugin #896
- Only reroute to new window if modal dialog is not open #896

### Changed
- Use a CommandItem that opens the Info dialog for comments to avoid log spam
- Revert old workaround for Kodi treating a non-folder listitem as playable
- Improve parsing of plugin url query parameters to allow empty values

### New
- Add items_per_page query parameter to allow number of items in widgets to be customised #896
- Add item_filter query parameter to override "Hide videos from listings" setting #896
- Comma seperated string of item types to be filtered out of listing
- "?item_filter=shorts" will remove shorts from listing
- "?item_filter=shorts,live" will remove shorts and live streams from listing
- "?item_filter" will show all item types
- Allowable item types:
- shorts
- upcoming
- upcoming_live
- live
- premieres
- completed
- vod

## v7.1.0+beta.1
###
### Fixed
- Fix logging/retry of sqlite3.OperationalError
- Fix trying to use ISA for progressive live streams
- Retain list position when refreshing listings
Expand Down
9 changes: 8 additions & 1 deletion resources/lib/youtube_plugin/kodion/abstract_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,14 @@ def on_goto_page(provider, context, re_match):
else:
page_token = ''
params = dict(params, page=page, page_token=page_token)
return provider.reroute(context=context, path=path, params=params)

if (not context.get_infobool('System.HasActiveModalDialog')
and context.is_plugin_path(
context.get_infolabel('Container.FolderPath'),
partial=True,
)):
return provider.reroute(context=context, path=path, params=params)
return provider.navigate(context.clone(path, params))

@staticmethod
def on_reroute(provider, context, re_match):
Expand Down
15 changes: 11 additions & 4 deletions resources/lib/youtube_plugin/kodion/context/abstract_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ class AbstractContext(object):
}
_INT_PARAMS = {
'fanart_type',
'items_per_page',
'live',
'next_page_token',
'offset',
Expand All @@ -81,6 +82,7 @@ class AbstractContext(object):
}
_LIST_PARAMS = {
'channel_ids',
'item_filter',
'playlist_ids',
}
_STRING_PARAMS = {
Expand Down Expand Up @@ -305,7 +307,10 @@ def get_param(self, name, default=None):
def parse_uri(self, uri):
uri = urlsplit(uri)
path = uri.path
params = self.parse_params(dict(parse_qsl(uri.query)), update=False)
params = self.parse_params(
dict(parse_qsl(uri.query, keep_blank_values=True)),
update=False,
)
return path, params

def parse_params(self, params, update=True):
Expand All @@ -327,9 +332,11 @@ def parse_params(self, params, update=True):
elif param in self._FLOAT_PARAMS:
parsed_value = float(value)
elif param in self._LIST_PARAMS:
parsed_value = [
val for val in value.split(',') if val
]
parsed_value = (
list(value)
if isinstance(value, (list, tuple)) else
[val for val in value.split(',') if val]
)
elif param in self._STRING_PARAMS:
parsed_value = to_str(value)
if param in self._STRING_BOOL_PARAMS:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,9 @@ def init(self):
if num_args > 2:
params = sys.argv[2][1:]
if params:
self.parse_params(dict(parse_qsl(params)))
self.parse_params(
dict(parse_qsl(params, keep_blank_values=True))
)

# then Kodi resume status
if num_args > 3 and sys.argv[3].lower() == 'resume:true':
Expand Down Expand Up @@ -425,9 +427,7 @@ def get_subtitle_language(self):

def get_playlist_player(self, playlist_type=None):
if not self._playlist or playlist_type:
self._playlist = XbmcPlaylistPlayer(playlist_type,
proxy(self),
retry=3)
self._playlist = XbmcPlaylistPlayer(proxy(self), playlist_type)
return self._playlist

def get_ui(self):
Expand Down
18 changes: 10 additions & 8 deletions resources/lib/youtube_plugin/kodion/items/xbmc/xbmc_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,15 +568,17 @@ def directory_listitem(context, directory_item, show_fanart=None, **_kwargs):
set_info(list_item, directory_item, props)

"""
# ListItems that do not open a lower level list should have the isFolder
# parameter of the xbmcplugin.addDirectoryItem set to False, however this
# now appears to mark the ListItem as playable, even if the IsPlayable
# property is not set or set to "false".
# Set isFolder to True as a workaround, regardless of whether the ListItem
# is actually a folder.
is_folder = not directory_item.is_action()
ListItems that do not open a lower level list should have the isFolder
parameter of the xbmcplugin.addDirectoryItem set to False, however this
now appears to mark the ListItem as playable, even if the IsPlayable
property is not set or set to "false".
Set isFolder to True as a workaround, regardless of whether the ListItem
is actually a folder.
"""
is_folder = True
# Workaround:
# is_folder = True
# Test correctly setting isFolder:
is_folder = not directory_item.is_action()

context_menu = directory_item.get_context_menu()
if context_menu is not None:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,26 @@ class XbmcPlaylistPlayer(AbstractPlaylistPlayer):
'audio': xbmc.PLAYLIST_MUSIC, # 0
}

def __init__(self, playlist_type, context, retry=0):
def __init__(self, context, playlist_type=None, retry=None):
super(XbmcPlaylistPlayer, self).__init__()

self._context = context

playlist_id = self._PLAYER_PLAYLIST.get(playlist_type)
if not playlist_type:
player = xbmc.Player()
if retry is None:
retry = 3 if player.isPlaying() else 0

if playlist_type is None:
playlist_id = self.get_playlist_id(retry=retry)
else:
playlist_id = (
self._PLAYER_PLAYLIST.get(playlist_type)
or self._PLAYER_PLAYLIST['video']
)
self.set_playlist_id(playlist_id)

self._playlist = xbmc.PlayList(playlist_id)
self._player = xbmc.Player()
self._player = player

def clear(self):
self._playlist.clear()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,13 @@ def stream_select(self, value=None):
'vod': True,
}

def item_filter(self, update=None):
types = dict.fromkeys(self.get_string_list(SETTINGS.HIDE_VIDEOS), False)
def item_filter(self, update=None, override=None):
types = dict.fromkeys(
self.get_string_list(SETTINGS.HIDE_VIDEOS)
if override is None else
override,
False
)
types = dict(self._DEFAULT_FILTER, **types)
if update:
if 'live_folder' in update:
Expand Down
8 changes: 4 additions & 4 deletions resources/lib/youtube_plugin/youtube/client/request_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ def build_client(cls, client_name=None, data=None):
client = merge_dicts(cls.CLIENTS['_common'], client, templates)
client['_name'] = client_name

for values, template_id, template in templates.values():
if template_id in values:
values[template_id] = template.format(**client)

try:
params = client['params']
if client.get('_access_token'):
Expand All @@ -373,8 +377,4 @@ def build_client(cls, client_name=None, data=None):
except KeyError:
pass

for values, template_id, template in templates.values():
if template_id in values:
values[template_id] = template.format(**client)

return client
Loading
Loading