diff --git a/addon.xml b/addon.xml index a72ab9429..dc48179b5 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + diff --git a/changelog.txt b/changelog.txt index 8cce7ab2f..d45d4600b 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,3 +1,9 @@ +## v7.0.3 +### Fixed +- Fix incorrect labelling of subtitle language in Kodi subtitle selection dialog #595 +- Fix failure to play videos when MPEG-DASH and subtitles were enabled in Kodi 20 and lower #595 +- Fix Python 2 compatibility + ## v7.0.3+beta.5 ### Fixed - Properly fix infotagger error with Kodi v19 diff --git a/resources/language/resource.language.en_au/strings.po b/resources/language/resource.language.en_au/strings.po index b5f2756eb..a89e3ba7c 100644 --- a/resources/language/resource.language.en_au/strings.po +++ b/resources/language/resource.language.en_au/strings.po @@ -1400,3 +1400,7 @@ msgstr "" msgctxt "#30774" msgid "All available" msgstr "" + +msgctxt "#30775" +msgid "%s (translation)" +msgstr "" diff --git a/resources/language/resource.language.en_gb/strings.po b/resources/language/resource.language.en_gb/strings.po index 0a5dd59c0..a538dddd8 100644 --- a/resources/language/resource.language.en_gb/strings.po +++ b/resources/language/resource.language.en_gb/strings.po @@ -1400,3 +1400,7 @@ msgstr "" msgctxt "#30774" msgid "All available" msgstr "" + +msgctxt "#30775" +msgid "%s (translation)" +msgstr "" diff --git a/resources/language/resource.language.en_nz/strings.po b/resources/language/resource.language.en_nz/strings.po index a52043a25..f819f45ce 100644 --- a/resources/language/resource.language.en_nz/strings.po +++ b/resources/language/resource.language.en_nz/strings.po @@ -1396,3 +1396,7 @@ msgstr "" msgctxt "#30774" msgid "All available" msgstr "" + +msgctxt "#30775" +msgid "%s (translation)" +msgstr "" diff --git a/resources/language/resource.language.en_us/strings.po b/resources/language/resource.language.en_us/strings.po index 13a859a6b..0f89e12ae 100644 --- a/resources/language/resource.language.en_us/strings.po +++ b/resources/language/resource.language.en_us/strings.po @@ -1401,3 +1401,7 @@ msgstr "" msgctxt "#30774" msgid "All available" msgstr "" + +msgctxt "#30775" +msgid "%s (translation)" +msgstr "" diff --git a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py index 5e5858ee1..0e1a1f177 100644 --- a/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py +++ b/resources/lib/youtube_plugin/kodion/context/xbmc/xbmc_context.py @@ -194,6 +194,7 @@ class XbmcContext(AbstractContext): 'subtitles.all': 30774, 'subtitles.language': 30560, 'subtitles.no_auto_generated': 30602, + 'subtitles.translation': 30775, 'subtitles.with_fallback': 30601, 'succeeded': 30575, 'trending': 30513, diff --git a/resources/lib/youtube_plugin/kodion/sql_store/function_cache.py b/resources/lib/youtube_plugin/kodion/sql_store/function_cache.py index 015ed30a2..19850a727 100644 --- a/resources/lib/youtube_plugin/kodion/sql_store/function_cache.py +++ b/resources/lib/youtube_plugin/kodion/sql_store/function_cache.py @@ -68,7 +68,7 @@ def get_result(self, func, *args, **kwargs): cache_id = self._create_id_from_func(partial_func) return self._get(cache_id) - def run(self, func, seconds, *args, _refresh=False, **kwargs): + def run(self, func, seconds, *args, **kwargs): """ Returns the cached data of the given function. :param func, function to cache @@ -76,6 +76,7 @@ def run(self, func, seconds, *args, _refresh=False, **kwargs): :param _refresh: bool, updates cache with new func result :return: """ + refresh = kwargs.pop('_refresh', False) partial_func = partial(func, *args, **kwargs) # if caching is disabled call the function @@ -83,7 +84,7 @@ def run(self, func, seconds, *args, _refresh=False, **kwargs): return partial_func() cache_id = self._create_id_from_func(partial_func) - data = None if _refresh else self._get(cache_id, seconds=seconds) + data = None if refresh else self._get(cache_id, seconds=seconds) if data is None: data = partial_func() self._set(cache_id, data) diff --git a/resources/lib/youtube_plugin/kodion/utils/methods.py b/resources/lib/youtube_plugin/kodion/utils/methods.py index 2466cdf6f..c980a575c 100644 --- a/resources/lib/youtube_plugin/kodion/utils/methods.py +++ b/resources/lib/youtube_plugin/kodion/utils/methods.py @@ -165,7 +165,7 @@ def _find_best_fit_video(_stream_data): return selected_stream_data -def create_path(*args, is_uri=False): +def create_path(*args, **kwargs): path = '/'.join([ part for part in [ @@ -178,7 +178,7 @@ def create_path(*args, is_uri=False): else: return '/' - if is_uri: + if kwargs.get('is_uri', False): return quote(path) return path diff --git a/resources/lib/youtube_plugin/youtube/helper/subtitles.py b/resources/lib/youtube_plugin/youtube/helper/subtitles.py index 485c3f5a0..4c643eba4 100644 --- a/resources/lib/youtube_plugin/youtube/helper/subtitles.py +++ b/resources/lib/youtube_plugin/youtube/helper/subtitles.py @@ -231,26 +231,26 @@ def _prompt(self): if not num_total: self._context.log_debug('No subtitles found for prompt') else: + translation_lang = self._context.localize('subtitles.translation') choice = self._context.get_ui().on_select( self._context.localize('subtitles.language'), [name for _, name in captions] + - [name + ' *' for _, name in translations] + [translation_lang % name for _, name in translations] ) - if choice == -1: - self._context.log_debug('Subtitle selection cancelled') - return None - track = None if 0 <= choice < num_captions: track = self.caption_tracks[choice] kind = track.get('kind') - choice = translations[choice - num_captions] + choice = captions[choice - num_captions] is_translation = False elif num_captions <= choice < num_total: track = self.defaults['translation_base'] kind = 'translation' choice = translations[choice - num_captions] is_translation = True + else: + self._context.log_debug('Subtitle selection cancelled') + return None url = self._get_url( caption_track=track, diff --git a/resources/lib/youtube_plugin/youtube/helper/video_info.py b/resources/lib/youtube_plugin/youtube/helper/video_info.py index e86f03606..b918dea77 100644 --- a/resources/lib/youtube_plugin/youtube/helper/video_info.py +++ b/resources/lib/youtube_plugin/youtube/helper/video_info.py @@ -1858,16 +1858,23 @@ def _filter_group(previous_group, previous_stream, item): set_id += 1 if subs_data: + translation_lang = self._context.localize('subtitles.translation') for lang_code, subtitle in subs_data.items(): label = language = subtitle['language'] kind = subtitle['kind'] if kind: if kind == 'translation': - label = '{0} ({1})'.format(language, kind) + label = translation_lang % language kind = '_'.join((lang_code, kind)) else: kind = lang_code + url = (unquote(subtitle['url']) + .replace("&", "&") + .replace('"', """) + .replace("<", "<") + .replace(">", ">")) + output.extend(( '\t\t\n' - '\t\t\t\t', subtitle['url'], '\n' + '\t\t\t\t', url, '\n' '\t\t\t\n' '\t\t\n' ))