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.0.9+beta.1 #823

Merged
merged 14 commits into from
Jun 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.0.8" provider-name="anxdpanic, bromix, MoojMidge">
<addon id="plugin.video.youtube" name="YouTube" version="7.0.9+beta.1" 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
14 changes: 14 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
## v7.0.9+beta.1
### Fixed
- Fix renaming playlists
- Improve https server wakeup #746 #801

### Changed
- Make live query parameter optional when playing channel live stream
- Allow for removal of custom watch later and history playlists from settings #818
- Use default value of "HL" for history or "WL" for watch later as reset value
- This will then clear the setting and clear value from access_manager.json
- Old values will be stored as a backup, just in case
- Update cached data when playlists are modified (removed/renamed)
- Changed bandwidth attribute of subtitles in MPEG-DASH manifest to 0

## v7.0.8
### Fixed
- Update selection and sorting of streams to fix missing live streams
Expand Down
30 changes: 18 additions & 12 deletions resources/lib/youtube_plugin/kodion/abstract_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import re

from .constants import CHECK_SETTINGS, REROUTE, content, paths
from .constants import CHECK_SETTINGS, CONTENT, PATHS, REROUTE_PATH
from .exceptions import KodionException
from .items import (
DirectoryItem,
Expand All @@ -36,49 +36,49 @@ def __init__(self):
# register some default paths
self.register_path(r''.join((
'^',
'(?:', paths.HOME, ')?/?$'
'(?:', PATHS.HOME, ')?/?$'
)), self._internal_root)

self.register_path(r''.join((
'^',
paths.ROUTE,
PATHS.ROUTE,
'(?P<path>/[^?]+?)(?:/*[?].+|/*)$'
)), self.reroute)

self.register_path(r''.join((
'^',
paths.GOTO_PAGE,
PATHS.GOTO_PAGE,
'(?P<page>/[0-9]+)?'
'(?P<path>/[^?]+?)(?:/*[?].+|/*)$'
)), self._internal_goto_page)

self.register_path(r''.join((
'^',
paths.COMMAND,
PATHS.COMMAND,
'/(?P<command>[^?]+?)(?:/*[?].+|/*)$'
)), self._on_command)

self.register_path(r''.join((
'^',
paths.WATCH_LATER,
PATHS.WATCH_LATER,
'/(?P<command>add|clear|list|remove)/?$'
)), self.on_watch_later)

self.register_path(r''.join((
'^',
paths.BOOKMARKS,
PATHS.BOOKMARKS,
'/(?P<command>add|clear|list|remove)/?$'
)), self.on_bookmarks)

self.register_path(r''.join((
'^',
'(', paths.SEARCH, '|', paths.EXTERNAL_SEARCH, ')',
'(', PATHS.SEARCH, '|', PATHS.EXTERNAL_SEARCH, ')',
'/(?P<command>input|query|list|remove|clear|rename)?/?$'
)), self._internal_search)

self.register_path(r''.join((
'^',
paths.HISTORY,
PATHS.HISTORY,
'/?$'
)), self.on_playback_history)

Expand Down Expand Up @@ -234,10 +234,16 @@ def reroute(self, context, re_match=None, path=None, params=None):
_scope=function_cache.SCOPE_NONE,
context=context.clone(path, params),
)
except Exception as exc:
context.log_error('Rerouting error: |{0}|'.format(exc))
finally:
context.log_debug('Rerouting to |{path}| |{params}|{status}'
.format(path=path,
params=params,
status='' if result else ' failed'))
if not result:
return False
context.get_ui().set_property(REROUTE, path)
context.get_ui().set_property(REROUTE_PATH, path)
context.execute('ActivateWindow(Videos, {0}{1})'.format(
context.create_uri(path, params),
', return' if window_return else '',
Expand Down Expand Up @@ -312,10 +318,10 @@ def _internal_search(self, context, re_match):

if not params.get('incognito') and not params.get('channel_id'):
search_history.update(query)
context.set_path(paths.SEARCH, 'query')
context.set_path(PATHS.SEARCH, 'query')
return self.on_search(query, context, re_match)

context.set_content(content.LIST_CONTENT)
context.set_content(CONTENT.LIST_CONTENT)
result = []

location = context.get_param('location', False)
Expand Down
138 changes: 87 additions & 51 deletions resources/lib/youtube_plugin/kodion/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,96 +11,132 @@
from __future__ import absolute_import, division, unicode_literals

from . import (
const_content_types as content,
const_paths as paths,
const_settings as settings,
const_sort_methods as sort,
const_content_types as CONTENT,
const_paths as PATHS,
const_settings as SETTINGS,
const_sort_methods as SORT,
)


# Addon paths
ADDON_ID = 'plugin.video.youtube'
ADDON_PATH = 'special://home/addons/{id}'.format(id=ADDON_ID)
DATA_PATH = 'special://profile/addon_data/{id}'.format(id=ADDON_ID)
MEDIA_PATH = ADDON_PATH + '/resources/media'
RESOURCE_PATH = ADDON_PATH + '/resources'
TEMP_PATH = 'special://temp/{id}'.format(id=ADDON_ID)

# Const values
VALUE_FROM_STR = {
'0': False,
'1': True,
'false': False,
'true': True,
}

# Flags
ABORT_FLAG = 'abort_requested'
BUSY_FLAG = 'busy'
WAIT_FLAG = 'builtin_running'

# ListItem Properties
CHANNEL_ID = 'channel_id'
CHECK_SETTINGS = 'check_settings'
DEVELOPER_CONFIGS = 'configs'
CONTENT_TYPE = 'content_type'
LICENSE_TOKEN = 'license_token'
LICENSE_URL = 'license_url'
PLAY_COUNT = 'video_play_count'
PLAY_FORCE_AUDIO = 'audio_only'
PLAY_PROMPT_QUALITY = 'ask_for_quality'
PLAY_PROMPT_SUBTITLES = 'prompt_for_subtitles'
PLAYLIST_ID = 'playlist_id'
PLAYLISTITEM_ID = 'playlistitem_id'
SUBSCRIPTION_ID = 'subscription_id'
VIDEO_ID = 'video_id'

# Events
CHECK_SETTINGS = 'check_settings'
PLAYBACK_INIT = 'playback_init'
PLAYBACK_STARTED = 'playback_started'
PLAYBACK_STOPPED = 'playback_stopped'
PLAYER_DATA = 'player_json'
PLAYLIST_ID = 'playlist_id'
PLAYLISTITEM_ID = 'playlistitem_id'
PLAYLIST_PATH = 'playlist_path'
PLAYLIST_POSITION = 'playlist_position'
REFRESH_CONTAINER = 'refresh_container'
RELOAD_ACCESS_MANAGER = 'reload_access_manager'
REROUTE = 'reroute'
SLEEPING = 'sleeping'
SUBSCRIPTION_ID = 'subscription_id'
SWITCH_PLAYER_FLAG = 'switch_player'
VIDEO_ID = 'video_id'
WAIT_FLAG = 'builtin_running'

# Sleep/wakeup states
PLUGIN_WAKEUP = 'plugin_wakeup'
PLUGIN_SLEEPING = 'plugin_sleeping'
SERVER_WAKEUP = 'server_wakeup'
SERVER_POST_START = 'server_post_start'
WAKEUP = 'wakeup'

# Play options
PLAY_FORCE_AUDIO = 'audio_only'
PLAY_PROMPT_QUALITY = 'ask_for_quality'
PLAY_PROMPT_SUBTITLES = 'prompt_for_subtitles'
PLAY_WITH = 'play_with'

# Stored data
CONTENT_TYPE = 'content_type'
DEVELOPER_CONFIGS = 'configs'
LICENSE_TOKEN = 'license_token'
LICENSE_URL = 'license_url'
PLAYER_DATA = 'player_json'
PLAYLIST_PATH = 'playlist_path'
PLAYLIST_POSITION = 'playlist_position'
REROUTE_PATH = 'reroute_path'

__all__ = (
'ABORT_FLAG',
# Addon paths
'ADDON_ID',
'ADDON_PATH',
'DATA_PATH',
'MEDIA_PATH',
'RESOURCE_PATH',
'TEMP_PATH',

# Const values
'VALUE_FROM_STR',

# Flags
'ABORT_FLAG',
'BUSY_FLAG',
'WAIT_FLAG',

# ListItem properties
'CHANNEL_ID',
'PLAY_COUNT',
'PLAYLIST_ID',
'PLAYLISTITEM_ID',
'SUBSCRIPTION_ID',
'VIDEO_ID',

# Events
'CHECK_SETTINGS',
'PLAYBACK_INIT',
'PLAYBACK_STARTED',
'PLAYBACK_STOPPED',
'REFRESH_CONTAINER',
'RELOAD_ACCESS_MANAGER',

# Sleep/wakeup states
'PLUGIN_SLEEPING',
'PLUGIN_WAKEUP',
'SERVER_POST_START',
'SERVER_WAKEUP',
'WAKEUP',

# Play options
'PLAY_FORCE_AUDIO',
'PLAY_PROMPT_QUALITY',
'PLAY_PROMPT_SUBTITLES',
'PLAY_WITH',

# Stored data
'CONTENT_TYPE',
'DATA_PATH',
'DEVELOPER_CONFIGS',
'LICENSE_TOKEN',
'LICENSE_URL',
'MEDIA_PATH',
'PLAY_COUNT',
'PLAY_FORCE_AUDIO',
'PLAY_PROMPT_QUALITY',
'PLAY_PROMPT_SUBTITLES',
'PLAYBACK_INIT',
'PLAYBACK_STARTED',
'PLAYBACK_STOPPED',
'PLAYER_DATA',
'PLAYLIST_ID',
'PLAYLISTITEM_ID',
'PLAYLIST_PATH',
'PLAYLIST_POSITION',
'REFRESH_CONTAINER',
'RELOAD_ACCESS_MANAGER',
'RESOURCE_PATH',
'REROUTE',
'SLEEPING',
'SUBSCRIPTION_ID',
'SWITCH_PLAYER_FLAG',
'TEMP_PATH',
'VALUE_FROM_STR',
'VIDEO_ID',
'WAIT_FLAG',
'WAKEUP',
'content',
'paths',
'settings',
'sort',
'REROUTE_PATH',

# Other constants
'CONTENT',
'PATHS',
'SETTINGS',
'SORT',
)
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 @@ -14,7 +14,13 @@

from .. import logger
from ..compatibility import quote, to_str, urlencode
from ..constants import VALUE_FROM_STR
from ..constants import (
PLAY_FORCE_AUDIO,
PLAY_PROMPT_QUALITY,
PLAY_PROMPT_SUBTITLES,
PLAY_WITH,
VALUE_FROM_STR,
)
from ..json_store import AccessManager
from ..sql_store import (
BookmarksList,
Expand All @@ -34,8 +40,10 @@ class AbstractContext(object):
_settings = None

_BOOL_PARAMS = {
'ask_for_quality',
'audio_only',
PLAY_FORCE_AUDIO,
PLAY_PROMPT_SUBTITLES,
PLAY_PROMPT_QUALITY,
PLAY_WITH,
'confirmed',
'clip',
'enable',
Expand All @@ -47,7 +55,6 @@ class AbstractContext(object):
'location',
'logged_in',
'play',
'prompt_for_subtitles',
'resume',
'screensaver',
'strm',
Expand Down
Loading
Loading