Skip to content

Commit

Permalink
Merge pull request #575 from MoojMidge/master
Browse files Browse the repository at this point in the history
v7.0.3+beta.3
  • Loading branch information
MoojMidge authored Feb 9, 2024
2 parents 8c543b7 + d8389be commit 4381622
Show file tree
Hide file tree
Showing 30 changed files with 696 additions and 314 deletions.
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.3+beta.2" provider-name="anxdpanic, bromix">
<addon id="plugin.video.youtube" name="YouTube" version="7.0.3+beta.3" provider-name="anxdpanic, bromix">
<requires>
<import addon="xbmc.python" version="3.0.1"/>
<import addon="script.module.requests" version="2.12.4"/>
Expand Down
16 changes: 16 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
## v7.0.3+beta.3
### Fixed
Fix invalid error when removing subscriptions #568
Fix removing item from playlist #570
Fix related videos and respect pagination limits #572
Fix not correctly including visitor data in continuation requests
Fix for possible database locks during setup
Fix incorrect timezone details for premiered time #574

### Changed
Don't show subscribe context menu item in My Subscriptions #568

### New
Add ability to unsubscribe from My Subscriptions #240, #568
Make MPEG-DASH frame rate details configurable #336

## v7.0.3+beta.2
### Changed
- Function and data cache are now created per user
Expand Down
8 changes: 8 additions & 0 deletions resources/language/resource.language.en_au/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1384,3 +1384,11 @@ msgstr ""
msgctxt "#30770"
msgid "Are you sure you want to clear your Watch Later list?"
msgstr ""

msgctxt "#30771"
msgid "Disable fractional framerate hinting"
msgstr ""

msgctxt "#30772"
msgid "Disable all framerate hinting"
msgstr ""
8 changes: 8 additions & 0 deletions resources/language/resource.language.en_gb/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1384,3 +1384,11 @@ msgstr ""
msgctxt "#30770"
msgid "Are you sure you want to clear your Watch Later list?"
msgstr ""

msgctxt "#30771"
msgid "Disable fractional framerate hinting"
msgstr ""

msgctxt "#30772"
msgid "Disable all framerate hinting"
msgstr ""
8 changes: 8 additions & 0 deletions resources/language/resource.language.en_nz/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1380,3 +1380,11 @@ msgstr ""
msgctxt "#30770"
msgid "Are you sure you want to clear your Watch Later list?"
msgstr ""

msgctxt "#30771"
msgid "Disable fractional framerate hinting"
msgstr ""

msgctxt "#30772"
msgid "Disable all framerate hinting"
msgstr ""
8 changes: 8 additions & 0 deletions resources/language/resource.language.en_us/strings.po
Original file line number Diff line number Diff line change
Expand Up @@ -1385,3 +1385,11 @@ msgstr ""
msgctxt "#30770"
msgid "Are you sure you want to clear your Watch Later list?"
msgstr ""

msgctxt "#30771"
msgid "Disable fractional framerate hinting"
msgstr ""

msgctxt "#30772"
msgid "Disable all framerate hinting"
msgstr ""
10 changes: 5 additions & 5 deletions resources/lib/youtube_plugin/kodion/abstract_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,25 +38,25 @@ def __init__(self):
self.register_path(r'^/$', '_internal_root')

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

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

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

self.register_path(r''.join((
'^/',
'^',
paths.HISTORY,
'/$'
)), 'on_playback_history')
Expand Down Expand Up @@ -320,7 +320,7 @@ def _internal_search(self, context, re_match):
search_history.update(query)
except:
pass
context.set_path('/kodion/search/query/')
context.set_path(paths.SEARCH, 'query')
if isinstance(query, bytes):
query = query.decode('utf-8')
return self.on_search(query, context, re_match)
Expand Down
14 changes: 10 additions & 4 deletions resources/lib/youtube_plugin/kodion/constants/const_paths.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,16 @@
from __future__ import absolute_import, division, unicode_literals


SEARCH = 'kodion/search'
FAVORITES = 'kodion/favorites'
WATCH_LATER = 'kodion/watch_later'
HISTORY = 'kodion/playback_history'
SEARCH = '/kodion/search'
FAVORITES = '/kodion/favorites'
WATCH_LATER = '/kodion/watch_later'
HISTORY = '/kodion/playback_history'

DISLIKED_VIDEOS = '/special/disliked_videos'
LIKED_VIDEOS = '/channel/mine/playlist/LL'
MY_PLAYLISTS = '/channel/mine/playlists'
MY_SUBSCRIPTIONS = '/special/new_uploaded_videos'
SUBSCRIPTIONS = '/subscriptions/list'

API = '/youtube/api'
API_SUBMIT = '/youtube/api/submit'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ def create_uri(self, path='/', params=None):
def get_path(self):
return self._path

def set_path(self, value):
self._path = value
def set_path(self, *path):
self._path = create_path(*path)

def get_params(self):
return self._params
Expand Down Expand Up @@ -370,3 +370,7 @@ def sleep(milli_seconds):
@staticmethod
def get_infolabel(name):
raise NotImplementedError()

@staticmethod
def get_listitem_detail(detail_name, attr=False):
raise NotImplementedError()
30 changes: 12 additions & 18 deletions resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py
Original file line number Diff line number Diff line change
Expand Up @@ -327,24 +327,10 @@ def format_time(time_obj, str_format=None):
return time_obj.strftime(str_format)

def get_language(self):
"""
The xbmc.getLanguage() method is fucked up!!! We always return 'en-US' for now
"""

