diff --git a/addons.xml b/addons.xml index 8869f04..3a5b17d 100644 --- a/addons.xml +++ b/addons.xml @@ -32,13 +32,21 @@ plugin.video.tidb-2.2.1.zip Skip intro, recap, credits, and preview segments in movies and TV shows using TheIntroDB + Salta sigla iniziale, riepilogo, titoli di coda e anteprime in film e serie TV usando TheIntroDB 基于 TheIntroDB 数据库,自动跳过电影和电视剧的片头、前情回顾、片尾和预告片段 تخطى المقدمة، والملخص، وتتر النهاية، ومعاينات الحلقات في الأفلام والمسلسلات باستخدام TheIntroDB Passer l'intro, le résumé, le générique et les aperçus des films et séries avec TheIntroDB + Salta la intro, el resumen, los créditos y los avances de películas y series con TheIntroDB + Pomijaj intro, streszczenia, napisy końcowe i zapowiedzi w filmach i serialach dzięki TheIntroDB + Omite intro-ul, rezumatul, genericul și previzualizările în filme și seriale cu TheIntroDB Looks up segment timings from TheIntroDB while you watch. Uses TVDB ids first, then TMDB, then IMDb ids (tt…) with season/episode. + Recupera gli orari dei segmenti da TheIntroDB durante la visione. Usa prima gli ID TVDB, poi TMDB, infine gli ID IMDb (tt…) con stagione ed episodio. 观看时自动从 TheIntroDB 数据库查询片段时间信息。优先使用 TVDB ID 进行匹配,其次为 TMDB ID,最后为 IMDb ID(tt 开头)配合季/集号查询。 يجلب أزمنة المقاطع من TheIntroDB أثناء المشاهدة. يستخدم معرّفات TVDB أولاً، ثم TMDB، ثم معرّفات IMDb (tt…) مع الموسم والحلقة. Récupère les horodatages des segments depuis TheIntroDB pendant la lecture. Utilise en priorité les identifiants TVDB, puis les identifiants TMDB, puis les identifiants IMDb (tt…) avec la saison et l'épisode. + Consulta los tiempos de los segmentos de TheIntroDB mientras ves contenido. Usa primero los ID de TVDB, luego los de TMDB y, por último, los de IMDb (tt…) con temporada y episodio. + Pobiera czasy segmentów z TheIntroDB podczas oglądania. Najpierw używa identyfikatorów TVDB, potem TMDB, a na końcu IMDb (tt…) wraz z sezonem i odcinkiem. + Preia timpii segmentelor de la TheIntroDB în timp ce vizionezi. Folosește mai întâi ID-urile TVDB, apoi TMDB și, la final, ID-urile IMDb (tt…) împreună cu sezonul și episodul. all GPL-3.0-or-later diff --git a/addons.xml.md5 b/addons.xml.md5 index a9f5740..11fc37a 100644 --- a/addons.xml.md5 +++ b/addons.xml.md5 @@ -1 +1 @@ -75edbb71e1d3aa526e9aeb0de67c06be +51b91a96e6f6415f193aa9d5abab1b0c diff --git a/docs/index.html b/docs/index.html index 6eccd3c..3f850e5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1,5 +1,5 @@ -repository.tidb.repo-2.0.1.zip -plugin.video.tidb-2.2.0.zip +repository.tidb.repo-2.0.0.zip +plugin.video.tidb-2.2.1.zip diff --git a/plugin.video.tidb/addon.xml b/plugin.video.tidb/addon.xml index 83fa148..6ea256c 100644 --- a/plugin.video.tidb/addon.xml +++ b/plugin.video.tidb/addon.xml @@ -14,11 +14,17 @@ 基于 TheIntroDB 数据库,自动跳过电影和电视剧的片头、前情回顾、片尾和预告片段 تخطى المقدمة، والملخص، وتتر النهاية، ومعاينات الحلقات في الأفلام والمسلسلات باستخدام TheIntroDB Passer l'intro, le résumé, le générique et les aperçus des films et séries avec TheIntroDB + Salta la intro, el resumen, los créditos y los avances de películas y series con TheIntroDB + Pomijaj intro, streszczenia, napisy końcowe i zapowiedzi w filmach i serialach dzięki TheIntroDB + Omite intro-ul, rezumatul, genericul și previzualizările în filme și seriale cu TheIntroDB Looks up segment timings from TheIntroDB while you watch. Uses TVDB ids first, then TMDB, then IMDb ids (tt…) with season/episode. Recupera gli orari dei segmenti da TheIntroDB durante la visione. Usa prima gli ID TVDB, poi TMDB, infine gli ID IMDb (tt…) con stagione ed episodio. 观看时自动从 TheIntroDB 数据库查询片段时间信息。优先使用 TVDB ID 进行匹配,其次为 TMDB ID,最后为 IMDb ID(tt 开头)配合季/集号查询。 يجلب أزمنة المقاطع من TheIntroDB أثناء المشاهدة. يستخدم معرّفات TVDB أولاً، ثم TMDB، ثم معرّفات IMDb (tt…) مع الموسم والحلقة. Récupère les horodatages des segments depuis TheIntroDB pendant la lecture. Utilise en priorité les identifiants TVDB, puis les identifiants TMDB, puis les identifiants IMDb (tt…) avec la saison et l'épisode. + Consulta los tiempos de los segmentos de TheIntroDB mientras ves contenido. Usa primero los ID de TVDB, luego los de TMDB y, por último, los de IMDb (tt…) con temporada y episodio. + Pobiera czasy segmentów z TheIntroDB podczas oglądania. Najpierw używa identyfikatorów TVDB, potem TMDB, a na końcu IMDb (tt…) wraz z sezonem i odcinkiem. + Preia timpii segmentelor de la TheIntroDB în timp ce vizionezi. Folosește mai întâi ID-urile TVDB, apoi TMDB și, la final, ID-urile IMDb (tt…) împreună cu sezonul și episodul. all GPL-3.0-or-later diff --git a/plugin.video.tidb/resources/language/resource.language.it_it/strings.po b/plugin.video.tidb/resources/language/resource.language.it_it/strings.po index 98cca50..68475e4 100644 --- a/plugin.video.tidb/resources/language/resource.language.it_it/strings.po +++ b/plugin.video.tidb/resources/language/resource.language.it_it/strings.po @@ -174,3 +174,7 @@ msgstr "Classico" msgctxt "#32050" msgid "Glass" msgstr "Effetto vetro" + +msgctxt "#32051" +msgid "Retry for late metadata (up to 30 seconds)" +msgstr "Riprova per metadati in ritardo (fino a 30 secondi)" diff --git a/tests/test_language_coverage.py b/tests/test_language_coverage.py new file mode 100644 index 0000000..a57e6a7 --- /dev/null +++ b/tests/test_language_coverage.py @@ -0,0 +1,127 @@ +# SPDX-License-Identifier: GPL-3.0-or-later +# Copyright (C) 2026 TheIntroDB +# +"""Unit tests for what a shipped language has to carry. + +Nothing here starts the add-on: these tests stand in for Kodi's own string lookup and +the add-on manager's language list, both of which work off the files on disk. + +- Kodi resolves a ``$ADDON[plugin.video.tidb ]`` label through the active + language's ``strings.po``, keyed by the ``msgctxt`` id. Only the add-on's own + ``resource.language.en_gb`` file is complete, so a language that is missing an id + shows the English text (or the raw tag) in the middle of an otherwise translated + dialog — which is how the Italian file came to be short of the string that shipped + with the late-metadata retry. +- A new setting inherits the same problem twice: the id it labels has to exist in every + language, and every language has to be one the add-on advertises at all. +- Advertising a language is an addon.xml job, not a strings.po job: the add-on manager + describes the add-on in English until the metadata carries ```` + and ```` for it (see the repo skill). The tag is ``xx_YY`` + casing — the addon-checker XSD rejects a lower-case region such as ``ar_sa``. +""" +import os +import re +import unittest +import xml.etree.ElementTree as ElementTree + +REPO_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) +ADDON_DIR = os.path.join(REPO_DIR, 'plugin.video.tidb') +LANGUAGE_DIR = os.path.join(ADDON_DIR, 'resources', 'language') +SETTINGS_XML = os.path.join(ADDON_DIR, 'resources', 'settings.xml') +ADDON_XML = os.path.join(ADDON_DIR, 'addon.xml') +BASE_LANGUAGE = 'resource.language.en_gb' + +#: One ``msgctxt``/``msgid``/``msgstr`` triple of a PO file. The escapes are allowed +#: through untouched: the tests compare the file's own text, not a decoded string. +ENTRY = re.compile( + r'msgctxt "#(?P\d+)"\s*\n' + r'msgid "(?P(?:[^"\\]|\\.)*)"\s*\n' + r'msgstr "(?P(?:[^"\\]|\\.)*)"') + +#: What a language tag in addon.xml has to look like: `fr_FR`, `zh_CN`, never `ar_sa`. +LANGUAGE_TAG = re.compile(r'^[a-z]{2}_[A-Z]{2}$') + +#: Every `$ADDON[plugin.video.tidb ]` a setting is labelled with. +SETTING_LABEL = re.compile(r'\$ADDON\[plugin\.video\.tidb (\d+)\]') + + +def _language_folders(): + """Every shipped ``resource.language.*`` folder, sorted.""" + return sorted(name for name in os.listdir(LANGUAGE_DIR) + if name.startswith('resource.language.') + and os.path.isfile(os.path.join(LANGUAGE_DIR, name, 'strings.po'))) + + +def _strings(folder): + """One language file as ``{string id: (msgid, msgstr)}``.""" + with open(os.path.join(LANGUAGE_DIR, folder, 'strings.po'), encoding='utf-8') as handle: + text = handle.read() + return {int(match.group('id')): (match.group('msgid'), match.group('msgstr')) + for match in ENTRY.finditer(text)} + + +def _metadata_languages(): + """The addon.xml language tags, as ``{tag: {'summary', 'description'}}``.""" + root = ElementTree.parse(ADDON_XML).getroot() + languages = {} + for element in root.iter(): + if element.tag in ('summary', 'description') and element.get('lang'): + languages.setdefault(element.get('lang'), set()).add(element.tag) + return languages + + +class StringCoverageTests(unittest.TestCase): + """Every language carries every string, and every shipped language is advertised.""" + + def test_the_english_file_is_the_reference(self): + self.assertTrue(_strings(BASE_LANGUAGE), + '{} carries no strings to compare against'.format(BASE_LANGUAGE)) + + def test_every_language_covers_the_english_ids(self): + base = _strings(BASE_LANGUAGE) + for folder in _language_folders(): + if folder == BASE_LANGUAGE: + continue + strings = _strings(folder) + with self.subTest(language=folder): + self.assertEqual(sorted(set(base) - set(strings)), [], + '{}: ids en_gb has and this language does not'.format(folder)) + self.assertEqual(sorted(set(strings) - set(base)), [], + '{}: ids that are not in en_gb'.format(folder)) + for string_id, (msgid, msgstr) in sorted(strings.items()): + self.assertEqual(base[string_id][0], msgid, + '#{} in {}: msgid differs from en_gb'.format(string_id, folder)) + self.assertTrue(msgstr.strip(), + '#{} in {}: empty msgstr'.format(string_id, folder)) + + def test_every_settings_label_is_a_string_in_every_language(self): + with open(SETTINGS_XML, encoding='utf-8') as handle: + wanted = {int(value) for value in SETTING_LABEL.findall(handle.read())} + self.assertTrue(wanted, 'settings.xml labels no strings at all') + for folder in _language_folders(): + with self.subTest(language=folder): + self.assertEqual(sorted(wanted - set(_strings(folder))), [], + '{}: settings.xml labels an id this language lacks'.format(folder)) + + def test_every_shipped_language_is_advertised(self): + advertised = {tag.lower() for tag in _metadata_languages()} + shipped = {folder.rsplit('.', 1)[-1] for folder in _language_folders()} + self.assertEqual(sorted(shipped - advertised), [], + 'folders with no / in addon.xml') + self.assertEqual(sorted(advertised - shipped), [], + 'metadata languages with no strings.po folder') + + def test_every_advertised_language_has_both_strings(self): + for tag, elements in sorted(_metadata_languages().items()): + with self.subTest(language=tag): + self.assertEqual({'summary', 'description'}, elements, + '{}: a summary and a description are both needed'.format(tag)) + + def test_the_language_tags_use_the_xx_YY_casing(self): + for tag in sorted(_metadata_languages()): + with self.subTest(language=tag): + self.assertRegex(tag, LANGUAGE_TAG) + + +if __name__ == '__main__': + unittest.main()