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.1+beta.2 #941

Merged
merged 26 commits into from
Oct 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
87e8a7f
Properly display bookmarks that were created with only partial inform…
MoojMidge Oct 11, 2024
6dd9a0e
Fix creation of YouTube object Items to set minimum required item id …
MoojMidge Oct 11, 2024
09a38f5
Standardise return type of LoginClient.refresh_token #932
MoojMidge Oct 11, 2024
d539d9e
Remove unused/redundant LoginClient.authenticate method
MoojMidge Oct 11, 2024
0739682
Improve updating of bookmarks and displaying unavailable bookmarked v…
MoojMidge Oct 11, 2024
01336b2
Fix curl headers not being used when set on path of setResolvedUrl li…
MoojMidge Oct 12, 2024
88dfa60
Explicitly set http server protocol version to HTTP/1.1
MoojMidge Oct 12, 2024
64d76a8
Fix HEAD requests to MPD manifests after 74c7d04
MoojMidge Oct 12, 2024
6fe83fe
Rename StreamInfo._make_curl_headers to StreamInfo._make_header_string
MoojMidge Oct 14, 2024
d2586b7
Don't access match group using __getitem__ to restore Python 2 compat…
MoojMidge Oct 14, 2024
db867f5
Further updates to standardise logging for script, plugin and service…
MoojMidge Oct 23, 2024
42e314b
Further updates/tidy ups to improve logging
MoojMidge Oct 23, 2024
7d70432
Rename StreamInfo._make_header_string to StreamInfo._prepare_headers
MoojMidge Oct 24, 2024
8f76bef
Properly distinguish between VP9 and VP9.2 with HDR info
MoojMidge Oct 24, 2024
54cdb9c
Fix kodion.utils.methods.redact_ip not defined in __all__
MoojMidge Oct 24, 2024
e73d704
Add new kodion.utils.methods.entity_escape method
MoojMidge Oct 24, 2024
c76f51b
Misc tidy ups
MoojMidge Oct 24, 2024
292fb94
Fix http server not running when script shows client IP
MoojMidge Oct 25, 2024
0388d14
Add View all and Shuffle context menu items for playlists
MoojMidge Oct 25, 2024
2351a4a
Dont ask for playlist order when playing from specific video
MoojMidge Oct 25, 2024
82c499a
Add kodion.logger.Logger mixin class and kodion.logging.enabled plugi…
MoojMidge Oct 26, 2024
a42753f
Store stream and MediaItem headers as dict
MoojMidge Oct 27, 2024
7dae24c
Ensure connection is closed on HTTPServer redirect
MoojMidge Oct 27, 2024
2f3ce1e
Move kodion.utils.methods.entity_escape to kodion.comptibility.entity…
MoojMidge Oct 27, 2024
4ca960b
Add context menu items for Uploads playlist
MoojMidge Oct 27, 2024
b6f6837
Version bump v7.1.1+beta.2
MoojMidge Oct 27, 2024
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.1.1+beta.1" provider-name="anxdpanic, bromix, MoojMidge">
<addon id="plugin.video.youtube" name="YouTube" version="7.1.1+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
19 changes: 19 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
## v7.1.1+beta.2
### Fixed
- Standardise return type of LoginClient.refresh_token #932
- Fix curl headers not being used when set on path of setResolvedUrl listitem
- Fix HEAD requests to MPD manifests
- Fix various Python2 incompatible changes
- Properly distinguish between VP9 and VP9.2 with HDR info
- Fix http server not running when script shows client IP

### Changed
- Improve display and update of bookmarks
- Explicitly set http server protocol version to HTTP/1.1
- Improve logging

### New
- Add View all and Shuffle context menu items for playlists
- New setting to enable debug logging for addon
- Setting > Advanced > Logging > Enable debug logging

## v7.1.1+beta.1
### Fixed
- Fix http server not listening on any interface if listen IP is 0.0.0.0 #927
Expand Down
2 changes: 1 addition & 1 deletion resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ msgid "None"
msgstr ""

msgctxt "#30562"
msgid ""
msgid "View all"
msgstr ""

msgctxt "#30563"
Expand Down
1 change: 0 additions & 1 deletion resources/lib/youtube_plugin/kodion/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@

from __future__ import absolute_import, division, unicode_literals