"""
if self.get_system_version().get_release_name() == 'Frodo':
return 'en-US'
try:
language = xbmc.getLanguage(0, region=True)
language = language.split('-')
language = '%s-%s' % (language[0].lower(), language[1].upper())
return language
except Exception as exc:
self.log_error('Failed to get system language (%s)', exc.__str__())
return 'en-US'
"""

kodi_language = xbmc.getLanguage(format=xbmc.ISO_639_1, region=True)
lang_code, seperator, region = kodi_language.partition('-')
if region:
return seperator.join((lang_code.lower(), region.upper()))
return 'en-US'

def get_language_name(self, lang_id=None):
Expand Down Expand Up @@ -606,3 +592,11 @@ def abort_requested(self):
@staticmethod
def get_infolabel(name):
return xbmc.getInfoLabel(name)

@staticmethod
def get_listitem_detail(detail_name, attr=False):
return xbmc.getInfoLabel(
'Container.ListItem(0).{0}'.format(detail_name)
if attr else
'Container.ListItem(0).Property({0})'.format(detail_name)
)
24 changes: 11 additions & 13 deletions resources/lib/youtube_plugin/kodion/items/menu_items.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,18 +312,10 @@ def go_to_channel(context, channel_id, channel_name):


def subscribe_to_channel(context, channel_id, channel_name=''):
if not channel_name:
return (
context.localize('subscribe'),
'RunPlugin({0})'.format(context.create_uri(
('subscriptions', 'add',),
{
'subscription_id': channel_id,
},
))
)
return (
context.localize('subscribe_to') % context.get_ui().bold(channel_name),
context.localize('subscribe_to') % context.get_ui().bold(channel_name)
if channel_name else
context.localize('subscribe'),
'RunPlugin({0})'.format(context.create_uri(
('subscriptions', 'add',),
{
Expand All @@ -333,13 +325,19 @@ def subscribe_to_channel(context, channel_id, channel_name=''):
)


def unsubscribe_from_channel(context, channel_id):
def unsubscribe_from_channel(context, channel_id=None, subscription_id=None):
return (
context.localize('unsubscribe'),
'RunPlugin({0})'.format(context.create_uri(
('subscriptions', 'remove',),
{
'subscription_id': channel_id,
'subscription_id': subscription_id,
},
)) if subscription_id else
'RunPlugin({0})'.format(context.create_uri(
('subscriptions', 'remove',),
{
'channel_id': channel_id,
},
))
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ def get_mpd_video_qualities(self):
if selected >= key]

def stream_features(self):
return self.get_string_list(settings.MPD_STREAM_FEATURES)
return frozenset(self.get_string_list(settings.MPD_STREAM_FEATURES))

_STREAM_SELECT = {
1: 'auto',
Expand Down
41 changes: 23 additions & 18 deletions resources/lib/youtube_plugin/kodion/sql_store/storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,15 +173,21 @@ def _open(self):
self.__class__._table_created = False
self.__class__._table_updated = True

try:
db = sqlite3.connect(self._filepath,
check_same_thread=False,
timeout=1,
isolation_level=None)
except sqlite3.OperationalError as exc:
log_error('SQLStorage._execute - {exc}:\n{details}'.format(
exc=exc, details=''.join(format_stack())
))
for _ in range(3):
try:
db = sqlite3.connect(self._filepath,
check_same_thread=False,
timeout=1,
isolation_level=None)
break
except (sqlite3.Error, sqlite3.OperationalError) as exc:
log_error('SQLStorage._open - {exc}:\n{details}'.format(
exc=exc, details=''.join(format_stack())
))
if isinstance(exc, sqlite3.Error):
return False
time.sleep(0.1)
else:
return False

cursor = db.cursor()
Expand All @@ -207,7 +213,7 @@ def _open(self):
)

if not self._table_updated:
for result in cursor.execute(self._sql['has_old_table']):
for result in self._execute(cursor, self._sql['has_old_table']):
if result[0] == 1:
statements.extend((
'PRAGMA writable_schema = 1;',
Expand All @@ -220,7 +226,7 @@ def _open(self):
transaction_begin = len(sql_script) + 1
sql_script.extend(('BEGIN;', 'COMMIT;', 'VACUUM;'))
sql_script[transaction_begin:transaction_begin] = statements
cursor.executescript('\n'.join(sql_script))
self._execute(cursor, '\n'.join(sql_script), script=True)

self.__class__._table_created = True
self.__class__._table_updated = True
Expand All @@ -239,7 +245,7 @@ def _close(self):
self._db = None

@staticmethod
def _execute(cursor, query, values=None, many=False):
def _execute(cursor, query, values=None, many=False, script=False):
if values is None:
values = ()
"""
Expand All @@ -251,17 +257,16 @@ def _execute(cursor, query, values=None, many=False):
try:
if many:
return cursor.executemany(query, values)
if script:
return cursor.executescript(query)
return cursor.execute(query, values)
except sqlite3.OperationalError as exc:
except (sqlite3.Error, sqlite3.OperationalError) as exc:
log_error('SQLStorage._execute - {exc}:\n{details}'.format(
exc=exc, details=''.join(format_stack())
))
if isinstance(exc, sqlite3.Error):
return []
time.sleep(0.1)
except sqlite3.Error as exc:
log_error('SQLStorage._execute - {exc}:\n{details}'.format(
exc=exc, details=''.join(format_stack())
))
return []
return []

def _optimize_file_size(self, defer=False):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def on_ok(self, title, text):
def on_remove_content(self, content_name):
raise NotImplementedError()

def on_select(self, title, items=None):
def on_select(self, title, items=None, preselect=-1, use_details=False):
raise NotImplementedError()

def open_settings(self):
Expand Down
Loading

0 comments on commit 4381622

Please sign in to comment.