from . import logger
from .abstract_provider import (
# Abstract provider for implementation by the user
AbstractProvider,
Expand Down
28 changes: 28 additions & 0 deletions resources/lib/youtube_plugin/kodion/compatibility/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
'byte_string_type',
'cpu_count',
'datetime_infolabel',
'entity_escape',
'parse_qs',
'parse_qsl',
'quote',
Expand Down Expand Up @@ -54,12 +55,25 @@
import xbmcplugin
import xbmcvfs


xbmc.LOGNOTICE = xbmc.LOGINFO
xbmc.LOGSEVERE = xbmc.LOGFATAL

string_type = str
byte_string_type = bytes
to_str = str


def entity_escape(text,
entities=str.maketrans({
'&': '&amp;',
'"': '&quot;',
'<': '&lt;',
'>': '&gt;',
'\'': '&#x27;',
})):
return text.translate(entities)

# Compatibility shims for Kodi v18 and Python v2.7
except ImportError:
from BaseHTTPServer import BaseHTTPRequestHandler
Expand Down Expand Up @@ -130,11 +144,25 @@ def _file_closer(*args, **kwargs):
string_type = basestring
byte_string_type = (bytes, str)


def to_str(value):
if isinstance(value, unicode):
return value.encode('utf-8')
return str(value)


def entity_escape(text,
entities={
'&': '&amp;',
'"': '&quot;',
'<': '&lt;',
'>': '&gt;',
'\'': '&#x27;',
}):
for key, value in entities.viewitems():
text = text.replace(key, value)
return text

# Kodi v20+
if hasattr(xbmcgui.ListItem, 'setDateTime'):
def datetime_infolabel(datetime_obj, *_args, **_kwargs):
Expand Down
2 changes: 2 additions & 0 deletions resources/lib/youtube_plugin/kodion/constants/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
PLAY_FORCE_AUDIO = 'audio_only'
PLAY_PROMPT_QUALITY = 'ask_for_quality'
PLAY_PROMPT_SUBTITLES = 'prompt_for_subtitles'
PLAY_STRM = 'strm'
PLAY_TIMESHIFT = 'timeshift'
PLAY_WITH = 'play_with'

Expand Down Expand Up @@ -124,6 +125,7 @@
'PLAY_FORCE_AUDIO',
'PLAY_PROMPT_QUALITY',
'PLAY_PROMPT_SUBTITLES',
'PLAY_STRM',
'PLAY_TIMESHIFT',
'PLAY_WITH',

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,5 @@
HTTPD_LISTEN = 'kodion.http.listen' # (str)
HTTPD_WHITELIST = 'kodion.http.ip.whitelist' # (str)
HTTPD_IDLE_SLEEP = 'youtube.http.idle_sleep' # (bool)

LOGGING_ENABLED = 'kodion.logging.enabled' # (bool)
26 changes: 4 additions & 22 deletions resources/lib/youtube_plugin/kodion/context/abstract_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,14 @@

import os

from .. import logger
from ..logger import Logger
from ..compatibility import parse_qsl, quote, to_str, urlencode, urlsplit
from ..constants import (
PATHS,
PLAY_FORCE_AUDIO,
PLAY_PROMPT_QUALITY,
PLAY_PROMPT_SUBTITLES,
PLAY_STRM,
PLAY_TIMESHIFT,
PLAY_WITH,
VALUE_FROM_STR,
Expand All @@ -36,7 +37,7 @@
from ..utils import current_system_version


class AbstractContext(object):
class AbstractContext(Logger):
_initialized = False
_addon = None
_settings = None
Expand All @@ -45,6 +46,7 @@ class AbstractContext(object):
PLAY_FORCE_AUDIO,
PLAY_PROMPT_SUBTITLES,
PLAY_PROMPT_QUALITY,
PLAY_STRM,
PLAY_TIMESHIFT,
PLAY_WITH,
'confirmed',
Expand All @@ -58,10 +60,8 @@ class AbstractContext(object):
'incognito',
'location',
'logged_in',
'play',
'resume',
'screensaver',
'strm',
'window_return',
}
_INT_PARAMS = {
Expand Down Expand Up @@ -430,24 +430,6 @@ def set_content(self, content_type, sub_type=None, category_label=None):
def add_sort_method(self, *sort_methods):
raise NotImplementedError()

def log(self, text, log_level=logger.NOTICE):
logger.log(text, log_level, self.get_id())

def log_warning(self, text):
self.log(text, logger.WARNING)

def log_error(self, text):
self.log(text, logger.ERROR)

def log_notice(self, text):
self.log(text, logger.NOTICE)

def log_debug(self, text):
self.log(text, logger.DEBUG)

def log_info(self, text):
self.log(text, logger.INFO)

def clone(self, new_path=None, new_params=None):
raise NotImplementedError()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ class XbmcContext(AbstractContext):
'playlist.progress.updating': 30536,
'playlist.removed_from': 30715,
'playlist.select': 30521,
'playlist.view.all': 30562,
'playlists': 30501,
'please_wait': 30119,
'prompt': 30566,
Expand Down Expand Up @@ -683,6 +684,7 @@ def use_inputstream_adaptive(self, prompt=False):
'av01': loose_version('20.3.0'),
'vp8': False,
'vp9': loose_version('2.3.14'),
'vp9.2': loose_version('2.4.0'),
}

def inputstream_adaptive_capabilities(self, capability=None):
Expand Down
6 changes: 3 additions & 3 deletions resources/lib/youtube_plugin/kodion/debug.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import atexit
import os

from .logger import log_debug
from .logger import Logger


def debug_here(host='localhost'):
Expand Down Expand Up @@ -145,7 +145,7 @@ def __exit__(self, exc_type=None, exc_val=None, exc_tb=None):
if not self._enabled:
return

log_debug('Profiling stats: {0}'.format(self.get_stats(
Logger.log_debug('Profiling stats: {0}'.format(self.get_stats(
num_lines=self._num_lines,
print_callees=self._print_callees,
reuse=self._reuse,
Expand Down Expand Up @@ -270,7 +270,7 @@ def get_stats(self,
return output

def print_stats(self):
log_debug('Profiling stats: {0}'.format(self.get_stats(
Logger.log_debug('Profiling stats: {0}'.format(self.get_stats(
num_lines=self._num_lines,
print_callees=self._print_callees,
reuse=self._reuse,
Expand Down
84 changes: 83 additions & 1 deletion resources/lib/youtube_plugin/kodion/items/base_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,14 @@
from datetime import date, datetime
from hashlib import md5

from ..compatibility import datetime_infolabel, string_type, to_str, unescape
from ..compatibility import (
datetime_infolabel,
parse_qsl,
string_type,
to_str,
unescape,
urlsplit,
)
from ..constants import MEDIA_PATH


Expand All @@ -27,6 +34,8 @@ def __init__(self, name, uri, image=None, fanart=None):
self.set_name(name)

self._uri = uri
self._available = True
self._callback = None

self._image = ''
if image:
Expand All @@ -35,6 +44,7 @@ def __init__(self, name, uri, image=None, fanart=None):
if fanart:
self.set_fanart(fanart)

self._bookmark_id = None
self._bookmark_timestamp = None
self._context_menu = None
self._added_utc = None
Expand Down Expand Up @@ -71,6 +81,47 @@ def get_id(self):
"""
return md5(''.join((self._name, self._uri)).encode('utf-8')).hexdigest()

def parse_item_ids_from_uri(self):
if not self._uri:
return None

item_ids = {}

uri = urlsplit(self._uri)
path = uri.path
params = dict(parse_qsl(uri.query))

video_id = params.get('video_id')
if video_id:
item_ids['video_id'] = video_id

channel_id = None
playlist_id = None

while path:
part, _, next_part = path.partition('/')
if not next_part:
break

if part == 'channel':
channel_id = next_part.partition('/')[0]
elif part == 'playlist':
playlist_id = next_part.partition('/')[0]
path = next_part

if channel_id:
item_ids['channel_id'] = channel_id
if playlist_id:
item_ids['playlist_id'] = playlist_id

for item_id, value in item_ids.items():
try:
setattr(self, item_id, value)
except AttributeError:
pass

return item_ids

def set_name(self, name):
try:
name = unescape(name)
Expand All @@ -96,6 +147,22 @@ def get_uri(self):
"""
return self._uri

@property
def available(self):
return self._available

@available.setter
def available(self, value):
self._available = value

@property
def callback(self):
return self._callback

@callback.setter
def callback(self, value):
self._callback = value

def set_image(self, image):
if not image:
return
Expand Down Expand Up @@ -190,6 +257,14 @@ def get_count(self):
def set_count(self, count):
self._count = int(count or 0)

@property
def bookmark_id(self):
return self._bookmark_id

@bookmark_id.setter
def bookmark_id(self, value):
self._bookmark_id = value

def set_bookmark_timestamp(self, timestamp):
self._bookmark_timestamp = timestamp

Expand All @@ -200,6 +275,10 @@ def get_bookmark_timestamp(self):
def playable(self):
return self._playable

@playable.setter
def playable(self, value):
self._playable = value

def add_artist(self, artist):
if artist:
if self._artists is None:
Expand Down Expand Up @@ -289,3 +368,6 @@ def encode(self, obj, nested=False):
if nested:
return output
return super(_Encoder, self).encode(output)

def default(self, obj):
pass
Loading
Loading