From a15b8d560252a953999976343b7665c533570365 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Tue, 9 Jul 2024 09:01:39 -0400 Subject: [PATCH 01/78] Fixed pt-BR issue with subdl provider. --- custom_libs/subliminal_patch/providers/subdl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/subdl.py b/custom_libs/subliminal_patch/providers/subdl.py index bf4dc79d2..3c2d2ce7d 100644 --- a/custom_libs/subliminal_patch/providers/subdl.py +++ b/custom_libs/subliminal_patch/providers/subdl.py @@ -130,7 +130,8 @@ class SubdlProvider(ProviderRetryMixin, Provider): imdb_id = self.video.imdb_id # be sure to remove duplicates using list(set()) - langs_list = sorted(list(set([lang.basename.upper() for lang in languages]))) + langs_list = sorted(list(set([language_converters['subdl'].to_subdl[(lang.alpha3, lang.country, lang.script)] + for lang in languages]))) langs = ','.join(langs_list) logger.debug(f'Searching for those languages: {langs}') From 032e8b812d1b8c96ddb8902ae31803b6827c66f6 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Tue, 9 Jul 2024 10:01:17 -0400 Subject: [PATCH 02/78] no log: small improvement to subdl languages conversion --- custom_libs/subliminal_patch/providers/subdl.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/subdl.py b/custom_libs/subliminal_patch/providers/subdl.py index 3c2d2ce7d..794625d15 100644 --- a/custom_libs/subliminal_patch/providers/subdl.py +++ b/custom_libs/subliminal_patch/providers/subdl.py @@ -27,8 +27,6 @@ retry_timeout = 5 language_converters.register('subdl = subliminal_patch.converters.subdl:SubdlConverter') -supported_languages = list(language_converters['subdl'].to_subdl.keys()) - class SubdlSubtitle(Subtitle): provider_name = 'subdl' @@ -91,7 +89,7 @@ class SubdlProvider(ProviderRetryMixin, Provider): """Subdl Provider""" server_hostname = 'api.subdl.com' - languages = {Language(*lang) for lang in supported_languages} + languages = {Language(*lang) for lang in list(language_converters['subdl'].to_subdl.keys())} languages.update(set(Language.rebuild(lang, forced=True) for lang in languages)) languages.update(set(Language.rebuild(l, hi=True) for l in languages)) @@ -130,8 +128,8 @@ class SubdlProvider(ProviderRetryMixin, Provider): imdb_id = self.video.imdb_id # be sure to remove duplicates using list(set()) - langs_list = sorted(list(set([language_converters['subdl'].to_subdl[(lang.alpha3, lang.country, lang.script)] - for lang in languages]))) + langs_list = sorted(list(set([language_converters['subdl'].convert(lang.alpha3, lang.country, lang.script) for + lang in languages]))) langs = ','.join(langs_list) logger.debug(f'Searching for those languages: {langs}') From ab2925e416f2d297d94c5441b11af3721d9d05f7 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Tue, 9 Jul 2024 23:52:55 +0900 Subject: [PATCH 03/78] Fixed popover text wrap browser compatibility (#2573) --- frontend/src/components/TextPopover.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/TextPopover.tsx b/frontend/src/components/TextPopover.tsx index 974c0d0c0..03dd58700 100644 --- a/frontend/src/components/TextPopover.tsx +++ b/frontend/src/components/TextPopover.tsx @@ -25,7 +25,7 @@ const TextPopover: FunctionComponent = ({ opened={hovered} label={text} {...tooltip} - style={{ textWrap: "pretty" }} + style={{ textWrap: "wrap" }} >
{children}
From 96af60918ea4e94190af290fe41fcc5034b3d23f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 9 Jul 2024 23:53:20 +0900 Subject: [PATCH 04/78] no log: Bump the mantine group in /frontend with 6 updates (#2572) Bumps the mantine group in /frontend with 6 updates: | Package | From | To | | --- | --- | --- | | [@mantine/core](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core) | `7.11.0` | `7.11.1` | | [@mantine/dropzone](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dropzone) | `7.11.0` | `7.11.1` | | [@mantine/form](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/form) | `7.11.0` | `7.11.1` | | [@mantine/hooks](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks) | `7.11.0` | `7.11.1` | | [@mantine/modals](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/modals) | `7.11.0` | `7.11.1` | | [@mantine/notifications](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/notifications) | `7.11.0` | `7.11.1` | Updates `@mantine/core` from 7.11.0 to 7.11.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.1/packages/@mantine/core) Updates `@mantine/dropzone` from 7.11.0 to 7.11.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.1/packages/@mantine/dropzone) Updates `@mantine/form` from 7.11.0 to 7.11.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.1/packages/@mantine/form) Updates `@mantine/hooks` from 7.11.0 to 7.11.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.1/packages/@mantine/hooks) Updates `@mantine/modals` from 7.11.0 to 7.11.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.1/packages/@mantine/modals) Updates `@mantine/notifications` from 7.11.0 to 7.11.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.1/packages/@mantine/notifications) --- updated-dependencies: - dependency-name: "@mantine/core" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/dropzone" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/hooks" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/modals" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/notifications" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 70 +++++++++++++++++++------------------- frontend/package.json | 12 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 38d3e3f76..b8b546e04 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,12 +9,12 @@ "version": "1.0.0", "license": "GPL-3", "dependencies": { - "@mantine/core": "^7.11.0", - "@mantine/dropzone": "^7.11.0", - "@mantine/form": "^7.11.0", - "@mantine/hooks": "^7.11.0", - "@mantine/modals": "^7.11.0", - "@mantine/notifications": "^7.11.0", + "@mantine/core": "^7.11.1", + "@mantine/dropzone": "^7.11.1", + "@mantine/form": "^7.11.1", + "@mantine/hooks": "^7.11.1", + "@mantine/modals": "^7.11.1", + "@mantine/notifications": "^7.11.1", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", @@ -2967,9 +2967,9 @@ } }, "node_modules/@mantine/core": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.11.0.tgz", - "integrity": "sha512-yw2Llww9mw8rDWZtucdEuvkqqjHdreUibos7JCUpejL721FW1Tn9L91nsxO/YQFSS7jn4Q0CP+1YbQ/PMULmwA==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.11.1.tgz", + "integrity": "sha512-qEwe5ijBe3MWOg4yerJ+HXMugIBtS1Bbqbdnfrg2cuHXr+2paqu8SQMzldtzqfiLsRajOtkokOkY67jUJOacCA==", "dependencies": { "@floating-ui/react": "^0.26.9", "clsx": "^2.1.1", @@ -2979,7 +2979,7 @@ "type-fest": "^4.12.0" }, "peerDependencies": { - "@mantine/hooks": "7.11.0", + "@mantine/hooks": "7.11.1", "react": "^18.2.0", "react-dom": "^18.2.0" } @@ -2996,23 +2996,23 @@ } }, "node_modules/@mantine/dropzone": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.11.0.tgz", - "integrity": "sha512-8vZgm8+NlBrQFJlWckaoqz55zjk8GVX0GDn1bZUunUtIJ5uv/wJPAInq3IlRdzvWVfz5MA+4oxd32fa5oxsBSA==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.11.1.tgz", + "integrity": "sha512-Jvn+ikhT1GtQq3EMAYWK+1lk6CVDeB1Ykok7oUjTWPZDYAcQkLDNfPpFLqrbPPYSMav0u67zzaq9fUVTYVVhew==", "dependencies": { "react-dropzone-esm": "15.0.1" }, "peerDependencies": { - "@mantine/core": "7.11.0", - "@mantine/hooks": "7.11.0", + "@mantine/core": "7.11.1", + "@mantine/hooks": "7.11.1", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/form": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.11.0.tgz", - "integrity": "sha512-BmkzRp57O1zZuxCYH76w6zeBNhczq7OeRtkG/zvMo35BJp1K5u8eetN3AC1WwkGLmrNid2BCIsvTFHDP9DYnaQ==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.11.1.tgz", + "integrity": "sha512-d14Rrx4Yid3/sDPvRHt5mYK37PWedflwbxWO0vJ98qpYFUGunw9pTm7dmPNoUoj4fHGX9b0F+TWuM4zXs2wAwg==", "dependencies": { "fast-deep-equal": "^3.1.3", "klona": "^2.0.6" @@ -3022,43 +3022,43 @@ } }, "node_modules/@mantine/hooks": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.11.0.tgz", - "integrity": "sha512-T3472GhUXFhuhXUHlxjHv0wfb73lFyNuaw631c7Ddtgvewq0WKtNqYd7j/Zz/k02DuS3r0QXA7e12/XgqHBZjg==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.11.1.tgz", + "integrity": "sha512-28WS/U6QL4jaIHf1uFpny5Tglu9MoyyM4bWLmIcAQHtOD3YHpuNvs9OTWLqKAQs6VN+kydlxvjvT+w1LBWEpQg==", "peerDependencies": { "react": "^18.2.0" } }, "node_modules/@mantine/modals": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.11.0.tgz", - "integrity": "sha512-I4bxdXirLNvVbmVcS9lhU9z1bknE8XlteGeSxAZ00SLUk9EowG+AX/9nK0TrSG2GBNDX82fFxp2z98/o7bTw5w==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.11.1.tgz", + "integrity": "sha512-SDHhpt7O+Y8rTW5RaXFqIIjuD87efUqhC5kxqLyRsuivQ+tk4gMY37R5gR8o0yC6vifKBzjjYVFeeGTLocRTBg==", "peerDependencies": { - "@mantine/core": "7.11.0", - "@mantine/hooks": "7.11.0", + "@mantine/core": "7.11.1", + "@mantine/hooks": "7.11.1", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/notifications": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.11.0.tgz", - "integrity": "sha512-UtAHJoSi4s+lfVZrkUDWMlg6j0w1LZaiMEOBMG9p5MV5dP38W75LeCy2cio2Znji2S5YzXaZolOkHBT5ZONKAw==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.11.1.tgz", + "integrity": "sha512-4MpuePstpWvCwiEX75oUAdxp3SXWsiq0+fd4zb5YMu+CaqiaDbUIOupEpi/uCez3lYhY0ojHyjNgYsqZ7cy1Fg==", "dependencies": { - "@mantine/store": "7.11.0", + "@mantine/store": "7.11.1", "react-transition-group": "4.4.5" }, "peerDependencies": { - "@mantine/core": "7.11.0", - "@mantine/hooks": "7.11.0", + "@mantine/core": "7.11.1", + "@mantine/hooks": "7.11.1", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/store": { - "version": "7.11.0", - "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.11.0.tgz", - "integrity": "sha512-zPmOpdFgvkUqYKSK7NNKbhgXsh2QPw51m3iypTaj0mw+rZbk3WSH9vZvaEx59X0QG+ahwUg2/HezbjfXFUbvrA==", + "version": "7.11.1", + "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.11.1.tgz", + "integrity": "sha512-5xOompA7pADDvYlw6KEr0YIr95bdFI0W/KZizi8E/BKOLVUpku1UvqcClodq4U0Xjz5eZt/Jf3gEV9lyJbt8Zw==", "peerDependencies": { "react": "^18.2.0" } diff --git a/frontend/package.json b/frontend/package.json index 0d3c0546e..221d3a97d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,12 +13,12 @@ }, "private": true, "dependencies": { - "@mantine/core": "^7.11.0", - "@mantine/dropzone": "^7.11.0", - "@mantine/form": "^7.11.0", - "@mantine/hooks": "^7.11.0", - "@mantine/modals": "^7.11.0", - "@mantine/notifications": "^7.11.0", + "@mantine/core": "^7.11.1", + "@mantine/dropzone": "^7.11.1", + "@mantine/form": "^7.11.1", + "@mantine/hooks": "^7.11.1", + "@mantine/modals": "^7.11.1", + "@mantine/notifications": "^7.11.1", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", From 12e7bbfb01e846f95074705a111823eab72f5a7d Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Tue, 9 Jul 2024 23:54:02 +0900 Subject: [PATCH 05/78] Fixed animetosho empty language fallback (#2571) --- custom_libs/subliminal_patch/providers/animetosho.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/animetosho.py b/custom_libs/subliminal_patch/providers/animetosho.py index 1fb791e86..9cd3d80b9 100644 --- a/custom_libs/subliminal_patch/providers/animetosho.py +++ b/custom_libs/subliminal_patch/providers/animetosho.py @@ -141,7 +141,8 @@ class AnimeToshoProvider(Provider, ProviderSubtitleArchiveMixin): for subtitle_file in subtitle_files: hex_id = format(subtitle_file['id'], '08x') - lang = Language.fromalpha3b(subtitle_file['info']['lang']) + # Animetosho assumes missing languages as english as fallback when not specified. + lang = Language.fromalpha3b(subtitle_file['info'].get('lang', 'eng')) # For Portuguese and Portuguese Brazilian they both share the same code, the name is the only # identifier AnimeTosho provides. Also, some subtitles does not have name, in this case it could From aafaf1cbf1ac29249960f2d5f2c7ba0608a5c284 Mon Sep 17 00:00:00 2001 From: Vitiko Date: Tue, 9 Jul 2024 18:51:51 -0400 Subject: [PATCH 06/78] Update fese (extractor) (cover #2538) --- .../providers/embeddedsubtitles.py | 9 +- libs/fese-0.2.9.dist-info/INSTALLER | 1 - libs/fese-0.2.9.dist-info/LICENSE | 674 ------------------ libs/fese-0.2.9.dist-info/METADATA | 34 - libs/fese-0.2.9.dist-info/RECORD | 13 - libs/fese-0.2.9.dist-info/REQUESTED | 0 libs/fese-0.2.9.dist-info/WHEEL | 5 - libs/fese-0.2.9.dist-info/top_level.txt | 1 - libs/fese/container.py | 5 +- libs/fese/tags.py | 4 + libs/version.txt | 2 +- .../test_embeddedsubtitles.py | 19 + 12 files changed, 35 insertions(+), 732 deletions(-) delete mode 100644 libs/fese-0.2.9.dist-info/INSTALLER delete mode 100755 libs/fese-0.2.9.dist-info/LICENSE delete mode 100644 libs/fese-0.2.9.dist-info/METADATA delete mode 100644 libs/fese-0.2.9.dist-info/RECORD delete mode 100644 libs/fese-0.2.9.dist-info/REQUESTED delete mode 100644 libs/fese-0.2.9.dist-info/WHEEL delete mode 100644 libs/fese-0.2.9.dist-info/top_level.txt diff --git a/custom_libs/subliminal_patch/providers/embeddedsubtitles.py b/custom_libs/subliminal_patch/providers/embeddedsubtitles.py index 002f439b7..2d8a492c7 100644 --- a/custom_libs/subliminal_patch/providers/embeddedsubtitles.py +++ b/custom_libs/subliminal_patch/providers/embeddedsubtitles.py @@ -112,7 +112,11 @@ class EmbeddedSubtitlesProvider(Provider): # Default is True container.FFMPEG_STATS = False - tags.LANGUAGE_FALLBACK = self._fallback_lang if self._unknown_as_fallback and self._fallback_lang else None + tags.LANGUAGE_FALLBACK = ( + self._fallback_lang + if self._unknown_as_fallback and self._fallback_lang + else None + ) logger.debug("Language fallback set: %s", tags.LANGUAGE_FALLBACK) def initialize(self): @@ -194,7 +198,7 @@ class EmbeddedSubtitlesProvider(Provider): def download_subtitle(self, subtitle: EmbeddedSubtitle): try: path = self._get_subtitle_path(subtitle) - except KeyError: # TODO: add MustGetBlacklisted support + except KeyError: # TODO: add MustGetBlacklisted support logger.error("Couldn't get subtitle path") return None @@ -229,6 +233,7 @@ class EmbeddedSubtitlesProvider(Provider): timeout=self._timeout, fallback_to_convert=True, basename_callback=_basename_callback, + progress_callback=lambda d: logger.debug("Progress: %s", d), ) # Add the extracted paths to the containter path key self._cached_paths[container.path] = extracted diff --git a/libs/fese-0.2.9.dist-info/INSTALLER b/libs/fese-0.2.9.dist-info/INSTALLER deleted file mode 100644 index a1b589e38..000000000 --- a/libs/fese-0.2.9.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/libs/fese-0.2.9.dist-info/LICENSE b/libs/fese-0.2.9.dist-info/LICENSE deleted file mode 100755 index f288702d2..000000000 --- a/libs/fese-0.2.9.dist-info/LICENSE +++ /dev/null @@ -1,674 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 3, 29 June 2007 - - Copyright (C) 2007 Free Software Foundation, Inc. - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The GNU General Public License is a free, copyleft license for -software and other kinds of works. - - The licenses for most software and other practical works are designed -to take away your freedom to share and change the works. By contrast, -the GNU General Public License is intended to guarantee your freedom to -share and change all versions of a program--to make sure it remains free -software for all its users. We, the Free Software Foundation, use the -GNU General Public License for most of our software; it applies also to -any other work released this way by its authors. You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -them if you wish), that you receive source code or can get it if you -want it, that you can change the software or use pieces of it in new -free programs, and that you know you can do these things. - - To protect your rights, we need to prevent others from denying you -these rights or asking you to surrender the rights. Therefore, you have -certain responsibilities if you distribute copies of the software, or if -you modify it: responsibilities to respect the freedom of others. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must pass on to the recipients the same -freedoms that you received. You must make sure that they, too, receive -or can get the source code. And you must show them these terms so they -know their rights. - - Developers that use the GNU GPL protect your rights with two steps: -(1) assert copyright on the software, and (2) offer you this License -giving you legal permission to copy, distribute and/or modify it. - - For the developers' and authors' protection, the GPL clearly explains -that there is no warranty for this free software. For both users' and -authors' sake, the GPL requires that modified versions be marked as -changed, so that their problems will not be attributed erroneously to -authors of previous versions. - - Some devices are designed to deny users access to install or run -modified versions of the software inside them, although the manufacturer -can do so. This is fundamentally incompatible with the aim of -protecting users' freedom to change the software. The systematic -pattern of such abuse occurs in the area of products for individuals to -use, which is precisely where it is most unacceptable. Therefore, we -have designed this version of the GPL to prohibit the practice for those -products. If such problems arise substantially in other domains, we -stand ready to extend this provision to those domains in future versions -of the GPL, as needed to protect the freedom of users. - - Finally, every program is threatened constantly by software patents. -States should not allow patents to restrict development and use of -software on general-purpose computers, but in those that do, we wish to -avoid the special danger that patents applied to a free program could -make it effectively proprietary. To prevent this, the GPL assures that -patents cannot be used to render the program non-free. - - The precise terms and conditions for copying, distribution and -modification follow. - - TERMS AND CONDITIONS - - 0. Definitions. - - "This License" refers to version 3 of the GNU General Public License. - - "Copyright" also means copyright-like laws that apply to other kinds of -works, such as semiconductor masks. - - "The Program" refers to any copyrightable work licensed under this -License. Each licensee is addressed as "you". "Licensees" and -"recipients" may be individuals or organizations. - - To "modify" a work means to copy from or adapt all or part of the work -in a fashion requiring copyright permission, other than the making of an -exact copy. The resulting work is called a "modified version" of the -earlier work or a work "based on" the earlier work. - - A "covered work" means either the unmodified Program or a work based -on the Program. - - To "propagate" a work means to do anything with it that, without -permission, would make you directly or secondarily liable for -infringement under applicable copyright law, except executing it on a -computer or modifying a private copy. Propagation includes copying, -distribution (with or without modification), making available to the -public, and in some countries other activities as well. - - To "convey" a work means any kind of propagation that enables other -parties to make or receive copies. Mere interaction with a user through -a computer network, with no transfer of a copy, is not conveying. - - An interactive user interface displays "Appropriate Legal Notices" -to the extent that it includes a convenient and prominently visible -feature that (1) displays an appropriate copyright notice, and (2) -tells the user that there is no warranty for the work (except to the -extent that warranties are provided), that licensees may convey the -work under this License, and how to view a copy of this License. If -the interface presents a list of user commands or options, such as a -menu, a prominent item in the list meets this criterion. - - 1. Source Code. - - The "source code" for a work means the preferred form of the work -for making modifications to it. "Object code" means any non-source -form of a work. - - A "Standard Interface" means an interface that either is an official -standard defined by a recognized standards body, or, in the case of -interfaces specified for a particular programming language, one that -is widely used among developers working in that language. - - The "System Libraries" of an executable work include anything, other -than the work as a whole, that (a) is included in the normal form of -packaging a Major Component, but which is not part of that Major -Component, and (b) serves only to enable use of the work with that -Major Component, or to implement a Standard Interface for which an -implementation is available to the public in source code form. A -"Major Component", in this context, means a major essential component -(kernel, window system, and so on) of the specific operating system -(if any) on which the executable work runs, or a compiler used to -produce the work, or an object code interpreter used to run it. - - The "Corresponding Source" for a work in object code form means all -the source code needed to generate, install, and (for an executable -work) run the object code and to modify the work, including scripts to -control those activities. However, it does not include the work's -System Libraries, or general-purpose tools or generally available free -programs which are used unmodified in performing those activities but -which are not part of the work. For example, Corresponding Source -includes interface definition files associated with source files for -the work, and the source code for shared libraries and dynamically -linked subprograms that the work is specifically designed to require, -such as by intimate data communication or control flow between those -subprograms and other parts of the work. - - The Corresponding Source need not include anything that users -can regenerate automatically from other parts of the Corresponding -Source. - - The Corresponding Source for a work in source code form is that -same work. - - 2. Basic Permissions. - - All rights granted under this License are granted for the term of -copyright on the Program, and are irrevocable provided the stated -conditions are met. This License explicitly affirms your unlimited -permission to run the unmodified Program. The output from running a -covered work is covered by this License only if the output, given its -content, constitutes a covered work. This License acknowledges your -rights of fair use or other equivalent, as provided by copyright law. - - You may make, run and propagate covered works that you do not -convey, without conditions so long as your license otherwise remains -in force. You may convey covered works to others for the sole purpose -of having them make modifications exclusively for you, or provide you -with facilities for running those works, provided that you comply with -the terms of this License in conveying all material for which you do -not control copyright. Those thus making or running the covered works -for you must do so exclusively on your behalf, under your direction -and control, on terms that prohibit them from making any copies of -your copyrighted material outside their relationship with you. - - Conveying under any other circumstances is permitted solely under -the conditions stated below. Sublicensing is not allowed; section 10 -makes it unnecessary. - - 3. Protecting Users' Legal Rights From Anti-Circumvention Law. - - No covered work shall be deemed part of an effective technological -measure under any applicable law fulfilling obligations under article -11 of the WIPO copyright treaty adopted on 20 December 1996, or -similar laws prohibiting or restricting circumvention of such -measures. - - When you convey a covered work, you waive any legal power to forbid -circumvention of technological measures to the extent such circumvention -is effected by exercising rights under this License with respect to -the covered work, and you disclaim any intention to limit operation or -modification of the work as a means of enforcing, against the work's -users, your or third parties' legal rights to forbid circumvention of -technological measures. - - 4. Conveying Verbatim Copies. - - You may convey verbatim copies of the Program's source code as you -receive it, in any medium, provided that you conspicuously and -appropriately publish on each copy an appropriate copyright notice; -keep intact all notices stating that this License and any -non-permissive terms added in accord with section 7 apply to the code; -keep intact all notices of the absence of any warranty; and give all -recipients a copy of this License along with the Program. - - You may charge any price or no price for each copy that you convey, -and you may offer support or warranty protection for a fee. - - 5. Conveying Modified Source Versions. - - You may convey a work based on the Program, or the modifications to -produce it from the Program, in the form of source code under the -terms of section 4, provided that you also meet all of these conditions: - - a) The work must carry prominent notices stating that you modified - it, and giving a relevant date. - - b) The work must carry prominent notices stating that it is - released under this License and any conditions added under section - 7. This requirement modifies the requirement in section 4 to - "keep intact all notices". - - c) You must license the entire work, as a whole, under this - License to anyone who comes into possession of a copy. This - License will therefore apply, along with any applicable section 7 - additional terms, to the whole of the work, and all its parts, - regardless of how they are packaged. This License gives no - permission to license the work in any other way, but it does not - invalidate such permission if you have separately received it. - - d) If the work has interactive user interfaces, each must display - Appropriate Legal Notices; however, if the Program has interactive - interfaces that do not display Appropriate Legal Notices, your - work need not make them do so. - - A compilation of a covered work with other separate and independent -works, which are not by their nature extensions of the covered work, -and which are not combined with it such as to form a larger program, -in or on a volume of a storage or distribution medium, is called an -"aggregate" if the compilation and its resulting copyright are not -used to limit the access or legal rights of the compilation's users -beyond what the individual works permit. Inclusion of a covered work -in an aggregate does not cause this License to apply to the other -parts of the aggregate. - - 6. Conveying Non-Source Forms. - - You may convey a covered work in object code form under the terms -of sections 4 and 5, provided that you also convey the -machine-readable Corresponding Source under the terms of this License, -in one of these ways: - - a) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by the - Corresponding Source fixed on a durable physical medium - customarily used for software interchange. - - b) Convey the object code in, or embodied in, a physical product - (including a physical distribution medium), accompanied by a - written offer, valid for at least three years and valid for as - long as you offer spare parts or customer support for that product - model, to give anyone who possesses the object code either (1) a - copy of the Corresponding Source for all the software in the - product that is covered by this License, on a durable physical - medium customarily used for software interchange, for a price no - more than your reasonable cost of physically performing this - conveying of source, or (2) access to copy the - Corresponding Source from a network server at no charge. - - c) Convey individual copies of the object code with a copy of the - written offer to provide the Corresponding Source. This - alternative is allowed only occasionally and noncommercially, and - only if you received the object code with such an offer, in accord - with subsection 6b. - - d) Convey the object code by offering access from a designated - place (gratis or for a charge), and offer equivalent access to the - Corresponding Source in the same way through the same place at no - further charge. You need not require recipients to copy the - Corresponding Source along with the object code. If the place to - copy the object code is a network server, the Corresponding Source - may be on a different server (operated by you or a third party) - that supports equivalent copying facilities, provided you maintain - clear directions next to the object code saying where to find the - Corresponding Source. Regardless of what server hosts the - Corresponding Source, you remain obligated to ensure that it is - available for as long as needed to satisfy these requirements. - - e) Convey the object code using peer-to-peer transmission, provided - you inform other peers where the object code and Corresponding - Source of the work are being offered to the general public at no - charge under subsection 6d. - - A separable portion of the object code, whose source code is excluded -from the Corresponding Source as a System Library, need not be -included in conveying the object code work. - - A "User Product" is either (1) a "consumer product", which means any -tangible personal property which is normally used for personal, family, -or household purposes, or (2) anything designed or sold for incorporation -into a dwelling. In determining whether a product is a consumer product, -doubtful cases shall be resolved in favor of coverage. For a particular -product received by a particular user, "normally used" refers to a -typical or common use of that class of product, regardless of the status -of the particular user or of the way in which the particular user -actually uses, or expects or is expected to use, the product. A product -is a consumer product regardless of whether the product has substantial -commercial, industrial or non-consumer uses, unless such uses represent -the only significant mode of use of the product. - - "Installation Information" for a User Product means any methods, -procedures, authorization keys, or other information required to install -and execute modified versions of a covered work in that User Product from -a modified version of its Corresponding Source. The information must -suffice to ensure that the continued functioning of the modified object -code is in no case prevented or interfered with solely because -modification has been made. - - If you convey an object code work under this section in, or with, or -specifically for use in, a User Product, and the conveying occurs as -part of a transaction in which the right of possession and use of the -User Product is transferred to the recipient in perpetuity or for a -fixed term (regardless of how the transaction is characterized), the -Corresponding Source conveyed under this section must be accompanied -by the Installation Information. But this requirement does not apply -if neither you nor any third party retains the ability to install -modified object code on the User Product (for example, the work has -been installed in ROM). - - The requirement to provide Installation Information does not include a -requirement to continue to provide support service, warranty, or updates -for a work that has been modified or installed by the recipient, or for -the User Product in which it has been modified or installed. Access to a -network may be denied when the modification itself materially and -adversely affects the operation of the network or violates the rules and -protocols for communication across the network. - - Corresponding Source conveyed, and Installation Information provided, -in accord with this section must be in a format that is publicly -documented (and with an implementation available to the public in -source code form), and must require no special password or key for -unpacking, reading or copying. - - 7. Additional Terms. - - "Additional permissions" are terms that supplement the terms of this -License by making exceptions from one or more of its conditions. -Additional permissions that are applicable to the entire Program shall -be treated as though they were included in this License, to the extent -that they are valid under applicable law. If additional permissions -apply only to part of the Program, that part may be used separately -under those permissions, but the entire Program remains governed by -this License without regard to the additional permissions. - - When you convey a copy of a covered work, you may at your option -remove any additional permissions from that copy, or from any part of -it. (Additional permissions may be written to require their own -removal in certain cases when you modify the work.) You may place -additional permissions on material, added by you to a covered work, -for which you have or can give appropriate copyright permission. - - Notwithstanding any other provision of this License, for material you -add to a covered work, you may (if authorized by the copyright holders of -that material) supplement the terms of this License with terms: - - a) Disclaiming warranty or limiting liability differently from the - terms of sections 15 and 16 of this License; or - - b) Requiring preservation of specified reasonable legal notices or - author attributions in that material or in the Appropriate Legal - Notices displayed by works containing it; or - - c) Prohibiting misrepresentation of the origin of that material, or - requiring that modified versions of such material be marked in - reasonable ways as different from the original version; or - - d) Limiting the use for publicity purposes of names of licensors or - authors of the material; or - - e) Declining to grant rights under trademark law for use of some - trade names, trademarks, or service marks; or - - f) Requiring indemnification of licensors and authors of that - material by anyone who conveys the material (or modified versions of - it) with contractual assumptions of liability to the recipient, for - any liability that these contractual assumptions directly impose on - those licensors and authors. - - All other non-permissive additional terms are considered "further -restrictions" within the meaning of section 10. If the Program as you -received it, or any part of it, contains a notice stating that it is -governed by this License along with a term that is a further -restriction, you may remove that term. If a license document contains -a further restriction but permits relicensing or conveying under this -License, you may add to a covered work material governed by the terms -of that license document, provided that the further restriction does -not survive such relicensing or conveying. - - If you add terms to a covered work in accord with this section, you -must place, in the relevant source files, a statement of the -additional terms that apply to those files, or a notice indicating -where to find the applicable terms. - - Additional terms, permissive or non-permissive, may be stated in the -form of a separately written license, or stated as exceptions; -the above requirements apply either way. - - 8. Termination. - - You may not propagate or modify a covered work except as expressly -provided under this License. Any attempt otherwise to propagate or -modify it is void, and will automatically terminate your rights under -this License (including any patent licenses granted under the third -paragraph of section 11). - - However, if you cease all violation of this License, then your -license from a particular copyright holder is reinstated (a) -provisionally, unless and until the copyright holder explicitly and -finally terminates your license, and (b) permanently, if the copyright -holder fails to notify you of the violation by some reasonable means -prior to 60 days after the cessation. - - Moreover, your license from a particular copyright holder is -reinstated permanently if the copyright holder notifies you of the -violation by some reasonable means, this is the first time you have -received notice of violation of this License (for any work) from that -copyright holder, and you cure the violation prior to 30 days after -your receipt of the notice. - - Termination of your rights under this section does not terminate the -licenses of parties who have received copies or rights from you under -this License. If your rights have been terminated and not permanently -reinstated, you do not qualify to receive new licenses for the same -material under section 10. - - 9. Acceptance Not Required for Having Copies. - - You are not required to accept this License in order to receive or -run a copy of the Program. Ancillary propagation of a covered work -occurring solely as a consequence of using peer-to-peer transmission -to receive a copy likewise does not require acceptance. However, -nothing other than this License grants you permission to propagate or -modify any covered work. These actions infringe copyright if you do -not accept this License. Therefore, by modifying or propagating a -covered work, you indicate your acceptance of this License to do so. - - 10. Automatic Licensing of Downstream Recipients. - - Each time you convey a covered work, the recipient automatically -receives a license from the original licensors, to run, modify and -propagate that work, subject to this License. You are not responsible -for enforcing compliance by third parties with this License. - - An "entity transaction" is a transaction transferring control of an -organization, or substantially all assets of one, or subdividing an -organization, or merging organizations. If propagation of a covered -work results from an entity transaction, each party to that -transaction who receives a copy of the work also receives whatever -licenses to the work the party's predecessor in interest had or could -give under the previous paragraph, plus a right to possession of the -Corresponding Source of the work from the predecessor in interest, if -the predecessor has it or can get it with reasonable efforts. - - You may not impose any further restrictions on the exercise of the -rights granted or affirmed under this License. For example, you may -not impose a license fee, royalty, or other charge for exercise of -rights granted under this License, and you may not initiate litigation -(including a cross-claim or counterclaim in a lawsuit) alleging that -any patent claim is infringed by making, using, selling, offering for -sale, or importing the Program or any portion of it. - - 11. Patents. - - A "contributor" is a copyright holder who authorizes use under this -License of the Program or a work on which the Program is based. The -work thus licensed is called the contributor's "contributor version". - - A contributor's "essential patent claims" are all patent claims -owned or controlled by the contributor, whether already acquired or -hereafter acquired, that would be infringed by some manner, permitted -by this License, of making, using, or selling its contributor version, -but do not include claims that would be infringed only as a -consequence of further modification of the contributor version. For -purposes of this definition, "control" includes the right to grant -patent sublicenses in a manner consistent with the requirements of -this License. - - Each contributor grants you a non-exclusive, worldwide, royalty-free -patent license under the contributor's essential patent claims, to -make, use, sell, offer for sale, import and otherwise run, modify and -propagate the contents of its contributor version. - - In the following three paragraphs, a "patent license" is any express -agreement or commitment, however denominated, not to enforce a patent -(such as an express permission to practice a patent or covenant not to -sue for patent infringement). To "grant" such a patent license to a -party means to make such an agreement or commitment not to enforce a -patent against the party. - - If you convey a covered work, knowingly relying on a patent license, -and the Corresponding Source of the work is not available for anyone -to copy, free of charge and under the terms of this License, through a -publicly available network server or other readily accessible means, -then you must either (1) cause the Corresponding Source to be so -available, or (2) arrange to deprive yourself of the benefit of the -patent license for this particular work, or (3) arrange, in a manner -consistent with the requirements of this License, to extend the patent -license to downstream recipients. "Knowingly relying" means you have -actual knowledge that, but for the patent license, your conveying the -covered work in a country, or your recipient's use of the covered work -in a country, would infringe one or more identifiable patents in that -country that you have reason to believe are valid. - - If, pursuant to or in connection with a single transaction or -arrangement, you convey, or propagate by procuring conveyance of, a -covered work, and grant a patent license to some of the parties -receiving the covered work authorizing them to use, propagate, modify -or convey a specific copy of the covered work, then the patent license -you grant is automatically extended to all recipients of the covered -work and works based on it. - - A patent license is "discriminatory" if it does not include within -the scope of its coverage, prohibits the exercise of, or is -conditioned on the non-exercise of one or more of the rights that are -specifically granted under this License. You may not convey a covered -work if you are a party to an arrangement with a third party that is -in the business of distributing software, under which you make payment -to the third party based on the extent of your activity of conveying -the work, and under which the third party grants, to any of the -parties who would receive the covered work from you, a discriminatory -patent license (a) in connection with copies of the covered work -conveyed by you (or copies made from those copies), or (b) primarily -for and in connection with specific products or compilations that -contain the covered work, unless you entered into that arrangement, -or that patent license was granted, prior to 28 March 2007. - - Nothing in this License shall be construed as excluding or limiting -any implied license or other defenses to infringement that may -otherwise be available to you under applicable patent law. - - 12. No Surrender of Others' Freedom. - - If conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot convey a -covered work so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you may -not convey it at all. For example, if you agree to terms that obligate you -to collect a royalty for further conveying from those to whom you convey -the Program, the only way you could satisfy both those terms and this -License would be to refrain entirely from conveying the Program. - - 13. Use with the GNU Affero General Public License. - - Notwithstanding any other provision of this License, you have -permission to link or combine any covered work with a work licensed -under version 3 of the GNU Affero General Public License into a single -combined work, and to convey the resulting work. The terms of this -License will continue to apply to the part which is the covered work, -but the special requirements of the GNU Affero General Public License, -section 13, concerning interaction through a network will apply to the -combination as such. - - 14. Revised Versions of this License. - - The Free Software Foundation may publish revised and/or new versions of -the GNU General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - - Each version is given a distinguishing version number. If the -Program specifies that a certain numbered version of the GNU General -Public License "or any later version" applies to it, you have the -option of following the terms and conditions either of that numbered -version or of any later version published by the Free Software -Foundation. If the Program does not specify a version number of the -GNU General Public License, you may choose any version ever published -by the Free Software Foundation. - - If the Program specifies that a proxy can decide which future -versions of the GNU General Public License can be used, that proxy's -public statement of acceptance of a version permanently authorizes you -to choose that version for the Program. - - Later license versions may give you additional or different -permissions. However, no additional obligations are imposed on any -author or copyright holder as a result of your choosing to follow a -later version. - - 15. Disclaimer of Warranty. - - THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY -APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT -HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY -OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, -THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM -IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF -ALL NECESSARY SERVICING, REPAIR OR CORRECTION. - - 16. Limitation of Liability. - - IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS -THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY -GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE -USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF -DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD -PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), -EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF -SUCH DAMAGES. - - 17. Interpretation of Sections 15 and 16. - - If the disclaimer of warranty and limitation of liability provided -above cannot be given local legal effect according to their terms, -reviewing courts shall apply local law that most closely approximates -an absolute waiver of all civil liability in connection with the -Program, unless a warranty or assumption of liability accompanies a -copy of the Program in return for a fee. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -state the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with this program. If not, see . - -Also add information on how to contact you by electronic and paper mail. - - If the program does terminal interaction, make it output a short -notice like this when it starts in an interactive mode: - - Copyright (C) - This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, your program's commands -might be different; for a GUI interface, you would use an "about box". - - You should also get your employer (if you work as a programmer) or school, -if any, to sign a "copyright disclaimer" for the program, if necessary. -For more information on this, and how to apply and follow the GNU GPL, see -. - - The GNU General Public License does not permit incorporating your program -into proprietary programs. If your program is a subroutine library, you -may consider it more useful to permit linking proprietary applications with -the library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. But first, please read -. diff --git a/libs/fese-0.2.9.dist-info/METADATA b/libs/fese-0.2.9.dist-info/METADATA deleted file mode 100644 index 85f1cd160..000000000 --- a/libs/fese-0.2.9.dist-info/METADATA +++ /dev/null @@ -1,34 +0,0 @@ -Metadata-Version: 2.1 -Name: fese -Version: 0.2.9 -Summary: A library to extract FFmpeg subtitle streams -Author-email: Vitiko Nogales -Requires-Python: >=3.7 -Description-Content-Type: text/markdown -License-File: LICENSE -Requires-Dist: babelfish -Requires-Dist: pysubs2 - -# fese - -A library to extract FFmpeg subtitle streams - -## Usage - -```python -import logging -import sys - -from fese.container import FFprobeVideoContainer - -logging.basicConfig(level=logging.DEBUG) - -video_path = sys.argv[1] - -video = fese.FFprobeVideoContainer(video_path) - -subtitles = video.get_subtitles() - -paths = video.extract_subtitles(subtitles) -print(paths) -``` diff --git a/libs/fese-0.2.9.dist-info/RECORD b/libs/fese-0.2.9.dist-info/RECORD deleted file mode 100644 index e30fae26a..000000000 --- a/libs/fese-0.2.9.dist-info/RECORD +++ /dev/null @@ -1,13 +0,0 @@ -fese-0.2.9.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -fese-0.2.9.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149 -fese-0.2.9.dist-info/METADATA,sha256=nJz9q6FwX7fqmsO3jgM0ZgV0gsCeILWoxVRUqCbJkFI,655 -fese-0.2.9.dist-info/RECORD,, -fese-0.2.9.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -fese-0.2.9.dist-info/WHEEL,sha256=oiQVh_5PnQM0E3gPdiz09WCNmwiHDMaGer_elqB3coM,92 -fese-0.2.9.dist-info/top_level.txt,sha256=ra2BuARVEUZpk76YpHnjVoqjR2FxvzhCdmW2OyBWGzE,5 -fese/__init__.py,sha256=_YUpx7sq26ioEp5LZOEKa-0MrRHQUuRuDCs0EQ6Amv4,150 -fese/container.py,sha256=sLuxP0vlba4iGVohGfYtd-QcjQ-YxMU6lqMOM-Wtqlc,10340 -fese/disposition.py,sha256=hv4YmXpsvKmUdpeWvSrZkhKgtZLZ8t56dmwMddsqxus,2156 -fese/exceptions.py,sha256=VZaubpq8SPpkUGp28Ryebsf9YzqbKK62nni6YZgDPYI,372 -fese/stream.py,sha256=Hgf6-amksHpuhSoY6SL6C3q4YtGCuRHl4fusBWE9nBE,4866 -fese/tags.py,sha256=qKkcjJmCKgnXIbZ9x-nngCNYAfv5cbJZ4A6EP0ckZME,5454 diff --git a/libs/fese-0.2.9.dist-info/REQUESTED b/libs/fese-0.2.9.dist-info/REQUESTED deleted file mode 100644 index e69de29bb..000000000 diff --git a/libs/fese-0.2.9.dist-info/WHEEL b/libs/fese-0.2.9.dist-info/WHEEL deleted file mode 100644 index 98c0d20b7..000000000 --- a/libs/fese-0.2.9.dist-info/WHEEL +++ /dev/null @@ -1,5 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.42.0) -Root-Is-Purelib: true -Tag: py3-none-any - diff --git a/libs/fese-0.2.9.dist-info/top_level.txt b/libs/fese-0.2.9.dist-info/top_level.txt deleted file mode 100644 index ee8bdad9b..000000000 --- a/libs/fese-0.2.9.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -fese diff --git a/libs/fese/container.py b/libs/fese/container.py index 21dfc20da..5f2c70371 100644 --- a/libs/fese/container.py +++ b/libs/fese/container.py @@ -54,7 +54,10 @@ def _ffmpeg_call(command, log_callback=None, progress_callback=None, timeout=100 if match: size, time_, bitrate, speed = match.groups() info = {"size": size, "time": time_, "bitrate": bitrate, "speed": speed} - progress_callback(info) + else: + info = {"size": "n/a", "time": "n/a", "bitrate": "n/a", "speed": "n/a"} + + progress_callback(info) if timeout is not None and time.time() - start > timeout: proc.kill() diff --git a/libs/fese/tags.py b/libs/fese/tags.py index b846fffea..3c4625eb1 100644 --- a/libs/fese/tags.py +++ b/libs/fese/tags.py @@ -192,4 +192,8 @@ _extra_languages = { "matches": ("pt-br", "pob", "pb", "brazilian", "brasil", "brazil"), "language_args": ("por", "BR"), }, + "fil": { + "matches": ("fil", "filipino"), + "language_args": ("tgl", "PH"), + }, } diff --git a/libs/version.txt b/libs/version.txt index 1eaf9a16a..823682624 100644 --- a/libs/version.txt +++ b/libs/version.txt @@ -10,7 +10,7 @@ charset-normalizer==3.3.2 deep-translator==1.11.4 dogpile.cache==1.3.2 dynaconf==3.2.4 -fese==0.2.9 +fese==0.3.0 ffsubsync==0.4.25 flask-cors==4.0.0 flask-migrate==4.0.5 diff --git a/tests/subliminal_patch/test_embeddedsubtitles.py b/tests/subliminal_patch/test_embeddedsubtitles.py index b7bfaa0a8..7326a368b 100644 --- a/tests/subliminal_patch/test_embeddedsubtitles.py +++ b/tests/subliminal_patch/test_embeddedsubtitles.py @@ -107,6 +107,13 @@ def fake_streams(): "tags": {"language": "eng", "title": "English"}, } ), + "tg": FFprobeSubtitleStream( + { + "index": 3, + "codec_name": "subrip", + "tags": {"language": "fil", "title": "Filipino"}, + } + ), "es_hi": FFprobeSubtitleStream( { "index": 3, @@ -192,6 +199,18 @@ def test_list_subtitles_hi_fallback_one_stream( assert subs[0].hearing_impaired == False +def test_list_subtitles_custom_language_from_fese( + video_single_language, fake_streams, mocker +): + with EmbeddedSubtitlesProvider(hi_fallback=True) as provider: + language = Language("tgl", "PH") + mocker.patch( + "subliminal_patch.providers.embeddedsubtitles._MemoizedFFprobeVideoContainer.get_subtitles", + return_value=[fake_streams["tg"]], + ) + assert provider.list_subtitles(video_single_language, {language}) + + def test_list_subtitles_hi_fallback_multiple_streams( video_single_language, fake_streams, mocker ): From 124ddeb4b9b1a8fbb1d05b258dcdbb793a92284a Mon Sep 17 00:00:00 2001 From: Vitiko Date: Tue, 9 Jul 2024 18:52:51 -0400 Subject: [PATCH 07/78] no log: add dist-info --- libs/fese-0.3.0.dist-info/INSTALLER | 1 + libs/fese-0.3.0.dist-info/LICENSE | 674 ++++++++++++++++++++++++ libs/fese-0.3.0.dist-info/METADATA | 34 ++ libs/fese-0.3.0.dist-info/RECORD | 13 + libs/fese-0.3.0.dist-info/REQUESTED | 0 libs/fese-0.3.0.dist-info/WHEEL | 5 + libs/fese-0.3.0.dist-info/top_level.txt | 1 + 7 files changed, 728 insertions(+) create mode 100644 libs/fese-0.3.0.dist-info/INSTALLER create mode 100755 libs/fese-0.3.0.dist-info/LICENSE create mode 100644 libs/fese-0.3.0.dist-info/METADATA create mode 100644 libs/fese-0.3.0.dist-info/RECORD create mode 100644 libs/fese-0.3.0.dist-info/REQUESTED create mode 100644 libs/fese-0.3.0.dist-info/WHEEL create mode 100644 libs/fese-0.3.0.dist-info/top_level.txt diff --git a/libs/fese-0.3.0.dist-info/INSTALLER b/libs/fese-0.3.0.dist-info/INSTALLER new file mode 100644 index 000000000..a1b589e38 --- /dev/null +++ b/libs/fese-0.3.0.dist-info/INSTALLER @@ -0,0 +1 @@ +pip diff --git a/libs/fese-0.3.0.dist-info/LICENSE b/libs/fese-0.3.0.dist-info/LICENSE new file mode 100755 index 000000000..f288702d2 --- /dev/null +++ b/libs/fese-0.3.0.dist-info/LICENSE @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/libs/fese-0.3.0.dist-info/METADATA b/libs/fese-0.3.0.dist-info/METADATA new file mode 100644 index 000000000..8c8782450 --- /dev/null +++ b/libs/fese-0.3.0.dist-info/METADATA @@ -0,0 +1,34 @@ +Metadata-Version: 2.1 +Name: fese +Version: 0.3.0 +Summary: A library to extract FFmpeg subtitle streams +Author-email: Vitiko Nogales +Requires-Python: >=3.7 +Description-Content-Type: text/markdown +License-File: LICENSE +Requires-Dist: babelfish +Requires-Dist: pysubs2 + +# fese + +A library to extract FFmpeg subtitle streams + +## Usage + +```python +import logging +import sys + +from fese.container import FFprobeVideoContainer + +logging.basicConfig(level=logging.DEBUG) + +video_path = sys.argv[1] + +video = fese.FFprobeVideoContainer(video_path) + +subtitles = video.get_subtitles() + +paths = video.extract_subtitles(subtitles) +print(paths) +``` diff --git a/libs/fese-0.3.0.dist-info/RECORD b/libs/fese-0.3.0.dist-info/RECORD new file mode 100644 index 000000000..55deffc5a --- /dev/null +++ b/libs/fese-0.3.0.dist-info/RECORD @@ -0,0 +1,13 @@ +fese-0.3.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +fese-0.3.0.dist-info/LICENSE,sha256=OXLcl0T2SZ8Pmy2_dmlvKuetivmyPd5m1q-Gyd-zaYY,35149 +fese-0.3.0.dist-info/METADATA,sha256=Y6rn3cPjHc2ySJrSnUAuXxahgSFs2YoAivSIgJqi40M,655 +fese-0.3.0.dist-info/RECORD,, +fese-0.3.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +fese-0.3.0.dist-info/WHEEL,sha256=Z4pYXqR_rTB7OWNDYFOm1qRk0RX6GFP2o8LgvP453Hk,91 +fese-0.3.0.dist-info/top_level.txt,sha256=ra2BuARVEUZpk76YpHnjVoqjR2FxvzhCdmW2OyBWGzE,5 +fese/__init__.py,sha256=_YUpx7sq26ioEp5LZOEKa-0MrRHQUuRuDCs0EQ6Amv4,150 +fese/container.py,sha256=zhUNLut9Tdy_oPa6gCophUekTQegGWbHdbd1prR5aHg,10443 +fese/disposition.py,sha256=hv4YmXpsvKmUdpeWvSrZkhKgtZLZ8t56dmwMddsqxus,2156 +fese/exceptions.py,sha256=VZaubpq8SPpkUGp28Ryebsf9YzqbKK62nni6YZgDPYI,372 +fese/stream.py,sha256=Hgf6-amksHpuhSoY6SL6C3q4YtGCuRHl4fusBWE9nBE,4866 +fese/tags.py,sha256=1v-CLuyEZ2tL-TVtOXY8nbo7a3jFwq6fTFDHtFjdnow,5554 diff --git a/libs/fese-0.3.0.dist-info/REQUESTED b/libs/fese-0.3.0.dist-info/REQUESTED new file mode 100644 index 000000000..e69de29bb diff --git a/libs/fese-0.3.0.dist-info/WHEEL b/libs/fese-0.3.0.dist-info/WHEEL new file mode 100644 index 000000000..5bea5450d --- /dev/null +++ b/libs/fese-0.3.0.dist-info/WHEEL @@ -0,0 +1,5 @@ +Wheel-Version: 1.0 +Generator: setuptools (70.3.0) +Root-Is-Purelib: true +Tag: py3-none-any + diff --git a/libs/fese-0.3.0.dist-info/top_level.txt b/libs/fese-0.3.0.dist-info/top_level.txt new file mode 100644 index 000000000..ee8bdad9b --- /dev/null +++ b/libs/fese-0.3.0.dist-info/top_level.txt @@ -0,0 +1 @@ +fese From e3a3ef1e931ec6124f59941e14d6544be3a9e268 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Tue, 9 Jul 2024 21:23:13 -0400 Subject: [PATCH 08/78] Improved subdl provider to filter out non SRT or ASS subtitles --- custom_libs/subliminal_patch/providers/subdl.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/subdl.py b/custom_libs/subliminal_patch/providers/subdl.py index 794625d15..66c5bf616 100644 --- a/custom_libs/subliminal_patch/providers/subdl.py +++ b/custom_libs/subliminal_patch/providers/subdl.py @@ -147,7 +147,9 @@ class SubdlProvider(ProviderRetryMixin, Provider): ('subs_per_page', 30), ('type', 'tv'), ('comment', 1), - ('releases', 1)), + ('releases', 1), + ('bazarr', 1)), # this argument filter incompatible image based or + # txt subtitles timeout=30), amount=retry_amount, retry_timeout=retry_timeout @@ -162,7 +164,9 @@ class SubdlProvider(ProviderRetryMixin, Provider): ('subs_per_page', 30), ('type', 'movie'), ('comment', 1), - ('releases', 1)), + ('releases', 1), + ('bazarr', 1)), # this argument filter incompatible image based or + # txt subtitles timeout=30), amount=retry_amount, retry_timeout=retry_timeout From 48019281d087516cf06da1b014a112a75f524be6 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 10 Jul 2024 10:01:34 -0400 Subject: [PATCH 09/78] no log: small fix to translate function --- bazarr/subtitles/tools/translate.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazarr/subtitles/tools/translate.py b/bazarr/subtitles/tools/translate.py index 4dcc25471..eaaa69182 100644 --- a/bazarr/subtitles/tools/translate.py +++ b/bazarr/subtitles/tools/translate.py @@ -44,7 +44,7 @@ def translate_subtitles_file(video_path, source_srt_file, from_lang, to_lang, fo subs = pysubs2.load(source_srt_file, encoding='utf-8') subs.remove_miscellaneous_events() lines_list = [x.plaintext for x in subs] - joined_lines_str = '\n\n\n'.join(lines_list) + joined_lines_str = '\n\n'.join(lines_list) logging.debug(f'BAZARR splitting subtitles into {max_characters} characters blocks') lines_block_list = [] From ebf3471eec3895ba06c5be3dfe1fb7efb7622100 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 10 Jul 2024 10:07:18 -0400 Subject: [PATCH 10/78] Fixed issue with soustitreseu when guessit is unable to guess episode or season from release name. #2569 --- custom_libs/subliminal_patch/providers/soustitreseu.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/soustitreseu.py b/custom_libs/subliminal_patch/providers/soustitreseu.py index 945b4a21b..727a70458 100644 --- a/custom_libs/subliminal_patch/providers/soustitreseu.py +++ b/custom_libs/subliminal_patch/providers/soustitreseu.py @@ -277,7 +277,11 @@ class SoustitreseuProvider(Provider, ProviderSubtitleArchiveMixin): release = name[:-4].lower().rstrip('tag').rstrip('en').rstrip('fr') _guess = guessit(release) if isinstance(video, Episode): - if video.episode != _guess['episode'] or video.season != _guess['season']: + try: + if video.episode != _guess['episode'] or video.season != _guess['season']: + continue + except KeyError: + # episode or season are missing from guessit result continue matches = set() From 03f0bdbe39e9551cecf53876db0993e0a30de3aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?I=C3=B1aki=20Larramendi?= <30437204+ilarramendi@users.noreply.github.com> Date: Wed, 10 Jul 2024 22:17:54 -0300 Subject: [PATCH 11/78] Added series empty subtitle episodes progress bar labels (#2575) --- frontend/src/pages/Series/index.tsx | 31 +++++++++++++++++++---------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/frontend/src/pages/Series/index.tsx b/frontend/src/pages/Series/index.tsx index 229082444..c142a6767 100644 --- a/frontend/src/pages/Series/index.tsx +++ b/frontend/src/pages/Series/index.tsx @@ -65,25 +65,34 @@ const SeriesView: FunctionComponent = () => { cell: (row) => { const { episodeFileCount, episodeMissingCount, profileId, title } = row.row.original; - let progress = 0; - let label = ""; - if (episodeFileCount === 0 || !profileId) { - progress = 0.0; - } else { - progress = (1.0 - episodeMissingCount / episodeFileCount) * 100.0; - label = `${ - episodeFileCount - episodeMissingCount - }/${episodeFileCount}`; - } + const label = `${episodeFileCount - episodeMissingCount}/${episodeFileCount}`; return ( {label} + {episodeMissingCount === episodeFileCount && ( + + {label} + + )} ); }, From 127a7aebadde462babba33d2115dc058a854954c Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Fri, 12 Jul 2024 09:55:55 +0900 Subject: [PATCH 12/78] Fixed cached logged out index page --- frontend/vite.config.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/frontend/vite.config.ts b/frontend/vite.config.ts index d6c625441..fbae83c88 100644 --- a/frontend/vite.config.ts +++ b/frontend/vite.config.ts @@ -36,6 +36,9 @@ export default defineConfig(async ({ mode, command }) => { enableBuild: false, }), VitePWA({ + workbox: { + globIgnores: ["index.html"], + }, registerType: "autoUpdate", includeAssets: [ `${imagesFolder}/favicon.ico`, From 91a35317cc1f627030b7bae4d9776acef4745afd Mon Sep 17 00:00:00 2001 From: Vitiko Date: Sun, 14 Jul 2024 19:02:50 -0400 Subject: [PATCH 13/78] Subdl Provider: add tests and use standard utils --- .../subliminal_patch/providers/subdl.py | 7 ++-- tests/subliminal_patch/test_subdl.py | 36 +++++++++++++++++++ 2 files changed, 38 insertions(+), 5 deletions(-) create mode 100644 tests/subliminal_patch/test_subdl.py diff --git a/custom_libs/subliminal_patch/providers/subdl.py b/custom_libs/subliminal_patch/providers/subdl.py index 66c5bf616..3c59f43a5 100644 --- a/custom_libs/subliminal_patch/providers/subdl.py +++ b/custom_libs/subliminal_patch/providers/subdl.py @@ -17,8 +17,7 @@ from .mixins import ProviderRetryMixin from subliminal_patch.subtitle import Subtitle from subliminal.subtitle import fix_line_ending from subliminal_patch.providers import Provider -from subliminal_patch.subtitle import guess_matches -from guessit import guessit +from subliminal_patch.providers import utils logger = logging.getLogger(__name__) @@ -57,7 +56,6 @@ class SubdlSubtitle(Subtitle): def get_matches(self, video): matches = set() - type_ = "movie" if isinstance(video, Movie) else "episode" # handle movies and series separately if isinstance(video, Episode): @@ -77,8 +75,7 @@ class SubdlSubtitle(Subtitle): # imdb matches.add('imdb_id') - # other properties - matches |= guess_matches(video, guessit(self.release_info, {"type": type_})) + utils.update_matches(matches, video, self.release_info) self.matches = matches diff --git a/tests/subliminal_patch/test_subdl.py b/tests/subliminal_patch/test_subdl.py new file mode 100644 index 000000000..47fe7577d --- /dev/null +++ b/tests/subliminal_patch/test_subdl.py @@ -0,0 +1,36 @@ +import os + +import pytest +from subliminal_patch.providers.subdl import SubdlProvider +from subliminal_patch.providers.subdl import SubdlSubtitle + + +@pytest.fixture(scope="session") +def provider(): + with SubdlProvider(os.environ["SUBDL_TOKEN"]) as provider: + yield provider + + +def test_list_subtitles_movie(provider, movies, languages): + for sub in provider.list_subtitles(movies["dune"], {languages["en"]}): + assert sub.language == languages["en"] + + +def test_download_subtitle(provider, languages): + data = { + "language": languages["en"], + "forced": False, + "hearing_impaired": False, + "page_link": "https://subdl.com/s/info/ebC6BrLCOC", + "download_link": "/subtitle/2808552-2770424.zip", + "file_id": "SUBDL::dune-2021-2770424.zip", + "release_names": ["Dune Part 1 WebDl"], + "uploader": "makoto77", + "season": 0, + "episode": None, + } + + sub = SubdlSubtitle(**data) + provider.download_subtitle(sub) + + assert sub.is_valid() From b4195934c1fd5ff97acf07d7fbd82f52e272c520 Mon Sep 17 00:00:00 2001 From: Vitiko Date: Sun, 14 Jul 2024 19:07:19 -0400 Subject: [PATCH 14/78] HDBits provider: handle KeyError (common exception) --- custom_libs/subliminal_patch/providers/hdbits.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/hdbits.py b/custom_libs/subliminal_patch/providers/hdbits.py index 19196aecd..87fdfaa82 100644 --- a/custom_libs/subliminal_patch/providers/hdbits.py +++ b/custom_libs/subliminal_patch/providers/hdbits.py @@ -96,7 +96,12 @@ class HDBitsProvider(Provider): "https://hdbits.org/api/torrents", json={**self._def_params, **lookup} ) response.raise_for_status() - ids = [item["id"] for item in response.json()["data"]] + + try: + ids = [item["id"] for item in response.json()["data"]] + except KeyError: + logger.debug("No data found") + return [] subtitles = [] for torrent_id in ids: From cb415531d8082e13a744c7a0fc34aefa87f758c5 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Tue, 16 Jul 2024 11:52:26 +0900 Subject: [PATCH 15/78] Fixed anidb refiner episode not found (#2581) --- bazarr/subtitles/refiners/anidb.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bazarr/subtitles/refiners/anidb.py b/bazarr/subtitles/refiners/anidb.py index f3c61916a..36ed05786 100644 --- a/bazarr/subtitles/refiners/anidb.py +++ b/bazarr/subtitles/refiners/anidb.py @@ -83,9 +83,9 @@ class AniDBClient(object): for index, anime_info in enumerate(animes): anime, episode_offset = anime_info - anidb_id = int(anime.attrib.get('anidbid')) + if episode > episode_offset: - anidb_id = anidb_id + anidb_id = int(anime.attrib.get('anidbid')) offset = episode_offset return anidb_id, episode - offset @@ -101,7 +101,12 @@ class AniDBClient(object): episodes = etree.fromstring(self.get_episodes(series_id)) - return series_id, int(episodes.find(f".//episode[epno='{episode_no}']").attrib.get('id')) + episode = episodes.find(f".//episode[epno='{episode_no}']") + + if not episode: + return series_id, None + + return series_id, int(episode.attrib.get('id')) @region.cache_on_arguments(expiration_time=REFINER_EXPIRATION_TIME) def get_episodes(self, series_id): From c852458b8c6a732b75832eb6ea72cc531a94d553 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 23 Jul 2024 10:21:07 +0900 Subject: [PATCH 16/78] no log: Bump the mantine group in /frontend with 6 updates (#2579) Bumps the mantine group in /frontend with 6 updates: | Package | From | To | | --- | --- | --- | | [@mantine/core](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core) | `7.11.1` | `7.11.2` | | [@mantine/dropzone](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dropzone) | `7.11.1` | `7.11.2` | | [@mantine/form](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/form) | `7.11.1` | `7.11.2` | | [@mantine/hooks](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks) | `7.11.1` | `7.11.2` | | [@mantine/modals](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/modals) | `7.11.1` | `7.11.2` | | [@mantine/notifications](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/notifications) | `7.11.1` | `7.11.2` | Updates `@mantine/core` from 7.11.1 to 7.11.2 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.2/packages/@mantine/core) Updates `@mantine/dropzone` from 7.11.1 to 7.11.2 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.2/packages/@mantine/dropzone) Updates `@mantine/form` from 7.11.1 to 7.11.2 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.2/packages/@mantine/form) Updates `@mantine/hooks` from 7.11.1 to 7.11.2 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.2/packages/@mantine/hooks) Updates `@mantine/modals` from 7.11.1 to 7.11.2 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.2/packages/@mantine/modals) Updates `@mantine/notifications` from 7.11.1 to 7.11.2 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.11.2/packages/@mantine/notifications) --- updated-dependencies: - dependency-name: "@mantine/core" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/dropzone" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/hooks" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/modals" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/notifications" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 70 +++++++++++++++++++------------------- frontend/package.json | 12 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b8b546e04..89c3927fd 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,12 +9,12 @@ "version": "1.0.0", "license": "GPL-3", "dependencies": { - "@mantine/core": "^7.11.1", - "@mantine/dropzone": "^7.11.1", - "@mantine/form": "^7.11.1", - "@mantine/hooks": "^7.11.1", - "@mantine/modals": "^7.11.1", - "@mantine/notifications": "^7.11.1", + "@mantine/core": "^7.11.2", + "@mantine/dropzone": "^7.11.2", + "@mantine/form": "^7.11.2", + "@mantine/hooks": "^7.11.2", + "@mantine/modals": "^7.11.2", + "@mantine/notifications": "^7.11.2", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", @@ -2967,9 +2967,9 @@ } }, "node_modules/@mantine/core": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.11.1.tgz", - "integrity": "sha512-qEwe5ijBe3MWOg4yerJ+HXMugIBtS1Bbqbdnfrg2cuHXr+2paqu8SQMzldtzqfiLsRajOtkokOkY67jUJOacCA==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.11.2.tgz", + "integrity": "sha512-T64RjdgY8UPAv249miW1lQyPPot1JbCcKKsAZMNQHgcttcxLhrFpKVvglc4/48hdSoxI4LYJPNvqp7zciZmucQ==", "dependencies": { "@floating-ui/react": "^0.26.9", "clsx": "^2.1.1", @@ -2979,7 +2979,7 @@ "type-fest": "^4.12.0" }, "peerDependencies": { - "@mantine/hooks": "7.11.1", + "@mantine/hooks": "7.11.2", "react": "^18.2.0", "react-dom": "^18.2.0" } @@ -2996,23 +2996,23 @@ } }, "node_modules/@mantine/dropzone": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.11.1.tgz", - "integrity": "sha512-Jvn+ikhT1GtQq3EMAYWK+1lk6CVDeB1Ykok7oUjTWPZDYAcQkLDNfPpFLqrbPPYSMav0u67zzaq9fUVTYVVhew==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.11.2.tgz", + "integrity": "sha512-/X29ym1uM1ca7ZMLVSSxm9KBbDNIpXBwZbzNIpopH0hxjbo2bSpPTbNUVB3EjRAVWDx9RGlyNxQV2jkhCos7QQ==", "dependencies": { "react-dropzone-esm": "15.0.1" }, "peerDependencies": { - "@mantine/core": "7.11.1", - "@mantine/hooks": "7.11.1", + "@mantine/core": "7.11.2", + "@mantine/hooks": "7.11.2", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/form": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.11.1.tgz", - "integrity": "sha512-d14Rrx4Yid3/sDPvRHt5mYK37PWedflwbxWO0vJ98qpYFUGunw9pTm7dmPNoUoj4fHGX9b0F+TWuM4zXs2wAwg==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.11.2.tgz", + "integrity": "sha512-NRY4HDgcArDEP+wUaHITnoVh0Ce3rM3Blo9fLNj2VYO8k7AfuSWp+fQdqrjDI0k9wGU3YEj4/dbwOjKbtXEhxw==", "dependencies": { "fast-deep-equal": "^3.1.3", "klona": "^2.0.6" @@ -3022,43 +3022,43 @@ } }, "node_modules/@mantine/hooks": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.11.1.tgz", - "integrity": "sha512-28WS/U6QL4jaIHf1uFpny5Tglu9MoyyM4bWLmIcAQHtOD3YHpuNvs9OTWLqKAQs6VN+kydlxvjvT+w1LBWEpQg==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.11.2.tgz", + "integrity": "sha512-jhyVe/sbDEG2U8rr2lMecUPgQxcfr5hh9HazqGfkS7ZRIMDO7uJ947yAcTMGGkp5Lxtt5TBFt1Cb6tiB2/1agg==", "peerDependencies": { "react": "^18.2.0" } }, "node_modules/@mantine/modals": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.11.1.tgz", - "integrity": "sha512-SDHhpt7O+Y8rTW5RaXFqIIjuD87efUqhC5kxqLyRsuivQ+tk4gMY37R5gR8o0yC6vifKBzjjYVFeeGTLocRTBg==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.11.2.tgz", + "integrity": "sha512-AsVyGP5+F9jkQdQ9J0qzaK8q7n9bPcpswAjScpzIgEfUBC4RCvf63bmh9Yp1OEgxl1xkNdzGUYGVau0SQqHasA==", "peerDependencies": { - "@mantine/core": "7.11.1", - "@mantine/hooks": "7.11.1", + "@mantine/core": "7.11.2", + "@mantine/hooks": "7.11.2", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/notifications": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.11.1.tgz", - "integrity": "sha512-4MpuePstpWvCwiEX75oUAdxp3SXWsiq0+fd4zb5YMu+CaqiaDbUIOupEpi/uCez3lYhY0ojHyjNgYsqZ7cy1Fg==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.11.2.tgz", + "integrity": "sha512-KB/6mp3mU3LvcFlfMc5zK5mWcrAO+zAGeiBb1oUjNFXBECCn9xizqqUeT0YbWBHL7wysq9IThDJxLwUBnQt+8Q==", "dependencies": { - "@mantine/store": "7.11.1", + "@mantine/store": "7.11.2", "react-transition-group": "4.4.5" }, "peerDependencies": { - "@mantine/core": "7.11.1", - "@mantine/hooks": "7.11.1", + "@mantine/core": "7.11.2", + "@mantine/hooks": "7.11.2", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/store": { - "version": "7.11.1", - "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.11.1.tgz", - "integrity": "sha512-5xOompA7pADDvYlw6KEr0YIr95bdFI0W/KZizi8E/BKOLVUpku1UvqcClodq4U0Xjz5eZt/Jf3gEV9lyJbt8Zw==", + "version": "7.11.2", + "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.11.2.tgz", + "integrity": "sha512-FfkmnOnCivOjqwNaTZeV4TgDANUs7fP+0uSgzp0GuvwTuDfQNVafPBRzPkjKuz5ug+Nn9l6WwjfJ6LBDv9U0LQ==", "peerDependencies": { "react": "^18.2.0" } diff --git a/frontend/package.json b/frontend/package.json index 221d3a97d..6c93464b4 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,12 +13,12 @@ }, "private": true, "dependencies": { - "@mantine/core": "^7.11.1", - "@mantine/dropzone": "^7.11.1", - "@mantine/form": "^7.11.1", - "@mantine/hooks": "^7.11.1", - "@mantine/modals": "^7.11.1", - "@mantine/notifications": "^7.11.1", + "@mantine/core": "^7.11.2", + "@mantine/dropzone": "^7.11.2", + "@mantine/form": "^7.11.2", + "@mantine/hooks": "^7.11.2", + "@mantine/modals": "^7.11.2", + "@mantine/notifications": "^7.11.2", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", From b304f6f1efecdfa5b258138029b54460267e8032 Mon Sep 17 00:00:00 2001 From: JayZed Date: Wed, 24 Jul 2024 13:09:30 -0400 Subject: [PATCH 17/78] Added new feature: Tag-Based Automatic Language Profile Selection --- bazarr/api/system/settings.py | 2 + bazarr/app/config.py | 2 + bazarr/app/database.py | 9 ++- bazarr/radarr/sync/movies.py | 13 +++- bazarr/radarr/sync/parser.py | 17 ++++- bazarr/sonarr/sync/parser.py | 72 ++++++++++--------- bazarr/sonarr/sync/series.py | 12 +++- .../forms/ProfileEditForm.module.scss | 8 +++ .../src/components/forms/ProfileEditForm.tsx | 31 +++++++- .../src/pages/Settings/Languages/index.tsx | 22 ++++++ .../src/pages/Settings/Languages/table.tsx | 5 ++ frontend/src/types/api.d.ts | 1 + 12 files changed, 150 insertions(+), 44 deletions(-) diff --git a/bazarr/api/system/settings.py b/bazarr/api/system/settings.py index 103df6304..126e2f7a5 100644 --- a/bazarr/api/system/settings.py +++ b/bazarr/api/system/settings.py @@ -73,6 +73,7 @@ class SystemSettings(Resource): mustNotContain=str(item['mustNotContain']), originalFormat=int(item['originalFormat']) if item['originalFormat'] not in None_Keys else None, + tag=item['tag'] if 'tag' in item else None, ) .where(TableLanguagesProfiles.profileId == item['profileId'])) existing.remove(item['profileId']) @@ -89,6 +90,7 @@ class SystemSettings(Resource): mustNotContain=str(item['mustNotContain']), originalFormat=int(item['originalFormat']) if item['originalFormat'] not in None_Keys else None, + tag=item['tag'] if 'tag' in item else None, )) for profileId in existing: # Remove deleted profiles diff --git a/bazarr/app/config.py b/bazarr/app/config.py index f5203da84..aebdf5dc3 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -88,6 +88,8 @@ validators = [ Validator('general.use_sonarr', must_exist=True, default=False, is_type_of=bool), Validator('general.use_radarr', must_exist=True, default=False, is_type_of=bool), Validator('general.path_mappings_movie', must_exist=True, default=[], is_type_of=list), + Validator('general.serie_tag_enabled', must_exist=True, default=False, is_type_of=bool), + Validator('general.movie_tag_enabled', must_exist=True, default=False, is_type_of=bool), Validator('general.serie_default_enabled', must_exist=True, default=False, is_type_of=bool), Validator('general.serie_default_profile', must_exist=True, default='', is_type_of=(int, str)), Validator('general.movie_default_enabled', must_exist=True, default=False, is_type_of=bool), diff --git a/bazarr/app/database.py b/bazarr/app/database.py index fa612c4eb..3780befea 100644 --- a/bazarr/app/database.py +++ b/bazarr/app/database.py @@ -379,6 +379,7 @@ def update_profile_id_list(): 'mustContain': ast.literal_eval(x.mustContain) if x.mustContain else [], 'mustNotContain': ast.literal_eval(x.mustNotContain) if x.mustNotContain else [], 'originalFormat': x.originalFormat, + 'tag': x.tag, } for x in database.execute( select(TableLanguagesProfiles.profileId, TableLanguagesProfiles.name, @@ -386,7 +387,8 @@ def update_profile_id_list(): TableLanguagesProfiles.items, TableLanguagesProfiles.mustContain, TableLanguagesProfiles.mustNotContain, - TableLanguagesProfiles.originalFormat)) + TableLanguagesProfiles.originalFormat, + TableLanguagesProfiles.tag)) .all() ] @@ -421,7 +423,7 @@ def get_profile_cutoff(profile_id): if profile_id and profile_id != 'null': cutoff_language = [] for profile in profile_id_list: - profileId, name, cutoff, items, mustContain, mustNotContain, originalFormat = profile.values() + profileId, name, cutoff, items, mustContain, mustNotContain, originalFormat, tag = profile.values() if cutoff: if profileId == int(profile_id): for item in items: @@ -511,7 +513,8 @@ def upgrade_languages_profile_hi_values(): TableLanguagesProfiles.items, TableLanguagesProfiles.mustContain, TableLanguagesProfiles.mustNotContain, - TableLanguagesProfiles.originalFormat) + TableLanguagesProfiles.originalFormat, + TableLanguagesProfiles.tag) ))\ .all(): items = json.loads(languages_profile.items) diff --git a/bazarr/radarr/sync/movies.py b/bazarr/radarr/sync/movies.py index 82416cffb..6273a0a8d 100644 --- a/bazarr/radarr/sync/movies.py +++ b/bazarr/radarr/sync/movies.py @@ -28,6 +28,11 @@ def trace(message): logging.debug(FEATURE_PREFIX + message) +def get_language_profiles(): + return database.execute( + select(TableLanguagesProfiles.profileId, TableLanguagesProfiles.name, TableLanguagesProfiles.tag)).all() + + def update_all_movies(): movies_full_scan_subtitles() logging.info('BAZARR All existing movie subtitles indexed from disk.') @@ -108,6 +113,7 @@ def update_movies(send_event=True): else: audio_profiles = get_profile_list() tagsDict = get_tags() + language_profiles = get_language_profiles() # Get movies data from radarr movies = get_movies_from_radarr_api(apikey_radarr=apikey_radarr) @@ -178,6 +184,7 @@ def update_movies(send_event=True): if str(movie['tmdbId']) in current_movies_id_db: parsed_movie = movieParser(movie, action='update', tags_dict=tagsDict, + language_profiles=language_profiles, movie_default_profile=movie_default_profile, audio_profiles=audio_profiles) if not any([parsed_movie.items() <= x for x in current_movies_db_kv]): @@ -186,6 +193,7 @@ def update_movies(send_event=True): else: parsed_movie = movieParser(movie, action='insert', tags_dict=tagsDict, + language_profiles=language_profiles, movie_default_profile=movie_default_profile, audio_profiles=audio_profiles) add_movie(parsed_movie, send_event) @@ -247,6 +255,7 @@ def update_one_movie(movie_id, action, defer_search=False): audio_profiles = get_profile_list() tagsDict = get_tags() + language_profiles = get_language_profiles() try: # Get movie data from radarr api @@ -256,10 +265,10 @@ def update_one_movie(movie_id, action, defer_search=False): return else: if action == 'updated' and existing_movie: - movie = movieParser(movie_data, action='update', tags_dict=tagsDict, + movie = movieParser(movie_data, action='update', tags_dict=tagsDict, language_profiles=language_profiles, movie_default_profile=movie_default_profile, audio_profiles=audio_profiles) elif action == 'updated' and not existing_movie: - movie = movieParser(movie_data, action='insert', tags_dict=tagsDict, + movie = movieParser(movie_data, action='insert', tags_dict=tagsDict, language_profiles=language_profiles, movie_default_profile=movie_default_profile, audio_profiles=audio_profiles) except Exception: logging.exception('BAZARR cannot get movie returned by SignalR feed from Radarr API.') diff --git a/bazarr/radarr/sync/parser.py b/bazarr/radarr/sync/parser.py index 9648152c2..d5f3e08c8 100644 --- a/bazarr/radarr/sync/parser.py +++ b/bazarr/radarr/sync/parser.py @@ -11,7 +11,17 @@ from utilities.path_mappings import path_mappings from .converter import RadarrFormatAudioCodec, RadarrFormatVideoCodec -def movieParser(movie, action, tags_dict, movie_default_profile, audio_profiles): +def get_matching_profile(tags, language_profiles): + matching_profile = None + if len(tags) > 0: + for profileId, name, tag in language_profiles: + if tag in tags: + matching_profile = profileId + break + return matching_profile + + +def movieParser(movie, action, tags_dict, language_profiles, movie_default_profile, audio_profiles): if 'movieFile' in movie: try: overview = str(movie['overview']) @@ -140,6 +150,11 @@ def movieParser(movie, action, tags_dict, movie_default_profile, audio_profiles) parsed_movie['subtitles'] = '[]' parsed_movie['profileId'] = movie_default_profile + if settings.general.movie_tag_enabled: + tag_profile = get_matching_profile(tags, language_profiles) + if tag_profile: + parsed_movie['profileId'] = tag_profile + return parsed_movie diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index d8fce1697..32980cbab 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -12,7 +12,17 @@ from sonarr.info import get_sonarr_info from .converter import SonarrFormatVideoCodec, SonarrFormatAudioCodec -def seriesParser(show, action, tags_dict, serie_default_profile, audio_profiles): +def get_matching_profile(tags, language_profiles): + matching_profile = None + if len(tags) > 0: + for profileId, name, tag in language_profiles: + if tag in tags: + matching_profile = profileId + break + return matching_profile + + +def seriesParser(show, action, tags_dict, language_profiles, serie_default_profile, audio_profiles): overview = show['overview'] if 'overview' in show else '' poster = '' fanart = '' @@ -42,39 +52,33 @@ def seriesParser(show, action, tags_dict, serie_default_profile, audio_profiles) else: audio_language = [] - if action == 'update': - return {'title': show["title"], - 'path': show["path"], - 'tvdbId': int(show["tvdbId"]), - 'sonarrSeriesId': int(show["id"]), - 'overview': overview, - 'poster': poster, - 'fanart': fanart, - 'audio_language': str(audio_language), - 'sortTitle': show['sortTitle'], - 'year': str(show['year']), - 'alternativeTitles': alternate_titles, - 'tags': str(tags), - 'seriesType': show['seriesType'], - 'imdbId': imdbId, - 'monitored': str(bool(show['monitored']))} - else: - return {'title': show["title"], - 'path': show["path"], - 'tvdbId': show["tvdbId"], - 'sonarrSeriesId': show["id"], - 'overview': overview, - 'poster': poster, - 'fanart': fanart, - 'audio_language': str(audio_language), - 'sortTitle': show['sortTitle'], - 'year': str(show['year']), - 'alternativeTitles': alternate_titles, - 'tags': str(tags), - 'seriesType': show['seriesType'], - 'imdbId': imdbId, - 'profileId': serie_default_profile, - 'monitored': str(bool(show['monitored']))} + parsed_series = { + 'title': show["title"], + 'path': show["path"], + 'tvdbId': int(show["tvdbId"]), + 'sonarrSeriesId': int(show["id"]), + 'overview': overview, + 'poster': poster, + 'fanart': fanart, + 'audio_language': str(audio_language), + 'sortTitle': show['sortTitle'], + 'year': str(show['year']), + 'alternativeTitles': alternate_titles, + 'tags': str(tags), + 'seriesType': show['seriesType'], + 'imdbId': imdbId, + 'monitored': str(bool(show['monitored'])) + } + + if action == 'insert': + parsed_series['profileId'] = serie_default_profile + + if settings.general.serie_tag_enabled: + tag_profile = get_matching_profile(tags, language_profiles) + if tag_profile: + parsed_series['profileId'] = tag_profile + + return parsed_series def profile_id_to_language(id_, profiles): diff --git a/bazarr/sonarr/sync/series.py b/bazarr/sonarr/sync/series.py index 96a00009c..f8bd84990 100644 --- a/bazarr/sonarr/sync/series.py +++ b/bazarr/sonarr/sync/series.py @@ -26,6 +26,11 @@ def trace(message): logging.debug(FEATURE_PREFIX + message) +def get_language_profiles(): + return database.execute( + select(TableLanguagesProfiles.profileId, TableLanguagesProfiles.name, TableLanguagesProfiles.tag)).all() + + def get_series_monitored_table(): series_monitored = database.execute( select(TableShows.tvdbId, TableShows.monitored))\ @@ -58,6 +63,7 @@ def update_series(send_event=True): audio_profiles = get_profile_list() tagsDict = get_tags() + language_profiles = get_language_profiles() # Get shows data from Sonarr series = get_series_from_sonarr_api(apikey_sonarr=apikey_sonarr) @@ -111,6 +117,7 @@ def update_series(send_event=True): if show['id'] in current_shows_db: updated_series = seriesParser(show, action='update', tags_dict=tagsDict, + language_profiles=language_profiles, serie_default_profile=serie_default_profile, audio_profiles=audio_profiles) @@ -132,6 +139,7 @@ def update_series(send_event=True): event_stream(type='series', payload=show['id']) else: added_series = seriesParser(show, action='insert', tags_dict=tagsDict, + language_profiles=language_profiles, serie_default_profile=serie_default_profile, audio_profiles=audio_profiles) @@ -203,7 +211,7 @@ def update_one_series(series_id, action): audio_profiles = get_profile_list() tagsDict = get_tags() - + language_profiles = get_language_profiles() try: # Get series data from sonarr api series = None @@ -215,10 +223,12 @@ def update_one_series(series_id, action): else: if action == 'updated' and existing_series: series = seriesParser(series_data[0], action='update', tags_dict=tagsDict, + language_profiles=language_profiles, serie_default_profile=serie_default_profile, audio_profiles=audio_profiles) elif action == 'updated' and not existing_series: series = seriesParser(series_data[0], action='insert', tags_dict=tagsDict, + language_profiles=language_profiles, serie_default_profile=serie_default_profile, audio_profiles=audio_profiles) except Exception: diff --git a/frontend/src/components/forms/ProfileEditForm.module.scss b/frontend/src/components/forms/ProfileEditForm.module.scss index d98b850ff..3d4a8e177 100644 --- a/frontend/src/components/forms/ProfileEditForm.module.scss +++ b/frontend/src/components/forms/ProfileEditForm.module.scss @@ -3,3 +3,11 @@ padding: 0; } } + +.evenly { + flex-wrap: wrap; + + & > div { + flex: 1; + } +} diff --git a/frontend/src/components/forms/ProfileEditForm.tsx b/frontend/src/components/forms/ProfileEditForm.tsx index 75e2f9df7..267951fcb 100644 --- a/frontend/src/components/forms/ProfileEditForm.tsx +++ b/frontend/src/components/forms/ProfileEditForm.tsx @@ -3,6 +3,7 @@ import { Accordion, Button, Checkbox, + Flex, Select, Stack, Switch, @@ -72,9 +73,16 @@ const ProfileEditForm: FunctionComponent = ({ (value) => value.length > 0, "Must have a name", ), + tag: FormUtils.validation((value) => { + if (!value) { + return true; + } + + return /^[a-z_0-9-]+$/.test(value); + }, "Only lowercase alphanumeric characters, underscores (_) and hyphens (-) are allowed"), items: FormUtils.validation( (value) => value.length > 0, - "Must contain at lease 1 language", + "Must contain at least 1 language", ), }, }); @@ -265,7 +273,24 @@ const ProfileEditForm: FunctionComponent = ({ })} > - + + + + form.setFieldValue( + "tag", + (prev) => + prev?.toLowerCase().trim().replace(/\s+/g, "_") ?? undefined, + ) + } + > + = ({ > - {form.errors.items} = ({ + {form.errors.items} {
+
+ + If enabled, Bazarr will look at the names of all tags of a Series from + Sonarr (or a Movie from Radarr) to find a matching Bazarr language + profile tag. It will use as the language profile the FIRST tag from + Sonarr/Radarr that matches the tag of a Bazarr language profile + EXACTLY. If mutiple tags match, there is no guarantee as to which one + will be used, so choose your tag names carefully. Also, if you update + the tag names in Sonarr/Radarr, Bazarr will detect this and repeat the + matching process for the affected shows. However, if a show's only + matching tag is removed from Sonarr/Radarr, Bazarr will NOT remove the + show's existing language profile, but keep it, as is. + + + +
{ header: "Name", accessorKey: "name", }, + { + header: "Tag", + accessorKey: "tag", + }, { header: "Languages", accessorKey: "items", @@ -178,6 +182,7 @@ const Table: FunctionComponent = () => { const profile = { profileId: nextProfileId, name: "", + tag: undefined, items: [], cutoff: null, mustContain: [], diff --git a/frontend/src/types/api.d.ts b/frontend/src/types/api.d.ts index 069be3029..e8bd4483e 100644 --- a/frontend/src/types/api.d.ts +++ b/frontend/src/types/api.d.ts @@ -40,6 +40,7 @@ declare namespace Language { mustContain: string[]; mustNotContain: string[]; originalFormat: boolean | null; + tag: string | undefined; } } From 2658638f384aac50a47d6fe5c0264171ae9bcb16 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Fri, 26 Jul 2024 09:09:40 +0900 Subject: [PATCH 18/78] Fixed anidb refinement for sonarr specials (#2590) --- bazarr/subtitles/refiners/anidb.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bazarr/subtitles/refiners/anidb.py b/bazarr/subtitles/refiners/anidb.py index 36ed05786..c680bba5a 100644 --- a/bazarr/subtitles/refiners/anidb.py +++ b/bazarr/subtitles/refiners/anidb.py @@ -84,6 +84,22 @@ class AniDBClient(object): for index, anime_info in enumerate(animes): anime, episode_offset = anime_info + mapping_list = anime.find('mapping-list') + + # Handle mapping list for Specials + if mapping_list: + for mapping in mapping_list.findall("mapping"): + # Mapping values are usually like ;1-1;2-1;3-1; + for episode_ref in mapping.text.split(';'): + if not episode_ref: + continue + + anidb_episode, tvdb_episode = map(int, episode_ref.split('-')) + if tvdb_episode == episode: + anidb_id = int(anime.attrib.get('anidbid')) + + return anidb_id, anidb_episode + if episode > episode_offset: anidb_id = int(anime.attrib.get('anidbid')) offset = episode_offset From e4429e1a412eea4898c03698a5fe92582c6239eb Mon Sep 17 00:00:00 2001 From: Vitiko Date: Fri, 26 Jul 2024 18:59:40 -0400 Subject: [PATCH 19/78] no log: Fix #2578 --- custom_libs/subliminal_patch/providers/utils.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/utils.py b/custom_libs/subliminal_patch/providers/utils.py index 2feaecea2..86fee237f 100644 --- a/custom_libs/subliminal_patch/providers/utils.py +++ b/custom_libs/subliminal_patch/providers/utils.py @@ -65,7 +65,7 @@ def _get_matching_sub( guess = guessit(sub_name, options=guess_options) matched_episode_num = guess.get("episode") - if matched_episode_num: + if not matched_episode_num: logger.debug("No episode number found in file: %s", sub_name) if episode_title is not None: From 8fe8eaf7dad6b1eccde9d0622e946e15acc43688 Mon Sep 17 00:00:00 2001 From: Vitiko Date: Fri, 26 Jul 2024 19:09:09 -0400 Subject: [PATCH 20/78] Subdl Provider: avoid raising exception on no results ProviderError is raised when the movie or the TVShow is not found, causing Bazarr to throttle the provider instead of returning an empty list. --- custom_libs/subliminal_patch/providers/subdl.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/subdl.py b/custom_libs/subliminal_patch/providers/subdl.py index 3c59f43a5..102125eae 100644 --- a/custom_libs/subliminal_patch/providers/subdl.py +++ b/custom_libs/subliminal_patch/providers/subdl.py @@ -181,7 +181,8 @@ class SubdlProvider(ProviderRetryMixin, Provider): result = res.json() if ('success' in result and not result['success']) or ('status' in result and not result['status']): - raise ProviderError(result['error']) + logger.debug(result["error"]) + return [] logger.debug(f"Query returned {len(result['subtitles'])} subtitles") From 4a341869858103a60dccf712e70e6ad97f311a29 Mon Sep 17 00:00:00 2001 From: Vitiko Date: Fri, 26 Jul 2024 19:16:37 -0400 Subject: [PATCH 21/78] SuperSubtitles: handle KeyError for movie searches --- custom_libs/subliminal_patch/providers/supersubtitles.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/supersubtitles.py b/custom_libs/subliminal_patch/providers/supersubtitles.py index c3ecb06a3..cc7752925 100644 --- a/custom_libs/subliminal_patch/providers/supersubtitles.py +++ b/custom_libs/subliminal_patch/providers/supersubtitles.py @@ -455,7 +455,13 @@ class SuperSubtitlesProvider(Provider, ProviderSubtitleArchiveMixin): soup = ParserBeautifulSoup(r, ['lxml']) tables = soup.find_all("table") - tables = tables[0].find_all("tr") + + try: + tables = tables[0].find_all("tr") + except IndexError: + logger.debug("No tables found for %s", url) + return [] + i = 0 for table in tables: From 557c1dc7e8d00991b171520c8ae1eb1b1a46e075 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Sun, 4 Aug 2024 21:22:20 +0900 Subject: [PATCH 22/78] Fixed get movie monitored status (#2591) --- bazarr/radarr/sync/movies.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bazarr/radarr/sync/movies.py b/bazarr/radarr/sync/movies.py index 6273a0a8d..a5ecf0416 100644 --- a/bazarr/radarr/sync/movies.py +++ b/bazarr/radarr/sync/movies.py @@ -64,7 +64,7 @@ def update_movie(updated_movie, send_event): def get_movie_monitored_status(movie_id): existing_movie_monitored = database.execute( select(TableMovies.monitored) - .where(TableMovies.tmdbId == movie_id))\ + .where(TableMovies.tmdbId == str(movie_id)))\ .first() if existing_movie_monitored is None: return True From cc82c01c88c2b396639658069a82450042e9759a Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Sun, 4 Aug 2024 21:23:20 +0900 Subject: [PATCH 23/78] no log: Bump the fortawesome group in /frontend with 4 updates (#2595) Bumps the fortawesome group in /frontend with 4 updates: [@fortawesome/fontawesome-svg-core](https://github.com/FortAwesome/Font-Awesome), [@fortawesome/free-brands-svg-icons](https://github.com/FortAwesome/Font-Awesome), [@fortawesome/free-regular-svg-icons](https://github.com/FortAwesome/Font-Awesome) and [@fortawesome/free-solid-svg-icons](https://github.com/FortAwesome/Font-Awesome). Updates `@fortawesome/fontawesome-svg-core` from 6.5.2 to 6.6.0 - [Release notes](https://github.com/FortAwesome/Font-Awesome/releases) - [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/6.x/CHANGELOG.md) - [Commits](https://github.com/FortAwesome/Font-Awesome/compare/6.5.2...6.6.0) Updates `@fortawesome/free-brands-svg-icons` from 6.5.2 to 6.6.0 - [Release notes](https://github.com/FortAwesome/Font-Awesome/releases) - [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/6.x/CHANGELOG.md) - [Commits](https://github.com/FortAwesome/Font-Awesome/compare/6.5.2...6.6.0) Updates `@fortawesome/free-regular-svg-icons` from 6.5.2 to 6.6.0 - [Release notes](https://github.com/FortAwesome/Font-Awesome/releases) - [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/6.x/CHANGELOG.md) - [Commits](https://github.com/FortAwesome/Font-Awesome/compare/6.5.2...6.6.0) Updates `@fortawesome/free-solid-svg-icons` from 6.5.2 to 6.6.0 - [Release notes](https://github.com/FortAwesome/Font-Awesome/releases) - [Changelog](https://github.com/FortAwesome/Font-Awesome/blob/6.x/CHANGELOG.md) - [Commits](https://github.com/FortAwesome/Font-Awesome/compare/6.5.2...6.6.0) --- updated-dependencies: - dependency-name: "@fortawesome/fontawesome-svg-core" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: fortawesome - dependency-name: "@fortawesome/free-brands-svg-icons" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: fortawesome - dependency-name: "@fortawesome/free-regular-svg-icons" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: fortawesome - dependency-name: "@fortawesome/free-solid-svg-icons" dependency-type: direct:development update-type: version-update:semver-minor dependency-group: fortawesome ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 51 +++++++++++++++++--------------------- frontend/package.json | 8 +++--- 2 files changed, 27 insertions(+), 32 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 89c3927fd..ae4d5d461 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -26,10 +26,10 @@ }, "devDependencies": { "@fontsource/roboto": "^5.0.12", - "@fortawesome/fontawesome-svg-core": "^6.5.2", - "@fortawesome/free-brands-svg-icons": "^6.5.2", - "@fortawesome/free-regular-svg-icons": "^6.5.2", - "@fortawesome/free-solid-svg-icons": "^6.5.2", + "@fortawesome/fontawesome-svg-core": "^6.6.0", + "@fortawesome/free-brands-svg-icons": "^6.6.0", + "@fortawesome/free-regular-svg-icons": "^6.6.0", + "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", "@tanstack/react-query-devtools": "^5.40.1", "@testing-library/jest-dom": "^6.4.2", @@ -2750,62 +2750,57 @@ "dev": true }, "node_modules/@fortawesome/fontawesome-common-types": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.5.2.tgz", - "integrity": "sha512-gBxPg3aVO6J0kpfHNILc+NMhXnqHumFxOmjYCFfOiLZfwhnnfhtsdA2hfJlDnj+8PjAs6kKQPenOTKj3Rf7zHw==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-common-types/-/fontawesome-common-types-6.6.0.tgz", + "integrity": "sha512-xyX0X9mc0kyz9plIyryrRbl7ngsA9jz77mCZJsUkLl+ZKs0KWObgaEBoSgQiYWAsSmjz/yjl0F++Got0Mdp4Rw==", "dev": true, - "hasInstallScript": true, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/fontawesome-svg-core": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.5.2.tgz", - "integrity": "sha512-5CdaCBGl8Rh9ohNdxeeTMxIj8oc3KNBgIeLMvJosBMdslK/UnEB8rzyDRrbKdL1kDweqBPo4GT9wvnakHWucZw==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@fortawesome/fontawesome-svg-core/-/fontawesome-svg-core-6.6.0.tgz", + "integrity": "sha512-KHwPkCk6oRT4HADE7smhfsKudt9N/9lm6EJ5BVg0tD1yPA5hht837fB87F8pn15D8JfTqQOjhKTktwmLMiD7Kg==", "dev": true, - "hasInstallScript": true, "dependencies": { - "@fortawesome/fontawesome-common-types": "6.5.2" + "@fortawesome/fontawesome-common-types": "6.6.0" }, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/free-brands-svg-icons": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-6.5.2.tgz", - "integrity": "sha512-zi5FNYdmKLnEc0jc0uuHH17kz/hfYTg4Uei0wMGzcoCL/4d3WM3u1VMc0iGGa31HuhV5i7ZK8ZlTCQrHqRHSGQ==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-brands-svg-icons/-/free-brands-svg-icons-6.6.0.tgz", + "integrity": "sha512-1MPD8lMNW/earme4OQi1IFHtmHUwAKgghXlNwWi9GO7QkTfD+IIaYpIai4m2YJEzqfEji3jFHX1DZI5pbY/biQ==", "dev": true, - "hasInstallScript": true, "dependencies": { - "@fortawesome/fontawesome-common-types": "6.5.2" + "@fortawesome/fontawesome-common-types": "6.6.0" }, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/free-regular-svg-icons": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.5.2.tgz", - "integrity": "sha512-iabw/f5f8Uy2nTRtJ13XZTS1O5+t+anvlamJ3zJGLEVE2pKsAWhPv2lq01uQlfgCX7VaveT3EVs515cCN9jRbw==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-regular-svg-icons/-/free-regular-svg-icons-6.6.0.tgz", + "integrity": "sha512-Yv9hDzL4aI73BEwSEh20clrY8q/uLxawaQ98lekBx6t9dQKDHcDzzV1p2YtBGTtolYtNqcWdniOnhzB+JPnQEQ==", "dev": true, - "hasInstallScript": true, "dependencies": { - "@fortawesome/fontawesome-common-types": "6.5.2" + "@fortawesome/fontawesome-common-types": "6.6.0" }, "engines": { "node": ">=6" } }, "node_modules/@fortawesome/free-solid-svg-icons": { - "version": "6.5.2", - "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.5.2.tgz", - "integrity": "sha512-QWFZYXFE7O1Gr1dTIp+D6UcFUF0qElOnZptpi7PBUMylJh+vFmIedVe1Ir6RM1t2tEQLLSV1k7bR4o92M+uqlw==", + "version": "6.6.0", + "resolved": "https://registry.npmjs.org/@fortawesome/free-solid-svg-icons/-/free-solid-svg-icons-6.6.0.tgz", + "integrity": "sha512-IYv/2skhEDFc2WGUcqvFJkeK39Q+HyPf5GHUrT/l2pKbtgEIv1al1TKd6qStR5OIwQdN1GZP54ci3y4mroJWjA==", "dev": true, - "hasInstallScript": true, "dependencies": { - "@fortawesome/fontawesome-common-types": "6.5.2" + "@fortawesome/fontawesome-common-types": "6.6.0" }, "engines": { "node": ">=6" diff --git a/frontend/package.json b/frontend/package.json index 6c93464b4..938e92930 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -30,10 +30,10 @@ }, "devDependencies": { "@fontsource/roboto": "^5.0.12", - "@fortawesome/fontawesome-svg-core": "^6.5.2", - "@fortawesome/free-brands-svg-icons": "^6.5.2", - "@fortawesome/free-regular-svg-icons": "^6.5.2", - "@fortawesome/free-solid-svg-icons": "^6.5.2", + "@fortawesome/fontawesome-svg-core": "^6.6.0", + "@fortawesome/free-brands-svg-icons": "^6.6.0", + "@fortawesome/free-regular-svg-icons": "^6.6.0", + "@fortawesome/free-solid-svg-icons": "^6.6.0", "@fortawesome/react-fontawesome": "^0.2.2", "@tanstack/react-query-devtools": "^5.40.1", "@testing-library/jest-dom": "^6.4.2", From e5edf6203cce098b09f4fb4ae89a5c9bd414cc3d Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Sun, 4 Aug 2024 21:30:13 +0900 Subject: [PATCH 24/78] Fixed postgresql database migrations not applied (#2601) --- migrations/env.py | 2 -- migrations/versions/452dd0f0b578_.py | 4 ++-- migrations/versions/{b183a2ac0dd1 => b183a2ac0dd1_.py} | 0 3 files changed, 2 insertions(+), 4 deletions(-) rename migrations/versions/{b183a2ac0dd1 => b183a2ac0dd1_.py} (100%) diff --git a/migrations/env.py b/migrations/env.py index beddf9710..e591f1a9f 100644 --- a/migrations/env.py +++ b/migrations/env.py @@ -110,8 +110,6 @@ def run_migrations_online(): elif bind.engine.name == 'postgresql': bind.execute(text("SET CONSTRAINTS ALL IMMEDIATE;")) - bind.close() - if context.is_offline_mode(): run_migrations_offline() diff --git a/migrations/versions/452dd0f0b578_.py b/migrations/versions/452dd0f0b578_.py index 13e623988..a4e7b2966 100644 --- a/migrations/versions/452dd0f0b578_.py +++ b/migrations/versions/452dd0f0b578_.py @@ -1,7 +1,7 @@ """empty message Revision ID: 452dd0f0b578 -Revises: 30f37e2e15e1 +Revises: b183a2ac0dd1 Create Date: 2024-05-06 20:27:15.618027 """ @@ -11,7 +11,7 @@ import sqlalchemy as sa # revision identifiers, used by Alembic. revision = '452dd0f0b578' -down_revision = '30f37e2e15e1' +down_revision = 'b183a2ac0dd1' branch_labels = None depends_on = None diff --git a/migrations/versions/b183a2ac0dd1 b/migrations/versions/b183a2ac0dd1_.py similarity index 100% rename from migrations/versions/b183a2ac0dd1 rename to migrations/versions/b183a2ac0dd1_.py From 866b1d5894a4f8cf873a4b3d11a0dc8c4bbd47d7 Mon Sep 17 00:00:00 2001 From: The Man Date: Tue, 6 Aug 2024 02:24:15 +0200 Subject: [PATCH 25/78] Added jimaku provider (#2505) Co-authored-by: Danny <1695103+Rapptz@users.noreply.github.com> --- bazarr/app/config.py | 6 + bazarr/app/get_providers.py | 6 + bazarr/subtitles/refiners/__init__.py | 2 + bazarr/subtitles/refiners/anidb.py | 134 +++--- bazarr/subtitles/refiners/anilist.py | 77 ++++ custom_libs/subliminal/video.py | 12 +- .../subliminal_patch/providers/jimaku.py | 419 ++++++++++++++++++ custom_libs/subliminal_patch/video.py | 4 + frontend/src/pages/Settings/Providers/list.ts | 29 ++ 9 files changed, 634 insertions(+), 55 deletions(-) create mode 100644 bazarr/subtitles/refiners/anilist.py create mode 100644 custom_libs/subliminal_patch/providers/jimaku.py diff --git a/bazarr/app/config.py b/bazarr/app/config.py index aebdf5dc3..b0a8c62ba 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -300,6 +300,12 @@ validators = [ # analytics section Validator('analytics.enabled', must_exist=True, default=True, is_type_of=bool), + + # jimaku section + Validator('jimaku.api_key', must_exist=True, default='', is_type_of=str), + Validator('jimaku.enable_name_search_fallback', must_exist=True, default=True, is_type_of=bool), + Validator('jimaku.enable_archives_download', must_exist=True, default=False, is_type_of=bool), + Validator('jimaku.enable_ai_subs', must_exist=True, default=False, is_type_of=bool), # titlovi section Validator('titlovi.username', must_exist=True, default='', is_type_of=str, cast=str), diff --git a/bazarr/app/get_providers.py b/bazarr/app/get_providers.py index b9ce975ff..fe1445497 100644 --- a/bazarr/app/get_providers.py +++ b/bazarr/app/get_providers.py @@ -285,6 +285,12 @@ def get_providers_auth(): 'username': settings.titlovi.username, 'password': settings.titlovi.password, }, + 'jimaku': { + 'api_key': settings.jimaku.api_key, + 'enable_name_search_fallback': settings.jimaku.enable_name_search_fallback, + 'enable_archives_download': settings.jimaku.enable_archives_download, + 'enable_ai_subs': settings.jimaku.enable_ai_subs, + }, 'ktuvit': { 'email': settings.ktuvit.email, 'hashed_password': settings.ktuvit.hashed_password, diff --git a/bazarr/subtitles/refiners/__init__.py b/bazarr/subtitles/refiners/__init__.py index ff1e715a0..9fbdecbb2 100644 --- a/bazarr/subtitles/refiners/__init__.py +++ b/bazarr/subtitles/refiners/__init__.py @@ -4,10 +4,12 @@ from .ffprobe import refine_from_ffprobe from .database import refine_from_db from .arr_history import refine_from_arr_history from .anidb import refine_from_anidb +from .anilist import refine_from_anilist registered = { "database": refine_from_db, "ffprobe": refine_from_ffprobe, "arr_history": refine_from_arr_history, "anidb": refine_from_anidb, + "anilist": refine_from_anilist, # Must run AFTER AniDB } diff --git a/bazarr/subtitles/refiners/anidb.py b/bazarr/subtitles/refiners/anidb.py index c680bba5a..5faa9878a 100644 --- a/bazarr/subtitles/refiners/anidb.py +++ b/bazarr/subtitles/refiners/anidb.py @@ -20,7 +20,10 @@ except ImportError: except ImportError: import xml.etree.ElementTree as etree -refined_providers = {'animetosho'} +refined_providers = {'animetosho', 'jimaku'} +providers_requiring_anidb_api = {'animetosho'} + +logger = logging.getLogger(__name__) api_url = 'http://api.anidb.net:9001/httpapi' @@ -40,6 +43,10 @@ class AniDBClient(object): @property def is_throttled(self): return self.cache and self.cache.get('is_throttled') + + @property + def has_api_credentials(self): + return self.api_client_key != '' and self.api_client_key is not None @property def daily_api_request_count(self): @@ -62,7 +69,9 @@ class AniDBClient(object): return r.content @region.cache_on_arguments(expiration_time=timedelta(days=1).total_seconds()) - def get_series_id(self, mappings, tvdb_series_season, tvdb_series_id, episode): + def get_show_information(self, tvdb_series_id, tvdb_series_season, episode): + mappings = etree.fromstring(self.get_series_mappings()) + # Enrich the collection of anime with the episode offset animes = [ self.AnimeInfo(anime, int(anime.attrib.get('episodeoffset', 0))) @@ -71,49 +80,60 @@ class AniDBClient(object): ) ] + is_special_entry = False if not animes: - return None, None + # Some entries will store TVDB seasons in a nested mapping list, identifiable by the value 'a' as the season + special_entries = mappings.findall( + f".//anime[@tvdbid='{tvdb_series_id}'][@defaulttvdbseason='a']" + ) - # Sort the anime by offset in ascending order - animes.sort(key=lambda a: a.episode_offset) + if not special_entries: + return None, None, None - # Different from Tvdb, Anidb have different ids for the Parts of a season - anidb_id = None - offset = 0 + is_special_entry = True + for special_entry in special_entries: + mapping_list = special_entry.findall(f".//mapping[@tvdbseason='{tvdb_series_season}']") + if len(mapping_list) > 0: + anidb_id = int(special_entry.attrib.get('anidbid')) + offset = int(mapping_list[0].attrib.get('offset', 0)) - for index, anime_info in enumerate(animes): - anime, episode_offset = anime_info + if not is_special_entry: + # Sort the anime by offset in ascending order + animes.sort(key=lambda a: a.episode_offset) - mapping_list = anime.find('mapping-list') + # Different from Tvdb, Anidb have different ids for the Parts of a season + anidb_id = None + offset = 0 - # Handle mapping list for Specials - if mapping_list: - for mapping in mapping_list.findall("mapping"): - # Mapping values are usually like ;1-1;2-1;3-1; - for episode_ref in mapping.text.split(';'): - if not episode_ref: - continue + for index, anime_info in enumerate(animes): + anime, episode_offset = anime_info + + mapping_list = anime.find('mapping-list') - anidb_episode, tvdb_episode = map(int, episode_ref.split('-')) - if tvdb_episode == episode: - anidb_id = int(anime.attrib.get('anidbid')) + # Handle mapping list for Specials + if mapping_list: + for mapping in mapping_list.findall("mapping"): + # Mapping values are usually like ;1-1;2-1;3-1; + for episode_ref in mapping.text.split(';'): + if not episode_ref: + continue - return anidb_id, anidb_episode + anidb_episode, tvdb_episode = map(int, episode_ref.split('-')) + if tvdb_episode == episode: + anidb_id = int(anime.attrib.get('anidbid')) - if episode > episode_offset: - anidb_id = int(anime.attrib.get('anidbid')) - offset = episode_offset + return anidb_id, anidb_episode, 0 - return anidb_id, episode - offset + if episode > episode_offset: + anidb_id = int(anime.attrib.get('anidbid')) + offset = episode_offset - @region.cache_on_arguments(expiration_time=timedelta(days=1).total_seconds()) - def get_series_episodes_ids(self, tvdb_series_id, season, episode): - mappings = etree.fromstring(self.get_series_mappings()) - - series_id, episode_no = self.get_series_id(mappings, season, tvdb_series_id, episode) + return anidb_id, episode - offset, offset + @region.cache_on_arguments(expiration_time=timedelta(days=1).total_seconds()) + def get_episode_ids(self, series_id, episode_no): if not series_id: - return None, None + return None episodes = etree.fromstring(self.get_episodes(series_id)) @@ -177,7 +197,7 @@ class AniDBClient(object): def refine_from_anidb(path, video): if not isinstance(video, Episode) or not video.series_tvdb_id: - logging.debug(f'Video is not an Anime TV series, skipping refinement for {video}') + logger.debug(f'Video is not an Anime TV series, skipping refinement for {video}') return @@ -190,27 +210,35 @@ def refine_anidb_ids(video): season = video.season if video.season else 0 - if anidb_client.is_throttled: - logging.warning(f'API daily limit reached. Skipping refinement for {video.series}') - - return video - - try: - anidb_series_id, anidb_episode_id = anidb_client.get_series_episodes_ids( - video.series_tvdb_id, - season, video.episode, - ) - except TooManyRequests: - logging.error(f'API daily limit reached while refining {video.series}') - - anidb_client.mark_as_throttled() - - return video - - if not anidb_episode_id: - logging.error(f'Could not find anime series {video.series}') - + anidb_series_id, anidb_episode_no, anidb_season_episode_offset = anidb_client.get_show_information( + video.series_tvdb_id, + season, + video.episode, + ) + + if not anidb_series_id: + logger.error(f'Could not find anime series {video.series}') return video + + anidb_episode_id = None + if anidb_client.has_api_credentials: + if anidb_client.is_throttled: + logger.warning(f'API daily limit reached. Skipping episode ID refinement for {video.series}') + else: + try: + anidb_episode_id = anidb_client.get_episode_ids( + anidb_series_id, + anidb_episode_no + ) + except TooManyRequests: + logger.error(f'API daily limit reached while refining {video.series}') + anidb_client.mark_as_throttled() + else: + intersect = providers_requiring_anidb_api.intersection(settings.general.enabled_providers) + if len(intersect) >= 1: + logger.warn(f'AniDB API credentials are not fully set up, the following providers may not work: {intersect}') video.series_anidb_id = anidb_series_id video.series_anidb_episode_id = anidb_episode_id + video.series_anidb_episode_no = anidb_episode_no + video.series_anidb_season_episode_offset = anidb_season_episode_offset diff --git a/bazarr/subtitles/refiners/anilist.py b/bazarr/subtitles/refiners/anilist.py new file mode 100644 index 000000000..3d0bb7b35 --- /dev/null +++ b/bazarr/subtitles/refiners/anilist.py @@ -0,0 +1,77 @@ +# coding=utf-8 +# fmt: off + +import logging +import time +import requests +from collections import namedtuple +from datetime import timedelta + +from app.config import settings +from subliminal import Episode, region, __short_version__ + +logger = logging.getLogger(__name__) +refined_providers = {'jimaku'} + +class AniListClient(object): + def __init__(self, session=None, timeout=10): + self.session = session or requests.Session() + self.session.timeout = timeout + self.session.headers['Content-Type'] = 'application/json' + self.session.headers['User-Agent'] = 'Subliminal/%s' % __short_version__ + + @region.cache_on_arguments(expiration_time=timedelta(days=1).total_seconds()) + def get_series_mappings(self): + r = self.session.get( + 'https://raw.githubusercontent.com/Fribb/anime-lists/master/anime-list-mini.json' + ) + + r.raise_for_status() + return r.json() + + def get_series_id(self, candidate_id_name, candidate_id_value): + anime_list = self.get_series_mappings() + + tag_map = { + "series_anidb_id": "anidb_id", + "imdb_id": "imdb_id" + } + mapped_tag = tag_map.get(candidate_id_name, candidate_id_name) + + obj = [obj for obj in anime_list if mapped_tag in obj and str(obj[mapped_tag]) == str(candidate_id_value)] + logger.debug(f"Based on '{mapped_tag}': '{candidate_id_value}', anime-list matched: {obj}") + + if len(obj) > 0: + return obj[0]["anilist_id"] + else: + logger.debug(f"Could not find corresponding AniList ID with '{mapped_tag}': {candidate_id_value}") + return None + +def refine_from_anilist(path, video): + # Safety checks + if isinstance(video, Episode): + if not video.series_anidb_id: + logger.error(f"Will not refine '{video.series}' as it does not have an AniDB ID.") + return + + if refined_providers.intersection(settings.general.enabled_providers) and video.anilist_id is None: + refine_anilist_ids(video) + +def refine_anilist_ids(video): + anilist_client = AniListClient() + + if isinstance(video, Episode): + candidate_id_name = "series_anidb_id" + else: + candidate_id_name = "imdb_id" + + candidate_id_value = getattr(video, candidate_id_name, None) + if not candidate_id_value: + logger.error(f"Found no value for property {candidate_id_name} of video.") + return video + + anilist_id = anilist_client.get_series_id(candidate_id_name, candidate_id_value) + if not anilist_id: + return video + + video.anilist_id = anilist_id \ No newline at end of file diff --git a/custom_libs/subliminal/video.py b/custom_libs/subliminal/video.py index 2168d91a9..66c090945 100644 --- a/custom_libs/subliminal/video.py +++ b/custom_libs/subliminal/video.py @@ -130,7 +130,8 @@ class Episode(Video): """ def __init__(self, name, series, season, episode, title=None, year=None, original_series=True, tvdb_id=None, series_tvdb_id=None, series_imdb_id=None, alternative_series=None, series_anidb_id=None, - series_anidb_episode_id=None, **kwargs): + series_anidb_episode_id=None, series_anidb_season_episode_offset=None, + anilist_id=None, **kwargs): super(Episode, self).__init__(name, **kwargs) #: Series of the episode @@ -163,8 +164,11 @@ class Episode(Video): #: Alternative names of the series self.alternative_series = alternative_series or [] + #: Anime specific information self.series_anidb_episode_id = series_anidb_episode_id self.series_anidb_id = series_anidb_id + self.series_anidb_season_episode_offset = series_anidb_season_episode_offset + self.anilist_id = anilist_id @classmethod def fromguess(cls, name, guess): @@ -207,10 +211,11 @@ class Movie(Video): :param str title: title of the movie. :param int year: year of the movie. :param list alternative_titles: alternative titles of the movie + :param int anilist_id: AniList ID of movie (if Anime) :param \*\*kwargs: additional parameters for the :class:`Video` constructor. """ - def __init__(self, name, title, year=None, alternative_titles=None, **kwargs): + def __init__(self, name, title, year=None, alternative_titles=None, anilist_id=None, **kwargs): super(Movie, self).__init__(name, **kwargs) #: Title of the movie @@ -221,6 +226,9 @@ class Movie(Video): #: Alternative titles of the movie self.alternative_titles = alternative_titles or [] + + #: AniList ID of the movie + self.anilist_id = anilist_id @classmethod def fromguess(cls, name, guess): diff --git a/custom_libs/subliminal_patch/providers/jimaku.py b/custom_libs/subliminal_patch/providers/jimaku.py new file mode 100644 index 000000000..68393821d --- /dev/null +++ b/custom_libs/subliminal_patch/providers/jimaku.py @@ -0,0 +1,419 @@ +from __future__ import absolute_import + +from datetime import timedelta +import logging +import os +import re +import time + +from requests import Session +from subliminal import region, __short_version__ +from subliminal.cache import REFINER_EXPIRATION_TIME +from subliminal.exceptions import ConfigurationError, AuthenticationError, ServiceUnavailable +from subliminal.utils import sanitize +from subliminal.video import Episode, Movie +from subliminal_patch.providers import Provider +from subliminal_patch.subtitle import Subtitle +from subliminal_patch.exceptions import APIThrottled +from subliminal_patch.providers.utils import get_subtitle_from_archive, get_archive_from_bytes +from urllib.parse import urlencode, urljoin +from guessit import guessit +from subzero.language import Language, FULL_LANGUAGE_LIST + +logger = logging.getLogger(__name__) + +# Unhandled formats, such files will always get filtered out +unhandled_archive_formats = (".7z",) +accepted_archive_formats = (".zip", ".rar") + +class JimakuSubtitle(Subtitle): + '''Jimaku Subtitle.''' + provider_name = 'jimaku' + + hash_verifiable = False + + def __init__(self, language, video, download_url, filename): + super(JimakuSubtitle, self).__init__(language, page_link=download_url) + + self.video = video + self.download_url = download_url + self.filename = filename + self.release_info = filename + self.is_archive = filename.endswith(accepted_archive_formats) + + @property + def id(self): + return self.download_url + + def get_matches(self, video): + matches = set() + + # Episode/Movie specific matches + if isinstance(video, Episode): + if sanitize(video.series) and sanitize(self.video.series) in ( + sanitize(name) for name in [video.series] + video.alternative_series): + matches.add('series') + + if video.season and self.video.season is None or video.season and video.season == self.video.season: + matches.add('season') + elif isinstance(video, Movie): + if sanitize(video.title) and sanitize(self.video.title) in ( + sanitize(name) for name in [video.title] + video.alternative_titles): + matches.add('title') + + # General matches + if video.year and video.year == self.video.year: + matches.add('year') + + video_type = 'movie' if isinstance(video, Movie) else 'episode' + matches.add(video_type) + + guess = guessit(self.filename, {'type': video_type}) + for g in guess: + if g[0] == "release_group" or "source": + if video.release_group == g[1]: + matches.add('release_group') + break + + # Prioritize .srt by repurposing the audio_codec match + if self.filename.endswith(".srt"): + matches.add('audio_codec') + + return matches + +class JimakuProvider(Provider): + '''Jimaku Provider.''' + video_types = (Episode, Movie) + + api_url = 'https://jimaku.cc/api' + api_ratelimit_max_delay_seconds = 5 + api_ratelimit_backoff_limit = 3 + + corrupted_file_size_threshold = 500 + + languages = {Language.fromietf("ja")} + + def __init__(self, enable_name_search_fallback, enable_archives_download, enable_ai_subs, api_key): + if api_key: + self.api_key = api_key + else: + raise ConfigurationError('Missing api_key.') + + self.enable_name_search_fallback = enable_name_search_fallback + self.download_archives = enable_archives_download + self.enable_ai_subs = enable_ai_subs + self.session = None + + def initialize(self): + self.session = Session() + self.session.headers['Content-Type'] = 'application/json' + self.session.headers['Authorization'] = self.api_key + self.session.headers['User-Agent'] = os.environ.get("SZ_USER_AGENT") + + def terminate(self): + self.session.close() + + def _query(self, video): + if isinstance(video, Movie): + media_name = video.title.lower() + elif isinstance(video, Episode): + media_name = video.series.lower() + + # With entries that have a season larger than 1, Jimaku appends the corresponding season number to the name. + # We'll reassemble media_name here to account for cases where we can only search by name alone. + season_addendum = str(video.season) if video.season > 1 else None + media_name = f"{media_name} {season_addendum}" if season_addendum else media_name + + # Search for entry + searching_for_entry_attempts = 0 + additional_url_params = {} + while searching_for_entry_attempts < 2: + searching_for_entry_attempts += 1 + url = self._assemble_jimaku_search_url(video, media_name, additional_url_params) + if not url: + return None + + searching_for_entry = "query" in url + data = self._search_for_entry(url) + + if not data: + if searching_for_entry and searching_for_entry_attempts < 2: + logger.info("Maybe this is live action media? Will retry search without anime parameter...") + additional_url_params = {'anime': "false"} + else: + return None + else: + break + + # We only go for the first entry + entry = data[0] + + entry_id = entry.get('id') + anilist_id = entry.get('anilist_id', None) + entry_name = entry.get('name') + is_movie = entry.get('flags', {}).get('movie', False) + + if isinstance(video, Episode) and is_movie: + logger.warn("Bazarr thinks this is a series, but Jimaku says this is a movie! May not be able to match subtitles...") + + logger.info(f"Matched entry: ID: '{entry_id}', anilist_id: '{anilist_id}', name: '{entry_name}', english_name: '{entry.get('english_name')}', movie: {is_movie}") + if entry.get("flags").get("unverified"): + logger.warning(f"This entry '{entry_id}' is unverified, subtitles might be incomplete or have quality issues!") + + # Get a list of subtitles for entry + episode_number = video.episode if "episode" in dir(video) else None + url_params = {'episode': episode_number} if isinstance(video, Episode) and not is_movie else {} + only_look_for_archives = False + + has_offset = isinstance(video, Episode) and video.series_anidb_season_episode_offset is not None + + retry_count = 0 + adjusted_ep_num = None + while retry_count <= 1: + # Account for positive episode offset first + if isinstance(video, Episode) and not is_movie and retry_count < 1: + if video.season > 1 and has_offset: + offset_value = video.series_anidb_season_episode_offset + offset_value = offset_value if offset_value > 0 else -offset_value + + if episode_number < offset_value: + adjusted_ep_num = episode_number + offset_value + logger.warning(f"Will try using adjusted episode number {adjusted_ep_num} first") + url_params = {'episode': adjusted_ep_num} + + url = f"entries/{entry_id}/files" + data = self._search_for_subtitles(url, url_params) + + if not data: + if isinstance(video, Episode) and not is_movie and has_offset and retry_count < 1: + logger.warning(f"Found no subtitles for adjusted episode number, but will retry with normal episode number {episode_number}") + url_params = {'episode': episode_number} + elif isinstance(video, Episode) and not is_movie and retry_count < 1: + logger.warning(f"Found no subtitles for episode number {episode_number}, but will retry without 'episode' parameter") + url_params = {} + only_look_for_archives = True + else: + return None + + retry_count += 1 + else: + if adjusted_ep_num: + video.episode = adjusted_ep_num + logger.debug(f"This videos episode attribute has been updated to: {video.episode}") + break + + # Filter subtitles + list_of_subtitles = [] + + data = [item for item in data if not item['name'].endswith(unhandled_archive_formats)] + + # Detect only archives being uploaded + archive_entries = [item for item in data if item['name'].endswith(accepted_archive_formats)] + subtitle_entries = [item for item in data if not item['name'].endswith(accepted_archive_formats)] + has_only_archives = len(archive_entries) > 0 and len(subtitle_entries) == 0 + if has_only_archives: + logger.warning("Have only found archived subtitles") + + elif only_look_for_archives: + data = [item for item in data if item['name'].endswith(accepted_archive_formats)] + + for item in data: + filename = item.get('name') + download_url = item.get('url') + is_archive = filename.endswith(accepted_archive_formats) + + # Archives will still be considered if they're the only files available, as is mostly the case for movies. + if is_archive and not has_only_archives and not self.download_archives: + logger.warning(f"Skipping archive '{filename}' because normal subtitles are available instead") + continue + + if not self.enable_ai_subs: + p = re.compile(r'[\[\(]?(whisperai)[\]\)]?|[\[\(]whisper[\]\)]', re.IGNORECASE) + if p.search(filename): + logger.warning(f"Skipping subtitle '{filename}' as it's suspected of being AI generated") + continue + + sub_languages = self._try_determine_subtitle_languages(filename) + if len(sub_languages) > 1: + logger.warning(f"Skipping subtitle '{filename}' as it's suspected of containing multiple languages") + continue + + # Check if file is obviously corrupt. If no size is returned, assume OK + filesize = item.get('size', self.corrupted_file_size_threshold) + if filesize < self.corrupted_file_size_threshold: + logger.warning(f"Skipping possibly corrupt file '{filename}': Filesize is just {filesize} bytes") + continue + + if not filename.endswith(unhandled_archive_formats): + lang = sub_languages[0] if len(sub_languages) > 1 else Language("jpn") + list_of_subtitles.append(JimakuSubtitle(lang, video, download_url, filename)) + else: + logger.debug(f"Skipping archive '{filename}' as it's not a supported format") + + return list_of_subtitles + + def list_subtitles(self, video, languages=None): + subtitles = self._query(video) + if not subtitles: + return [] + + return [s for s in subtitles] + + def download_subtitle(self, subtitle: JimakuSubtitle): + target_url = subtitle.download_url + response = self.session.get(target_url, timeout=10) + response.raise_for_status() + + if subtitle.is_archive: + archive = get_archive_from_bytes(response.content) + if archive: + if isinstance(subtitle.video, Episode): + subtitle.content = get_subtitle_from_archive( + archive, + episode=subtitle.video.episode, + episode_title=subtitle.video.title + ) + else: + subtitle.content = get_subtitle_from_archive( + archive + ) + else: + logger.warning("Archive seems to not be an archive! File possibly corrupt?") + return None + else: + subtitle.content = response.content + + def _do_jimaku_request(self, url_path, url_params={}): + url = urljoin(f"{self.api_url}/{url_path}", '?' + urlencode(url_params)) + + retry_count = 0 + while retry_count < self.api_ratelimit_backoff_limit: + response = self.session.get(url, timeout=10) + + if response.status_code == 429: + reset_time = 5 + retry_count + 1 + + logger.warning(f"Jimaku ratelimit hit, waiting for '{reset_time}' seconds ({retry_count}/{self.api_ratelimit_backoff_limit} tries)") + time.sleep(reset_time) + continue + elif response.status_code == 401: + raise AuthenticationError("Unauthorized. API key possibly invalid") + else: + response.raise_for_status() + + data = response.json() + logger.debug(f"Length of response on {url}: {len(data)}") + if len(data) == 0: + logger.error(f"Jimaku returned no items for our our query: {url}") + return None + elif 'error' in data: + raise ServiceUnavailable(f"Jimaku returned an error: '{data.get('error')}', Code: '{data.get('code')}'") + else: + return data + + raise APIThrottled(f"Jimaku ratelimit max backoff limit of {self.api_ratelimit_backoff_limit} reached, aborting") + + # Wrapper functions to indirectly call _do_jimaku_request with different cache configs + @region.cache_on_arguments(expiration_time=REFINER_EXPIRATION_TIME) + def _search_for_entry(self, url_path, url_params={}): + return self._do_jimaku_request(url_path, url_params) + + @region.cache_on_arguments(expiration_time=timedelta(minutes=1).total_seconds()) + def _search_for_subtitles(self, url_path, url_params={}): + return self._do_jimaku_request(url_path, url_params) + + @staticmethod + def _try_determine_subtitle_languages(filename): + # This is more like a guess and not a 100% fool-proof way of detecting multi-lang subs: + # It assumes that language codes, if present, are in the last metadata group of the subs filename. + # If such codes are not present, or we failed to match any at all, then we'll just assume that the sub is purely Japanese. + default_language = Language("jpn") + + dot_delimit = filename.split(".") + bracket_delimit = re.split(r'[\[\]\(\)]+', filename) + + candidate_list = list() + if len(dot_delimit) > 2: + candidate_list = dot_delimit[-2] + elif len(bracket_delimit) > 2: + candidate_list = bracket_delimit[-2] + + candidates = [] if len(candidate_list) == 0 else re.split(r'[,\-\+\& ]+', candidate_list) + + # Discard match group if any candidate... + # ...contains any numbers, as the group is likely encoding information + if any(re.compile(r'\d').search(string) for string in candidates): + return [default_language] + # ...is >= 5 chars long, as the group is likely other unrelated metadata + if any(len(string) >= 5 for string in candidates): + return [default_language] + + languages = list() + for candidate in candidates: + candidate = candidate.lower() + if candidate in ["ass", "srt"]: + continue + + # Sometimes, languages are hidden in 4 character blocks, i.e. "JPSC" + if len(candidate) == 4: + for addendum in [candidate[:2], candidate[2:]]: + candidates.append(addendum) + continue + + # Sometimes, language codes can have additional info such as 'cc' or 'sdh'. For example: "ja[cc]" + if len(dot_delimit) > 2 and any(c in candidate for c in '[]()'): + candidate = re.split(r'[\[\]\(\)]+', candidate)[0] + + try: + language_squash = { + "jp": "ja", + "jap": "ja", + "chs": "zho", + "cht": "zho", + "zhi": "zho", + "cn": "zho" + } + + candidate = language_squash[candidate] if candidate in language_squash else candidate + if len(candidate) > 2: + language = Language(candidate) + else: + language = Language.fromietf(candidate) + + if not any(l.alpha3 == language.alpha3 for l in languages): + languages.append(language) + except: + if candidate in FULL_LANGUAGE_LIST: + # Create a dummy for the unknown language + languages.append(Language("zul")) + + if len(languages) > 1: + # Sometimes a metadata group that actually contains info about codecs gets processed as valid languages. + # To prevent false positives, we'll check if Japanese language codes are in the processed languages list. + # If not, then it's likely that we didn't actually match language codes -> Assume Japanese only subtitle. + contains_jpn = any([l for l in languages if l.alpha3 == "jpn"]) + + return languages if contains_jpn else [Language("jpn")] + else: + return [default_language] + + def _assemble_jimaku_search_url(self, video, media_name, additional_params={}): + endpoint = "entries/search" + anilist_id = video.anilist_id + + params = {} + if anilist_id: + params = {'anilist_id': anilist_id} + else: + if self.enable_name_search_fallback or isinstance(video, Movie): + params = {'query': media_name} + else: + logger.error(f"Skipping '{media_name}': Got no AniList ID and fuzzy matching using name is disabled") + return None + + if additional_params: + params.update(additional_params) + + logger.info(f"Will search for entry based on params: {params}") + return urljoin(endpoint, '?' + urlencode(params)) \ No newline at end of file diff --git a/custom_libs/subliminal_patch/video.py b/custom_libs/subliminal_patch/video.py index f5df0c92e..96101cf54 100644 --- a/custom_libs/subliminal_patch/video.py +++ b/custom_libs/subliminal_patch/video.py @@ -35,6 +35,8 @@ class Video(Video_): info_url=None, series_anidb_id=None, series_anidb_episode_id=None, + series_anidb_season_episode_offset=None, + anilist_id=None, **kwargs ): super(Video, self).__init__( @@ -61,3 +63,5 @@ class Video(Video_): self.info_url = info_url self.series_anidb_series_id = series_anidb_id, self.series_anidb_episode_id = series_anidb_episode_id, + self.series_anidb_season_episode_offset = series_anidb_season_episode_offset, + self.anilist_id = anilist_id, diff --git a/frontend/src/pages/Settings/Providers/list.ts b/frontend/src/pages/Settings/Providers/list.ts index b2f9a33c7..8d7a86a99 100644 --- a/frontend/src/pages/Settings/Providers/list.ts +++ b/frontend/src/pages/Settings/Providers/list.ts @@ -218,6 +218,35 @@ export const ProviderList: Readonly = [ }, ], }, + { + key: "jimaku", + name: "Jimaku.cc", + description: "Japanese Subtitles Provider", + message: + "API key required. Subtitles stem from various sources and might have quality/timing issues.", + inputs: [ + { + type: "password", + key: "api_key", + name: "API key", + }, + { + type: "switch", + key: "enable_name_search_fallback", + name: "Search by name if no AniList ID was determined (Less accurate, required for live action)", + }, + { + type: "switch", + key: "enable_archives_download", + name: "Also consider archives alongside uncompressed subtitles", + }, + { + type: "switch", + key: "enable_ai_subs", + name: "Download AI generated subtitles", + }, + ], + }, { key: "hosszupuska", description: "Hungarian Subtitles Provider" }, { key: "karagarga", From 5582cc076dd58a63638d96cb0dbc5119554fe127 Mon Sep 17 00:00:00 2001 From: JayZed Date: Mon, 5 Aug 2024 21:40:34 -0400 Subject: [PATCH 26/78] Fix for provider subtitle language being unintentionally modified This prevents unwanted changes to the provider copy of the language. Thanks to @vitiko98 for suggesting a better place for this fix. --- custom_libs/subliminal_patch/subtitle.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/custom_libs/subliminal_patch/subtitle.py b/custom_libs/subliminal_patch/subtitle.py index c19acd1ec..06a491be7 100644 --- a/custom_libs/subliminal_patch/subtitle.py +++ b/custom_libs/subliminal_patch/subtitle.py @@ -12,6 +12,7 @@ import chardet import pysrt import pysubs2 from bs4 import UnicodeDammit +from copy import deepcopy from pysubs2 import SSAStyle from pysubs2.formats.subrip import parse_tags, MAX_REPRESENTABLE_TIME from pysubs2.time import ms_to_times @@ -65,6 +66,11 @@ class Subtitle(Subtitle_): # format = "srt" # default format is srt def __init__(self, language, hearing_impaired=False, page_link=None, encoding=None, mods=None, original_format=False): + # language needs to be cloned because it is actually a reference to the provider language object + # if a new copy is not created then all subsequent subtitles for this provider will incorrectly be modified + # at least until Bazarr is restarted or the provider language object is recreated somehow + language = deepcopy(language) + # set subtitle language to hi if it's hearing_impaired if hearing_impaired: language = Language.rebuild(language, hi=True) From 0fc334f731ddda1d70fb4b0ad6fc7c0329c76048 Mon Sep 17 00:00:00 2001 From: Hlib Date: Tue, 6 Aug 2024 14:15:50 +0300 Subject: [PATCH 27/78] Fixed AvistaZ and CinemaZ scraping when the Reseed notification is displayed --- custom_libs/subliminal_patch/providers/avistaz_network.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/avistaz_network.py b/custom_libs/subliminal_patch/providers/avistaz_network.py index 2c5796ce3..30e68d047 100644 --- a/custom_libs/subliminal_patch/providers/avistaz_network.py +++ b/custom_libs/subliminal_patch/providers/avistaz_network.py @@ -5,7 +5,7 @@ from random import randint import pycountry from requests.cookies import RequestsCookieJar -from subliminal.exceptions import AuthenticationError +from subliminal.exceptions import AuthenticationError, ProviderError from subliminal.providers import ParserBeautifulSoup from subliminal_patch.http import RetryingCFSession from subliminal_patch.pitcher import store_verification @@ -354,7 +354,10 @@ class AvistazNetworkProviderBase(Provider): def _parse_release_table(self, html): release_data_table = (ParserBeautifulSoup(html, ['html.parser']) - .select_one('#content-area > div:nth-child(4) > div.table-responsive > table > tbody')) + .select_one('#content-area > div.block > div.table-responsive > table > tbody')) + + if release_data_table is None: + raise ProviderError('Unexpected HTML page layout - no release data table found') rows = {} for tr in release_data_table.find_all('tr', recursive=False): From 2ee008b57bdb8b00844c2401ae26f56efad135e1 Mon Sep 17 00:00:00 2001 From: JayZed Date: Tue, 6 Aug 2024 14:13:38 -0400 Subject: [PATCH 28/78] Removed raising of OSError during subsync (#2584) --- bazarr/subtitles/tools/subsyncer.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/bazarr/subtitles/tools/subsyncer.py b/bazarr/subtitles/tools/subsyncer.py index edde5c774..5c7ae38b0 100644 --- a/bazarr/subtitles/tools/subsyncer.py +++ b/bazarr/subtitles/tools/subsyncer.py @@ -97,8 +97,7 @@ class SubSyncer: result = run(self.args) except Exception: logging.exception( - f'BAZARR an exception occurs during the synchronization process for this subtitles: {self.srtin}') - raise OSError + f'BAZARR an exception occurs during the synchronization process for this subtitle file: {self.srtin}') else: if settings.subsync.debug: return result From 1ec415f0c5d0d9d72555778d1c5f564271f0ea3d Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Wed, 7 Aug 2024 09:03:59 +0900 Subject: [PATCH 29/78] Fixed table items losing order when action is executed --- frontend/src/pages/System/Announcements/table.tsx | 8 ++++---- frontend/src/pages/System/Tasks/table.tsx | 8 ++++---- frontend/src/pages/Wanted/Movies/index.tsx | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/frontend/src/pages/System/Announcements/table.tsx b/frontend/src/pages/System/Announcements/table.tsx index febb32fa1..910fb4bd5 100644 --- a/frontend/src/pages/System/Announcements/table.tsx +++ b/frontend/src/pages/System/Announcements/table.tsx @@ -19,7 +19,7 @@ const Table: FunctionComponent = ({ announcements }) => { () => [ { header: "Since", - accessor: "timestamp", + accessorKey: "timestamp", cell: ({ row: { original: { timestamp }, @@ -30,7 +30,7 @@ const Table: FunctionComponent = ({ announcements }) => { }, { header: "Announcement", - accessor: "text", + accessorKey: "text", cell: ({ row: { original: { text }, @@ -41,7 +41,7 @@ const Table: FunctionComponent = ({ announcements }) => { }, { header: "More Info", - accessor: "link", + accessorKey: "link", cell: ({ row: { original: { link }, @@ -56,7 +56,7 @@ const Table: FunctionComponent = ({ announcements }) => { }, { header: "Dismiss", - accessor: "hash", + accessorKey: "hash", cell: ({ row: { original: { dismissible, hash }, diff --git a/frontend/src/pages/System/Tasks/table.tsx b/frontend/src/pages/System/Tasks/table.tsx index ed3248b6f..5e1b045bd 100644 --- a/frontend/src/pages/System/Tasks/table.tsx +++ b/frontend/src/pages/System/Tasks/table.tsx @@ -17,7 +17,7 @@ const Table: FunctionComponent = ({ tasks }) => { () => [ { header: "Name", - accessor: "name", + accessorKey: "name", cell: ({ row: { original: { name }, @@ -28,7 +28,7 @@ const Table: FunctionComponent = ({ tasks }) => { }, { header: "Interval", - accessor: "interval", + accessorKey: "interval", cell: ({ row: { original: { interval }, @@ -39,11 +39,11 @@ const Table: FunctionComponent = ({ tasks }) => { }, { header: "Next Execution", - accessor: "next_run_in", + accessorKey: "next_run_in", }, { header: "Run", - accessor: "job_running", + accessorKey: "job_running", cell: ({ row: { original: { job_id: jobId, job_running: jobRunning }, diff --git a/frontend/src/pages/Wanted/Movies/index.tsx b/frontend/src/pages/Wanted/Movies/index.tsx index 7c497f799..c05cfb7c3 100644 --- a/frontend/src/pages/Wanted/Movies/index.tsx +++ b/frontend/src/pages/Wanted/Movies/index.tsx @@ -21,7 +21,7 @@ const WantedMoviesView: FunctionComponent = () => { () => [ { header: "Name", - accessor: "title", + accessorKey: "title", cell: ({ row: { original: { title, radarrId }, @@ -37,7 +37,7 @@ const WantedMoviesView: FunctionComponent = () => { }, { header: "Missing", - accessor: "missing_subtitles", + accessorKey: "missing_subtitles", cell: ({ row: { original: { radarrId, missing_subtitles: missingSubtitles }, From 88f5d1c7b6392f5d73b8da0830c6a378b488d55f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 7 Aug 2024 09:08:04 +0900 Subject: [PATCH 30/78] no log: Bump the mantine group in /frontend with 6 updates (#2608) Bumps the mantine group in /frontend with 6 updates: | Package | From | To | | --- | --- | --- | | [@mantine/core](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core) | `7.11.2` | `7.12.0` | | [@mantine/dropzone](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dropzone) | `7.11.2` | `7.12.0` | | [@mantine/form](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/form) | `7.11.2` | `7.12.0` | | [@mantine/hooks](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks) | `7.11.2` | `7.12.0` | | [@mantine/modals](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/modals) | `7.11.2` | `7.12.0` | | [@mantine/notifications](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/notifications) | `7.11.2` | `7.12.0` | Updates `@mantine/core` from 7.11.2 to 7.12.0 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.0/packages/@mantine/core) Updates `@mantine/dropzone` from 7.11.2 to 7.12.0 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.0/packages/@mantine/dropzone) Updates `@mantine/form` from 7.11.2 to 7.12.0 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.0/packages/@mantine/form) Updates `@mantine/hooks` from 7.11.2 to 7.12.0 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.0/packages/@mantine/hooks) Updates `@mantine/modals` from 7.11.2 to 7.12.0 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.0/packages/@mantine/modals) Updates `@mantine/notifications` from 7.11.2 to 7.12.0 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.0/packages/@mantine/notifications) --- updated-dependencies: - dependency-name: "@mantine/core" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mantine - dependency-name: "@mantine/dropzone" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mantine - dependency-name: "@mantine/form" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mantine - dependency-name: "@mantine/hooks" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mantine - dependency-name: "@mantine/modals" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mantine - dependency-name: "@mantine/notifications" dependency-type: direct:production update-type: version-update:semver-minor dependency-group: mantine ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 70 +++++++++++++++++++------------------- frontend/package.json | 12 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index ae4d5d461..84e544f0c 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,12 +9,12 @@ "version": "1.0.0", "license": "GPL-3", "dependencies": { - "@mantine/core": "^7.11.2", - "@mantine/dropzone": "^7.11.2", - "@mantine/form": "^7.11.2", - "@mantine/hooks": "^7.11.2", - "@mantine/modals": "^7.11.2", - "@mantine/notifications": "^7.11.2", + "@mantine/core": "^7.12.0", + "@mantine/dropzone": "^7.12.0", + "@mantine/form": "^7.12.0", + "@mantine/hooks": "^7.12.0", + "@mantine/modals": "^7.12.0", + "@mantine/notifications": "^7.12.0", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", @@ -2962,9 +2962,9 @@ } }, "node_modules/@mantine/core": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.11.2.tgz", - "integrity": "sha512-T64RjdgY8UPAv249miW1lQyPPot1JbCcKKsAZMNQHgcttcxLhrFpKVvglc4/48hdSoxI4LYJPNvqp7zciZmucQ==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.12.0.tgz", + "integrity": "sha512-FxsaIaEnqxV71MBGGsvXXad2q9KYTaIQFVP4TSAZI6xLChklXF/qJTqvabweaoW9BaVQT75b/BnUoJFzPfyAfw==", "dependencies": { "@floating-ui/react": "^0.26.9", "clsx": "^2.1.1", @@ -2974,7 +2974,7 @@ "type-fest": "^4.12.0" }, "peerDependencies": { - "@mantine/hooks": "7.11.2", + "@mantine/hooks": "7.12.0", "react": "^18.2.0", "react-dom": "^18.2.0" } @@ -2991,23 +2991,23 @@ } }, "node_modules/@mantine/dropzone": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.11.2.tgz", - "integrity": "sha512-/X29ym1uM1ca7ZMLVSSxm9KBbDNIpXBwZbzNIpopH0hxjbo2bSpPTbNUVB3EjRAVWDx9RGlyNxQV2jkhCos7QQ==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.12.0.tgz", + "integrity": "sha512-emj9D2fCaeLmrBPE15dAZ31tI0hDENMN3Emz1xqMqmR/5xuzsVSTiZRJxIARsHn2Muiva3jLdRLFdW9A8YB3FA==", "dependencies": { "react-dropzone-esm": "15.0.1" }, "peerDependencies": { - "@mantine/core": "7.11.2", - "@mantine/hooks": "7.11.2", + "@mantine/core": "7.12.0", + "@mantine/hooks": "7.12.0", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/form": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.11.2.tgz", - "integrity": "sha512-NRY4HDgcArDEP+wUaHITnoVh0Ce3rM3Blo9fLNj2VYO8k7AfuSWp+fQdqrjDI0k9wGU3YEj4/dbwOjKbtXEhxw==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.12.0.tgz", + "integrity": "sha512-npNHxjis/tOun12EYPYP9cQwJbtFHcGZF1m2yNCcNFVMdkBtTiqH23DdGByXmJRkypYQssSMdQTm3F1zfGsjdQ==", "dependencies": { "fast-deep-equal": "^3.1.3", "klona": "^2.0.6" @@ -3017,43 +3017,43 @@ } }, "node_modules/@mantine/hooks": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.11.2.tgz", - "integrity": "sha512-jhyVe/sbDEG2U8rr2lMecUPgQxcfr5hh9HazqGfkS7ZRIMDO7uJ947yAcTMGGkp5Lxtt5TBFt1Cb6tiB2/1agg==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.12.0.tgz", + "integrity": "sha512-UKMSpQZMdmecZX1PKPoknfUOE9MfDPiZR1myU4wUUKpaZibvvmhYuy8mcOOmYWegapRS3ErKIAc2cNnJ1Dk4RQ==", "peerDependencies": { "react": "^18.2.0" } }, "node_modules/@mantine/modals": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.11.2.tgz", - "integrity": "sha512-AsVyGP5+F9jkQdQ9J0qzaK8q7n9bPcpswAjScpzIgEfUBC4RCvf63bmh9Yp1OEgxl1xkNdzGUYGVau0SQqHasA==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.12.0.tgz", + "integrity": "sha512-CXt2nUK0VuWc+cwC1flCeH5FnQYjA8iQfGgZ37wSFv2qxzJFQ61QlRJjdgIG7T+DccUHjqXKkjYohLxXE36EQQ==", "peerDependencies": { - "@mantine/core": "7.11.2", - "@mantine/hooks": "7.11.2", + "@mantine/core": "7.12.0", + "@mantine/hooks": "7.12.0", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/notifications": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.11.2.tgz", - "integrity": "sha512-KB/6mp3mU3LvcFlfMc5zK5mWcrAO+zAGeiBb1oUjNFXBECCn9xizqqUeT0YbWBHL7wysq9IThDJxLwUBnQt+8Q==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.12.0.tgz", + "integrity": "sha512-eW2g66b1K/EUdHD842QnQHWdKWbk1mCJkzDAyxcMGZ2BqU2zzpTUZdexbfDg2BqE/Mj/BGc3B9r2mKHt/6ebBg==", "dependencies": { - "@mantine/store": "7.11.2", + "@mantine/store": "7.12.0", "react-transition-group": "4.4.5" }, "peerDependencies": { - "@mantine/core": "7.11.2", - "@mantine/hooks": "7.11.2", + "@mantine/core": "7.12.0", + "@mantine/hooks": "7.12.0", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/store": { - "version": "7.11.2", - "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.11.2.tgz", - "integrity": "sha512-FfkmnOnCivOjqwNaTZeV4TgDANUs7fP+0uSgzp0GuvwTuDfQNVafPBRzPkjKuz5ug+Nn9l6WwjfJ6LBDv9U0LQ==", + "version": "7.12.0", + "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.12.0.tgz", + "integrity": "sha512-gKOJQVKTxJQbjhG/qlaLiv47ydHgdN+ZC2jFRJHr1jjNeiCqzIT4wX1ofG27c5byPTAwAHvuf+/FLOV3rywUpA==", "peerDependencies": { "react": "^18.2.0" } diff --git a/frontend/package.json b/frontend/package.json index 938e92930..7feb4a17d 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,12 +13,12 @@ }, "private": true, "dependencies": { - "@mantine/core": "^7.11.2", - "@mantine/dropzone": "^7.11.2", - "@mantine/form": "^7.11.2", - "@mantine/hooks": "^7.11.2", - "@mantine/modals": "^7.11.2", - "@mantine/notifications": "^7.11.2", + "@mantine/core": "^7.12.0", + "@mantine/dropzone": "^7.12.0", + "@mantine/form": "^7.12.0", + "@mantine/hooks": "^7.12.0", + "@mantine/modals": "^7.12.0", + "@mantine/notifications": "^7.12.0", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", From f424c216288e270fab3742ad0e6a29097bb185ce Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Wed, 7 Aug 2024 09:12:48 +0900 Subject: [PATCH 31/78] no log: Remove item overview fallback image poster --- frontend/src/pages/views/ItemOverview.tsx | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/frontend/src/pages/views/ItemOverview.tsx b/frontend/src/pages/views/ItemOverview.tsx index 15b43aab1..d03da3b80 100644 --- a/frontend/src/pages/views/ItemOverview.tsx +++ b/frontend/src/pages/views/ItemOverview.tsx @@ -142,12 +142,7 @@ const ItemOverview: FunctionComponent = (props) => { }} > - + From baae406a0213c8efd6d626ed71761db27e192c04 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Fri, 9 Aug 2024 16:40:44 +0900 Subject: [PATCH 32/78] Added settings provider maximum description lines (#2611) --- .../pages/Settings/Providers/components.tsx | 2 ++ .../src/pages/Settings/components/Card.tsx | 29 +++++++++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/frontend/src/pages/Settings/Providers/components.tsx b/frontend/src/pages/Settings/Providers/components.tsx index 72e2c3b1f..acae15261 100644 --- a/frontend/src/pages/Settings/Providers/components.tsx +++ b/frontend/src/pages/Settings/Providers/components.tsx @@ -108,10 +108,12 @@ export const ProviderView: FunctionComponent = ({ }) .map((v, idx) => ( select(v)} + lineClamp={2} > )); } else { diff --git a/frontend/src/pages/Settings/components/Card.tsx b/frontend/src/pages/Settings/components/Card.tsx index 69df15636..a8a33eec3 100644 --- a/frontend/src/pages/Settings/components/Card.tsx +++ b/frontend/src/pages/Settings/components/Card.tsx @@ -1,14 +1,23 @@ import { FunctionComponent } from "react"; -import { Center, Stack, Text, UnstyledButton } from "@mantine/core"; +import { + Center, + MantineStyleProp, + Stack, + Text, + UnstyledButton, +} from "@mantine/core"; import { faPlus } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import TextPopover from "@/components/TextPopover"; import styles from "./Card.module.scss"; interface CardProps { - header?: string; description?: string; - plus?: boolean; + header?: string; + lineClamp?: number | undefined; onClick?: () => void; + plus?: boolean; + titleStyles?: MantineStyleProp | undefined; } export const Card: FunctionComponent = ({ @@ -16,6 +25,8 @@ export const Card: FunctionComponent = ({ description, plus, onClick, + lineClamp, + titleStyles, }) => { return ( @@ -24,9 +35,15 @@ export const Card: FunctionComponent = ({ ) : ( - - {header} - + + + {header} + + + + )} From 8c68fba85d668606fd47b5ac15571a732ef20c04 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Sat, 10 Aug 2024 14:11:42 +0900 Subject: [PATCH 33/78] no log: Remove missleading anime logs --- bazarr/subtitles/refiners/anidb.py | 2 -- bazarr/subtitles/refiners/anilist.py | 6 ++++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bazarr/subtitles/refiners/anidb.py b/bazarr/subtitles/refiners/anidb.py index 5faa9878a..ea56adc3d 100644 --- a/bazarr/subtitles/refiners/anidb.py +++ b/bazarr/subtitles/refiners/anidb.py @@ -197,8 +197,6 @@ class AniDBClient(object): def refine_from_anidb(path, video): if not isinstance(video, Episode) or not video.series_tvdb_id: - logger.debug(f'Video is not an Anime TV series, skipping refinement for {video}') - return if refined_providers.intersection(settings.general.enabled_providers) and video.series_anidb_id is None: diff --git a/bazarr/subtitles/refiners/anilist.py b/bazarr/subtitles/refiners/anilist.py index 3d0bb7b35..4a008a5e1 100644 --- a/bazarr/subtitles/refiners/anilist.py +++ b/bazarr/subtitles/refiners/anilist.py @@ -13,6 +13,7 @@ from subliminal import Episode, region, __short_version__ logger = logging.getLogger(__name__) refined_providers = {'jimaku'} + class AniListClient(object): def __init__(self, session=None, timeout=10): self.session = session or requests.Session() @@ -47,16 +48,17 @@ class AniListClient(object): logger.debug(f"Could not find corresponding AniList ID with '{mapped_tag}': {candidate_id_value}") return None + def refine_from_anilist(path, video): # Safety checks if isinstance(video, Episode): if not video.series_anidb_id: - logger.error(f"Will not refine '{video.series}' as it does not have an AniDB ID.") return if refined_providers.intersection(settings.general.enabled_providers) and video.anilist_id is None: refine_anilist_ids(video) + def refine_anilist_ids(video): anilist_client = AniListClient() @@ -74,4 +76,4 @@ def refine_anilist_ids(video): if not anilist_id: return video - video.anilist_id = anilist_id \ No newline at end of file + video.anilist_id = anilist_id From dc9df6814be4a554ba39360e6843c782158905f5 Mon Sep 17 00:00:00 2001 From: Hlib Date: Mon, 19 Aug 2024 15:58:41 +0300 Subject: [PATCH 34/78] Fixed provider AvistaZ & CinemaZ optional subtitle Uploader (#2628) --- custom_libs/subliminal_patch/providers/avistaz_network.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/avistaz_network.py b/custom_libs/subliminal_patch/providers/avistaz_network.py index 30e68d047..61afefcbf 100644 --- a/custom_libs/subliminal_patch/providers/avistaz_network.py +++ b/custom_libs/subliminal_patch/providers/avistaz_network.py @@ -318,7 +318,7 @@ class AvistazNetworkProviderBase(Provider): release_name = release['Title'].get_text().strip() lang = lookup_lang(subtitle_cols['Language'].get_text().strip()) download_link = subtitle_cols['Download'].a['href'] - uploader_name = subtitle_cols['Uploader'].get_text().strip() + uploader_name = subtitle_cols['Uploader'].get_text().strip() if 'Uploader' in subtitle_cols else None if lang not in languages: continue From 00c7eabd8c351c32a3fd00338eaf2653c1ce382e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 19 Aug 2024 21:59:08 +0900 Subject: [PATCH 35/78] no log: Bump the mantine group in /frontend with 6 updates (#2619) Bumps the mantine group in /frontend with 6 updates: | Package | From | To | | --- | --- | --- | | [@mantine/core](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/core) | `7.12.0` | `7.12.1` | | [@mantine/dropzone](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/dropzone) | `7.12.0` | `7.12.1` | | [@mantine/form](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/form) | `7.12.0` | `7.12.1` | | [@mantine/hooks](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/hooks) | `7.12.0` | `7.12.1` | | [@mantine/modals](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/modals) | `7.12.0` | `7.12.1` | | [@mantine/notifications](https://github.com/mantinedev/mantine/tree/HEAD/packages/@mantine/notifications) | `7.12.0` | `7.12.1` | Updates `@mantine/core` from 7.12.0 to 7.12.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.1/packages/@mantine/core) Updates `@mantine/dropzone` from 7.12.0 to 7.12.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.1/packages/@mantine/dropzone) Updates `@mantine/form` from 7.12.0 to 7.12.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.1/packages/@mantine/form) Updates `@mantine/hooks` from 7.12.0 to 7.12.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.1/packages/@mantine/hooks) Updates `@mantine/modals` from 7.12.0 to 7.12.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.1/packages/@mantine/modals) Updates `@mantine/notifications` from 7.12.0 to 7.12.1 - [Release notes](https://github.com/mantinedev/mantine/releases) - [Changelog](https://github.com/mantinedev/mantine/blob/master/CHANGELOG.md) - [Commits](https://github.com/mantinedev/mantine/commits/7.12.1/packages/@mantine/notifications) --- updated-dependencies: - dependency-name: "@mantine/core" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/dropzone" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/form" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/hooks" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/modals" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine - dependency-name: "@mantine/notifications" dependency-type: direct:production update-type: version-update:semver-patch dependency-group: mantine ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 70 +++++++++++++++++++------------------- frontend/package.json | 12 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 84e544f0c..f13ebf55e 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,12 +9,12 @@ "version": "1.0.0", "license": "GPL-3", "dependencies": { - "@mantine/core": "^7.12.0", - "@mantine/dropzone": "^7.12.0", - "@mantine/form": "^7.12.0", - "@mantine/hooks": "^7.12.0", - "@mantine/modals": "^7.12.0", - "@mantine/notifications": "^7.12.0", + "@mantine/core": "^7.12.1", + "@mantine/dropzone": "^7.12.1", + "@mantine/form": "^7.12.1", + "@mantine/hooks": "^7.12.1", + "@mantine/modals": "^7.12.1", + "@mantine/notifications": "^7.12.1", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", @@ -2962,9 +2962,9 @@ } }, "node_modules/@mantine/core": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.12.0.tgz", - "integrity": "sha512-FxsaIaEnqxV71MBGGsvXXad2q9KYTaIQFVP4TSAZI6xLChklXF/qJTqvabweaoW9BaVQT75b/BnUoJFzPfyAfw==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.12.1.tgz", + "integrity": "sha512-PXKIDaT1fpNB77dPQIcdFGM2NRnfmsJSVx3uuBccngBQWMIWI0wPyiO1Y26DK4LQrbrypeb+TS+Zxpgx6RoiCA==", "dependencies": { "@floating-ui/react": "^0.26.9", "clsx": "^2.1.1", @@ -2974,7 +2974,7 @@ "type-fest": "^4.12.0" }, "peerDependencies": { - "@mantine/hooks": "7.12.0", + "@mantine/hooks": "7.12.1", "react": "^18.2.0", "react-dom": "^18.2.0" } @@ -2991,23 +2991,23 @@ } }, "node_modules/@mantine/dropzone": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.12.0.tgz", - "integrity": "sha512-emj9D2fCaeLmrBPE15dAZ31tI0hDENMN3Emz1xqMqmR/5xuzsVSTiZRJxIARsHn2Muiva3jLdRLFdW9A8YB3FA==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.12.1.tgz", + "integrity": "sha512-IuAdCnl6PDtkDnGp4vQlHgxr9z3R7s0685khVKpxy/3f+XfdoswUBBY3X7XyirpDXMIjMD4SLpkIzwuUXgZsag==", "dependencies": { "react-dropzone-esm": "15.0.1" }, "peerDependencies": { - "@mantine/core": "7.12.0", - "@mantine/hooks": "7.12.0", + "@mantine/core": "7.12.1", + "@mantine/hooks": "7.12.1", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/form": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.12.0.tgz", - "integrity": "sha512-npNHxjis/tOun12EYPYP9cQwJbtFHcGZF1m2yNCcNFVMdkBtTiqH23DdGByXmJRkypYQssSMdQTm3F1zfGsjdQ==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.12.1.tgz", + "integrity": "sha512-Q+lpgG9N8srlsI0IPnD1V1c2ZaI0xmR3bBEVm+LttSos6Q5zkG49Yy011mc0cXzEKUk2h48j8PLoPHfSEzO03g==", "dependencies": { "fast-deep-equal": "^3.1.3", "klona": "^2.0.6" @@ -3017,43 +3017,43 @@ } }, "node_modules/@mantine/hooks": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.12.0.tgz", - "integrity": "sha512-UKMSpQZMdmecZX1PKPoknfUOE9MfDPiZR1myU4wUUKpaZibvvmhYuy8mcOOmYWegapRS3ErKIAc2cNnJ1Dk4RQ==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.12.1.tgz", + "integrity": "sha512-YPA3qiMHJkWID5+YzakBaLvjHtX3Fg3PdPY49iIb/CaWM9+lrJ+77TOVS7bsY7ZTBHXUfzft1/6Woqt3xSuweA==", "peerDependencies": { "react": "^18.2.0" } }, "node_modules/@mantine/modals": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.12.0.tgz", - "integrity": "sha512-CXt2nUK0VuWc+cwC1flCeH5FnQYjA8iQfGgZ37wSFv2qxzJFQ61QlRJjdgIG7T+DccUHjqXKkjYohLxXE36EQQ==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.12.1.tgz", + "integrity": "sha512-olS07yDcCFLGylLGaQgBiTnKcRrUZVLKqBFBw5glcmc/wZmJf4SDMgx5mxSwBnsbJOwJ2d3aIYwO/qNTNnluSg==", "peerDependencies": { - "@mantine/core": "7.12.0", - "@mantine/hooks": "7.12.0", + "@mantine/core": "7.12.1", + "@mantine/hooks": "7.12.1", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/notifications": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.12.0.tgz", - "integrity": "sha512-eW2g66b1K/EUdHD842QnQHWdKWbk1mCJkzDAyxcMGZ2BqU2zzpTUZdexbfDg2BqE/Mj/BGc3B9r2mKHt/6ebBg==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.12.1.tgz", + "integrity": "sha512-YIV2ItCRJzbOjEyXtz5Rjf3qn6kwmcz6CqAGurpd+kecxx6wwNoKuKs6YNlz7tcprFegcH/hCUkW2tVbXHKVBA==", "dependencies": { - "@mantine/store": "7.12.0", + "@mantine/store": "7.12.1", "react-transition-group": "4.4.5" }, "peerDependencies": { - "@mantine/core": "7.12.0", - "@mantine/hooks": "7.12.0", + "@mantine/core": "7.12.1", + "@mantine/hooks": "7.12.1", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/store": { - "version": "7.12.0", - "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.12.0.tgz", - "integrity": "sha512-gKOJQVKTxJQbjhG/qlaLiv47ydHgdN+ZC2jFRJHr1jjNeiCqzIT4wX1ofG27c5byPTAwAHvuf+/FLOV3rywUpA==", + "version": "7.12.1", + "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.12.1.tgz", + "integrity": "sha512-zIzYEheEyXchPTNKsm88BJ0CTEZV6ZNwMhMDWHKQE3CzjKLJdKHJdIBcZImRU3Pn4GROZdZdIkQF9HLJ6BjvYw==", "peerDependencies": { "react": "^18.2.0" } diff --git a/frontend/package.json b/frontend/package.json index 7feb4a17d..f9d4a67b2 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,12 +13,12 @@ }, "private": true, "dependencies": { - "@mantine/core": "^7.12.0", - "@mantine/dropzone": "^7.12.0", - "@mantine/form": "^7.12.0", - "@mantine/hooks": "^7.12.0", - "@mantine/modals": "^7.12.0", - "@mantine/notifications": "^7.12.0", + "@mantine/core": "^7.12.1", + "@mantine/dropzone": "^7.12.1", + "@mantine/form": "^7.12.1", + "@mantine/hooks": "^7.12.1", + "@mantine/modals": "^7.12.1", + "@mantine/notifications": "^7.12.1", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", From 609349b4002290e771935c7e6d02263c3fdd7ce4 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sat, 24 Aug 2024 15:24:15 -0400 Subject: [PATCH 36/78] Refactored the translation routine to prevent Google Translate from messing with subtitles sequence by sending line by line (slower but better). #2558 --- bazarr/subtitles/tools/translate.py | 71 +++++++++++++++++------------ 1 file changed, 43 insertions(+), 28 deletions(-) diff --git a/bazarr/subtitles/tools/translate.py b/bazarr/subtitles/tools/translate.py index eaaa69182..534200e20 100644 --- a/bazarr/subtitles/tools/translate.py +++ b/bazarr/subtitles/tools/translate.py @@ -6,12 +6,16 @@ import pysubs2 from subliminal_patch.core import get_subtitle_path from subzero.language import Language from deep_translator import GoogleTranslator +from deep_translator.exceptions import TooManyRequests, RequestError, TranslationNotFound +from time import sleep +from concurrent.futures import ThreadPoolExecutor from languages.custom_lang import CustomLanguage from languages.get_languages import alpha3_from_alpha2, language_from_alpha2, language_from_alpha3 from radarr.history import history_log_movie from sonarr.history import history_log from subtitles.processing import ProcessSubtitlesResult +from app.event_handler import show_progress, hide_progress def translate_subtitles_file(video_path, source_srt_file, from_lang, to_lang, forced, hi, media_type, sonarr_series_id, @@ -33,8 +37,6 @@ def translate_subtitles_file(video_path, source_srt_file, from_lang, to_lang, fo logging.debug(f'BAZARR is translating in {lang_obj} this subtitles {source_srt_file}') - max_characters = 5000 - dest_srt_file = get_subtitle_path(video_path, language=lang_obj if isinstance(lang_obj, Language) else lang_obj.subzero_language(), extension='.srt', @@ -44,40 +46,53 @@ def translate_subtitles_file(video_path, source_srt_file, from_lang, to_lang, fo subs = pysubs2.load(source_srt_file, encoding='utf-8') subs.remove_miscellaneous_events() lines_list = [x.plaintext for x in subs] - joined_lines_str = '\n\n'.join(lines_list) - - logging.debug(f'BAZARR splitting subtitles into {max_characters} characters blocks') - lines_block_list = [] - translated_lines_list = [] - while len(joined_lines_str): - partial_lines_str = joined_lines_str[:max_characters] + lines_list_len = len(lines_list) - if len(joined_lines_str) > max_characters: - new_partial_lines_str = partial_lines_str.rsplit('\n\n', 1)[0] + def translate_line(id, line, attempt): + try: + translated_text = GoogleTranslator( + source='auto', + target=language_code_convert_dict.get(lang_obj.alpha2, lang_obj.alpha2) + ).translate(text=line) + except TooManyRequests: + if attempt <= 5: + sleep(1) + super(translate_line(id, line, attempt+1)) + else: + logging.debug(f'Too many requests while translating {line}') + translated_lines.append({'id': id, 'line': line}) + except (RequestError, TranslationNotFound): + logging.debug(f'Unable to translate line {line}') + translated_lines.append({'id': id, 'line': line}) else: - new_partial_lines_str = partial_lines_str + translated_lines.append({'id': id, 'line': translated_text}) + finally: + show_progress(id=f'translate_progress_{dest_srt_file}', + header=f'Translating subtitles lines to {language_from_alpha3(to_lang)}...', + name='', + value=len(translated_lines), + count=lines_list_len) - lines_block_list.append(new_partial_lines_str) - joined_lines_str = joined_lines_str.replace(new_partial_lines_str, '') + logging.debug(f'BAZARR is sending {lines_list_len} blocks to Google Translate') - logging.debug(f'BAZARR is sending {len(lines_block_list)} blocks to Google Translate') - for block_str in lines_block_list: - try: - translated_partial_srt_text = GoogleTranslator(source='auto', - target=language_code_convert_dict.get(lang_obj.alpha2, - lang_obj.alpha2) - ).translate(text=block_str) - except Exception: - logging.exception(f'BAZARR Unable to translate subtitles {source_srt_file}') - return False - else: - translated_partial_srt_list = translated_partial_srt_text.split('\n\n') - translated_lines_list += translated_partial_srt_list + pool = ThreadPoolExecutor(max_workers=10) + + translated_lines = [] + + for i, line in enumerate(lines_list): + pool.submit(translate_line, i, line, 1) + + pool.shutdown(wait=True) + + for i, line in enumerate(translated_lines): + lines_list[line['id']] = line['line'] + + hide_progress(id=f'translate_progress_{dest_srt_file}') logging.debug(f'BAZARR saving translated subtitles to {dest_srt_file}') for i, line in enumerate(subs): try: - line.plaintext = translated_lines_list[i] + line.plaintext = lines_list[i] except IndexError: logging.error(f'BAZARR is unable to translate malformed subtitles: {source_srt_file}') return False From 4887066000a461d2026e95ba8d493bd667d9bfb2 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Sun, 25 Aug 2024 22:46:57 +0900 Subject: [PATCH 37/78] Fixed chinese audio language (#2632) --- bazarr/languages/get_languages.py | 7 +++++++ bazarr/radarr/sync/parser.py | 6 ++---- bazarr/sonarr/sync/parser.py | 5 +++-- frontend/src/components/bazarr/AudioList.tsx | 3 ++- frontend/src/pages/views/ItemOverview.tsx | 3 ++- frontend/src/utilities/languages.ts | 4 ++++ 6 files changed, 20 insertions(+), 8 deletions(-) diff --git a/bazarr/languages/get_languages.py b/bazarr/languages/get_languages.py index 2fbd52c89..881dd6ce0 100644 --- a/bazarr/languages/get_languages.py +++ b/bazarr/languages/get_languages.py @@ -54,6 +54,13 @@ def create_languages_dict(): TableSettingsLanguages.code3b)) .all()] +def audio_language_from_alpha2(lang): + lang_map = { + 'Chinese': 'zh', + 'Portuguese (Brazil)': 'pb' + } + + return language_from_alpha2(lang_map.get(lang, lang)) def language_from_alpha2(lang): return next((item['name'] for item in languages_dict if item['code2'] == lang[:2]), None) diff --git a/bazarr/radarr/sync/parser.py b/bazarr/radarr/sync/parser.py index d5f3e08c8..11b2a6687 100644 --- a/bazarr/radarr/sync/parser.py +++ b/bazarr/radarr/sync/parser.py @@ -3,7 +3,7 @@ import os from app.config import settings -from languages.get_languages import language_from_alpha2 +from languages.get_languages import audio_language_from_alpha2 from radarr.info import get_radarr_info from utilities.video_analyzer import embedded_audio_reader from utilities.path_mappings import path_mappings @@ -117,9 +117,7 @@ def movieParser(movie, action, tags_dict, language_profiles, movie_default_profi for item in movie['movieFile']['languages']: if isinstance(item, dict): if 'name' in item: - language = item['name'] - if item['name'] == 'Portuguese (Brazil)': - language = language_from_alpha2('pb') + language = audio_language_from_alpha2(item['name']) audio_language.append(language) tags = [d['label'] for d in tags_dict if d['id'] in movie['tags']] diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index 32980cbab..24c92c575 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -5,6 +5,7 @@ import os from app.config import settings from app.database import TableShows, database, select from constants import MINIMUM_VIDEO_SIZE +from languages.get_languages import audio_language_from_alpha2 from utilities.path_mappings import path_mappings from utilities.video_analyzer import embedded_audio_reader from sonarr.info import get_sonarr_info @@ -115,13 +116,13 @@ def episodeParser(episode): item = episode['episodeFile']['language'] if isinstance(item, dict): if 'name' in item: - audio_language.append(item['name']) + audio_language.append(audio_language_from_alpha2(item['name'])) elif 'languages' in episode['episodeFile'] and len(episode['episodeFile']['languages']): items = episode['episodeFile']['languages'] if isinstance(items, list): for item in items: if 'name' in item: - audio_language.append(item['name']) + audio_language.append(audio_language_from_alpha2(item['name'])) else: audio_language = database.execute( select(TableShows.audio_language) diff --git a/frontend/src/components/bazarr/AudioList.tsx b/frontend/src/components/bazarr/AudioList.tsx index f1af7ff3c..f0dc07c0d 100644 --- a/frontend/src/components/bazarr/AudioList.tsx +++ b/frontend/src/components/bazarr/AudioList.tsx @@ -1,6 +1,7 @@ import { FunctionComponent } from "react"; import { Badge, BadgeProps, Group, GroupProps } from "@mantine/core"; import { BuildKey } from "@/utilities"; +import { normalizeAudioLanguage } from "@/utilities/languages"; export type AudioListProps = GroupProps & { audios: Language.Info[]; @@ -16,7 +17,7 @@ const AudioList: FunctionComponent = ({ {audios.map((audio, idx) => ( - {audio.name} + {normalizeAudioLanguage(audio.name)} ))} diff --git a/frontend/src/pages/views/ItemOverview.tsx b/frontend/src/pages/views/ItemOverview.tsx index d03da3b80..36d296850 100644 --- a/frontend/src/pages/views/ItemOverview.tsx +++ b/frontend/src/pages/views/ItemOverview.tsx @@ -31,6 +31,7 @@ import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { Language } from "@/components/bazarr"; import { BuildKey } from "@/utilities"; import { + normalizeAudioLanguage, useLanguageProfileBy, useProfileItemsToLanguages, } from "@/utilities/languages"; @@ -87,7 +88,7 @@ const ItemOverview: FunctionComponent = (props) => { icon={faMusic} title="Audio Language" > - {v.name} + {normalizeAudioLanguage(v.name)} )) ?? [], [item?.audio_language], diff --git a/frontend/src/utilities/languages.ts b/frontend/src/utilities/languages.ts index 1b59aa4e7..7885e9667 100644 --- a/frontend/src/utilities/languages.ts +++ b/frontend/src/utilities/languages.ts @@ -51,3 +51,7 @@ export function useLanguageFromCode3(code3: string) { [data, code3], ); } + +export const normalizeAudioLanguage = (name: string) => { + return name === "Chinese Simplified" ? "Chinese" : name; +}; From eb084abc21b3d37390d6ec70d73e62297032f7c3 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 25 Aug 2024 15:05:31 -0400 Subject: [PATCH 38/78] Fixed hearing-impaired detection using regex when language is Arabic and parenthesis are included in text. #2612 --- bazarr/subtitles/indexer/utils.py | 2 +- custom_libs/subliminal_patch/core.py | 14 ++++++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/bazarr/subtitles/indexer/utils.py b/bazarr/subtitles/indexer/utils.py index 03549d748..222a66a8f 100644 --- a/bazarr/subtitles/indexer/utils.py +++ b/bazarr/subtitles/indexer/utils.py @@ -136,6 +136,6 @@ def guess_external_subtitles(dest_folder, subtitles, media_type, previously_inde continue text = text.decode(encoding) - if bool(re.search(core.HI_REGEX, text)): + if core.parse_for_hi_regex(subtitle_text=text, alpha3_language=language.alpha3): subtitles[subtitle] = Language.rebuild(subtitles[subtitle], forced=False, hi=True) return subtitles diff --git a/custom_libs/subliminal_patch/core.py b/custom_libs/subliminal_patch/core.py index c1629496b..f0d7f3618 100644 --- a/custom_libs/subliminal_patch/core.py +++ b/custom_libs/subliminal_patch/core.py @@ -49,7 +49,17 @@ SUBTITLE_EXTENSIONS = ('.srt', '.sub', '.smi', '.txt', '.ssa', '.ass', '.mpl', ' _POOL_LIFETIME = datetime.timedelta(hours=12) -HI_REGEX = re.compile(r'[*¶♫♪].{3,}[*¶♫♪]|[\[\(\{].{3,}[\]\)\}](? Date: Mon, 26 Aug 2024 10:10:44 +0900 Subject: [PATCH 39/78] no log: Bump recharts from 2.12.6 to 2.12.7 in /frontend (#2629) Bumps [recharts](https://github.com/recharts/recharts) from 2.12.6 to 2.12.7. - [Release notes](https://github.com/recharts/recharts/releases) - [Changelog](https://github.com/recharts/recharts/blob/3.x/CHANGELOG.md) - [Commits](https://github.com/recharts/recharts/compare/v2.12.6...v2.12.7) --- updated-dependencies: - dependency-name: recharts dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 8 ++++---- frontend/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index f13ebf55e..020f6b83f 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -58,7 +58,7 @@ "prettier": "^3.2.5", "prettier-plugin-organize-imports": "^3.2.4", "pretty-quick": "^4.0.0", - "recharts": "^2.12.6", + "recharts": "^2.12.7", "sass": "^1.74.1", "typescript": "^5.4.4", "vite": "^5.2.8", @@ -9938,9 +9938,9 @@ } }, "node_modules/recharts": { - "version": "2.12.6", - "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.12.6.tgz", - "integrity": "sha512-D+7j9WI+D0NHauah3fKHuNNcRK8bOypPW7os1DERinogGBGaHI7i6tQKJ0aUF3JXyBZ63dyfKIW2WTOPJDxJ8w==", + "version": "2.12.7", + "resolved": "https://registry.npmjs.org/recharts/-/recharts-2.12.7.tgz", + "integrity": "sha512-hlLJMhPQfv4/3NBSAyq3gzGg4h2v69RJh6KU7b3pXYNNAELs9kEoXOjbkxdXpALqKBoVmVptGfLpxdaVYqjmXQ==", "dev": true, "dependencies": { "clsx": "^2.0.0", diff --git a/frontend/package.json b/frontend/package.json index f9d4a67b2..7ca8da32f 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -62,7 +62,7 @@ "prettier": "^3.2.5", "prettier-plugin-organize-imports": "^3.2.4", "pretty-quick": "^4.0.0", - "recharts": "^2.12.6", + "recharts": "^2.12.7", "sass": "^1.74.1", "typescript": "^5.4.4", "vite": "^5.2.8", From 9ec60279896420f80916687d29530025f16ba0a8 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Mon, 26 Aug 2024 10:36:40 +0900 Subject: [PATCH 40/78] Fixed badge overflow --- frontend/src/assets/badge.module.scss | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/frontend/src/assets/badge.module.scss b/frontend/src/assets/badge.module.scss index 4b8717fe3..5b31be59e 100644 --- a/frontend/src/assets/badge.module.scss +++ b/frontend/src/assets/badge.module.scss @@ -47,4 +47,8 @@ } } } + + .label { + overflow: visible; + } } From 855da6b1bb1cbb41d687e4593e2e9d092ed6e273 Mon Sep 17 00:00:00 2001 From: GabbeHags <38500419+GabbeHags@users.noreply.github.com> Date: Mon, 26 Aug 2024 13:49:33 +0200 Subject: [PATCH 41/78] Fixed subf2m search process by stripping html title result before using regex --- custom_libs/subliminal_patch/providers/subf2m.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/subf2m.py b/custom_libs/subliminal_patch/providers/subf2m.py index 6b3a59129..0ef39595d 100644 --- a/custom_libs/subliminal_patch/providers/subf2m.py +++ b/custom_libs/subliminal_patch/providers/subf2m.py @@ -220,7 +220,7 @@ class Subf2mProvider(Provider): results = [] for result in self._gen_results(title): - text = result.text.lower() + text = result.text.strip().lower() match = self._movie_title_regex.match(text) if not match: continue @@ -254,7 +254,7 @@ class Subf2mProvider(Provider): results = [] for result in self._gen_results(title): - text = result.text.lower() + text = result.text.strip().lower() match = self._tv_show_title_regex.match(text) if not match: From 0e876fcc93b1771934f6816fc5994b7e0efff8ef Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Tue, 27 Aug 2024 09:00:44 +0900 Subject: [PATCH 42/78] Added sonarr and radarr settings tags validation (#2634) --- bazarr/app/config.py | 10 ++++++++-- frontend/src/pages/Settings/Radarr/index.tsx | 5 +++++ frontend/src/pages/Settings/Sonarr/index.tsx | 5 +++++ frontend/src/pages/Settings/components/forms.tsx | 16 ++++++++++++++-- 4 files changed, 32 insertions(+), 4 deletions(-) diff --git a/bazarr/app/config.py b/bazarr/app/config.py index b0a8c62ba..5e5b5ac04 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -37,6 +37,12 @@ def validate_ip_address(ip_string): except ValueError: return False +def validate_tags(tags): + if not tags: + return True + + return all(re.match( r'^[a-z0-9_-]+$', item) for item in tags) + ONE_HUNDRED_YEARS_IN_MINUTES = 52560000 ONE_HUNDRED_YEARS_IN_HOURS = 876000 @@ -178,7 +184,7 @@ validators = [ Validator('sonarr.only_monitored', must_exist=True, default=False, is_type_of=bool), Validator('sonarr.series_sync', must_exist=True, default=60, is_type_of=int, is_in=[15, 60, 180, 360, 720, 1440, 10080, ONE_HUNDRED_YEARS_IN_MINUTES]), - Validator('sonarr.excluded_tags', must_exist=True, default=[], is_type_of=list), + Validator('sonarr.excluded_tags', must_exist=True, default=[], is_type_of=list, condition=validate_tags), Validator('sonarr.excluded_series_types', must_exist=True, default=[], is_type_of=list), Validator('sonarr.use_ffprobe_cache', must_exist=True, default=True, is_type_of=bool), Validator('sonarr.exclude_season_zero', must_exist=True, default=False, is_type_of=bool), @@ -201,7 +207,7 @@ validators = [ Validator('radarr.only_monitored', must_exist=True, default=False, is_type_of=bool), Validator('radarr.movies_sync', must_exist=True, default=60, is_type_of=int, is_in=[15, 60, 180, 360, 720, 1440, 10080, ONE_HUNDRED_YEARS_IN_MINUTES]), - Validator('radarr.excluded_tags', must_exist=True, default=[], is_type_of=list), + Validator('radarr.excluded_tags', must_exist=True, default=[], is_type_of=list, condition=validate_tags), Validator('radarr.use_ffprobe_cache', must_exist=True, default=True, is_type_of=bool), Validator('radarr.defer_search_signalr', must_exist=True, default=False, is_type_of=bool), Validator('radarr.sync_only_monitored_movies', must_exist=True, default=False, is_type_of=bool), diff --git a/frontend/src/pages/Settings/Radarr/index.tsx b/frontend/src/pages/Settings/Radarr/index.tsx index b2e858178..264c78924 100644 --- a/frontend/src/pages/Settings/Radarr/index.tsx +++ b/frontend/src/pages/Settings/Radarr/index.tsx @@ -54,6 +54,11 @@ const SettingsRadarrView: FunctionComponent = () => { + values?.map((item) => + item.replace(/[^a-z0-9_-]/gi, "").toLowerCase(), + ) + } > Movies with those tags (case sensitive) in Radarr will be excluded diff --git a/frontend/src/pages/Settings/Sonarr/index.tsx b/frontend/src/pages/Settings/Sonarr/index.tsx index ed66ef679..ff4ac6ca2 100644 --- a/frontend/src/pages/Settings/Sonarr/index.tsx +++ b/frontend/src/pages/Settings/Sonarr/index.tsx @@ -56,6 +56,11 @@ const SettingsSonarrView: FunctionComponent = () => { + values?.map((item) => + item.replace(/[^a-z0-9_-]/gi, "").toLowerCase(), + ) + } > Episodes from series with those tags (case sensitive) in Sonarr will diff --git a/frontend/src/pages/Settings/components/forms.tsx b/frontend/src/pages/Settings/components/forms.tsx index 95134db92..1e4f744b9 100644 --- a/frontend/src/pages/Settings/components/forms.tsx +++ b/frontend/src/pages/Settings/components/forms.tsx @@ -160,13 +160,25 @@ export const Slider: FunctionComponent = (props) => { }; type ChipsProp = BaseInput & - Omit; + Omit & { + sanitizeFn?: (values: string[] | null) => string[] | undefined; + }; export const Chips: FunctionComponent = (props) => { const { value, update, rest } = useBaseInput(props); + const handleChange = (value: string[] | null) => { + const sanitizedValues = props.sanitizeFn?.(value) ?? value; + + update(sanitizedValues || null); + }; + return ( - + ); }; From ee622e64b44a71991c29cf545432c43f9bd92ec0 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 27 Aug 2024 09:01:06 +0900 Subject: [PATCH 43/78] no log: Bump @types/react in /frontend in the react group (#2636) Bumps the react group in /frontend with 1 update: [@types/react](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/HEAD/types/react). Updates `@types/react` from 18.3.3 to 18.3.4 - [Release notes](https://github.com/DefinitelyTyped/DefinitelyTyped/releases) - [Commits](https://github.com/DefinitelyTyped/DefinitelyTyped/commits/HEAD/types/react) --- updated-dependencies: - dependency-name: "@types/react" dependency-type: direct:development update-type: version-update:semver-patch dependency-group: react ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- frontend/package-lock.json | 8 ++++---- frontend/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 020f6b83f..7b038b38a 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -38,7 +38,7 @@ "@types/jest": "^29.5.12", "@types/lodash": "^4.17.1", "@types/node": "^20.12.6", - "@types/react": "^18.3.3", + "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", "@vite-pwa/assets-generator": "^0.2.4", "@vitejs/plugin-react": "^4.2.1", @@ -3876,9 +3876,9 @@ "devOptional": true }, "node_modules/@types/react": { - "version": "18.3.3", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.3.tgz", - "integrity": "sha512-hti/R0pS0q1/xx+TsI73XIqk26eBsISZ2R0wUijXIngRK9R/e7Xw/cXVxQK7R5JjW+SV4zGcn5hXjudkN/pLIw==", + "version": "18.3.4", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.4.tgz", + "integrity": "sha512-J7W30FTdfCxDDjmfRM+/JqLHBIyl7xUIp9kwK637FGmY7+mkSFSe6L4jpZzhj5QMfLssSDP4/i75AKkrdC7/Jw==", "devOptional": true, "dependencies": { "@types/prop-types": "*", diff --git a/frontend/package.json b/frontend/package.json index 7ca8da32f..86a7fff4b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -42,7 +42,7 @@ "@types/jest": "^29.5.12", "@types/lodash": "^4.17.1", "@types/node": "^20.12.6", - "@types/react": "^18.3.3", + "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", "@vite-pwa/assets-generator": "^0.2.4", "@vitejs/plugin-react": "^4.2.1", From 74f2c6646404b76821146e9b58bed12c53fc1186 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nejc=20Kova=C4=8D?= <9419014+nate9976@users.noreply.github.com> Date: Tue, 27 Aug 2024 13:05:43 +0200 Subject: [PATCH 44/78] Fixed Podnapisi not returning any subtitles --- custom_libs/subliminal_patch/providers/podnapisi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/podnapisi.py b/custom_libs/subliminal_patch/providers/podnapisi.py index 18131ff52..b13a47c4d 100644 --- a/custom_libs/subliminal_patch/providers/podnapisi.py +++ b/custom_libs/subliminal_patch/providers/podnapisi.py @@ -209,7 +209,7 @@ class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin): break # exit if no results - if not xml.find('pagination/results') or not int(xml.find('pagination/results').text): + if not xml.find('pagination/results').text or not int(xml.find('pagination/results').text): logger.debug('No subtitles found') break From f1f3850f9e0f30403f87a359143dfe366b479e37 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Tue, 27 Aug 2024 21:51:14 -0400 Subject: [PATCH 45/78] no log: small fixes to my latest commit --- bazarr/subtitles/indexer/utils.py | 4 ++-- custom_libs/subliminal_patch/core.py | 5 ++++- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/bazarr/subtitles/indexer/utils.py b/bazarr/subtitles/indexer/utils.py index 222a66a8f..63b9dee6d 100644 --- a/bazarr/subtitles/indexer/utils.py +++ b/bazarr/subtitles/indexer/utils.py @@ -2,7 +2,6 @@ import os import logging -import re from guess_language import guess_language from subliminal_patch import core @@ -136,6 +135,7 @@ def guess_external_subtitles(dest_folder, subtitles, media_type, previously_inde continue text = text.decode(encoding) - if core.parse_for_hi_regex(subtitle_text=text, alpha3_language=language.alpha3): + if core.parse_for_hi_regex(subtitle_text=text, + alpha3_language=language.alpha3 if hasattr(language, 'alpha3') else None): subtitles[subtitle] = Language.rebuild(subtitles[subtitle], forced=False, hi=True) return subtitles diff --git a/custom_libs/subliminal_patch/core.py b/custom_libs/subliminal_patch/core.py index f0d7f3618..0fc2ac0a7 100644 --- a/custom_libs/subliminal_patch/core.py +++ b/custom_libs/subliminal_patch/core.py @@ -1213,7 +1213,10 @@ def save_subtitles(file_path, subtitles, single=False, directory=None, chmod=Non continue # create subtitle path - if subtitle.text and parse_for_hi_regex(subtitle_text=subtitle.text, alpha3_language=subtitle.language.alpha3): + if subtitle.text and parse_for_hi_regex(subtitle_text=subtitle.text, + alpha3_language=subtitle.language.alpha3 if + (hasattr(subtitle, 'language') and hasattr(subtitle.language, 'alpha3')) + else None): subtitle.language.hi = True subtitle_path = get_subtitle_path(file_path, None if single else subtitle.language, forced_tag=subtitle.language.forced, From e5f1528bbad2d0df8d0ed32b16cfa6856db79f2c Mon Sep 17 00:00:00 2001 From: JayZed Date: Wed, 28 Aug 2024 14:30:00 -0400 Subject: [PATCH 46/78] Added ability to remove language profiles based on tag values --- bazarr/app/config.py | 2 ++ bazarr/radarr/sync/parser.py | 4 +++ bazarr/sonarr/sync/parser.py | 6 +++- .../src/pages/Settings/Languages/index.tsx | 28 +++++++++++++++++-- frontend/src/types/settings.d.ts | 1 + 5 files changed, 38 insertions(+), 3 deletions(-) diff --git a/bazarr/app/config.py b/bazarr/app/config.py index 5e5b5ac04..73ed05e7c 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -96,6 +96,7 @@ validators = [ Validator('general.path_mappings_movie', must_exist=True, default=[], is_type_of=list), Validator('general.serie_tag_enabled', must_exist=True, default=False, is_type_of=bool), Validator('general.movie_tag_enabled', must_exist=True, default=False, is_type_of=bool), + Validator('general.remove_profile_tags', must_exist=True, default=[], is_type_of=list, condition=validate_tags), Validator('general.serie_default_enabled', must_exist=True, default=False, is_type_of=bool), Validator('general.serie_default_profile', must_exist=True, default='', is_type_of=(int, str)), Validator('general.movie_default_enabled', must_exist=True, default=False, is_type_of=bool), @@ -468,6 +469,7 @@ array_keys = ['excluded_tags', 'enabled_integrations', 'path_mappings', 'path_mappings_movie', + 'remove_profile_tags', 'language_equals', 'blacklisted_languages', 'blacklisted_providers'] diff --git a/bazarr/radarr/sync/parser.py b/bazarr/radarr/sync/parser.py index 11b2a6687..60aad85a5 100644 --- a/bazarr/radarr/sync/parser.py +++ b/bazarr/radarr/sync/parser.py @@ -152,6 +152,10 @@ def movieParser(movie, action, tags_dict, language_profiles, movie_default_profi tag_profile = get_matching_profile(tags, language_profiles) if tag_profile: parsed_movie['profileId'] = tag_profile + remove_profile_tags_list = settings.general.remove_profile_tags + if len(remove_profile_tags_list) > 0: + if set(tags) & set(remove_profile_tags_list): + parsed_movie['profileId'] = None return parsed_movie diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index 24c92c575..216a9d1f5 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -78,7 +78,11 @@ def seriesParser(show, action, tags_dict, language_profiles, serie_default_profi tag_profile = get_matching_profile(tags, language_profiles) if tag_profile: parsed_series['profileId'] = tag_profile - + remove_profile_tags_list = settings.general.remove_profile_tags + if len(remove_profile_tags_list) > 0: + if set(tags) & set(remove_profile_tags_list): + parsed_series['profileId'] = None + return parsed_series diff --git a/frontend/src/pages/Settings/Languages/index.tsx b/frontend/src/pages/Settings/Languages/index.tsx index 6a5b5309b..1bd9d72a8 100644 --- a/frontend/src/pages/Settings/Languages/index.tsx +++ b/frontend/src/pages/Settings/Languages/index.tsx @@ -1,7 +1,9 @@ import { FunctionComponent } from "react"; +import { Text as MantineText } from "@mantine/core"; import { useLanguageProfiles, useLanguages } from "@/apis/hooks"; import { Check, + Chips, CollapseBox, Layout, Message, @@ -121,12 +123,21 @@ const SettingsLanguagesView: FunctionComponent = () => { Sonarr (or a Movie from Radarr) to find a matching Bazarr language profile tag. It will use as the language profile the FIRST tag from Sonarr/Radarr that matches the tag of a Bazarr language profile - EXACTLY. If mutiple tags match, there is no guarantee as to which one + EXACTLY. If multiple tags match, there is no guarantee as to which one will be used, so choose your tag names carefully. Also, if you update the tag names in Sonarr/Radarr, Bazarr will detect this and repeat the matching process for the affected shows. However, if a show's only matching tag is removed from Sonarr/Radarr, Bazarr will NOT remove the - show's existing language profile, but keep it, as is. + show's existing language profile for that reason. But if you wish to + have language profiles removed automatically by tag value, simply + enter a list of one or more tags in the{" "} + + Remove Profile Tags + {" "} + entry list below. If your video tag matches one of the tags in that + list, then Bazarr will remove the language profile for that video. If + there is a conflict between profile selection and profile removal, + then profile removal wins out and is performed. { label="Movies" settingKey="settings-general-movie_tag_enabled" > + + values?.map((item) => + item.replace(/[^a-z0-9_-]/gi, "").toLowerCase(), + ) + } + > + + Enter tag values that will trigger a language profile removal. Leave + empty if you don't want Bazarr to remove language profiles. +
Date: Thu, 29 Aug 2024 16:22:24 +0900 Subject: [PATCH 47/78] no log: Replace raw html bold tag inside text with Mantine Text (#2639) --- .../src/pages/Settings/Subtitles/index.tsx | 50 ++++++++++++------- 1 file changed, 32 insertions(+), 18 deletions(-) diff --git a/frontend/src/pages/Settings/Subtitles/index.tsx b/frontend/src/pages/Settings/Subtitles/index.tsx index a2250e5a9..a2e05a5c5 100644 --- a/frontend/src/pages/Settings/Subtitles/index.tsx +++ b/frontend/src/pages/Settings/Subtitles/index.tsx @@ -1,5 +1,5 @@ -import { FunctionComponent } from "react"; -import { Code, Space, Table } from "@mantine/core"; +import React, { FunctionComponent } from "react"; +import { Code, Space, Table, Text as MantineText } from "@mantine/core"; import { Check, CollapseBox, @@ -115,14 +115,16 @@ const commandOptions: CommandOption[] = [ }, ]; -const commandOptionElements: JSX.Element[] = commandOptions.map((op, idx) => ( - - - {op.option} - - {op.description} - -)); +const commandOptionElements: React.JSX.Element[] = commandOptions.map( + (op, idx) => ( + + + {op.option} + + {op.description} + + ), +); const SettingsSubtitlesView: FunctionComponent = () => { return ( @@ -436,8 +438,11 @@ const SettingsSubtitlesView: FunctionComponent = () => { - Only series subtitles with scores below this value will be - automatically synchronized. + Only series subtitles with scores{" "} + + below + {" "} + this value will be automatically synchronized. { - Only movie subtitles with scores below this value will be - automatically synchronized. + Only movie subtitles with scores{" "} + + below + {" "} + this value will be automatically synchronized. @@ -478,8 +486,11 @@ const SettingsSubtitlesView: FunctionComponent = () => { - Only series subtitles with scores below this value will be - automatically post-processed. + Only series subtitles with scores{" "} + + below + {" "} + this value will be automatically post-processed. { - Only movie subtitles with scores below this value will be - automatically post-processed. + Only movie subtitles with scores{" "} + + below + {" "} + this value will be automatically post-processed. Date: Thu, 29 Aug 2024 16:49:13 +0900 Subject: [PATCH 48/78] no log: Eslint plugin updates (#2574) --- frontend/.eslintrc.json | 6 +- frontend/package-lock.json | 1842 ++++------------- frontend/package.json | 4 +- frontend/src/apis/hooks/episodes.ts | 26 +- frontend/src/apis/hooks/movies.ts | 33 +- frontend/src/apis/hooks/system.ts | 37 +- .../src/components/async/MutateAction.tsx | 1 - .../src/components/async/MutateButton.tsx | 1 - .../src/components/async/QueryOverlay.tsx | 2 +- frontend/src/components/inputs/Selector.tsx | 5 +- frontend/src/modules/modals/hooks.ts | 13 +- frontend/src/modules/socketio/reducer.ts | 52 +- .../pages/Settings/components/forms.test.tsx | 8 +- .../src/pages/Settings/components/forms.tsx | 10 +- 14 files changed, 537 insertions(+), 1503 deletions(-) diff --git a/frontend/.eslintrc.json b/frontend/.eslintrc.json index 97b3d3de5..f1418bfdf 100644 --- a/frontend/.eslintrc.json +++ b/frontend/.eslintrc.json @@ -15,12 +15,11 @@ "@typescript-eslint/no-unused-vars": "warn" }, "extends": [ - "react-app", - "plugin:react-hooks/recommended", "eslint:recommended", + "plugin:react-hooks/recommended", "plugin:@typescript-eslint/recommended" ], - "plugins": ["testing-library", "simple-import-sort"], + "plugins": ["testing-library", "simple-import-sort", "react-refresh"], "overrides": [ { "files": [ @@ -63,6 +62,7 @@ } } ], + "parser": "@typescript-eslint/parser", "parserOptions": { "sourceType": "module", "ecmaVersion": "latest" diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 7b038b38a..37f6f3319 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -40,14 +40,16 @@ "@types/node": "^20.12.6", "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^7.16.0", + "@typescript-eslint/parser": "^7.16.0", "@vite-pwa/assets-generator": "^0.2.4", "@vitejs/plugin-react": "^4.2.1", "@vitest/coverage-v8": "^1.4.0", "@vitest/ui": "^1.2.2", "clsx": "^2.1.0", "eslint": "^8.57.0", - "eslint-config-react-app": "^7.0.1", "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.7", "eslint-plugin-simple-import-sort": "^12.1.0", "eslint-plugin-testing-library": "^6.2.0", "husky": "^9.0.11", @@ -164,33 +166,6 @@ "integrity": "sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg==", "dev": true }, - "node_modules/@babel/eslint-parser": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/eslint-parser/-/eslint-parser-7.24.1.tgz", - "integrity": "sha512-d5guuzMlPeDfZIbpQ8+g1NaCNuAGBBGNECh0HVqz1sjOeVLh2CEaifuOysCH18URW6R7pqXINvf5PaR/dC6jLQ==", - "dev": true, - "dependencies": { - "@nicolo-ribaudo/eslint-scope-5-internals": "5.1.1-v1", - "eslint-visitor-keys": "^2.1.0", - "semver": "^6.3.1" - }, - "engines": { - "node": "^10.13.0 || ^12.13.0 || >=14.0.0" - }, - "peerDependencies": { - "@babel/core": "^7.11.0", - "eslint": "^7.5.0 || ^8.0.0" - } - }, - "node_modules/@babel/eslint-parser/node_modules/eslint-visitor-keys": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/eslint-visitor-keys/-/eslint-visitor-keys-2.1.0.tgz", - "integrity": "sha512-0rSmRBzXgDzIsD6mGdJgevzgezI534Cer5L/vyMX0kHzT/jiB43jRhd9YUlMGYLQy2zprNmoT8qasCGtY+QaKw==", - "dev": true, - "engines": { - "node": ">=10" - } - }, "node_modules/@babel/generator": { "version": "7.24.4", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.24.4.tgz", @@ -687,109 +662,6 @@ "@babel/core": "^7.0.0" } }, - "node_modules/@babel/plugin-proposal-class-properties": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-class-properties/-/plugin-proposal-class-properties-7.18.6.tgz", - "integrity": "sha512-cumfXOF0+nzZrrN8Rf0t7M+tF6sZc7vhQwYQck9q1/5w2OExlD+b4v4RpMJFaV1Z7WcDRgO6FqvxqxGlwo+RHQ==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-class-properties instead.", - "dev": true, - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-decorators": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-decorators/-/plugin-proposal-decorators-7.24.1.tgz", - "integrity": "sha512-zPEvzFijn+hRvJuX2Vu3KbEBN39LN3f7tW3MQO2LsIs57B26KU+kUc82BdAktS1VCM6libzh45eKGI65lg0cpA==", - "dev": true, - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.24.1", - "@babel/helper-plugin-utils": "^7.24.0", - "@babel/plugin-syntax-decorators": "^7.24.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-nullish-coalescing-operator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-nullish-coalescing-operator/-/plugin-proposal-nullish-coalescing-operator-7.18.6.tgz", - "integrity": "sha512-wQxQzxYeJqHcfppzBDnm1yAY0jSRkUXR2z8RePZYrKwMKgMlE8+Z6LUno+bd6LvbGh8Gltvy74+9pIYkr+XkKA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-nullish-coalescing-operator instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-nullish-coalescing-operator": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-numeric-separator": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-numeric-separator/-/plugin-proposal-numeric-separator-7.18.6.tgz", - "integrity": "sha512-ozlZFogPqoLm8WBr5Z8UckIoE4YQ5KESVcNudyXOR8uqIkliTEgJ3RoketfG6pmzLdeZF0H/wjE9/cCEitBl7Q==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-numeric-separator instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.18.6", - "@babel/plugin-syntax-numeric-separator": "^7.10.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-optional-chaining": { - "version": "7.21.0", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-optional-chaining/-/plugin-proposal-optional-chaining-7.21.0.tgz", - "integrity": "sha512-p4zeefM72gpmEe2fkUr/OnOXpWEf8nAgk7ZYVqqfFiyIG7oFfVZcCrU64hWn5xp4tQ9LkV4bTIa5rD0KANpKNA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-optional-chaining instead.", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.20.2", - "@babel/helper-skip-transparent-expression-wrappers": "^7.20.0", - "@babel/plugin-syntax-optional-chaining": "^7.8.3" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-proposal-private-methods": { - "version": "7.18.6", - "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-methods/-/plugin-proposal-private-methods-7.18.6.tgz", - "integrity": "sha512-nutsvktDItsNn4rpGItSNV2sz1XwS+nfU0Rg8aCx3W3NOKVzdMjJRu0O5OkgDp3ZGICSTbgRpxZoWsxoKRvbeA==", - "deprecated": "This proposal has been merged to the ECMAScript standard and thus this plugin is no longer maintained. Please use @babel/plugin-transform-private-methods instead.", - "dev": true, - "dependencies": { - "@babel/helper-create-class-features-plugin": "^7.18.6", - "@babel/helper-plugin-utils": "^7.18.6" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-proposal-private-property-in-object": { "version": "7.21.0-placeholder-for-preset-env.2", "resolved": "https://registry.npmjs.org/@babel/plugin-proposal-private-property-in-object/-/plugin-proposal-private-property-in-object-7.21.0-placeholder-for-preset-env.2.tgz", @@ -841,21 +713,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-decorators": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-decorators/-/plugin-syntax-decorators-7.24.1.tgz", - "integrity": "sha512-05RJdO/cCrtVWuAaSn1tS3bH8jbsJa/Y1uD186u6J4C/1mnHFxseeuWpsqr9anvo7TUulev7tm7GDwRV+VuhDw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-dynamic-import": { "version": "7.8.3", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-dynamic-import/-/plugin-syntax-dynamic-import-7.8.3.tgz", @@ -880,21 +737,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-flow": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-flow/-/plugin-syntax-flow-7.24.1.tgz", - "integrity": "sha512-sxi2kLTI5DeW5vDtMUsk4mTPwvlUDbjOnoWayhynCwrw4QXRld4QEYwqzY8JmQXaJUtgUuCIurtSRH5sn4c7mA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-import-assertions": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-import-assertions/-/plugin-syntax-import-assertions-7.24.1.tgz", @@ -949,21 +791,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-jsx": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-jsx/-/plugin-syntax-jsx-7.24.1.tgz", - "integrity": "sha512-2eCtxZXf+kbkMIsXS4poTvT4Yu5rXiRa+9xGVT56raghjmBTKMpFNc9R4IDiB4emao9eO22Ox7CxuJG7BgExqA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-logical-assignment-operators": { "version": "7.10.4", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-logical-assignment-operators/-/plugin-syntax-logical-assignment-operators-7.10.4.tgz", @@ -1066,21 +893,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-syntax-typescript": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-typescript/-/plugin-syntax-typescript-7.24.1.tgz", - "integrity": "sha512-Yhnmvy5HZEnHUty6i++gcfH1/l68AHnItFHnaCv6hn9dNh0hQvvQJsxpi4BMBFN5DLeHBuucT/0DgzXif/OyRw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-syntax-unicode-sets-regex": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/plugin-syntax-unicode-sets-regex/-/plugin-syntax-unicode-sets-regex-7.18.6.tgz", @@ -1342,22 +1154,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-flow-strip-types": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-flow-strip-types/-/plugin-transform-flow-strip-types-7.24.1.tgz", - "integrity": "sha512-iIYPIWt3dUmUKKE10s3W+jsQ3icFkw0JyRVyY1B7G4yK/nngAOHLVx8xlhA6b/Jzl/Y0nis8gjqhqKtRDQqHWQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0", - "@babel/plugin-syntax-flow": "^7.24.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-for-of": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-for-of/-/plugin-transform-for-of-7.24.1.tgz", @@ -1714,55 +1510,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-react-display-name": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-display-name/-/plugin-transform-react-display-name-7.24.1.tgz", - "integrity": "sha512-mvoQg2f9p2qlpDQRBC7M3c3XTr0k7cp/0+kFKKO/7Gtu0LSw16eKB+Fabe2bDT/UpsyasTBBkAnbdsLrkD5XMw==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx": { - "version": "7.23.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx/-/plugin-transform-react-jsx-7.23.4.tgz", - "integrity": "sha512-5xOpoPguCZCRbo/JeHlloSkTA8Bld1J/E1/kLfD1nsuiW1m8tduTA1ERCgIZokDflX/IBzKcqR3l7VlRgiIfHA==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-module-imports": "^7.22.15", - "@babel/helper-plugin-utils": "^7.22.5", - "@babel/plugin-syntax-jsx": "^7.23.3", - "@babel/types": "^7.23.4" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/plugin-transform-react-jsx-development": { - "version": "7.22.5", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-development/-/plugin-transform-react-jsx-development-7.22.5.tgz", - "integrity": "sha512-bDhuzwWMuInwCYeDeMzyi7TaBgRQei6DqxhbyniL7/VG4RSS7HtSL2QbY4eESy1KJqlWt8g3xeEBGPuo+XqC8A==", - "dev": true, - "dependencies": { - "@babel/plugin-transform-react-jsx": "^7.22.5" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-react-jsx-self": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-jsx-self/-/plugin-transform-react-jsx-self-7.24.1.tgz", @@ -1793,22 +1540,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-react-pure-annotations": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-react-pure-annotations/-/plugin-transform-react-pure-annotations-7.24.1.tgz", - "integrity": "sha512-+pWEAaDJvSm9aFvJNpLiM2+ktl2Sn2U5DdyiWdZBxmLc6+xGt88dvFqsHiAiDS+8WqUwbDfkKz9jRxK3M0k+kA==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-plugin-utils": "^7.24.0" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-regenerator": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-regenerator/-/plugin-transform-regenerator-7.24.1.tgz", @@ -1840,26 +1571,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-runtime": { - "version": "7.24.3", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-runtime/-/plugin-transform-runtime-7.24.3.tgz", - "integrity": "sha512-J0BuRPNlNqlMTRJ72eVptpt9VcInbxO6iP3jaxr+1NPhC0UkKL+6oeX6VXMEYdADnuqmMmsBspt4d5w8Y/TCbQ==", - "dev": true, - "dependencies": { - "@babel/helper-module-imports": "^7.24.3", - "@babel/helper-plugin-utils": "^7.24.0", - "babel-plugin-polyfill-corejs2": "^0.4.10", - "babel-plugin-polyfill-corejs3": "^0.10.1", - "babel-plugin-polyfill-regenerator": "^0.6.1", - "semver": "^6.3.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-shorthand-properties": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-shorthand-properties/-/plugin-transform-shorthand-properties-7.24.1.tgz", @@ -1936,24 +1647,6 @@ "@babel/core": "^7.0.0-0" } }, - "node_modules/@babel/plugin-transform-typescript": { - "version": "7.24.4", - "resolved": "https://registry.npmjs.org/@babel/plugin-transform-typescript/-/plugin-transform-typescript-7.24.4.tgz", - "integrity": "sha512-79t3CQ8+oBGk/80SQ8MN3Bs3obf83zJ0YZjDmDaEZN8MqhMI760apl5z6a20kFeMXBwJX99VpKT8CKxEBp5H1g==", - "dev": true, - "dependencies": { - "@babel/helper-annotate-as-pure": "^7.22.5", - "@babel/helper-create-class-features-plugin": "^7.24.4", - "@babel/helper-plugin-utils": "^7.24.0", - "@babel/plugin-syntax-typescript": "^7.24.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/plugin-transform-unicode-escapes": { "version": "7.24.1", "resolved": "https://registry.npmjs.org/@babel/plugin-transform-unicode-escapes/-/plugin-transform-unicode-escapes-7.24.1.tgz", @@ -2126,45 +1819,6 @@ "@babel/core": "^7.0.0-0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/@babel/preset-react": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/preset-react/-/preset-react-7.24.1.tgz", - "integrity": "sha512-eFa8up2/8cZXLIpkafhaADTXSnl7IsUFCYenRWrARBz0/qZwcT0RBXpys0LJU4+WfPoF2ZG6ew6s2V6izMCwRA==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0", - "@babel/helper-validator-option": "^7.23.5", - "@babel/plugin-transform-react-display-name": "^7.24.1", - "@babel/plugin-transform-react-jsx": "^7.23.4", - "@babel/plugin-transform-react-jsx-development": "^7.22.5", - "@babel/plugin-transform-react-pure-annotations": "^7.24.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, - "node_modules/@babel/preset-typescript": { - "version": "7.24.1", - "resolved": "https://registry.npmjs.org/@babel/preset-typescript/-/preset-typescript-7.24.1.tgz", - "integrity": "sha512-1DBaMmRDpuYQBPWD8Pf/WEwCrtgRHxsZnP4mIy9G/X+hFfbI47Q2G4t1Paakld84+qsk2fSsUPMKg71jkoOOaQ==", - "dev": true, - "dependencies": { - "@babel/helper-plugin-utils": "^7.24.0", - "@babel/helper-validator-option": "^7.23.5", - "@babel/plugin-syntax-jsx": "^7.24.1", - "@babel/plugin-transform-modules-commonjs": "^7.24.1", - "@babel/plugin-transform-typescript": "^7.24.1" - }, - "engines": { - "node": ">=6.9.0" - }, - "peerDependencies": { - "@babel/core": "^7.0.0-0" - } - }, "node_modules/@babel/regjsgen": { "version": "0.8.0", "resolved": "https://registry.npmjs.org/@babel/regjsgen/-/regjsgen-0.8.0.tgz", @@ -3058,37 +2712,6 @@ "react": "^18.2.0" } }, - "node_modules/@nicolo-ribaudo/eslint-scope-5-internals": { - "version": "5.1.1-v1", - "resolved": "https://registry.npmjs.org/@nicolo-ribaudo/eslint-scope-5-internals/-/eslint-scope-5-internals-5.1.1-v1.tgz", - "integrity": "sha512-54/JRvkLIzzDWshCWfuhadfrfZVPiElY8Fcgmg1HroEly/EDSszzhBAsarCux+D/kOslTRquNzuyGSmUSTTHGg==", - "dev": true, - "dependencies": { - "eslint-scope": "5.1.1" - } - }, - "node_modules/@nicolo-ribaudo/eslint-scope-5-internals/node_modules/eslint-scope": { - "version": "5.1.1", - "resolved": "https://registry.npmjs.org/eslint-scope/-/eslint-scope-5.1.1.tgz", - "integrity": "sha512-2NxwbF/hZ0KpepYN0cNbo+FN6XoK7GaHlQhgx/hIZl6Va0bF45RQOOwhLIy8lQDbuCiadSLCBnH2CFYquit5bw==", - "dev": true, - "dependencies": { - "esrecurse": "^4.3.0", - "estraverse": "^4.1.1" - }, - "engines": { - "node": ">=8.0.0" - } - }, - "node_modules/@nicolo-ribaudo/eslint-scope-5-internals/node_modules/estraverse": { - "version": "4.3.0", - "resolved": "https://registry.npmjs.org/estraverse/-/estraverse-4.3.0.tgz", - "integrity": "sha512-39nnKffWz8xN1BU/2c79n9nB9HDzo0niYUqx6xyqUnyoAnQyyWpOTdZEeiCch8BBu515t4wp9ZmgVfVhn9EBpw==", - "dev": true, - "engines": { - "node": ">=4.0" - } - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -3412,12 +3035,6 @@ "win32" ] }, - "node_modules/@rushstack/eslint-patch": { - "version": "1.10.1", - "resolved": "https://registry.npmjs.org/@rushstack/eslint-patch/-/eslint-patch-1.10.1.tgz", - "integrity": "sha512-S3Kq8e7LqxkA9s7HKLqXGTGck1uwis5vAXan3FnU5yw1Ec5hsSGnq4s/UCaSqABPOnOTg7zASLyst7+ohgWexg==", - "dev": true - }, "node_modules/@sinclair/typebox": { "version": "0.27.8", "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", @@ -3842,12 +3459,6 @@ "integrity": "sha512-5+fP8P8MFNC+AyZCDxrB2pkZFPGzqQWUzpSeuuVLvm8VMcorNYavBqoFcxK8bQz4Qsbn4oUEEem4wDLfcysGHA==", "dev": true }, - "node_modules/@types/json5": { - "version": "0.0.29", - "resolved": "https://registry.npmjs.org/@types/json5/-/json5-0.0.29.tgz", - "integrity": "sha512-dRLjCWHYg4oaA77cxO64oO+7JwCwnIzkZPdrrC71jQmQtlhM556pwKo5bUzqvZndkVbeFLIIi+9TC40JNF5hNQ==", - "dev": true - }, "node_modules/@types/lodash": { "version": "4.17.1", "resolved": "https://registry.npmjs.org/@types/lodash/-/lodash-4.17.1.tgz", @@ -3863,12 +3474,6 @@ "undici-types": "~5.26.4" } }, - "node_modules/@types/parse-json": { - "version": "4.0.2", - "resolved": "https://registry.npmjs.org/@types/parse-json/-/parse-json-4.0.2.tgz", - "integrity": "sha512-dISoDXWWQwUquiKsyZ4Ng+HX2KsPL7LyHKHQwgGFEA3IaKac4Obd+h2a/a6waisAoepJlBcx9paWqjA8/HVjCw==", - "dev": true - }, "node_modules/@types/prop-types": { "version": "15.7.12", "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.12.tgz", @@ -3936,32 +3541,32 @@ "dev": true }, "node_modules/@typescript-eslint/eslint-plugin": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-5.62.0.tgz", - "integrity": "sha512-TiZzBSJja/LbhNPvk6yc0JrX9XqhQ0hdh6M2svYfsHGejaKFIAGd9MQ+ERIMzLGlN/kZoYIgdxFV0PuljTKXag==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/eslint-plugin/-/eslint-plugin-7.16.0.tgz", + "integrity": "sha512-py1miT6iQpJcs1BiJjm54AMzeuMPBSPuKPlnT8HlfudbcS5rYeX5jajpLf3mrdRh9dA/Ec2FVUY0ifeVNDIhZw==", "dev": true, + "license": "MIT", "dependencies": { - "@eslint-community/regexpp": "^4.4.0", - "@typescript-eslint/scope-manager": "5.62.0", - "@typescript-eslint/type-utils": "5.62.0", - "@typescript-eslint/utils": "5.62.0", - "debug": "^4.3.4", + "@eslint-community/regexpp": "^4.10.0", + "@typescript-eslint/scope-manager": "7.16.0", + "@typescript-eslint/type-utils": "7.16.0", + "@typescript-eslint/utils": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", "graphemer": "^1.4.0", - "ignore": "^5.2.0", - "natural-compare-lite": "^1.4.0", - "semver": "^7.3.7", - "tsutils": "^3.21.0" + "ignore": "^5.3.1", + "natural-compare": "^1.4.0", + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "@typescript-eslint/parser": "^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "@typescript-eslint/parser": "^7.0.0", + "eslint": "^8.56.0" }, "peerDependenciesMeta": { "typescript": { @@ -3969,26 +3574,140 @@ } } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/lru-cache": { - "version": "6.0.0", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", - "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/scope-manager": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.16.0.tgz", + "integrity": "sha512-8gVv3kW6n01Q6TrI1cmTZ9YMFi3ucDT7i7aI5lEikk2ebk1AEjrwX8MDTdaX5D7fPXMBLvnsaa0IFTAu+jcfOw==", "dev": true, + "license": "MIT", "dependencies": { - "yallist": "^4.0.0" + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0" }, "engines": { - "node": ">=10" + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { - "version": "7.6.0", - "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.0.tgz", - "integrity": "sha512-EnwXhrlwXMk9gKu5/flx5sv/an57AkRplG3hTK68W7FRDN+k+OWBj65M7719OkA82XLBxrcX0KSHj+X5COhOVg==", + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.16.0.tgz", + "integrity": "sha512-fecuH15Y+TzlUutvUl9Cc2XJxqdLr7+93SQIbcZfd4XRGGKoxyljK27b+kxKamjRkU7FYC6RrbSCg0ALcZn/xw==", "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.16.0.tgz", + "integrity": "sha512-a5NTvk51ZndFuOLCh5OaJBELYc2O3Zqxfl3Js78VFE1zE46J2AaVuW+rEbVkQznjkmlzWsUI15BG5tQMixzZLw==", + "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "lru-cache": "^6.0.0" + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/utils": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.16.0.tgz", + "integrity": "sha512-PqP4kP3hb4r7Jav+NiRCntlVzhxBNWq6ZQ+zQwII1y/G/1gdIPeYDCKr2+dH6049yJQsWZiHU6RlwvIFBXXGNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.16.0", + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/typescript-estree": "7.16.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.16.0.tgz", + "integrity": "sha512-rMo01uPy9C7XxG7AFsxa8zLnWXTF8N3PYclekWSrurvhwiw1eW88mrKiAYe6s53AUY57nTRz8dJsuuXdkAhzCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.16.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/eslint-plugin/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "license": "ISC", "bin": { "semver": "bin/semver.js" }, @@ -3996,51 +3715,89 @@ "node": ">=10" } }, - "node_modules/@typescript-eslint/eslint-plugin/node_modules/yallist": { - "version": "4.0.0", - "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", - "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", - "dev": true - }, - "node_modules/@typescript-eslint/experimental-utils": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-5.62.0.tgz", - "integrity": "sha512-RTXpeB3eMkpoclG3ZHft6vG/Z30azNHuqY6wKPBHlVMZFuEvrtlEDe8gMqDb+SO+9hjC/pLekeSCryf9vMZlCw==", + "node_modules/@typescript-eslint/parser": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-7.16.0.tgz", + "integrity": "sha512-ar9E+k7CU8rWi2e5ErzQiC93KKEFAXA2Kky0scAlPcxYblLt8+XZuHUZwlyfXILyQa95P6lQg+eZgh/dDs3+Vw==", "dev": true, + "license": "BSD-2-Clause", "dependencies": { - "@typescript-eslint/utils": "5.62.0" + "@typescript-eslint/scope-manager": "7.16.0", + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/typescript-estree": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", + "debug": "^4.3.4" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } } }, - "node_modules/@typescript-eslint/parser": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-5.62.0.tgz", - "integrity": "sha512-VlJEV0fOQ7BExOsHYAGrgbEiZoi8D+Bl2+f6V2RrXerRSylnp+ZBHmPvaIa8cz0Ajx7WO7Z5RqfgYg7ED1nRhA==", + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/scope-manager": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.16.0.tgz", + "integrity": "sha512-8gVv3kW6n01Q6TrI1cmTZ9YMFi3ucDT7i7aI5lEikk2ebk1AEjrwX8MDTdaX5D7fPXMBLvnsaa0IFTAu+jcfOw==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/scope-manager": "5.62.0", - "@typescript-eslint/types": "5.62.0", - "@typescript-eslint/typescript-estree": "5.62.0", - "debug": "^4.3.4" + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.16.0.tgz", + "integrity": "sha512-fecuH15Y+TzlUutvUl9Cc2XJxqdLr7+93SQIbcZfd4XRGGKoxyljK27b+kxKamjRkU7FYC6RrbSCg0ALcZn/xw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || >=20.0.0" }, - "peerDependencies": { - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.16.0.tgz", + "integrity": "sha512-a5NTvk51ZndFuOLCh5OaJBELYc2O3Zqxfl3Js78VFE1zE46J2AaVuW+rEbVkQznjkmlzWsUI15BG5tQMixzZLw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, "peerDependenciesMeta": { "typescript": { @@ -4048,6 +3805,63 @@ } } }, + "node_modules/@typescript-eslint/parser/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.16.0.tgz", + "integrity": "sha512-rMo01uPy9C7XxG7AFsxa8zLnWXTF8N3PYclekWSrurvhwiw1eW88mrKiAYe6s53AUY57nTRz8dJsuuXdkAhzCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.16.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/parser/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/scope-manager": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-5.62.0.tgz", @@ -4066,25 +3880,87 @@ } }, "node_modules/@typescript-eslint/type-utils": { - "version": "5.62.0", - "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-5.62.0.tgz", - "integrity": "sha512-xsSQreu+VnfbqQpW5vnCJdq1Z3Q0U31qiWmRhr98ONQmcp/yhiPJFPq8MXiJVLiksmOKSjIldZzkebzHuCGzew==", + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/type-utils/-/type-utils-7.16.0.tgz", + "integrity": "sha512-j0fuUswUjDHfqV/UdW6mLtOQQseORqfdmoBNDFOqs9rvNVR2e+cmu6zJu/Ku4SDuqiJko6YnhwcL8x45r8Oqxg==", "dev": true, + "license": "MIT", "dependencies": { - "@typescript-eslint/typescript-estree": "5.62.0", - "@typescript-eslint/utils": "5.62.0", + "@typescript-eslint/typescript-estree": "7.16.0", + "@typescript-eslint/utils": "7.16.0", "debug": "^4.3.4", - "tsutils": "^3.21.0" + "ts-api-utils": "^1.3.0" }, "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0" + "node": "^18.18.0 || >=20.0.0" }, "funding": { "type": "opencollective", "url": "https://opencollective.com/typescript-eslint" }, "peerDependencies": { - "eslint": "*" + "eslint": "^8.56.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/scope-manager": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/scope-manager/-/scope-manager-7.16.0.tgz", + "integrity": "sha512-8gVv3kW6n01Q6TrI1cmTZ9YMFi3ucDT7i7aI5lEikk2ebk1AEjrwX8MDTdaX5D7fPXMBLvnsaa0IFTAu+jcfOw==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-7.16.0.tgz", + "integrity": "sha512-fecuH15Y+TzlUutvUl9Cc2XJxqdLr7+93SQIbcZfd4XRGGKoxyljK27b+kxKamjRkU7FYC6RrbSCg0ALcZn/xw==", + "dev": true, + "license": "MIT", + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/typescript-estree": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-7.16.0.tgz", + "integrity": "sha512-a5NTvk51ZndFuOLCh5OaJBELYc2O3Zqxfl3Js78VFE1zE46J2AaVuW+rEbVkQznjkmlzWsUI15BG5tQMixzZLw==", + "dev": true, + "license": "BSD-2-Clause", + "dependencies": { + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/visitor-keys": "7.16.0", + "debug": "^4.3.4", + "globby": "^11.1.0", + "is-glob": "^4.0.3", + "minimatch": "^9.0.4", + "semver": "^7.6.0", + "ts-api-utils": "^1.3.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" }, "peerDependenciesMeta": { "typescript": { @@ -4092,6 +3968,86 @@ } } }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/utils": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/utils/-/utils-7.16.0.tgz", + "integrity": "sha512-PqP4kP3hb4r7Jav+NiRCntlVzhxBNWq6ZQ+zQwII1y/G/1gdIPeYDCKr2+dH6049yJQsWZiHU6RlwvIFBXXGNA==", + "dev": true, + "license": "MIT", + "dependencies": { + "@eslint-community/eslint-utils": "^4.4.0", + "@typescript-eslint/scope-manager": "7.16.0", + "@typescript-eslint/types": "7.16.0", + "@typescript-eslint/typescript-estree": "7.16.0" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + }, + "peerDependencies": { + "eslint": "^8.56.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/@typescript-eslint/visitor-keys": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/@typescript-eslint/visitor-keys/-/visitor-keys-7.16.0.tgz", + "integrity": "sha512-rMo01uPy9C7XxG7AFsxa8zLnWXTF8N3PYclekWSrurvhwiw1eW88mrKiAYe6s53AUY57nTRz8dJsuuXdkAhzCg==", + "dev": true, + "license": "MIT", + "dependencies": { + "@typescript-eslint/types": "7.16.0", + "eslint-visitor-keys": "^3.4.3" + }, + "engines": { + "node": "^18.18.0 || >=20.0.0" + }, + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/typescript-eslint" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dev": true, + "license": "MIT", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/minimatch": { + "version": "9.0.5", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.5.tgz", + "integrity": "sha512-G6T0ZX48xgozx7587koeX9Ys2NYy6Gmv//P89sEte9V9whIapMNF4idKxnW2QtCcLiTWlb/wfCabAtAFWhhBow==", + "dev": true, + "license": "ISC", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@typescript-eslint/type-utils/node_modules/semver": { + "version": "7.6.2", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.6.2.tgz", + "integrity": "sha512-FNAIBWCx9qcRhoHcgcJ0gvU7SN1lYU2ZXuSfl04bSC5OpvDHFyJCjdNHomPXxjQlCBU67YW64PzY7/VIEH7F2w==", + "dev": true, + "license": "ISC", + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/@typescript-eslint/types": { "version": "5.62.0", "resolved": "https://registry.npmjs.org/@typescript-eslint/types/-/types-5.62.0.tgz", @@ -4628,137 +4584,32 @@ "picomatch": "^2.0.4" }, "engines": { - "node": ">= 8" - } - }, - "node_modules/argparse": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", - "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", - "dev": true - }, - "node_modules/aria-query": { - "version": "5.3.0", - "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", - "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", - "dev": true, - "dependencies": { - "dequal": "^2.0.3" - } - }, - "node_modules/array-buffer-byte-length": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", - "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "is-array-buffer": "^3.0.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array-includes": { - "version": "3.1.8", - "resolved": "https://registry.npmjs.org/array-includes/-/array-includes-3.1.8.tgz", - "integrity": "sha512-itaWrbYbqpGXkGhZPGUulwnhVf5Hpy1xiCFsGqyIGglbBxmG5vSjxQen3/WGOjPpNEv1RtBLKxbmVXm8HpJStQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0", - "get-intrinsic": "^1.2.4", - "is-string": "^1.0.7" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array-union": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", - "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", - "dev": true, - "engines": { - "node": ">=8" - } - }, - "node_modules/array.prototype.findlast": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.findlast/-/array.prototype.findlast-1.2.5.tgz", - "integrity": "sha512-CVvd6FHg1Z3POpBLxO6E6zr+rSKEQ9L6rZHAaY7lLfhKsWYUBBOuMs0e9o24oopj6H+geRCX0YJ+TJLBK2eHyQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "es-shim-unscopables": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/array.prototype.findlastindex": { - "version": "1.2.5", - "resolved": "https://registry.npmjs.org/array.prototype.findlastindex/-/array.prototype.findlastindex-1.2.5.tgz", - "integrity": "sha512-zfETvRFA8o7EiNn++N5f/kaCw221hrpGsDmcpndVupkPzEc1Wuf3VgC0qby1BbHs7f5DVYjgtEU2LLh5bqeGfQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-errors": "^1.3.0", - "es-object-atoms": "^1.0.0", - "es-shim-unscopables": "^1.0.2" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "node": ">= 8" } }, - "node_modules/array.prototype.flat": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flat/-/array.prototype.flat-1.3.2.tgz", - "integrity": "sha512-djYB+Zx2vLewY8RWlNCUdHjDXs2XOgm602S9E7P/UpHgfeHL00cRiIF+IN/G/aUJ7kGPb6yO/ErDI5V2s8iycA==", + "node_modules/argparse": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/argparse/-/argparse-2.0.1.tgz", + "integrity": "sha512-8+9WqebbFzpX9OR+Wa6O29asIogeRMzcGtAINdpMHHyAg10f05aSFVBbcEqGf/PXw1EjAZ+q2/bEBg3DvurK3Q==", + "dev": true + }, + "node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "dequal": "^2.0.3" } }, - "node_modules/array.prototype.flatmap": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/array.prototype.flatmap/-/array.prototype.flatmap-1.3.2.tgz", - "integrity": "sha512-Ewyx0c9PmpcsByhSW4r+9zDU7sGjFc86qf/kKtuSCRdhfbk0SNLLkaT5qvcHnRGgc5NP/ly/y+qkXkqONX54CQ==", + "node_modules/array-buffer-byte-length": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz", + "integrity": "sha512-ahC5W1xgou+KTXix4sAO8Ki12Q+jf4i0+tmk3sC+zgcynshkHxzpXdImBehiUYKKKDwvfFiJl1tZt6ewscS1Mg==", "dev": true, "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" + "call-bind": "^1.0.5", + "is-array-buffer": "^3.0.4" }, "engines": { "node": ">= 0.4" @@ -4767,29 +4618,13 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/array.prototype.toreversed": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/array.prototype.toreversed/-/array.prototype.toreversed-1.1.2.tgz", - "integrity": "sha512-wwDCoT4Ck4Cz7sLtgUmzR5UV3YF5mFHUlbChCzZBQZ+0m2cl/DH3tKgvphv1nKgFsJ48oCSg6p91q2Vm0I/ZMA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2", - "define-properties": "^1.2.0", - "es-abstract": "^1.22.1", - "es-shim-unscopables": "^1.0.0" - } - }, - "node_modules/array.prototype.tosorted": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/array.prototype.tosorted/-/array.prototype.tosorted-1.1.3.tgz", - "integrity": "sha512-/DdH4TiTmOKzyQbp/eadcCVexiCb36xJg7HshYOYJnNZFDj33GEv0P7GxsynpShhq4OLYJzbGcBDkLsDt7MnNg==", + "node_modules/array-union": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/array-union/-/array-union-2.1.0.tgz", + "integrity": "sha512-HGyxoOTYUyCM6stUe6EJgnd4EoewAI7zMdfqO+kGjnlZmBDz/cR5pf8r/cR4Wq60sL/p0IkcjUEEPwS3GFrIyw==", "dev": true, - "dependencies": { - "call-bind": "^1.0.5", - "define-properties": "^1.2.1", - "es-abstract": "^1.22.3", - "es-errors": "^1.1.0", - "es-shim-unscopables": "^1.0.2" + "engines": { + "node": ">=8" } }, "node_modules/arraybuffer.prototype.slice": { @@ -4823,12 +4658,6 @@ "node": "*" } }, - "node_modules/ast-types-flow": { - "version": "0.0.8", - "resolved": "https://registry.npmjs.org/ast-types-flow/-/ast-types-flow-0.0.8.tgz", - "integrity": "sha512-OH/2E5Fg20h2aPrbe+QL8JZQFko0YZaF+j4mnQ7BGhfavO7OpSLa8a0y9sBwomHdSbkhTS8TQNayBfnW5DwbvQ==", - "dev": true - }, "node_modules/async": { "version": "3.2.5", "resolved": "https://registry.npmjs.org/async/-/async-3.2.5.tgz", @@ -4866,15 +4695,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/axe-core": { - "version": "4.7.0", - "resolved": "https://registry.npmjs.org/axe-core/-/axe-core-4.7.0.tgz", - "integrity": "sha512-M0JtH+hlOL5pLQwHOLNYZaXuhqmvS8oExsqB1SBYgA4Dk7u/xx+YdGHXaK5pyUfed5mYXdlYiphWq3G8cRi5JQ==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/axios": { "version": "1.6.8", "resolved": "https://registry.npmjs.org/axios/-/axios-1.6.8.tgz", @@ -4885,15 +4705,6 @@ "proxy-from-env": "^1.1.0" } }, - "node_modules/axobject-query": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/axobject-query/-/axobject-query-3.2.1.tgz", - "integrity": "sha512-jsyHu61e6N4Vbz/v18DHwWYKK0bSWLqn47eeDSKPB7m8tqMHF9YJ+mhIk2lVteyZrY8tnSj/jHOv4YiTCuCJgg==", - "dev": true, - "dependencies": { - "dequal": "^2.0.3" - } - }, "node_modules/b4a": { "version": "1.6.6", "resolved": "https://registry.npmjs.org/b4a/-/b4a-1.6.6.tgz", @@ -4901,21 +4712,6 @@ "dev": true, "license": "Apache-2.0" }, - "node_modules/babel-plugin-macros": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/babel-plugin-macros/-/babel-plugin-macros-3.1.0.tgz", - "integrity": "sha512-Cg7TFGpIr01vOQNODXOOaGz2NpCU5gl8x1qJFbb6hbZxR7XrcE2vtbAsTAbJ7/xwJtUuJEw8K8Zr/AE0LHlesg==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.12.5", - "cosmiconfig": "^7.0.0", - "resolve": "^1.19.0" - }, - "engines": { - "node": ">=10", - "npm": ">=6" - } - }, "node_modules/babel-plugin-polyfill-corejs2": { "version": "0.4.10", "resolved": "https://registry.npmjs.org/babel-plugin-polyfill-corejs2/-/babel-plugin-polyfill-corejs2-0.4.10.tgz", @@ -4955,36 +4751,6 @@ "@babel/core": "^7.4.0 || ^8.0.0-0 <8.0.0" } }, - "node_modules/babel-plugin-transform-react-remove-prop-types": { - "version": "0.4.24", - "resolved": "https://registry.npmjs.org/babel-plugin-transform-react-remove-prop-types/-/babel-plugin-transform-react-remove-prop-types-0.4.24.tgz", - "integrity": "sha512-eqj0hVcJUR57/Ug2zE1Yswsw4LhuqqHhD+8v120T1cl3kjg76QwtyBrdIk4WVwK+lAhBJVYCd/v+4nc4y+8JsA==", - "dev": true - }, - "node_modules/babel-preset-react-app": { - "version": "10.0.1", - "resolved": "https://registry.npmjs.org/babel-preset-react-app/-/babel-preset-react-app-10.0.1.tgz", - "integrity": "sha512-b0D9IZ1WhhCWkrTXyFuIIgqGzSkRIH5D5AmB0bXbzYAB1OBAwHcUeyWW2LorutLWF5btNo/N7r/cIdmvvKJlYg==", - "dev": true, - "dependencies": { - "@babel/core": "^7.16.0", - "@babel/plugin-proposal-class-properties": "^7.16.0", - "@babel/plugin-proposal-decorators": "^7.16.4", - "@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.0", - "@babel/plugin-proposal-numeric-separator": "^7.16.0", - "@babel/plugin-proposal-optional-chaining": "^7.16.0", - "@babel/plugin-proposal-private-methods": "^7.16.0", - "@babel/plugin-transform-flow-strip-types": "^7.16.0", - "@babel/plugin-transform-react-display-name": "^7.16.0", - "@babel/plugin-transform-runtime": "^7.16.4", - "@babel/preset-env": "^7.16.4", - "@babel/preset-react": "^7.16.0", - "@babel/preset-typescript": "^7.16.0", - "@babel/runtime": "^7.16.3", - "babel-plugin-macros": "^3.1.0", - "babel-plugin-transform-react-remove-prop-types": "^0.4.24" - } - }, "node_modules/balanced-match": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", @@ -5450,12 +5216,6 @@ "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==", "dev": true }, - "node_modules/confusing-browser-globals": { - "version": "1.0.11", - "resolved": "https://registry.npmjs.org/confusing-browser-globals/-/confusing-browser-globals-1.0.11.tgz", - "integrity": "sha512-JsPKdmh8ZkmnHxDk55FZ1TqVLvEQTvoByJZRN9jzI0UjxK/QgAmsphz7PGtqgPieQZ/CQcHWXCR7ATDNhGe+YA==", - "dev": true - }, "node_modules/consola": { "version": "3.2.3", "resolved": "https://registry.npmjs.org/consola/-/consola-3.2.3.tgz", @@ -5479,31 +5239,6 @@ "url": "https://opencollective.com/core-js" } }, - "node_modules/cosmiconfig": { - "version": "7.1.0", - "resolved": "https://registry.npmjs.org/cosmiconfig/-/cosmiconfig-7.1.0.tgz", - "integrity": "sha512-AdmX6xUzdNASswsFtmwSt7Vj8po9IuqXm0UXz7QKPuEUmPB4XyjGfaAr2PSuELMwkRMVH1EpIkX5bTZGRB3eCA==", - "dev": true, - "dependencies": { - "@types/parse-json": "^4.0.0", - "import-fresh": "^3.2.1", - "parse-json": "^5.0.0", - "path-type": "^4.0.0", - "yaml": "^1.10.0" - }, - "engines": { - "node": ">=10" - } - }, - "node_modules/cosmiconfig/node_modules/yaml": { - "version": "1.10.2", - "resolved": "https://registry.npmjs.org/yaml/-/yaml-1.10.2.tgz", - "integrity": "sha512-r3vXyErRCYJ7wg28yvBY5VSoAF8ZvlcW9/BwUzEtUsjvX/DKs24dIkuwjtuprwJJHsbyUbLApepYTR1BN4uHrg==", - "dev": true, - "engines": { - "node": ">= 6" - } - }, "node_modules/cross-spawn": { "version": "7.0.3", "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", @@ -5684,12 +5419,6 @@ "node": ">=12" } }, - "node_modules/damerau-levenshtein": { - "version": "1.0.8", - "resolved": "https://registry.npmjs.org/damerau-levenshtein/-/damerau-levenshtein-1.0.8.tgz", - "integrity": "sha512-sdQSFB7+llfUcQHUQO3+B8ERRj0Oa4w9POWMI/puGtuf7gFywGmkaLCElnudfTiKZV+NvHqL0ifzdrI8Ro7ESA==", - "dev": true - }, "node_modules/data-urls": { "version": "5.0.0", "resolved": "https://registry.npmjs.org/data-urls/-/data-urls-5.0.0.tgz", @@ -6008,12 +5737,6 @@ "integrity": "sha512-oJRPo82XEqtQAobHpJIR3zW5YO3sSRRkPz2an4yxi1UvqhsGm54vR/wzTFV74a3soDOJ8CKW7ajOOX5ESzddwg==", "dev": true }, - "node_modules/emoji-regex": { - "version": "9.2.2", - "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", - "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", - "dev": true - }, "node_modules/end-of-stream": { "version": "1.4.4", "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.4.tgz", @@ -6057,15 +5780,6 @@ "url": "https://github.com/fb55/entities?sponsor=1" } }, - "node_modules/error-ex": { - "version": "1.3.2", - "resolved": "https://registry.npmjs.org/error-ex/-/error-ex-1.3.2.tgz", - "integrity": "sha512-7dFHNmqeFSEt2ZBsCriorKnn3Z2pj+fd9kmI6QoWw4//DL+icEBfc0U7qJCisqrTsKTjw4fNFy2pW9OqStD84g==", - "dev": true, - "dependencies": { - "is-arrayish": "^0.2.1" - } - }, "node_modules/es-abstract": { "version": "1.23.3", "resolved": "https://registry.npmjs.org/es-abstract/-/es-abstract-1.23.3.tgz", @@ -6147,31 +5861,6 @@ "node": ">= 0.4" } }, - "node_modules/es-iterator-helpers": { - "version": "1.0.18", - "resolved": "https://registry.npmjs.org/es-iterator-helpers/-/es-iterator-helpers-1.0.18.tgz", - "integrity": "sha512-scxAJaewsahbqTYrGKJihhViaM6DDZDDoucfvzNbK0pOren1g/daDQ3IAhzn+1G14rBG7w+i5N+qul60++zlKA==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.0", - "es-errors": "^1.3.0", - "es-set-tostringtag": "^2.0.3", - "function-bind": "^1.1.2", - "get-intrinsic": "^1.2.4", - "globalthis": "^1.0.3", - "has-property-descriptors": "^1.0.2", - "has-proto": "^1.0.3", - "has-symbols": "^1.0.3", - "internal-slot": "^1.0.7", - "iterator.prototype": "^1.1.2", - "safe-array-concat": "^1.1.2" - }, - "engines": { - "node": ">= 0.4" - } - }, "node_modules/es-object-atoms": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/es-object-atoms/-/es-object-atoms-1.0.0.tgz", @@ -6198,15 +5887,6 @@ "node": ">= 0.4" } }, - "node_modules/es-shim-unscopables": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/es-shim-unscopables/-/es-shim-unscopables-1.0.2.tgz", - "integrity": "sha512-J3yBRXCzDu4ULnQwxyToo/OjdMx6akgVC7K6few0a7F/0wLtmKKN7I73AH5T2836UuXRqN7Qg+IIUw/+YJksRw==", - "dev": true, - "dependencies": { - "hasown": "^2.0.0" - } - }, "node_modules/es-to-primitive": { "version": "1.2.1", "resolved": "https://registry.npmjs.org/es-to-primitive/-/es-to-primitive-1.2.1.tgz", @@ -6338,252 +6018,6 @@ "url": "https://opencollective.com/eslint" } }, - "node_modules/eslint-config-react-app": { - "version": "7.0.1", - "resolved": "https://registry.npmjs.org/eslint-config-react-app/-/eslint-config-react-app-7.0.1.tgz", - "integrity": "sha512-K6rNzvkIeHaTd8m/QEh1Zko0KI7BACWkkneSs6s9cKZC/J27X3eZR6Upt1jkmZ/4FK+XUOPPxMEN7+lbUXfSlA==", - "dev": true, - "dependencies": { - "@babel/core": "^7.16.0", - "@babel/eslint-parser": "^7.16.3", - "@rushstack/eslint-patch": "^1.1.0", - "@typescript-eslint/eslint-plugin": "^5.5.0", - "@typescript-eslint/parser": "^5.5.0", - "babel-preset-react-app": "^10.0.1", - "confusing-browser-globals": "^1.0.11", - "eslint-plugin-flowtype": "^8.0.3", - "eslint-plugin-import": "^2.25.3", - "eslint-plugin-jest": "^25.3.0", - "eslint-plugin-jsx-a11y": "^6.5.1", - "eslint-plugin-react": "^7.27.1", - "eslint-plugin-react-hooks": "^4.3.0", - "eslint-plugin-testing-library": "^5.0.1" - }, - "engines": { - "node": ">=14.0.0" - }, - "peerDependencies": { - "eslint": "^8.0.0" - } - }, - "node_modules/eslint-config-react-app/node_modules/eslint-plugin-testing-library": { - "version": "5.11.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-testing-library/-/eslint-plugin-testing-library-5.11.1.tgz", - "integrity": "sha512-5eX9e1Kc2PqVRed3taaLnAAqPZGEX75C+M/rXzUAI3wIg/ZxzUm1OVAwfe/O+vE+6YXOLetSe9g5GKD2ecXipw==", - "dev": true, - "dependencies": { - "@typescript-eslint/utils": "^5.58.0" - }, - "engines": { - "node": "^12.22.0 || ^14.17.0 || >=16.0.0", - "npm": ">=6" - }, - "peerDependencies": { - "eslint": "^7.5.0 || ^8.0.0" - } - }, - "node_modules/eslint-import-resolver-node": { - "version": "0.3.9", - "resolved": "https://registry.npmjs.org/eslint-import-resolver-node/-/eslint-import-resolver-node-0.3.9.tgz", - "integrity": "sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==", - "dev": true, - "dependencies": { - "debug": "^3.2.7", - "is-core-module": "^2.13.0", - "resolve": "^1.22.4" - } - }, - "node_modules/eslint-import-resolver-node/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-module-utils": { - "version": "2.8.1", - "resolved": "https://registry.npmjs.org/eslint-module-utils/-/eslint-module-utils-2.8.1.tgz", - "integrity": "sha512-rXDXR3h7cs7dy9RNpUlQf80nX31XWJEyGq1tRMo+6GsO5VmTe4UTwtmonAD4ZkAsrfMVDA2wlGJ3790Ys+D49Q==", - "dev": true, - "dependencies": { - "debug": "^3.2.7" - }, - "engines": { - "node": ">=4" - }, - "peerDependenciesMeta": { - "eslint": { - "optional": true - } - } - }, - "node_modules/eslint-module-utils/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-plugin-flowtype": { - "version": "8.0.3", - "resolved": "https://registry.npmjs.org/eslint-plugin-flowtype/-/eslint-plugin-flowtype-8.0.3.tgz", - "integrity": "sha512-dX8l6qUL6O+fYPtpNRideCFSpmWOUVx5QcaGLVqe/vlDiBSe4vYljDWDETwnyFzpl7By/WVIu6rcrniCgH9BqQ==", - "dev": true, - "dependencies": { - "lodash": "^4.17.21", - "string-natural-compare": "^3.0.1" - }, - "engines": { - "node": ">=12.0.0" - }, - "peerDependencies": { - "@babel/plugin-syntax-flow": "^7.14.5", - "@babel/plugin-transform-react-jsx": "^7.14.9", - "eslint": "^8.1.0" - } - }, - "node_modules/eslint-plugin-import": { - "version": "2.29.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-import/-/eslint-plugin-import-2.29.1.tgz", - "integrity": "sha512-BbPC0cuExzhiMo4Ff1BTVwHpjjv28C5R+btTOGaCRC7UEz801up0JadwkeSk5Ued6TG34uaczuVuH6qyy5YUxw==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.7", - "array.prototype.findlastindex": "^1.2.3", - "array.prototype.flat": "^1.3.2", - "array.prototype.flatmap": "^1.3.2", - "debug": "^3.2.7", - "doctrine": "^2.1.0", - "eslint-import-resolver-node": "^0.3.9", - "eslint-module-utils": "^2.8.0", - "hasown": "^2.0.0", - "is-core-module": "^2.13.1", - "is-glob": "^4.0.3", - "minimatch": "^3.1.2", - "object.fromentries": "^2.0.7", - "object.groupby": "^1.0.1", - "object.values": "^1.1.7", - "semver": "^6.3.1", - "tsconfig-paths": "^3.15.0" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "eslint": "^2 || ^3 || ^4 || ^5 || ^6 || ^7.2.0 || ^8" - } - }, - "node_modules/eslint-plugin-import/node_modules/debug": { - "version": "3.2.7", - "resolved": "https://registry.npmjs.org/debug/-/debug-3.2.7.tgz", - "integrity": "sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==", - "dev": true, - "dependencies": { - "ms": "^2.1.1" - } - }, - "node_modules/eslint-plugin-import/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eslint-plugin-jest": { - "version": "25.7.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jest/-/eslint-plugin-jest-25.7.0.tgz", - "integrity": "sha512-PWLUEXeeF7C9QGKqvdSbzLOiLTx+bno7/HC9eefePfEb257QFHg7ye3dh80AZVkaa/RQsBB1Q/ORQvg2X7F0NQ==", - "dev": true, - "dependencies": { - "@typescript-eslint/experimental-utils": "^5.0.0" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - }, - "peerDependencies": { - "@typescript-eslint/eslint-plugin": "^4.0.0 || ^5.0.0", - "eslint": "^6.0.0 || ^7.0.0 || ^8.0.0" - }, - "peerDependenciesMeta": { - "@typescript-eslint/eslint-plugin": { - "optional": true - }, - "jest": { - "optional": true - } - } - }, - "node_modules/eslint-plugin-jsx-a11y": { - "version": "6.8.0", - "resolved": "https://registry.npmjs.org/eslint-plugin-jsx-a11y/-/eslint-plugin-jsx-a11y-6.8.0.tgz", - "integrity": "sha512-Hdh937BS3KdwwbBaKd5+PLCOmYY6U4f2h9Z2ktwtNKvIdIEu137rjYbcb9ApSbVJfWxANNuiKTD/9tOKjK9qOA==", - "dev": true, - "dependencies": { - "@babel/runtime": "^7.23.2", - "aria-query": "^5.3.0", - "array-includes": "^3.1.7", - "array.prototype.flatmap": "^1.3.2", - "ast-types-flow": "^0.0.8", - "axe-core": "=4.7.0", - "axobject-query": "^3.2.1", - "damerau-levenshtein": "^1.0.8", - "emoji-regex": "^9.2.2", - "es-iterator-helpers": "^1.0.15", - "hasown": "^2.0.0", - "jsx-ast-utils": "^3.3.5", - "language-tags": "^1.0.9", - "minimatch": "^3.1.2", - "object.entries": "^1.1.7", - "object.fromentries": "^2.0.7" - }, - "engines": { - "node": ">=4.0" - }, - "peerDependencies": { - "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" - } - }, - "node_modules/eslint-plugin-react": { - "version": "7.34.1", - "resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.34.1.tgz", - "integrity": "sha512-N97CxlouPT1AHt8Jn0mhhN2RrADlUAsk1/atcT2KyA/l9Q/E6ll7OIGwNumFmWfZ9skV3XXccYS19h80rHtgkw==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.7", - "array.prototype.findlast": "^1.2.4", - "array.prototype.flatmap": "^1.3.2", - "array.prototype.toreversed": "^1.1.2", - "array.prototype.tosorted": "^1.1.3", - "doctrine": "^2.1.0", - "es-iterator-helpers": "^1.0.17", - "estraverse": "^5.3.0", - "jsx-ast-utils": "^2.4.1 || ^3.0.0", - "minimatch": "^3.1.2", - "object.entries": "^1.1.7", - "object.fromentries": "^2.0.7", - "object.hasown": "^1.1.3", - "object.values": "^1.1.7", - "prop-types": "^15.8.1", - "resolve": "^2.0.0-next.5", - "semver": "^6.3.1", - "string.prototype.matchall": "^4.0.10" - }, - "engines": { - "node": ">=4" - }, - "peerDependencies": { - "eslint": "^3 || ^4 || ^5 || ^6 || ^7 || ^8" - } - }, "node_modules/eslint-plugin-react-hooks": { "version": "4.6.0", "resolved": "https://registry.npmjs.org/eslint-plugin-react-hooks/-/eslint-plugin-react-hooks-4.6.0.tgz", @@ -6596,33 +6030,14 @@ "eslint": "^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0-0" } }, - "node_modules/eslint-plugin-react/node_modules/doctrine": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.1.0.tgz", - "integrity": "sha512-35mSku4ZXK0vfCuHEDAwt55dg2jNajHZ1odvF+8SSr82EsZY4QmXfuWso8oEd8zRhVObSN18aM0CjSdoBX7zIw==", - "dev": true, - "dependencies": { - "esutils": "^2.0.2" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/eslint-plugin-react/node_modules/resolve": { - "version": "2.0.0-next.5", - "resolved": "https://registry.npmjs.org/resolve/-/resolve-2.0.0-next.5.tgz", - "integrity": "sha512-U7WjGVG9sH8tvjW5SmGbQuui75FiyjAX72HX15DwBBwF9dNiQZRQAg9nnPhYy+TUnE0+VcrttuvNI8oSxZcocA==", + "node_modules/eslint-plugin-react-refresh": { + "version": "0.4.7", + "resolved": "https://registry.npmjs.org/eslint-plugin-react-refresh/-/eslint-plugin-react-refresh-0.4.7.tgz", + "integrity": "sha512-yrj+KInFmwuQS2UQcg1SF83ha1tuHC1jMQbRNyuWtlEzzKRDgAl7L4Yp4NlDUZTZNlWvHEzOtJhMi40R7JxcSw==", "dev": true, - "dependencies": { - "is-core-module": "^2.13.0", - "path-parse": "^1.0.7", - "supports-preserve-symlinks-flag": "^1.0.0" - }, - "bin": { - "resolve": "bin/resolve" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" + "license": "MIT", + "peerDependencies": { + "eslint": ">=7" } }, "node_modules/eslint-plugin-simple-import-sort": { @@ -7628,27 +7043,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-arrayish": { - "version": "0.2.1", - "resolved": "https://registry.npmjs.org/is-arrayish/-/is-arrayish-0.2.1.tgz", - "integrity": "sha512-zz06S8t0ozoDXMG+ube26zeCTNXcKIPJZJi8hBrF4idCLms4CG9QtK7qBl1boi5ODzFpjswb5JPmHCbMpjaYzg==", - "dev": true - }, - "node_modules/is-async-function": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/is-async-function/-/is-async-function-2.0.0.tgz", - "integrity": "sha512-Y1JXKrfykRJGdlDwdKlLpLyMIiWqWvuSd17TvZk68PLAOGOoF4Xyav1z0Xhoi+gCYjZVeC5SI+hYFOfvXmGRCA==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-bigint": { "version": "1.0.4", "resolved": "https://registry.npmjs.org/is-bigint/-/is-bigint-1.0.4.tgz", @@ -7768,33 +7162,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-finalizationregistry": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-finalizationregistry/-/is-finalizationregistry-1.0.2.tgz", - "integrity": "sha512-0by5vtUJs8iFQb5TYUHHPudOR+qXYIMKtiUzvLIZITZUjknFmziyBJuLhVRc+Ds0dREFlskDNJKYIdIzu/9pfw==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.2" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/is-generator-function": { - "version": "1.0.10", - "resolved": "https://registry.npmjs.org/is-generator-function/-/is-generator-function-1.0.10.tgz", - "integrity": "sha512-jsEjy9l3yiXEQ+PsXdmBwEPcOxaXWLspKdplFUVI9vq1iZgIekeC0L167qeu86czQaxed3q/Uzuw0swL0irL8A==", - "dev": true, - "dependencies": { - "has-tostringtag": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-glob": { "version": "4.0.3", "resolved": "https://registry.npmjs.org/is-glob/-/is-glob-4.0.3.tgz", @@ -7807,18 +7174,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-map": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.3.tgz", - "integrity": "sha512-1Qed0/Hr2m+YqxnM09CjA2d/i6YZNfF6R2oRAOj36eUdS6qIV/huPJNSEpKbupewFs+ZsJlxsjjPbc0/afW6Lw==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-module": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/is-module/-/is-module-1.0.0.tgz", @@ -7913,18 +7268,6 @@ "node": ">=0.10.0" } }, - "node_modules/is-set": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.3.tgz", - "integrity": "sha512-iPAjerrse27/ygGLxw+EBR9agv9Y6uLeYVJMu+QNCoouJ1/1ri0mGrcWpfCqFZuzzx3WjtwxG098X+n4OuRkPg==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-shared-array-buffer": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.3.tgz", @@ -7997,18 +7340,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-weakmap": { - "version": "2.0.2", - "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.2.tgz", - "integrity": "sha512-K5pXYOm9wqY1RgjpL3YTkF39tni1XajUIkawTLUo9EZEVUFga5gSQJF8nNS7ZwJQ02y+1YCNYcMh+HIf1ZqE+w==", - "dev": true, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -8021,22 +7352,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/is-weakset": { - "version": "2.0.3", - "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.3.tgz", - "integrity": "sha512-LvIm3/KWzS9oRFHugab7d+M/GcBXuXX5xZkzPmN+NxihdQlZUQ4dWuSV1xR/sq6upL1TJEDrfBgRepHFdBtSNQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "get-intrinsic": "^1.2.4" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/isarray": { "version": "2.0.5", "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", @@ -8099,19 +7414,6 @@ "node": ">=8" } }, - "node_modules/iterator.prototype": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/iterator.prototype/-/iterator.prototype-1.1.2.tgz", - "integrity": "sha512-DR33HMMr8EzwuRL8Y9D3u2BMj8+RqSE850jfGu59kS7tbmPLzGkZmVSfyCFSDxuZiEY6Rzt3T2NA/qU+NwVj1w==", - "dev": true, - "dependencies": { - "define-properties": "^1.2.1", - "get-intrinsic": "^1.2.1", - "has-symbols": "^1.0.3", - "reflect.getprototypeof": "^1.0.4", - "set-function-name": "^2.0.1" - } - }, "node_modules/jake": { "version": "10.9.1", "resolved": "https://registry.npmjs.org/jake/-/jake-10.9.1.tgz", @@ -8388,12 +7690,6 @@ "integrity": "sha512-4bV5BfR2mqfQTJm+V5tPPdf+ZpuhiIvTuAB5g8kcrXOZpTT/QwwVRWBywX1ozr6lEuPdbHxwaJlm9G6mI2sfSQ==", "dev": true }, - "node_modules/json-parse-even-better-errors": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/json-parse-even-better-errors/-/json-parse-even-better-errors-2.3.1.tgz", - "integrity": "sha512-xyFwyhro/JEof6Ghe2iz2NcXoj2sloNsWr/XsERDK/oiPCfaNhl5ONfp+jQdAZRQQ0IJWNzH9zIZF7li91kh2w==", - "dev": true - }, "node_modules/json-schema": { "version": "0.4.0", "resolved": "https://registry.npmjs.org/json-schema/-/json-schema-0.4.0.tgz", @@ -8462,21 +7758,6 @@ "node": ">=0.10.0" } }, - "node_modules/jsx-ast-utils": { - "version": "3.3.5", - "resolved": "https://registry.npmjs.org/jsx-ast-utils/-/jsx-ast-utils-3.3.5.tgz", - "integrity": "sha512-ZZow9HBI5O6EPgSJLUb8n2NKgmVWTwCvHGwFuJlMjvLFqlGG6pjirPhtdsseaLZjSibD8eegzmYpUZwoIlj2cQ==", - "dev": true, - "dependencies": { - "array-includes": "^3.1.6", - "array.prototype.flat": "^1.3.1", - "object.assign": "^4.1.4", - "object.values": "^1.1.6" - }, - "engines": { - "node": ">=4.0" - } - }, "node_modules/keyv": { "version": "4.5.4", "resolved": "https://registry.npmjs.org/keyv/-/keyv-4.5.4.tgz", @@ -8494,24 +7775,6 @@ "node": ">= 8" } }, - "node_modules/language-subtag-registry": { - "version": "0.3.22", - "resolved": "https://registry.npmjs.org/language-subtag-registry/-/language-subtag-registry-0.3.22.tgz", - "integrity": "sha512-tN0MCzyWnoz/4nHS6uxdlFWoUZT7ABptwKPQ52Ea7URk6vll88bWBVhodtnlfEuCcKWNGoc+uGbw1cwa9IKh/w==", - "dev": true - }, - "node_modules/language-tags": { - "version": "1.0.9", - "resolved": "https://registry.npmjs.org/language-tags/-/language-tags-1.0.9.tgz", - "integrity": "sha512-MbjN408fEndfiQXbFQ1vnd+1NoLDsnQW41410oQBXiyXDMYH5z505juWa4KUE1LqxRC7DgOgZDbKLxHIwm27hA==", - "dev": true, - "dependencies": { - "language-subtag-registry": "^0.3.20" - }, - "engines": { - "node": ">=0.10" - } - }, "node_modules/leven": { "version": "3.1.0", "resolved": "https://registry.npmjs.org/leven/-/leven-3.1.0.tgz", @@ -8535,12 +7798,6 @@ "node": ">= 0.8.0" } }, - "node_modules/lines-and-columns": { - "version": "1.2.4", - "resolved": "https://registry.npmjs.org/lines-and-columns/-/lines-and-columns-1.2.4.tgz", - "integrity": "sha512-7ylylesZQ/PV29jhEDl3Ufjo6ZX7gCqJr5F7PKrqc93v7fzSymt1BpwEU8nAUXs8qzzvqhbjhK5QZg6Mt/HkBg==", - "dev": true - }, "node_modules/local-pkg": { "version": "0.5.0", "resolved": "https://registry.npmjs.org/local-pkg/-/local-pkg-0.5.0.tgz", @@ -8878,12 +8135,6 @@ "integrity": "sha512-OWND8ei3VtNC9h7V60qff3SVobHr996CTwgxubgyQYEpg290h9J0buyECNNJexkFm5sOajh5G116RYA1c8ZMSw==", "dev": true }, - "node_modules/natural-compare-lite": { - "version": "1.4.0", - "resolved": "https://registry.npmjs.org/natural-compare-lite/-/natural-compare-lite-1.4.0.tgz", - "integrity": "sha512-Tj+HTDSJJKaZnfiuw+iaF9skdPpTo2GtEly5JHnWV/hfv2Qj/9RKsGISQtLh2ox3l5EAGw487hnBee0sIJ6v2g==", - "dev": true - }, "node_modules/node-abi": { "version": "3.65.0", "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.65.0.tgz", @@ -8994,86 +8245,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/object.entries": { - "version": "1.1.8", - "resolved": "https://registry.npmjs.org/object.entries/-/object.entries-1.1.8.tgz", - "integrity": "sha512-cmopxi8VwRIAw/fkijJohSfpef5PdN0pMQJN6VC/ZKvn0LIknWD8KtgY6KlQdEc4tIjcQ3HxSMmnvtzIscdaYQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.fromentries": { - "version": "2.0.8", - "resolved": "https://registry.npmjs.org/object.fromentries/-/object.fromentries-2.0.8.tgz", - "integrity": "sha512-k6E21FzySsSK5a21KRADBd/NGneRegFO5pLHfdQLpRDETUNJueLXs3WCzyQ3tFRDYgbq3KHGXfTbi2bs8WQ6rQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.groupby": { - "version": "1.0.3", - "resolved": "https://registry.npmjs.org/object.groupby/-/object.groupby-1.0.3.tgz", - "integrity": "sha512-+Lhy3TQTuzXI5hevh8sBGqbmurHbbIjAi0Z4S63nthVLmLxfbj4T54a4CfZrXIrt9iP4mVAPYMo/v99taj3wjQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/object.hasown": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/object.hasown/-/object.hasown-1.1.4.tgz", - "integrity": "sha512-FZ9LZt9/RHzGySlBARE3VF+gE26TxR38SdmqOqliuTnl9wrKulaQs+4dee1V+Io8VfxqzAfHu6YuRgUy8OHoTg==", - "dev": true, - "dependencies": { - "define-properties": "^1.2.1", - "es-abstract": "^1.23.2", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/object.values": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/object.values/-/object.values-1.2.0.tgz", - "integrity": "sha512-yBYjY9QX2hnRmZHAjG/f13MzmBzxzYgQhFrke06TTyKY5zSTEqkOeukBzIdVA3j3ulu8Qa3MbVFShV7T2RmGtQ==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-object-atoms": "^1.0.0" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -9157,24 +8328,6 @@ "node": ">=6" } }, - "node_modules/parse-json": { - "version": "5.2.0", - "resolved": "https://registry.npmjs.org/parse-json/-/parse-json-5.2.0.tgz", - "integrity": "sha512-ayCKvm/phCGxOkYRSCM82iDwct8/EonSEgCSxWxD7ve6jHggsFl4fZVQBPRNgQoKiuV/odhFrGzQXZwbifC8Rg==", - "dev": true, - "dependencies": { - "@babel/code-frame": "^7.0.0", - "error-ex": "^1.3.1", - "json-parse-even-better-errors": "^2.3.0", - "lines-and-columns": "^1.1.6" - }, - "engines": { - "node": ">=8" - }, - "funding": { - "url": "https://github.com/sponsors/sindresorhus" - } - }, "node_modules/parse5": { "version": "7.1.2", "resolved": "https://registry.npmjs.org/parse5/-/parse5-7.1.2.tgz", @@ -9982,27 +9135,6 @@ "node": ">=8" } }, - "node_modules/reflect.getprototypeof": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/reflect.getprototypeof/-/reflect.getprototypeof-1.0.6.tgz", - "integrity": "sha512-fmfw4XgoDke3kdI6h4xcUz1dG8uaiv5q9gcEwLS4Pnth2kxT+GZ7YehS1JTMGBQmtV7Y4GFGbs2re2NqhdozUg==", - "dev": true, - "dependencies": { - "call-bind": "^1.0.7", - "define-properties": "^1.2.1", - "es-abstract": "^1.23.1", - "es-errors": "^1.3.0", - "get-intrinsic": "^1.2.4", - "globalthis": "^1.0.3", - "which-builtin-type": "^1.1.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/regenerate": { "version": "1.4.2", "resolved": "https://registry.npmjs.org/regenerate/-/regenerate-1.4.2.tgz", @@ -10729,12 +9861,6 @@ "safe-buffer": "~5.2.0" } }, - "node_modules/string-natural-compare": { - "version": "3.0.1", - "resolved": "https://registry.npmjs.org/string-natural-compare/-/string-natural-compare-3.0.1.tgz", - "integrity": "sha512-n3sPwynL1nwKi3WJ6AIsClwBMa0zTi54fn2oLU6ndfTSIO05xaznjSf15PcBZU6FNWbmN5Q6cxT4V5hGvB4taw==", - "dev": true - }, "node_modules/string.prototype.matchall": { "version": "4.0.11", "resolved": "https://registry.npmjs.org/string.prototype.matchall/-/string.prototype.matchall-4.0.11.tgz", @@ -10837,15 +9963,6 @@ "node": ">=8" } }, - "node_modules/strip-bom": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", - "integrity": "sha512-vavAMRXOgBVNF6nyEEmL3DBK19iRpDcoIwW+swQ+CbGiu7lju6t+JklA1MHweoWtadgt4ISVUsXLyDq34ddcwA==", - "dev": true, - "engines": { - "node": ">=4" - } - }, "node_modules/strip-comments": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/strip-comments/-/strip-comments-2.0.1.tgz", @@ -11177,28 +10294,17 @@ "node": ">=18" } }, - "node_modules/tsconfig-paths": { - "version": "3.15.0", - "resolved": "https://registry.npmjs.org/tsconfig-paths/-/tsconfig-paths-3.15.0.tgz", - "integrity": "sha512-2Ac2RgzDe/cn48GvOe3M+o82pEFewD3UPbyoUHHdKasHwJKjds4fLXWf/Ux5kATBKN20oaFGu+jbElp1pos0mg==", - "dev": true, - "dependencies": { - "@types/json5": "^0.0.29", - "json5": "^1.0.2", - "minimist": "^1.2.6", - "strip-bom": "^3.0.0" - } - }, - "node_modules/tsconfig-paths/node_modules/json5": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/json5/-/json5-1.0.2.tgz", - "integrity": "sha512-g1MWMLBiz8FKi1e4w0UyVL3w+iJceWAFBAaBnnGKOpNa5f8TLktkbre1+s6oICydWAm+HRUGTmI+//xv2hvXYA==", + "node_modules/ts-api-utils": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/ts-api-utils/-/ts-api-utils-1.3.0.tgz", + "integrity": "sha512-UQMIo7pb8WRomKR1/+MFVLTroIvDVtMX3K6OUir8ynLyzB8Jeriont2bTAtmNPa1ekAgN7YPDyf6V+ygrdU+eQ==", "dev": true, - "dependencies": { - "minimist": "^1.2.0" + "license": "MIT", + "engines": { + "node": ">=16" }, - "bin": { - "json5": "lib/cli.js" + "peerDependencies": { + "typescript": ">=4.2.0" } }, "node_modules/tslib": { @@ -12234,50 +11340,6 @@ "url": "https://github.com/sponsors/ljharb" } }, - "node_modules/which-builtin-type": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/which-builtin-type/-/which-builtin-type-1.1.3.tgz", - "integrity": "sha512-YmjsSMDBYsM1CaFiayOVT06+KJeXf0o5M/CAd4o1lTadFAtacTUM49zoYxr/oroopFDfhvN6iEcBxUyc3gvKmw==", - "dev": true, - "dependencies": { - "function.prototype.name": "^1.1.5", - "has-tostringtag": "^1.0.0", - "is-async-function": "^2.0.0", - "is-date-object": "^1.0.5", - "is-finalizationregistry": "^1.0.2", - "is-generator-function": "^1.0.10", - "is-regex": "^1.1.4", - "is-weakref": "^1.0.2", - "isarray": "^2.0.5", - "which-boxed-primitive": "^1.0.2", - "which-collection": "^1.0.1", - "which-typed-array": "^1.1.9" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/which-collection": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.2.tgz", - "integrity": "sha512-K4jVyjnBdgvc86Y6BkaLZEN933SwYOuBFkdmBu9ZfkcAbdVbpITnDmjvZ/aQjRXQrv5EPkTnD1s39GiiqbngCw==", - "dev": true, - "dependencies": { - "is-map": "^2.0.3", - "is-set": "^2.0.3", - "is-weakmap": "^2.0.2", - "is-weakset": "^2.0.3" - }, - "engines": { - "node": ">= 0.4" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, "node_modules/which-typed-array": { "version": "1.1.15", "resolved": "https://registry.npmjs.org/which-typed-array/-/which-typed-array-1.1.15.tgz", diff --git a/frontend/package.json b/frontend/package.json index 86a7fff4b..f89a71931 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -44,14 +44,16 @@ "@types/node": "^20.12.6", "@types/react": "^18.3.4", "@types/react-dom": "^18.3.0", + "@typescript-eslint/eslint-plugin": "^7.16.0", + "@typescript-eslint/parser": "^7.16.0", "@vite-pwa/assets-generator": "^0.2.4", "@vitejs/plugin-react": "^4.2.1", "@vitest/coverage-v8": "^1.4.0", "@vitest/ui": "^1.2.2", "clsx": "^2.1.0", "eslint": "^8.57.0", - "eslint-config-react-app": "^7.0.1", "eslint-plugin-react-hooks": "^4.6.0", + "eslint-plugin-react-refresh": "^0.4.7", "eslint-plugin-simple-import-sort": "^12.1.0", "eslint-plugin-testing-library": "^6.2.0", "husky": "^9.0.11", diff --git a/frontend/src/apis/hooks/episodes.ts b/frontend/src/apis/hooks/episodes.ts index 6a489e938..956fd103f 100644 --- a/frontend/src/apis/hooks/episodes.ts +++ b/frontend/src/apis/hooks/episodes.ts @@ -25,23 +25,6 @@ const cacheEpisodes = (client: QueryClient, episodes: Item.Episode[]) => { }); }; -export function useEpisodesByIds(ids: number[]) { - const client = useQueryClient(); - - const query = useQuery({ - queryKey: [QueryKeys.Series, QueryKeys.Episodes, ids], - queryFn: () => api.episodes.byEpisodeId(ids), - }); - - useEffect(() => { - if (query.isSuccess && query.data) { - cacheEpisodes(client, query.data); - } - }, [query.isSuccess, query.data, client]); - - return query; -} - export function useEpisodesBySeriesId(id: number) { const client = useQueryClient(); @@ -87,10 +70,11 @@ export function useEpisodeAddBlacklist() { }, onSuccess: (_, { seriesId }) => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.Series, QueryKeys.Episodes, QueryKeys.Blacklist], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.Series, seriesId], }); }, @@ -105,8 +89,8 @@ export function useEpisodeDeleteBlacklist() { mutationFn: (param: { all?: boolean; form?: FormType.DeleteBlacklist }) => api.episodes.deleteBlacklist(param.all, param.form), - onSuccess: (_) => { - client.invalidateQueries({ + onSuccess: () => { + void client.invalidateQueries({ queryKey: [QueryKeys.Series, QueryKeys.Episodes, QueryKeys.Blacklist], }); }, diff --git a/frontend/src/apis/hooks/movies.ts b/frontend/src/apis/hooks/movies.ts index cf4594cbe..6b1c5c2a5 100644 --- a/frontend/src/apis/hooks/movies.ts +++ b/frontend/src/apis/hooks/movies.ts @@ -15,23 +15,6 @@ const cacheMovies = (client: QueryClient, movies: Item.Movie[]) => { }); }; -export function useMoviesByIds(ids: number[]) { - const client = useQueryClient(); - - const query = useQuery({ - queryKey: [QueryKeys.Movies, ...ids], - queryFn: () => api.movies.movies(ids), - }); - - useEffect(() => { - if (query.isSuccess && query.data) { - cacheMovies(client, query.data); - } - }, [query.isSuccess, query.data, client]); - - return query; -} - export function useMovieById(id: number) { return useQuery({ queryKey: [QueryKeys.Movies, id], @@ -74,12 +57,13 @@ export function useMovieModification() { onSuccess: (_, form) => { form.id.forEach((v) => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.Movies, v], }); }); + // TODO: query less - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.Movies], }); }, @@ -93,7 +77,7 @@ export function useMovieAction() { mutationFn: (form: FormType.MoviesAction) => api.movies.action(form), onSuccess: () => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.Movies], }); }, @@ -125,10 +109,11 @@ export function useMovieAddBlacklist() { }, onSuccess: (_, { id }) => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.Movies, QueryKeys.Blacklist], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.Movies, id], }); }, @@ -143,8 +128,8 @@ export function useMovieDeleteBlacklist() { mutationFn: (param: { all?: boolean; form?: FormType.DeleteBlacklist }) => api.movies.deleteBlacklist(param.all, param.form), - onSuccess: (_, param) => { - client.invalidateQueries({ + onSuccess: () => { + void client.invalidateQueries({ queryKey: [QueryKeys.Movies, QueryKeys.Blacklist], }); }, diff --git a/frontend/src/apis/hooks/system.ts b/frontend/src/apis/hooks/system.ts index 109e77105..a0ce17fb9 100644 --- a/frontend/src/apis/hooks/system.ts +++ b/frontend/src/apis/hooks/system.ts @@ -54,22 +54,27 @@ export function useSettingsMutation() { mutationFn: (data: LooseObject) => api.system.updateSettings(data), onSuccess: () => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.System], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.Series], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.Episodes], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.Movies], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.Wanted], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.Badges], }); }, @@ -101,7 +106,7 @@ export function useDeleteLogs() { mutationFn: () => api.system.deleteLogs(), onSuccess: () => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Logs], }); }, @@ -128,11 +133,12 @@ export function useSystemAnnouncementsAddDismiss() { return api.system.addAnnouncementsDismiss(hash); }, - onSuccess: (_, { hash }) => { - client.invalidateQueries({ + onSuccess: () => { + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Announcements], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Badges], }); }, @@ -156,10 +162,11 @@ export function useRunTask() { mutationFn: (id: string) => api.system.runTask(id), onSuccess: () => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Tasks], }); - client.invalidateQueries({ + + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Backups], }); }, @@ -180,7 +187,7 @@ export function useCreateBackups() { mutationFn: () => api.system.createBackups(), onSuccess: () => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Backups], }); }, @@ -194,7 +201,7 @@ export function useRestoreBackups() { mutationFn: (filename: string) => api.system.restoreBackups(filename), onSuccess: () => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Backups], }); }, @@ -208,7 +215,7 @@ export function useDeleteBackups() { mutationFn: (filename: string) => api.system.deleteBackups(filename), onSuccess: () => { - client.invalidateQueries({ + void client.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Backups], }); }, diff --git a/frontend/src/components/async/MutateAction.tsx b/frontend/src/components/async/MutateAction.tsx index 6fff0dbb7..92c102ea9 100644 --- a/frontend/src/components/async/MutateAction.tsx +++ b/frontend/src/components/async/MutateAction.tsx @@ -16,7 +16,6 @@ type MutateActionProps = Omit< function MutateAction({ mutation, - noReset, onSuccess, onError, args, diff --git a/frontend/src/components/async/MutateButton.tsx b/frontend/src/components/async/MutateButton.tsx index 9197e2d50..908c2dfda 100644 --- a/frontend/src/components/async/MutateButton.tsx +++ b/frontend/src/components/async/MutateButton.tsx @@ -15,7 +15,6 @@ type MutateButtonProps = Omit< function MutateButton({ mutation, - noReset, onSuccess, onError, args, diff --git a/frontend/src/components/async/QueryOverlay.tsx b/frontend/src/components/async/QueryOverlay.tsx index 2a5848cf2..1672989ff 100644 --- a/frontend/src/components/async/QueryOverlay.tsx +++ b/frontend/src/components/async/QueryOverlay.tsx @@ -12,7 +12,7 @@ interface QueryOverlayProps { const QueryOverlay: FunctionComponent = ({ children, global = false, - result: { isLoading, isError, error }, + result: { isLoading }, }) => { return ( diff --git a/frontend/src/components/inputs/Selector.tsx b/frontend/src/components/inputs/Selector.tsx index 1825d314a..092fd24e7 100644 --- a/frontend/src/components/inputs/Selector.tsx +++ b/frontend/src/components/inputs/Selector.tsx @@ -7,7 +7,7 @@ import { Select, SelectProps, } from "@mantine/core"; -import { isNull, isUndefined, noop } from "lodash"; +import { isNull, isUndefined } from "lodash"; import { LOG } from "@/utilities/console"; export type SelectorOption = Override< @@ -49,10 +49,7 @@ export type GroupedSelectorProps = Override< >; export function GroupedSelector({ - value, options, - getkey = DefaultKeyBuilder, - onOptionSubmit = noop, ...select }: GroupedSelectorProps) { return ( diff --git a/frontend/src/modules/modals/hooks.ts b/frontend/src/modules/modals/hooks.ts index 09855ac51..667e429d3 100644 --- a/frontend/src/modules/modals/hooks.ts +++ b/frontend/src/modules/modals/hooks.ts @@ -5,11 +5,8 @@ import { ModalSettings } from "@mantine/modals/lib/context"; import { ModalComponent, ModalIdContext } from "./WithModal"; export function useModals() { - const { - openContextModal: openMantineContextModal, - closeContextModal: closeContextModalRaw, - ...rest - } = useMantineModals(); + const { openContextModal: openMantineContextModal, ...rest } = + useMantineModals(); const openContextModal = useCallback( ( @@ -26,7 +23,7 @@ export function useModals() { [openMantineContextModal], ); - const closeContextModal = useCallback( + const closeContext = useCallback( (modal: ModalComponent) => { rest.closeModal(modal.modalKey); }, @@ -43,7 +40,7 @@ export function useModals() { // TODO: Performance return useMemo( - () => ({ openContextModal, closeContextModal, closeSelf, ...rest }), - [closeContextModal, closeSelf, openContextModal, rest], + () => ({ openContextModal, closeContext, closeSelf, ...rest }), + [closeContext, closeSelf, openContextModal, rest], ); } diff --git a/frontend/src/modules/socketio/reducer.ts b/frontend/src/modules/socketio/reducer.ts index d19ff87c4..378ab12fc 100644 --- a/frontend/src/modules/socketio/reducer.ts +++ b/frontend/src/modules/socketio/reducer.ts @@ -40,13 +40,17 @@ export function createDefaultReducer(): SocketIO.Reducer[] { update: (ids) => { LOG("info", "Invalidating series", ids); ids.forEach((id) => { - queryClient.invalidateQueries({ queryKey: [QueryKeys.Series, id] }); + void queryClient.invalidateQueries({ + queryKey: [QueryKeys.Series, id], + }); }); }, delete: (ids) => { LOG("info", "Invalidating series", ids); ids.forEach((id) => { - queryClient.invalidateQueries({ queryKey: [QueryKeys.Series, id] }); + void queryClient.invalidateQueries({ + queryKey: [QueryKeys.Series, id], + }); }); }, }, @@ -55,13 +59,17 @@ export function createDefaultReducer(): SocketIO.Reducer[] { update: (ids) => { LOG("info", "Invalidating movies", ids); ids.forEach((id) => { - queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, id] }); + void queryClient.invalidateQueries({ + queryKey: [QueryKeys.Movies, id], + }); }); }, delete: (ids) => { LOG("info", "Invalidating movies", ids); ids.forEach((id) => { - queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, id] }); + void queryClient.invalidateQueries({ + queryKey: [QueryKeys.Movies, id], + }); }); }, }, @@ -78,7 +86,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { id, ]); if (episode !== undefined) { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Series, episode.sonarrSeriesId], }); } @@ -92,7 +100,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { id, ]); if (episode !== undefined) { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Series, episode.sonarrSeriesId], }); } @@ -101,28 +109,28 @@ export function createDefaultReducer(): SocketIO.Reducer[] { }, { key: "episode-wanted", - update: (ids) => { + update: () => { // Find a better way to update wanted - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Episodes, QueryKeys.Wanted], }); }, delete: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Episodes, QueryKeys.Wanted], }); }, }, { key: "movie-wanted", - update: (ids) => { + update: () => { // Find a better way to update wanted - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, QueryKeys.Wanted], }); }, delete: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, QueryKeys.Wanted], }); }, @@ -130,13 +138,13 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "settings", any: () => { - queryClient.invalidateQueries({ queryKey: [QueryKeys.System] }); + void queryClient.invalidateQueries({ queryKey: [QueryKeys.System] }); }, }, { key: "languages", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Languages], }); }, @@ -144,7 +152,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "badges", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Badges], }); }, @@ -152,7 +160,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "movie-history", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, QueryKeys.History], }); }, @@ -160,7 +168,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "movie-blacklist", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, QueryKeys.Blacklist], }); }, @@ -168,7 +176,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "episode-history", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Episodes, QueryKeys.History], }); }, @@ -176,7 +184,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "episode-blacklist", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Episodes, QueryKeys.Blacklist], }); }, @@ -184,7 +192,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "reset-episode-wanted", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Episodes, QueryKeys.Wanted], }); }, @@ -192,7 +200,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "reset-movie-wanted", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.Movies, QueryKeys.Wanted], }); }, @@ -200,7 +208,7 @@ export function createDefaultReducer(): SocketIO.Reducer[] { { key: "task", any: () => { - queryClient.invalidateQueries({ + void queryClient.invalidateQueries({ queryKey: [QueryKeys.System, QueryKeys.Tasks], }); }, diff --git a/frontend/src/pages/Settings/components/forms.test.tsx b/frontend/src/pages/Settings/components/forms.test.tsx index a88d2bec7..4ec60699b 100644 --- a/frontend/src/pages/Settings/components/forms.test.tsx +++ b/frontend/src/pages/Settings/components/forms.test.tsx @@ -2,7 +2,7 @@ import { FunctionComponent, PropsWithChildren, ReactElement } from "react"; import { useForm } from "@mantine/form"; import { describe, it } from "vitest"; import { FormContext, FormValues } from "@/pages/Settings/utilities/FormValues"; -import { render, RenderOptions, screen } from "@/tests"; +import { render, screen } from "@/tests"; import { Number, Text } from "./forms"; const FormSupport: FunctionComponent = ({ children }) => { @@ -15,10 +15,8 @@ const FormSupport: FunctionComponent = ({ children }) => { return {children}; }; -const formRender = ( - ui: ReactElement, - options?: Omit, -) => render({ui}); +const formRender = (ui: ReactElement) => + render({ui}); describe("Settings form", () => { describe("number component", () => { diff --git a/frontend/src/pages/Settings/components/forms.tsx b/frontend/src/pages/Settings/components/forms.tsx index 1e4f744b9..43b559736 100644 --- a/frontend/src/pages/Settings/components/forms.tsx +++ b/frontend/src/pages/Settings/components/forms.tsx @@ -1,4 +1,4 @@ -import { FunctionComponent, ReactNode, ReactText } from "react"; +import { FunctionComponent, ReactNode } from "react"; import { Input, NumberInput, @@ -49,7 +49,7 @@ export const Number: FunctionComponent = (props) => { ); }; -export type TextProps = BaseInput & TextInputProps; +export type TextProps = BaseInput & TextInputProps; export const Text: FunctionComponent = (props) => { const { value, update, rest } = useBaseInput(props); @@ -86,11 +86,7 @@ export interface CheckProps extends BaseInput { inline?: boolean; } -export const Check: FunctionComponent = ({ - label, - inline, - ...props -}) => { +export const Check: FunctionComponent = ({ label, ...props }) => { const { value, update, rest } = useBaseInput(props); return ( From cfa900404076ac440a3a5745279b0db85f5e85b4 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Thu, 29 Aug 2024 07:06:16 -0400 Subject: [PATCH 49/78] Fixed timeout while querying subdivx provider. #2633 --- custom_libs/subliminal_patch/providers/subdivx.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/subdivx.py b/custom_libs/subliminal_patch/providers/subdivx.py index a19ae1b5e..720cba3ed 100644 --- a/custom_libs/subliminal_patch/providers/subdivx.py +++ b/custom_libs/subliminal_patch/providers/subdivx.py @@ -172,7 +172,7 @@ class SubdivxSubtitlesProvider(Provider): logger.debug("Query: %s", query) - response = self.session.post(search_link, data=payload) + response = self.session.post(search_link, data=payload, timeout=30) if response.status_code == 500: logger.debug( From 0fd635c72df39c8415f6aff338487de769aa101e Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Fri, 30 Aug 2024 09:06:51 +0900 Subject: [PATCH 50/78] Fixed zimuku provider skipping non lowercase subtitles (#2644) --- custom_libs/subliminal_patch/providers/zimuku.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/zimuku.py b/custom_libs/subliminal_patch/providers/zimuku.py index 7c66bfc6a..9fc97eba0 100644 --- a/custom_libs/subliminal_patch/providers/zimuku.py +++ b/custom_libs/subliminal_patch/providers/zimuku.py @@ -316,7 +316,7 @@ class ZimukuProvider(Provider): r = self.yunsuo_bypass(download_link, headers={'Referer': subtitle.page_link}, timeout=30) r.raise_for_status() try: - filename = r.headers["Content-Disposition"] + filename = r.headers["Content-Disposition"].lower() except KeyError: logger.debug("Unable to parse subtitles filename. Dropping this subtitles.") return From 5f7e1f68c706a2f71dca0ed8b6763416d51342bb Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Thu, 29 Aug 2024 22:56:52 -0400 Subject: [PATCH 51/78] Fixed cutoff language not being properly handled. #2635 --- bazarr/subtitles/indexer/movies.py | 9 +++++++-- bazarr/subtitles/indexer/series.py | 9 +++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/bazarr/subtitles/indexer/movies.py b/bazarr/subtitles/indexer/movies.py index ba105efc3..563a68cff 100644 --- a/bazarr/subtitles/indexer/movies.py +++ b/bazarr/subtitles/indexer/movies.py @@ -216,7 +216,9 @@ def list_missing_subtitles_movies(no=None, send_event=True): if cutoff_temp_list: for cutoff_temp in cutoff_temp_list: - cutoff_language = [cutoff_temp['language'], cutoff_temp['forced'], cutoff_temp['hi']] + cutoff_language = {'language': cutoff_temp['language'], + 'forced': cutoff_temp['forced'], + 'hi': cutoff_temp['hi']} if cutoff_temp['audio_exclude'] == 'True' and \ any(x['code2'] == cutoff_temp['language'] for x in get_audio_profile_languages(movie_subtitles.audio_language)): @@ -224,7 +226,10 @@ def list_missing_subtitles_movies(no=None, send_event=True): elif cutoff_language in actual_subtitles_list: cutoff_met = True # HI is considered as good as normal - elif cutoff_language and [cutoff_language[0], 'False', 'True'] in actual_subtitles_list: + elif (cutoff_language and + {'language': cutoff_language['language'], + 'forced': 'False', + 'hi': 'True'} in actual_subtitles_list): cutoff_met = True if cutoff_met: diff --git a/bazarr/subtitles/indexer/series.py b/bazarr/subtitles/indexer/series.py index 6b8501dfe..64af2e4c3 100644 --- a/bazarr/subtitles/indexer/series.py +++ b/bazarr/subtitles/indexer/series.py @@ -216,7 +216,9 @@ def list_missing_subtitles(no=None, epno=None, send_event=True): if cutoff_temp_list: for cutoff_temp in cutoff_temp_list: - cutoff_language = [cutoff_temp['language'], cutoff_temp['forced'], cutoff_temp['hi']] + cutoff_language = {'language': cutoff_temp['language'], + 'forced': cutoff_temp['forced'], + 'hi': cutoff_temp['hi']} if cutoff_temp['audio_exclude'] == 'True' and \ any(x['code2'] == cutoff_temp['language'] for x in get_audio_profile_languages(episode_subtitles.audio_language)): @@ -224,7 +226,10 @@ def list_missing_subtitles(no=None, epno=None, send_event=True): elif cutoff_language in actual_subtitles_list: cutoff_met = True # HI is considered as good as normal - elif [cutoff_language[0], 'False', 'True'] in actual_subtitles_list: + elif (cutoff_language and + {'language': cutoff_language['language'], + 'forced': 'False', + 'hi': 'True'} in actual_subtitles_list): cutoff_met = True if cutoff_met: From deae4e52f0eabda1a6014bafcacf3ec121b8b430 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Mon, 2 Sep 2024 00:15:02 +0900 Subject: [PATCH 52/78] Fixed anidb refiner empty mapping episode reference not skipped --- bazarr/subtitles/refiners/anidb.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/bazarr/subtitles/refiners/anidb.py b/bazarr/subtitles/refiners/anidb.py index ea56adc3d..f896697bd 100644 --- a/bazarr/subtitles/refiners/anidb.py +++ b/bazarr/subtitles/refiners/anidb.py @@ -113,6 +113,9 @@ class AniDBClient(object): # Handle mapping list for Specials if mapping_list: for mapping in mapping_list.findall("mapping"): + if mapping.text is None: + continue + # Mapping values are usually like ;1-1;2-1;3-1; for episode_ref in mapping.text.split(';'): if not episode_ref: From 92708e722f9f2706f8503cc998032ddc9daf445f Mon Sep 17 00:00:00 2001 From: GabbeHags <38500419+GabbeHags@users.noreply.github.com> Date: Mon, 2 Sep 2024 11:19:52 +0200 Subject: [PATCH 53/78] Made all subf2m test pass (#2645) --- .../subliminal_patch/providers/subf2m.py | 4 +-- .../subliminal_patch/providers/utils.py | 8 +++-- custom_libs/subliminal_patch/subtitle.py | 2 +- tests/subliminal_patch/test_subf2m.py | 33 +++++++++++++++---- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/subf2m.py b/custom_libs/subliminal_patch/providers/subf2m.py index 0ef39595d..1ac0b4048 100644 --- a/custom_libs/subliminal_patch/providers/subf2m.py +++ b/custom_libs/subliminal_patch/providers/subf2m.py @@ -132,9 +132,9 @@ _DEFAULT_HEADERS = { class Subf2mProvider(Provider): provider_name = "subf2m" - _movie_title_regex = re.compile(r"^(.+?)( \((\d{4})\))?$") + _movie_title_regex = re.compile(r"^(.+?)(\s+\((\d{4})\))?$") _tv_show_title_regex = re.compile( - r"^(.+?) [-\(]\s?(.*?) (season|series)\)?( \((\d{4})\))?$" + r"^(.+?)\s+[-\(]\s?(.*?)\s+(season|series)\)?(\s+\((\d{4})\))?$" ) _tv_show_title_alt_regex = re.compile(r"(.+)\s(\d{1,2})(?:\s|$)") _supported_languages = {} diff --git a/custom_libs/subliminal_patch/providers/utils.py b/custom_libs/subliminal_patch/providers/utils.py index 86fee237f..206334462 100644 --- a/custom_libs/subliminal_patch/providers/utils.py +++ b/custom_libs/subliminal_patch/providers/utils.py @@ -86,11 +86,13 @@ def _get_matching_sub( return None -def _analize_sub_name(sub_name: str, title_): - titles = re.split(r"[.-]", os.path.splitext(sub_name)[0]) +def _analize_sub_name(sub_name: str, title_: str): + titles = re.split(r"[\s_\.\+]?[.-][\s_\.\+]?", os.path.splitext(sub_name)[0]) + for title in titles: title = title.strip() - ratio = SequenceMatcher(None, title, title_).ratio() + ratio = SequenceMatcher(None, title.lower(), title_.lower()).ratio() + if ratio > 0.85: logger.debug( "Episode title matched: '%s' -> '%s' [%s]", title, sub_name, ratio diff --git a/custom_libs/subliminal_patch/subtitle.py b/custom_libs/subliminal_patch/subtitle.py index 06a491be7..c65f8cdd2 100644 --- a/custom_libs/subliminal_patch/subtitle.py +++ b/custom_libs/subliminal_patch/subtitle.py @@ -281,7 +281,7 @@ class Subtitle(Subtitle_): return encoding def is_valid(self): - """Check if a :attr:`text` is a valid SubRip format. Note that orignal format will pypass the checking + """Check if a :attr:`text` is a valid SubRip format. Note that original format will bypass the checking :return: whether or not the subtitle is valid. :rtype: bool diff --git a/tests/subliminal_patch/test_subf2m.py b/tests/subliminal_patch/test_subf2m.py index e8369d2fa..b8901179b 100644 --- a/tests/subliminal_patch/test_subf2m.py +++ b/tests/subliminal_patch/test_subf2m.py @@ -184,15 +184,36 @@ def test_download_subtitle_episode(provider, subtitle_episode): assert subtitle_episode.is_valid() -def test_download_subtitle_episode_with_title(provider): +@pytest.mark.parametrize( + "language,page_link,release_info,episode_number,episode_title", + [ + ( + "en", + "https://subf2m.co/subtitles/courage-the-cowardly-dog/english/2232402", + "Season 3 complete.", + 13, + "Feast of the Bullfrogs", + ), + ( + "en", + "https://subf2m.co/subtitles/rick-and-morty-sixth-season/english/3060783", + "Used Subtitle Tools to convert from SUP to SRT, then ran the cleaner to remove HI. Grabbed subs from Rick.and.Morty.S06.1080p.BluRay.x264-STORiES.", + 7, + "Full Meta Jackrick", + ), + ], +) +def test_download_subtitle_episode_with_title( + provider, language, page_link, release_info, episode_number, episode_title +): sub = Subf2mSubtitle( - Language.fromalpha2("en"), - "https://subf2m.co/subtitles/courage-the-cowardly-dog/english/2232402", - "Season 3 complete.", - 13, + Language.fromalpha2(language), + page_link, + release_info, + episode_number, ) - sub.episode_title = "Feast of the Bullfrogs" + sub.episode_title = episode_title provider.download_subtitle(sub) assert sub.is_valid() From 4e365c6aa6f7e0786d8ceefdaa91099da59431f1 Mon Sep 17 00:00:00 2001 From: Omar Pakker Date: Tue, 3 Sep 2024 13:03:13 +0200 Subject: [PATCH 54/78] Added support for binding IPv4 AND IPv6 instead of just either one or the other --- bazarr/app/config.py | 4 +++- bazarr/app/logger.py | 9 ++++++--- bazarr/app/server.py | 5 ++--- frontend/src/pages/Settings/General/index.tsx | 4 ++-- 4 files changed, 13 insertions(+), 9 deletions(-) diff --git a/bazarr/app/config.py b/bazarr/app/config.py index 73ed05e7c..95e3db4f9 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -31,6 +31,8 @@ def base_url_slash_cleaner(uri): def validate_ip_address(ip_string): + if ip_string == '*': + return True try: ip_address(ip_string) return True @@ -73,7 +75,7 @@ validators = [ # general section Validator('general.flask_secret_key', must_exist=True, default=hexlify(os.urandom(16)).decode(), is_type_of=str), - Validator('general.ip', must_exist=True, default='0.0.0.0', is_type_of=str, condition=validate_ip_address), + Validator('general.ip', must_exist=True, default='*', is_type_of=str, condition=validate_ip_address), Validator('general.port', must_exist=True, default=6767, is_type_of=int, gte=1, lte=65535), Validator('general.base_url', must_exist=True, default='', is_type_of=str), Validator('general.path_mappings', must_exist=True, default=[], is_type_of=list), diff --git a/bazarr/app/logger.py b/bazarr/app/logger.py index a47acf3dc..8803ad3cb 100644 --- a/bazarr/app/logger.py +++ b/bazarr/app/logger.py @@ -58,10 +58,13 @@ class NoExceptionFormatter(logging.Formatter): class UnwantedWaitressMessageFilter(logging.Filter): def filter(self, record): - if settings.general.debug: - # no filtering in debug mode + if settings.general.debug or "BAZARR" in record.msg: + # no filtering in debug mode or if originating from us return True + if record.level != loggin.ERROR: + return False + unwantedMessages = [ "Exception while serving /api/socket.io/", ['Session is disconnected', 'Session not found'], @@ -161,7 +164,7 @@ def configure_logging(debug=False): logging.getLogger("websocket").setLevel(logging.CRITICAL) logging.getLogger("ga4mp.ga4mp").setLevel(logging.ERROR) - logging.getLogger("waitress").setLevel(logging.ERROR) + logging.getLogger("waitress").setLevel(logging.INFO) logging.getLogger("waitress").addFilter(UnwantedWaitressMessageFilter()) logging.getLogger("knowit").setLevel(logging.CRITICAL) logging.getLogger("enzyme").setLevel(logging.CRITICAL) diff --git a/bazarr/app/server.py b/bazarr/app/server.py index 1def54dab..4ffe436ce 100644 --- a/bazarr/app/server.py +++ b/bazarr/app/server.py @@ -50,7 +50,7 @@ class Server: self.connected = True except OSError as error: if error.errno == errno.EADDRNOTAVAIL: - logging.exception("BAZARR cannot bind to specified IP, trying with default (0.0.0.0)") + logging.exception("BAZARR cannot bind to specified IP, trying with 0.0.0.0") self.address = '0.0.0.0' self.connected = False super(Server, self).__init__() @@ -76,8 +76,7 @@ class Server: self.shutdown(EXIT_INTERRUPT) def start(self): - logging.info(f'BAZARR is started and waiting for request on http://{self.server.effective_host}:' - f'{self.server.effective_port}') + self.server.print_listen("BAZARR is started and waiting for requests on: http://{}:{}") signal.signal(signal.SIGINT, self.interrupt_handler) try: self.server.run() diff --git a/frontend/src/pages/Settings/General/index.tsx b/frontend/src/pages/Settings/General/index.tsx index 312d09d1f..6db3ee7fc 100644 --- a/frontend/src/pages/Settings/General/index.tsx +++ b/frontend/src/pages/Settings/General/index.tsx @@ -43,10 +43,10 @@ const SettingsGeneralView: FunctionComponent = () => {
- Valid IPv4 address or '0.0.0.0' for all interfaces + Valid IP address or '*' for all interfaces Date: Wed, 4 Sep 2024 06:53:30 -0400 Subject: [PATCH 55/78] Fixed podnapisi AttributeError --- custom_libs/subliminal_patch/providers/podnapisi.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/podnapisi.py b/custom_libs/subliminal_patch/providers/podnapisi.py index b13a47c4d..d20accb99 100644 --- a/custom_libs/subliminal_patch/providers/podnapisi.py +++ b/custom_libs/subliminal_patch/providers/podnapisi.py @@ -209,7 +209,8 @@ class PodnapisiProvider(_PodnapisiProvider, ProviderSubtitleArchiveMixin): break # exit if no results - if not xml.find('pagination/results').text or not int(xml.find('pagination/results').text): + if (not xml.find('pagination/results') or not xml.find('pagination/results').text or not + int(xml.find('pagination/results').text)): logger.debug('No subtitles found') break From 6ddfdfee6a64845fc0eab21b18ac56ad70d3e1f9 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 8 Sep 2024 07:56:46 -0400 Subject: [PATCH 56/78] Fixed series indexing when malformed alternate title is returned by Sonarr --- bazarr/sonarr/sync/parser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index 216a9d1f5..b985236fb 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -35,9 +35,11 @@ def seriesParser(show, action, tags_dict, language_profiles, serie_default_profi if image['coverType'] == 'fanart': fanart = image['url'].split('?')[0] - alternate_titles = None if show['alternateTitles'] is not None: - alternate_titles = str([item['title'] for item in show['alternateTitles']]) + alternate_titles = [item['title'] for item in show['alternateTitles'] if 'title' in item and item['title'] not + in [None, ''] and item["title"] != show["title"]] + else: + alternate_titles = [] tags = [d['label'] for d in tags_dict if d['id'] in show['tags']] @@ -64,7 +66,7 @@ def seriesParser(show, action, tags_dict, language_profiles, serie_default_profi 'audio_language': str(audio_language), 'sortTitle': show['sortTitle'], 'year': str(show['year']), - 'alternativeTitles': alternate_titles, + 'alternativeTitles': str(alternate_titles), 'tags': str(tags), 'seriesType': show['seriesType'], 'imdbId': imdbId, From 1aff7a35f25831944c1b3294280444ad9b5a25f1 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 9 Sep 2024 14:48:15 +0900 Subject: [PATCH 57/78] no log: Bump the mantine group in /frontend with 6 updates (#2649) --- frontend/package-lock.json | 70 +++++++++++++++++++------------------- frontend/package.json | 12 +++---- 2 files changed, 41 insertions(+), 41 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index 37f6f3319..b1884a08d 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -9,12 +9,12 @@ "version": "1.0.0", "license": "GPL-3", "dependencies": { - "@mantine/core": "^7.12.1", - "@mantine/dropzone": "^7.12.1", - "@mantine/form": "^7.12.1", - "@mantine/hooks": "^7.12.1", - "@mantine/modals": "^7.12.1", - "@mantine/notifications": "^7.12.1", + "@mantine/core": "^7.12.2", + "@mantine/dropzone": "^7.12.2", + "@mantine/form": "^7.12.2", + "@mantine/hooks": "^7.12.2", + "@mantine/modals": "^7.12.2", + "@mantine/notifications": "^7.12.2", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", @@ -2616,9 +2616,9 @@ } }, "node_modules/@mantine/core": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.12.1.tgz", - "integrity": "sha512-PXKIDaT1fpNB77dPQIcdFGM2NRnfmsJSVx3uuBccngBQWMIWI0wPyiO1Y26DK4LQrbrypeb+TS+Zxpgx6RoiCA==", + "version": "7.12.2", + "resolved": "https://registry.npmjs.org/@mantine/core/-/core-7.12.2.tgz", + "integrity": "sha512-FrMHOKq4s3CiPIxqZ9xnVX7H4PEGNmbtHMvWO/0YlfPgoV0Er/N/DNJOFW1ys4WSnidPTayYeB41riyxxGOpRQ==", "dependencies": { "@floating-ui/react": "^0.26.9", "clsx": "^2.1.1", @@ -2628,7 +2628,7 @@ "type-fest": "^4.12.0" }, "peerDependencies": { - "@mantine/hooks": "7.12.1", + "@mantine/hooks": "7.12.2", "react": "^18.2.0", "react-dom": "^18.2.0" } @@ -2645,23 +2645,23 @@ } }, "node_modules/@mantine/dropzone": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.12.1.tgz", - "integrity": "sha512-IuAdCnl6PDtkDnGp4vQlHgxr9z3R7s0685khVKpxy/3f+XfdoswUBBY3X7XyirpDXMIjMD4SLpkIzwuUXgZsag==", + "version": "7.12.2", + "resolved": "https://registry.npmjs.org/@mantine/dropzone/-/dropzone-7.12.2.tgz", + "integrity": "sha512-VXKpgFBfRfci6eQEyrmNSsTR7LdtErDhWloVw7W6YRsCqJxJHg9e3luG+yIk+tokzSyLoLOVZRX/mESDEso3PQ==", "dependencies": { "react-dropzone-esm": "15.0.1" }, "peerDependencies": { - "@mantine/core": "7.12.1", - "@mantine/hooks": "7.12.1", + "@mantine/core": "7.12.2", + "@mantine/hooks": "7.12.2", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/form": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.12.1.tgz", - "integrity": "sha512-Q+lpgG9N8srlsI0IPnD1V1c2ZaI0xmR3bBEVm+LttSos6Q5zkG49Yy011mc0cXzEKUk2h48j8PLoPHfSEzO03g==", + "version": "7.12.2", + "resolved": "https://registry.npmjs.org/@mantine/form/-/form-7.12.2.tgz", + "integrity": "sha512-MknzDN5F7u/V24wVrL5VIXNvE7/6NMt40K6w3p7wbKFZiLhdh/tDWdMcRN7PkkWF1j2+eoVCBAOCL74U3BzNag==", "dependencies": { "fast-deep-equal": "^3.1.3", "klona": "^2.0.6" @@ -2671,43 +2671,43 @@ } }, "node_modules/@mantine/hooks": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.12.1.tgz", - "integrity": "sha512-YPA3qiMHJkWID5+YzakBaLvjHtX3Fg3PdPY49iIb/CaWM9+lrJ+77TOVS7bsY7ZTBHXUfzft1/6Woqt3xSuweA==", + "version": "7.12.2", + "resolved": "https://registry.npmjs.org/@mantine/hooks/-/hooks-7.12.2.tgz", + "integrity": "sha512-dVMw8jpM0hAzc8e7/GNvzkk9N0RN/m+PKycETB3H6lJGuXJJSRR4wzzgQKpEhHwPccktDpvb4rkukKDq2jA8Fg==", "peerDependencies": { "react": "^18.2.0" } }, "node_modules/@mantine/modals": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.12.1.tgz", - "integrity": "sha512-olS07yDcCFLGylLGaQgBiTnKcRrUZVLKqBFBw5glcmc/wZmJf4SDMgx5mxSwBnsbJOwJ2d3aIYwO/qNTNnluSg==", + "version": "7.12.2", + "resolved": "https://registry.npmjs.org/@mantine/modals/-/modals-7.12.2.tgz", + "integrity": "sha512-ffnu9MtUHceoaLlhrwq+J+eojidEPkq3m2Rrt5HfcZv3vAP8RtqPnTfgk99WOB3vyCtdu8r4I9P3ckuYtPRtAg==", "peerDependencies": { - "@mantine/core": "7.12.1", - "@mantine/hooks": "7.12.1", + "@mantine/core": "7.12.2", + "@mantine/hooks": "7.12.2", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/notifications": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.12.1.tgz", - "integrity": "sha512-YIV2ItCRJzbOjEyXtz5Rjf3qn6kwmcz6CqAGurpd+kecxx6wwNoKuKs6YNlz7tcprFegcH/hCUkW2tVbXHKVBA==", + "version": "7.12.2", + "resolved": "https://registry.npmjs.org/@mantine/notifications/-/notifications-7.12.2.tgz", + "integrity": "sha512-gTvLHkoAZ42v5bZxibP9A50djp5ndEwumVhHSa7mxQ8oSS23tt3It/6hOqH7M+9kHY0a8s+viMiflUzTByA9qg==", "dependencies": { - "@mantine/store": "7.12.1", + "@mantine/store": "7.12.2", "react-transition-group": "4.4.5" }, "peerDependencies": { - "@mantine/core": "7.12.1", - "@mantine/hooks": "7.12.1", + "@mantine/core": "7.12.2", + "@mantine/hooks": "7.12.2", "react": "^18.2.0", "react-dom": "^18.2.0" } }, "node_modules/@mantine/store": { - "version": "7.12.1", - "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.12.1.tgz", - "integrity": "sha512-zIzYEheEyXchPTNKsm88BJ0CTEZV6ZNwMhMDWHKQE3CzjKLJdKHJdIBcZImRU3Pn4GROZdZdIkQF9HLJ6BjvYw==", + "version": "7.12.2", + "resolved": "https://registry.npmjs.org/@mantine/store/-/store-7.12.2.tgz", + "integrity": "sha512-NqL31sO/KcAETEWP/CiXrQOQNoE4168vZsxyXacQHGBueVMJa64WIDQtKLHrCnFRMws3vsXF02/OO4bH4XGcMQ==", "peerDependencies": { "react": "^18.2.0" } diff --git a/frontend/package.json b/frontend/package.json index f89a71931..291de7ada 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -13,12 +13,12 @@ }, "private": true, "dependencies": { - "@mantine/core": "^7.12.1", - "@mantine/dropzone": "^7.12.1", - "@mantine/form": "^7.12.1", - "@mantine/hooks": "^7.12.1", - "@mantine/modals": "^7.12.1", - "@mantine/notifications": "^7.12.1", + "@mantine/core": "^7.12.2", + "@mantine/dropzone": "^7.12.2", + "@mantine/form": "^7.12.2", + "@mantine/hooks": "^7.12.2", + "@mantine/modals": "^7.12.2", + "@mantine/notifications": "^7.12.2", "@tanstack/react-query": "^5.40.1", "@tanstack/react-table": "^8.19.2", "axios": "^1.6.8", From 10d475e81ec0babbdc8fd44020fdc5ee1bb359ad Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Tue, 10 Sep 2024 13:37:14 +0900 Subject: [PATCH 58/78] Fixed async audio languages not mapped fallback (#2652) --- bazarr/languages/get_languages.py | 9 +++++++-- bazarr/radarr/sync/parser.py | 4 ++-- bazarr/sonarr/sync/parser.py | 6 +++--- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/bazarr/languages/get_languages.py b/bazarr/languages/get_languages.py index 881dd6ce0..89e2316d8 100644 --- a/bazarr/languages/get_languages.py +++ b/bazarr/languages/get_languages.py @@ -54,13 +54,18 @@ def create_languages_dict(): TableSettingsLanguages.code3b)) .all()] -def audio_language_from_alpha2(lang): +def audio_language_from_name(lang): lang_map = { 'Chinese': 'zh', 'Portuguese (Brazil)': 'pb' } - return language_from_alpha2(lang_map.get(lang, lang)) + alpha2_code = lang_map.get(lang, None) + + if alpha2_code is None: + return lang + + return language_from_alpha2(alpha2_code) def language_from_alpha2(lang): return next((item['name'] for item in languages_dict if item['code2'] == lang[:2]), None) diff --git a/bazarr/radarr/sync/parser.py b/bazarr/radarr/sync/parser.py index 60aad85a5..cc186df2f 100644 --- a/bazarr/radarr/sync/parser.py +++ b/bazarr/radarr/sync/parser.py @@ -3,7 +3,7 @@ import os from app.config import settings -from languages.get_languages import audio_language_from_alpha2 +from languages.get_languages import audio_language_from_name from radarr.info import get_radarr_info from utilities.video_analyzer import embedded_audio_reader from utilities.path_mappings import path_mappings @@ -117,7 +117,7 @@ def movieParser(movie, action, tags_dict, language_profiles, movie_default_profi for item in movie['movieFile']['languages']: if isinstance(item, dict): if 'name' in item: - language = audio_language_from_alpha2(item['name']) + language = audio_language_from_name(item['name']) audio_language.append(language) tags = [d['label'] for d in tags_dict if d['id'] in movie['tags']] diff --git a/bazarr/sonarr/sync/parser.py b/bazarr/sonarr/sync/parser.py index b985236fb..27da32117 100644 --- a/bazarr/sonarr/sync/parser.py +++ b/bazarr/sonarr/sync/parser.py @@ -5,7 +5,7 @@ import os from app.config import settings from app.database import TableShows, database, select from constants import MINIMUM_VIDEO_SIZE -from languages.get_languages import audio_language_from_alpha2 +from languages.get_languages import audio_language_from_name from utilities.path_mappings import path_mappings from utilities.video_analyzer import embedded_audio_reader from sonarr.info import get_sonarr_info @@ -122,13 +122,13 @@ def episodeParser(episode): item = episode['episodeFile']['language'] if isinstance(item, dict): if 'name' in item: - audio_language.append(audio_language_from_alpha2(item['name'])) + audio_language.append(audio_language_from_name(item['name'])) elif 'languages' in episode['episodeFile'] and len(episode['episodeFile']['languages']): items = episode['episodeFile']['languages'] if isinstance(items, list): for item in items: if 'name' in item: - audio_language.append(audio_language_from_alpha2(item['name'])) + audio_language.append(audio_language_from_name(item['name'])) else: audio_language = database.execute( select(TableShows.audio_language) From 6d062f35009db472e58e58fb9a05f463fbbe49d7 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Thu, 12 Sep 2024 20:33:22 -0400 Subject: [PATCH 59/78] Modified some language names to match those in Sonarr and Radarr. #2650 --- bazarr/languages/custom_lang.py | 27 +++++++++++++++++---------- bazarr/languages/get_languages.py | 9 ++++++++- 2 files changed, 25 insertions(+), 11 deletions(-) diff --git a/bazarr/languages/custom_lang.py b/bazarr/languages/custom_lang.py index bc50a4758..e6f3aa2f3 100644 --- a/bazarr/languages/custom_lang.py +++ b/bazarr/languages/custom_lang.py @@ -5,7 +5,8 @@ import os from subzero.language import Language -from app.database import database, insert +from app.database import database, insert, update +from sqlalchemy.exc import IntegrityError logger = logging.getLogger(__name__) @@ -18,7 +19,7 @@ class CustomLanguage: language = "pt-BR" official_alpha2 = "pt" official_alpha3 = "por" - name = "Brazilian Portuguese" + name = "Portuguese (Brazil)" iso = "BR" _scripts = [] _possible_matches = ("pt-br", "pob", "pb", "brazilian", "brasil", "brazil") @@ -50,13 +51,19 @@ class CustomLanguage: """Register the custom language subclasses in the database.""" for sub in cls.__subclasses__(): - database.execute( - insert(table) - .values(code3=sub.alpha3, - code2=sub.alpha2, - name=sub.name, - enabled=0) - .on_conflict_do_nothing()) + try: + database.execute( + insert(table) + .values(code3=sub.alpha3, + code2=sub.alpha2, + name=sub.name, + enabled=0)) + except IntegrityError: + database.execute( + update(table) + .values(code2=sub.alpha2, + name=sub.name) + .where(table.code3 == sub.alpha3)) @classmethod def found_external(cls, subtitle, subtitle_path): @@ -212,7 +219,7 @@ class LatinAmericanSpanish(CustomLanguage): language = "es-MX" official_alpha2 = "es" official_alpha3 = "spa" - name = "Latin American Spanish" + name = "Spanish (Latino)" iso = "MX" # Not fair, but ok _scripts = ("419",) _possible_matches = ( diff --git a/bazarr/languages/get_languages.py b/bazarr/languages/get_languages.py index 89e2316d8..494343f6f 100644 --- a/bazarr/languages/get_languages.py +++ b/bazarr/languages/get_languages.py @@ -44,6 +44,12 @@ def create_languages_dict(): .values(name='Chinese Simplified') .where(TableSettingsLanguages.code3 == 'zho')) + # replace Modern Greek by Greek to match Sonarr and Radarr languages + database.execute( + update(TableSettingsLanguages) + .values(name='Greek') + .where(TableSettingsLanguages.code3 == 'ell')) + languages_dict = [{ 'code3': x.code3, 'code2': x.code2, @@ -54,10 +60,10 @@ def create_languages_dict(): TableSettingsLanguages.code3b)) .all()] + def audio_language_from_name(lang): lang_map = { 'Chinese': 'zh', - 'Portuguese (Brazil)': 'pb' } alpha2_code = lang_map.get(lang, None) @@ -67,6 +73,7 @@ def audio_language_from_name(lang): return language_from_alpha2(alpha2_code) + def language_from_alpha2(lang): return next((item['name'] for item in languages_dict if item['code2'] == lang[:2]), None) From b8aa2a8b1af42dff9539c6e190bd2e6a7a7fd0ca Mon Sep 17 00:00:00 2001 From: Matheus Amendola Date: Fri, 13 Sep 2024 09:44:19 -0300 Subject: [PATCH 60/78] Added support for Legendas.net provider --- bazarr/app/config.py | 4 + bazarr/app/get_providers.py | 4 + .../subliminal_patch/providers/legendasnet.py | 262 ++++++++++++++++++ frontend/src/pages/Settings/Providers/list.ts | 15 + 4 files changed, 285 insertions(+) create mode 100644 custom_libs/subliminal_patch/providers/legendasnet.py diff --git a/bazarr/app/config.py b/bazarr/app/config.py index 95e3db4f9..15e9959f6 100644 --- a/bazarr/app/config.py +++ b/bazarr/app/config.py @@ -282,6 +282,10 @@ validators = [ Validator('legendasdivx.password', must_exist=True, default='', is_type_of=str, cast=str), Validator('legendasdivx.skip_wrong_fps', must_exist=True, default=False, is_type_of=bool), + # legendasnet section + Validator('legendasnet.username', must_exist=True, default='', is_type_of=str, cast=str), + Validator('legendasnet.password', must_exist=True, default='', is_type_of=str, cast=str), + # ktuvit section Validator('ktuvit.email', must_exist=True, default='', is_type_of=str), Validator('ktuvit.hashed_password', must_exist=True, default='', is_type_of=str, cast=str), diff --git a/bazarr/app/get_providers.py b/bazarr/app/get_providers.py index fe1445497..125b24d40 100644 --- a/bazarr/app/get_providers.py +++ b/bazarr/app/get_providers.py @@ -264,6 +264,10 @@ def get_providers_auth(): 'password': settings.legendasdivx.password, 'skip_wrong_fps': settings.legendasdivx.skip_wrong_fps, }, + 'legendasnet': { + 'username': settings.legendasnet.username, + 'password': settings.legendasnet.password, + }, 'xsubs': { 'username': settings.xsubs.username, 'password': settings.xsubs.password, diff --git a/custom_libs/subliminal_patch/providers/legendasnet.py b/custom_libs/subliminal_patch/providers/legendasnet.py new file mode 100644 index 000000000..88bd081ec --- /dev/null +++ b/custom_libs/subliminal_patch/providers/legendasnet.py @@ -0,0 +1,262 @@ +# -*- coding: utf-8 -*- +import logging +import os +import time +import io +import json + +from zipfile import ZipFile, is_zipfile +from urllib.parse import urljoin +from requests import Session + +from subzero.language import Language +from subliminal import Episode, Movie +from subliminal.exceptions import ConfigurationError, ProviderError, DownloadLimitExceeded +from subliminal_patch.exceptions import APIThrottled +from .mixins import ProviderRetryMixin +from subliminal_patch.subtitle import Subtitle +from subliminal.subtitle import fix_line_ending +from subliminal_patch.providers import Provider +from subliminal_patch.providers import utils + +logger = logging.getLogger(__name__) + +retry_amount = 3 +retry_timeout = 5 + + +class LegendasNetSubtitle(Subtitle): + provider_name = 'legendasnet' + hash_verifiable = False + + def __init__(self, language, forced, page_link, download_link, file_id, release_names, uploader, + season=None, episode=None): + super().__init__(language) + language = Language.rebuild(language, forced=forced) + + self.season = season + self.episode = episode + self.releases = release_names + self.release_info = ', '.join(release_names) + self.language = language + self.forced = forced + self.file_id = file_id + self.page_link = page_link + self.download_link = download_link + self.uploader = uploader + self.matches = None + + @property + def id(self): + return self.file_id + + def get_matches(self, video): + matches = set() + + # handle movies and series separately + if isinstance(video, Episode): + # series + matches.add('series') + # season + if video.season == self.season: + matches.add('season') + # episode + if video.episode == self.episode: + matches.add('episode') + # imdb + matches.add('series_imdb_id') + else: + # title + matches.add('title') + # imdb + matches.add('imdb_id') + + utils.update_matches(matches, video, self.release_info) + + self.matches = matches + + return matches + + +class LegendasNetProvider(ProviderRetryMixin, Provider): + """Legendas.Net Provider""" + server_hostname = 'legendas.net/api' + + languages = {Language('por', 'BR')} + video_types = (Episode, Movie) + + def __init__(self, username, password): + self.session = Session() + self.session.headers = {'User-Agent': os.environ.get("SZ_USER_AGENT", "Sub-Zero/2")} + self.username = username + self.password = password + self.access_token = None + self.video = None + self._started = None + self.login() + + def login(self): + headersList = { + "Accept": "*/*", + "User-Agent": self.session.headers['User-Agent'], + "Content-Type": "application/json" + } + + payload = json.dumps({ + "email": self.username, + "password": self.password + }) + + response = self.session.request("POST", self.server_url() + 'login', data=payload, headers=headersList) + if response.status_code != 200: + raise ConfigurationError('Failed to login and retrieve access token') + self.access_token = response.json().get('access_token') + if not self.access_token: + raise ConfigurationError('Access token not found in login response') + self.session.headers.update({'Authorization': f'Bearer {self.access_token}'}) + + def initialize(self): + self._started = time.time() + + def terminate(self): + self.session.close() + + def server_url(self): + return f'https://{self.server_hostname}/v1/' + + def query(self, languages, video): + self.video = video + + # query the server + if isinstance(self.video, Episode): + res = self.retry( + lambda: self.session.get(self.server_url() + 'search/tv', + json={ + 'name': video.series, + 'page': 1, + 'per_page': 25, + 'tv_episode': video.episode, + 'tv_season': video.season, + 'imdb_id': video.series_imdb_id + }, + headers={'Content-Type': 'application/json'}, + timeout=30), + amount=retry_amount, + retry_timeout=retry_timeout + ) + else: + res = self.retry( + lambda: self.session.get(self.server_url() + 'search/movie', + json={ + 'name': video.title, + 'page': 1, + 'per_page': 25, + 'imdb_id': video.imdb_id + }, + headers={'Content-Type': 'application/json'}, + timeout=30), + amount=retry_amount, + retry_timeout=retry_timeout + ) + + if res.status_code == 404: + logger.error(f"Endpoint not found: {res.url}") + raise ProviderError("Endpoint not found") + elif res.status_code == 429: + raise APIThrottled("Too many requests") + elif res.status_code == 403: + raise ConfigurationError("Invalid access token") + elif res.status_code != 200: + res.raise_for_status() + + subtitles = [] + + result = res.json() + + if ('success' in result and not result['success']) or ('status' in result and not result['status']): + logger.debug(result["error"]) + return [] + + if isinstance(self.video, Episode): + if len(result['tv_shows']): + for item in result['tv_shows']: + subtitle = LegendasNetSubtitle( + language=Language('por', 'BR'), + forced=self._is_forced(item), + page_link= f"https://legendas.net/tv_legenda?movie_id={result['tv_shows'][0]['tmdb_id']}&legenda_id={item['id']}", + download_link= item['path'], + file_id=item['id'], + release_names=[item.get('release_name', '')], + uploader=item['uploader'], + season=item.get('season', ''), + episode=item.get('episode', '') + ) + subtitle.get_matches(self.video) + if subtitle.language in languages: + subtitles.append(subtitle) + else: + if len(result['movies']): + for item in result['movies']: + subtitle = LegendasNetSubtitle( + language=Language('por', 'BR'), + forced=self._is_forced(item), + page_link= f"https://legendas.net/legenda?movie_id={result['movies'][0]['tmdb_id']}&legenda_id={item['id']}", + download_link= item['path'], + file_id=item['id'], + release_names=[item.get('release_name', '')], + uploader=item['uploader'], + season=None, + episode=None + ) + subtitle.get_matches(self.video) + if subtitle.language in languages: + subtitles.append(subtitle) + + return subtitles + + @staticmethod + def _is_forced(item): + forced_tags = ['forced', 'foreign'] + for tag in forced_tags: + if tag in item.get('comment', '').lower(): + return True + + # nothing match so we consider it as normal subtitles + return False + + def list_subtitles(self, video, languages): + return self.query(languages, video) + + def download_subtitle(self, subtitle): + logger.debug('Downloading subtitle %r', subtitle) + download_link = urljoin("https://legendas.net",subtitle.download_link) + + r = self.retry( + lambda: self.session.get(download_link, timeout=30), + amount=retry_amount, + retry_timeout=retry_timeout + ) + + if r.status_code == 429: + raise DownloadLimitExceeded("Daily download limit exceeded") + elif r.status_code == 403: + raise ConfigurationError("Invalid access token") + elif r.status_code != 200: + r.raise_for_status() + + if not r: + logger.error(f'Could not download subtitle from {download_link}') + subtitle.content = None + return + else: + archive_stream = io.BytesIO(r.content) + if is_zipfile(archive_stream): + archive = ZipFile(archive_stream) + for name in archive.namelist(): + subtitle_content = archive.read(name) + subtitle.content = fix_line_ending(subtitle_content) + return + else: + subtitle_content = r.content + subtitle.content = fix_line_ending(subtitle_content) + return \ No newline at end of file diff --git a/frontend/src/pages/Settings/Providers/list.ts b/frontend/src/pages/Settings/Providers/list.ts index 8d7a86a99..8f0e46a56 100644 --- a/frontend/src/pages/Settings/Providers/list.ts +++ b/frontend/src/pages/Settings/Providers/list.ts @@ -305,6 +305,21 @@ export const ProviderList: Readonly = [ { type: "switch", key: "skip_wrong_fps", name: "Skip Wrong FPS" }, ], }, + { + key: "legendasnet", + name: "Legendas.net", + description: "Brazilian Subtitles Provider", + inputs: [ + { + type: "text", + key: "username", + }, + { + type: "password", + key: "password", + }, + ], + }, { key: "napiprojekt", description: "Polish Subtitles Provider" }, { key: "napisy24", From 42781d5b6826d81c53c682e6676e99e2cfa9f015 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Fri, 13 Sep 2024 08:48:52 -0400 Subject: [PATCH 61/78] no log: some pep8 fixes to legendasnet --- .../subliminal_patch/providers/legendasnet.py | 62 ++++++++++--------- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/custom_libs/subliminal_patch/providers/legendasnet.py b/custom_libs/subliminal_patch/providers/legendasnet.py index 88bd081ec..b5c8e0cd9 100644 --- a/custom_libs/subliminal_patch/providers/legendasnet.py +++ b/custom_libs/subliminal_patch/providers/legendasnet.py @@ -131,30 +131,30 @@ class LegendasNetProvider(ProviderRetryMixin, Provider): if isinstance(self.video, Episode): res = self.retry( lambda: self.session.get(self.server_url() + 'search/tv', - json={ - 'name': video.series, - 'page': 1, - 'per_page': 25, - 'tv_episode': video.episode, - 'tv_season': video.season, - 'imdb_id': video.series_imdb_id - }, - headers={'Content-Type': 'application/json'}, - timeout=30), + json={ + 'name': video.series, + 'page': 1, + 'per_page': 25, + 'tv_episode': video.episode, + 'tv_season': video.season, + 'imdb_id': video.series_imdb_id + }, + headers={'Content-Type': 'application/json'}, + timeout=30), amount=retry_amount, retry_timeout=retry_timeout ) else: res = self.retry( lambda: self.session.get(self.server_url() + 'search/movie', - json={ - 'name': video.title, - 'page': 1, - 'per_page': 25, - 'imdb_id': video.imdb_id - }, - headers={'Content-Type': 'application/json'}, - timeout=30), + json={ + 'name': video.title, + 'page': 1, + 'per_page': 25, + 'imdb_id': video.imdb_id + }, + headers={'Content-Type': 'application/json'}, + timeout=30), amount=retry_amount, retry_timeout=retry_timeout ) @@ -183,13 +183,14 @@ class LegendasNetProvider(ProviderRetryMixin, Provider): subtitle = LegendasNetSubtitle( language=Language('por', 'BR'), forced=self._is_forced(item), - page_link= f"https://legendas.net/tv_legenda?movie_id={result['tv_shows'][0]['tmdb_id']}&legenda_id={item['id']}", - download_link= item['path'], + page_link=f"https://legendas.net/tv_legenda?movie_id={result['tv_shows'][0]['tmdb_id']}&" + f"legenda_id={item['id']}", + download_link=item['path'], file_id=item['id'], release_names=[item.get('release_name', '')], - uploader=item['uploader'], - season=item.get('season', ''), - episode=item.get('episode', '') + uploader=item['uploader'], + season=item.get('season', ''), + episode=item.get('episode', '') ) subtitle.get_matches(self.video) if subtitle.language in languages: @@ -200,13 +201,14 @@ class LegendasNetProvider(ProviderRetryMixin, Provider): subtitle = LegendasNetSubtitle( language=Language('por', 'BR'), forced=self._is_forced(item), - page_link= f"https://legendas.net/legenda?movie_id={result['movies'][0]['tmdb_id']}&legenda_id={item['id']}", - download_link= item['path'], + page_link=f"https://legendas.net/legenda?movie_id={result['movies'][0]['tmdb_id']}&" + f"legenda_id={item['id']}", + download_link=item['path'], file_id=item['id'], release_names=[item.get('release_name', '')], - uploader=item['uploader'], - season=None, - episode=None + uploader=item['uploader'], + season=None, + episode=None ) subtitle.get_matches(self.video) if subtitle.language in languages: @@ -229,7 +231,7 @@ class LegendasNetProvider(ProviderRetryMixin, Provider): def download_subtitle(self, subtitle): logger.debug('Downloading subtitle %r', subtitle) - download_link = urljoin("https://legendas.net",subtitle.download_link) + download_link = urljoin("https://legendas.net", subtitle.download_link) r = self.retry( lambda: self.session.get(download_link, timeout=30), @@ -259,4 +261,4 @@ class LegendasNetProvider(ProviderRetryMixin, Provider): else: subtitle_content = r.content subtitle.content = fix_line_ending(subtitle_content) - return \ No newline at end of file + return From dc384d7694d37932596332bf2eab1b3fce363455 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 13 Sep 2024 21:58:58 +0900 Subject: [PATCH 62/78] no log: Bump @types/react in /frontend in the react group (#2653) --- frontend/package-lock.json | 8 ++++---- frontend/package.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/frontend/package-lock.json b/frontend/package-lock.json index b1884a08d..e189952d2 100644 --- a/frontend/package-lock.json +++ b/frontend/package-lock.json @@ -38,7 +38,7 @@ "@types/jest": "^29.5.12", "@types/lodash": "^4.17.1", "@types/node": "^20.12.6", - "@types/react": "^18.3.4", + "@types/react": "^18.3.5", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^7.16.0", "@typescript-eslint/parser": "^7.16.0", @@ -3481,9 +3481,9 @@ "devOptional": true }, "node_modules/@types/react": { - "version": "18.3.4", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.4.tgz", - "integrity": "sha512-J7W30FTdfCxDDjmfRM+/JqLHBIyl7xUIp9kwK637FGmY7+mkSFSe6L4jpZzhj5QMfLssSDP4/i75AKkrdC7/Jw==", + "version": "18.3.5", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.3.5.tgz", + "integrity": "sha512-WeqMfGJLGuLCqHGYRGHxnKrXcTitc6L/nBUWfWPcTarG3t9PsquqUMuVeXZeca+mglY4Vo5GZjCi0A3Or2lnxA==", "devOptional": true, "dependencies": { "@types/prop-types": "*", diff --git a/frontend/package.json b/frontend/package.json index 291de7ada..57a8cdd55 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -42,7 +42,7 @@ "@types/jest": "^29.5.12", "@types/lodash": "^4.17.1", "@types/node": "^20.12.6", - "@types/react": "^18.3.4", + "@types/react": "^18.3.5", "@types/react-dom": "^18.3.0", "@typescript-eslint/eslint-plugin": "^7.16.0", "@typescript-eslint/parser": "^7.16.0", From 695887b58456f8e99ce9b2b54054e537100bc966 Mon Sep 17 00:00:00 2001 From: Matheus Amendola Date: Sun, 15 Sep 2024 22:08:45 -0300 Subject: [PATCH 63/78] no log: updated readme for legendas.net Since Legendas.net was added in release v1.4.4, I am updating the README.md. --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2520aa9f9..d87fd9aa0 100644 --- a/README.md +++ b/README.md @@ -62,6 +62,7 @@ If you need something that is not already part of Bazarr, feel free to create a - Karagarga.in - Ktuvit (Get `hashed_password` using method described [here](https://github.com/XBMCil/service.subtitles.ktuvit)) - LegendasDivx +- Legendas.net - Napiprojekt - Napisy24 - Nekur From cc7a8000e74c09ac2a747cf303ff86a48f37ec1e Mon Sep 17 00:00:00 2001 From: Omar Pakker Date: Mon, 16 Sep 2024 18:10:50 +0200 Subject: [PATCH 64/78] Fixed logging filter bug introduced in 1.4.4 --- bazarr/app/logger.py | 2 +- tests/test_logging_filters.py | 22 ++++++++++++++++++++++ 2 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 tests/test_logging_filters.py diff --git a/bazarr/app/logger.py b/bazarr/app/logger.py index 8803ad3cb..e5f2fce7d 100644 --- a/bazarr/app/logger.py +++ b/bazarr/app/logger.py @@ -62,7 +62,7 @@ class UnwantedWaitressMessageFilter(logging.Filter): # no filtering in debug mode or if originating from us return True - if record.level != loggin.ERROR: + if record.level < logging.ERROR: return False unwantedMessages = [ diff --git a/tests/test_logging_filters.py b/tests/test_logging_filters.py new file mode 100644 index 000000000..9209fb09e --- /dev/null +++ b/tests/test_logging_filters.py @@ -0,0 +1,22 @@ +import logging + +from bazarr.app.logger import UnwantedWaitressMessageFilter + +def test_true_for_bazarr(): + record = logging.makeLogRecord({ + "level": logging.INFO, + "msg": "a message from BAZARR for logging" + }) + assert UnwantedWaitressMessageFilter().filter(record) + +def test_false_below_error(): + record = logging.makeLogRecord({ + "level": logging.INFO + }) + assert not UnwantedWaitressMessageFilter().filter(record) + +def test_true_error_up(): + record = logging.makeLogRecord({ + "level": logging.CRITICAL + }) + assert UnwantedWaitressMessageFilter().filter(record) From 90b44802dc3be1429b5d41eb4ad4603c80f1ce80 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Fri, 20 Sep 2024 07:42:16 -0400 Subject: [PATCH 65/78] Fixed logging filter issue. --- bazarr/app/logger.py | 2 +- tests/{ => bazarr}/test_logging_filters.py | 13 +++---------- 2 files changed, 4 insertions(+), 11 deletions(-) rename tests/{ => bazarr}/test_logging_filters.py (57%) diff --git a/bazarr/app/logger.py b/bazarr/app/logger.py index e5f2fce7d..8762d0355 100644 --- a/bazarr/app/logger.py +++ b/bazarr/app/logger.py @@ -62,7 +62,7 @@ class UnwantedWaitressMessageFilter(logging.Filter): # no filtering in debug mode or if originating from us return True - if record.level < logging.ERROR: + if record.levelno < logging.ERROR: return False unwantedMessages = [ diff --git a/tests/test_logging_filters.py b/tests/bazarr/test_logging_filters.py similarity index 57% rename from tests/test_logging_filters.py rename to tests/bazarr/test_logging_filters.py index 9209fb09e..05d655477 100644 --- a/tests/test_logging_filters.py +++ b/tests/bazarr/test_logging_filters.py @@ -3,20 +3,13 @@ import logging from bazarr.app.logger import UnwantedWaitressMessageFilter def test_true_for_bazarr(): - record = logging.makeLogRecord({ - "level": logging.INFO, - "msg": "a message from BAZARR for logging" - }) + record = logging.LogRecord("", logging.INFO, "", 0, "a message from BAZARR for logging", (), None) assert UnwantedWaitressMessageFilter().filter(record) def test_false_below_error(): - record = logging.makeLogRecord({ - "level": logging.INFO - }) + record = logging.LogRecord("", logging.INFO, "", 0, "", (), None) assert not UnwantedWaitressMessageFilter().filter(record) def test_true_error_up(): - record = logging.makeLogRecord({ - "level": logging.CRITICAL - }) + record = logging.LogRecord("", logging.CRITICAL, "", 0, "", (), None) assert UnwantedWaitressMessageFilter().filter(record) From 6364659c3b3e80dff701a9ce4bad785f2d181932 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Fri, 20 Sep 2024 07:43:20 -0400 Subject: [PATCH 66/78] no log: removed subscene provider tests --- tests/subliminal_patch/test_subscene.py | 50 ------------------------- 1 file changed, 50 deletions(-) delete mode 100644 tests/subliminal_patch/test_subscene.py diff --git a/tests/subliminal_patch/test_subscene.py b/tests/subliminal_patch/test_subscene.py deleted file mode 100644 index 72063aae3..000000000 --- a/tests/subliminal_patch/test_subscene.py +++ /dev/null @@ -1,50 +0,0 @@ -from subliminal_patch.providers import subscene_cloudscraper as subscene - - -def test_provider_scraper_call(): - with subscene.SubsceneProvider() as provider: - result = provider._scraper_call( - "https://subscene.com/subtitles/breaking-bad-fifth-season" - ) - assert result.status_code == 200 - - -def test_provider_gen_results(): - with subscene.SubsceneProvider() as provider: - assert list(provider._gen_results("Breaking Bad")) - - -def test_provider_search_movie(): - with subscene.SubsceneProvider() as provider: - result = provider._search_movie("Taxi Driver", 1976) - assert result == "/subtitles/taxi-driver" - - -def test_provider_find_movie_subtitles(languages): - with subscene.SubsceneProvider() as provider: - result = provider._find_movie_subtitles( - "/subtitles/taxi-driver", languages["en"] - ) - assert result - - -def test_provider_search_tv_show_season(): - with subscene.SubsceneProvider() as provider: - result = provider._search_tv_show_season("The Wire", 1) - assert result == "/subtitles/the-wire--first-season" - - -def test_provider_find_episode_subtitles(languages): - with subscene.SubsceneProvider() as provider: - result = provider._find_episode_subtitles( - "/subtitles/the-wire--first-season", 1, 1, languages["en"] - ) - assert result - - -def test_provider_download_subtitle(languages): - path = "https://subscene.com/subtitles/the-wire--first-season/english/115904" - subtitle = subscene.SubsceneSubtitle(languages["en"], path, "", 1) - with subscene.SubsceneProvider() as provider: - provider.download_subtitle(subtitle) - assert subtitle.is_valid() From 9db30f9eb0f59c2edd3db1a9586285b44ba4e49e Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Fri, 20 Sep 2024 08:43:53 -0400 Subject: [PATCH 67/78] no log: small fix to test --- tests/bazarr/test_logging_filters.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/bazarr/test_logging_filters.py b/tests/bazarr/test_logging_filters.py index 05d655477..bf01979e7 100644 --- a/tests/bazarr/test_logging_filters.py +++ b/tests/bazarr/test_logging_filters.py @@ -10,6 +10,6 @@ def test_false_below_error(): record = logging.LogRecord("", logging.INFO, "", 0, "", (), None) assert not UnwantedWaitressMessageFilter().filter(record) -def test_true_error_up(): +def test_true_above_error(): record = logging.LogRecord("", logging.CRITICAL, "", 0, "", (), None) assert UnwantedWaitressMessageFilter().filter(record) From 384a754f9ef93ec51ce59fa64d0423cd66d4560f Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 22 Sep 2024 12:21:42 -0400 Subject: [PATCH 68/78] Removed unnecessary vendored argparse module since it's included in Python since 3.2 --- libs/argparse-1.4.0.dist-info/INSTALLER | 1 - libs/argparse-1.4.0.dist-info/LICENSE.txt | 20 - libs/argparse-1.4.0.dist-info/METADATA | 84 - libs/argparse-1.4.0.dist-info/RECORD | 8 - libs/argparse-1.4.0.dist-info/REQUESTED | 0 libs/argparse-1.4.0.dist-info/WHEEL | 6 - libs/argparse-1.4.0.dist-info/top_level.txt | 1 - libs/argparse.py | 2392 ------------------- libs/version.txt | 1 - 9 files changed, 2513 deletions(-) delete mode 100644 libs/argparse-1.4.0.dist-info/INSTALLER delete mode 100644 libs/argparse-1.4.0.dist-info/LICENSE.txt delete mode 100644 libs/argparse-1.4.0.dist-info/METADATA delete mode 100644 libs/argparse-1.4.0.dist-info/RECORD delete mode 100644 libs/argparse-1.4.0.dist-info/REQUESTED delete mode 100644 libs/argparse-1.4.0.dist-info/WHEEL delete mode 100644 libs/argparse-1.4.0.dist-info/top_level.txt delete mode 100644 libs/argparse.py diff --git a/libs/argparse-1.4.0.dist-info/INSTALLER b/libs/argparse-1.4.0.dist-info/INSTALLER deleted file mode 100644 index a1b589e38..000000000 --- a/libs/argparse-1.4.0.dist-info/INSTALLER +++ /dev/null @@ -1 +0,0 @@ -pip diff --git a/libs/argparse-1.4.0.dist-info/LICENSE.txt b/libs/argparse-1.4.0.dist-info/LICENSE.txt deleted file mode 100644 index 640bc7809..000000000 --- a/libs/argparse-1.4.0.dist-info/LICENSE.txt +++ /dev/null @@ -1,20 +0,0 @@ -argparse is (c) 2006-2009 Steven J. Bethard . - -The argparse module was contributed to Python as of Python 2.7 and thus -was licensed under the Python license. Same license applies to all files in -the argparse package project. - -For details about the Python License, please see doc/Python-License.txt. - -History -------- - -Before (and including) argparse 1.1, the argparse package was licensed under -Apache License v2.0. - -After argparse 1.1, all project files from the argparse project were deleted -due to license compatibility issues between Apache License 2.0 and GNU GPL v2. - -The project repository then had a clean start with some files taken from -Python 2.7.1, so definitely all files are under Python License now. - diff --git a/libs/argparse-1.4.0.dist-info/METADATA b/libs/argparse-1.4.0.dist-info/METADATA deleted file mode 100644 index 39d06b1a7..000000000 --- a/libs/argparse-1.4.0.dist-info/METADATA +++ /dev/null @@ -1,84 +0,0 @@ -Metadata-Version: 2.1 -Name: argparse -Version: 1.4.0 -Summary: Python command-line parsing library -Home-page: https://github.com/ThomasWaldmann/argparse/ -Author: Thomas Waldmann -Author-email: tw@waldmann-edv.de -License: Python Software Foundation License -Keywords: argparse command line parser parsing -Platform: any -Classifier: Development Status :: 5 - Production/Stable -Classifier: Environment :: Console -Classifier: Intended Audience :: Developers -Classifier: License :: OSI Approved :: Python Software Foundation License -Classifier: Operating System :: OS Independent -Classifier: Programming Language :: Python -Classifier: Programming Language :: Python :: 2 -Classifier: Programming Language :: Python :: 3 -Classifier: Programming Language :: Python :: 2.3 -Classifier: Programming Language :: Python :: 2.4 -Classifier: Programming Language :: Python :: 2.5 -Classifier: Programming Language :: Python :: 2.6 -Classifier: Programming Language :: Python :: 2.7 -Classifier: Programming Language :: Python :: 3.0 -Classifier: Programming Language :: Python :: 3.1 -Classifier: Programming Language :: Python :: 3.2 -Classifier: Programming Language :: Python :: 3.3 -Classifier: Programming Language :: Python :: 3.4 -Classifier: Topic :: Software Development -License-File: LICENSE.txt - -The argparse module makes it easy to write user friendly command line -interfaces. - -The program defines what arguments it requires, and argparse will figure out -how to parse those out of sys.argv. The argparse module also automatically -generates help and usage messages and issues errors when users give the -program invalid arguments. - -As of Python >= 2.7 and >= 3.2, the argparse module is maintained within the -Python standard library. For users who still need to support Python < 2.7 or -< 3.2, it is also provided as a separate package, which tries to stay -compatible with the module in the standard library, but also supports older -Python versions. - -Also, we can fix bugs here for users who are stuck on some non-current python -version, like e.g. 3.2.3 (which has bugs that were fixed in a later 3.2.x -release). - -argparse is licensed under the Python license, for details see LICENSE.txt. - - -Compatibility -------------- - -argparse should work on Python >= 2.3, it was tested on: - -* 2.3, 2.4, 2.5, 2.6 and 2.7 -* 3.1, 3.2, 3.3, 3.4 - - -Installation ------------- - -Try one of these: - - python setup.py install - - easy_install argparse - - pip install argparse - - putting argparse.py in some directory listed in sys.path should also work - - -Bugs ----- - -If you find a bug in argparse (pypi), please try to reproduce it with latest -python 2.7 and 3.4 (and use argparse from stdlib). - -If it happens there also, please file a bug in the python.org issue tracker. -If it does not happen there, file a bug in the argparse package issue tracker. - diff --git a/libs/argparse-1.4.0.dist-info/RECORD b/libs/argparse-1.4.0.dist-info/RECORD deleted file mode 100644 index 8b6f6f6c9..000000000 --- a/libs/argparse-1.4.0.dist-info/RECORD +++ /dev/null @@ -1,8 +0,0 @@ -argparse-1.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -argparse-1.4.0.dist-info/LICENSE.txt,sha256=bVBNRcTRCfkl7wWJYLbRzicSu2tXk-kmv8FRcWrHQEg,741 -argparse-1.4.0.dist-info/METADATA,sha256=yZGPMA4uvkui2P7qaaiI89zqwjDbyFcehJG4j5Pk8Yk,2816 -argparse-1.4.0.dist-info/RECORD,, -argparse-1.4.0.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -argparse-1.4.0.dist-info/WHEEL,sha256=P2T-6epvtXQ2cBOE_U1K4_noqlJFN3tj15djMgEu4NM,110 -argparse-1.4.0.dist-info/top_level.txt,sha256=TgiWrQsF0mKWwqS2KHLORD0ZtqYHPRGdCAAzKwtVvJ4,9 -argparse.py,sha256=0ksYqisQDQvhoiuo19JERCSpg51tc641GFJIx7pTA0g,89214 diff --git a/libs/argparse-1.4.0.dist-info/REQUESTED b/libs/argparse-1.4.0.dist-info/REQUESTED deleted file mode 100644 index e69de29bb..000000000 diff --git a/libs/argparse-1.4.0.dist-info/WHEEL b/libs/argparse-1.4.0.dist-info/WHEEL deleted file mode 100644 index f31e450fd..000000000 --- a/libs/argparse-1.4.0.dist-info/WHEEL +++ /dev/null @@ -1,6 +0,0 @@ -Wheel-Version: 1.0 -Generator: bdist_wheel (0.41.3) -Root-Is-Purelib: true -Tag: py2-none-any -Tag: py3-none-any - diff --git a/libs/argparse-1.4.0.dist-info/top_level.txt b/libs/argparse-1.4.0.dist-info/top_level.txt deleted file mode 100644 index 1352d5e6f..000000000 --- a/libs/argparse-1.4.0.dist-info/top_level.txt +++ /dev/null @@ -1 +0,0 @@ -argparse diff --git a/libs/argparse.py b/libs/argparse.py deleted file mode 100644 index 70a77cc02..000000000 --- a/libs/argparse.py +++ /dev/null @@ -1,2392 +0,0 @@ -# Author: Steven J. Bethard . -# Maintainer: Thomas Waldmann - -"""Command-line parsing library - -This module is an optparse-inspired command-line parsing library that: - - - handles both optional and positional arguments - - produces highly informative usage messages - - supports parsers that dispatch to sub-parsers - -The following is a simple usage example that sums integers from the -command-line and writes the result to a file:: - - parser = argparse.ArgumentParser( - description='sum the integers at the command line') - parser.add_argument( - 'integers', metavar='int', nargs='+', type=int, - help='an integer to be summed') - parser.add_argument( - '--log', default=sys.stdout, type=argparse.FileType('w'), - help='the file where the sum should be written') - args = parser.parse_args() - args.log.write('%s' % sum(args.integers)) - args.log.close() - -The module contains the following public classes: - - - ArgumentParser -- The main entry point for command-line parsing. As the - example above shows, the add_argument() method is used to populate - the parser with actions for optional and positional arguments. Then - the parse_args() method is invoked to convert the args at the - command-line into an object with attributes. - - - ArgumentError -- The exception raised by ArgumentParser objects when - there are errors with the parser's actions. Errors raised while - parsing the command-line are caught by ArgumentParser and emitted - as command-line messages. - - - FileType -- A factory for defining types of files to be created. As the - example above shows, instances of FileType are typically passed as - the type= argument of add_argument() calls. - - - Action -- The base class for parser actions. Typically actions are - selected by passing strings like 'store_true' or 'append_const' to - the action= argument of add_argument(). However, for greater - customization of ArgumentParser actions, subclasses of Action may - be defined and passed as the action= argument. - - - HelpFormatter, RawDescriptionHelpFormatter, RawTextHelpFormatter, - ArgumentDefaultsHelpFormatter -- Formatter classes which - may be passed as the formatter_class= argument to the - ArgumentParser constructor. HelpFormatter is the default, - RawDescriptionHelpFormatter and RawTextHelpFormatter tell the parser - not to change the formatting for help text, and - ArgumentDefaultsHelpFormatter adds information about argument defaults - to the help. - -All other classes in this module are considered implementation details. -(Also note that HelpFormatter and RawDescriptionHelpFormatter are only -considered public as object names -- the API of the formatter objects is -still considered an implementation detail.) -""" - -__version__ = '1.4.0' # we use our own version number independant of the - # one in stdlib and we release this on pypi. - -__external_lib__ = True # to make sure the tests really test THIS lib, - # not the builtin one in Python stdlib - -__all__ = [ - 'ArgumentParser', - 'ArgumentError', - 'ArgumentTypeError', - 'FileType', - 'HelpFormatter', - 'ArgumentDefaultsHelpFormatter', - 'RawDescriptionHelpFormatter', - 'RawTextHelpFormatter', - 'Namespace', - 'Action', - 'ONE_OR_MORE', - 'OPTIONAL', - 'PARSER', - 'REMAINDER', - 'SUPPRESS', - 'ZERO_OR_MORE', -] - - -import copy as _copy -import os as _os -import re as _re -import sys as _sys -import textwrap as _textwrap - -from gettext import gettext as _ - -try: - set -except NameError: - # for python < 2.4 compatibility (sets module is there since 2.3): - from sets import Set as set - -try: - basestring -except NameError: - basestring = str - -try: - sorted -except NameError: - # for python < 2.4 compatibility: - def sorted(iterable, reverse=False): - result = list(iterable) - result.sort() - if reverse: - result.reverse() - return result - - -def _callable(obj): - return hasattr(obj, '__call__') or hasattr(obj, '__bases__') - - -SUPPRESS = '==SUPPRESS==' - -OPTIONAL = '?' -ZERO_OR_MORE = '*' -ONE_OR_MORE = '+' -PARSER = 'A...' -REMAINDER = '...' -_UNRECOGNIZED_ARGS_ATTR = '_unrecognized_args' - -# ============================= -# Utility functions and classes -# ============================= - -class _AttributeHolder(object): - """Abstract base class that provides __repr__. - - The __repr__ method returns a string in the format:: - ClassName(attr=name, attr=name, ...) - The attributes are determined either by a class-level attribute, - '_kwarg_names', or by inspecting the instance __dict__. - """ - - def __repr__(self): - type_name = type(self).__name__ - arg_strings = [] - for arg in self._get_args(): - arg_strings.append(repr(arg)) - for name, value in self._get_kwargs(): - arg_strings.append('%s=%r' % (name, value)) - return '%s(%s)' % (type_name, ', '.join(arg_strings)) - - def _get_kwargs(self): - return sorted(self.__dict__.items()) - - def _get_args(self): - return [] - - -def _ensure_value(namespace, name, value): - if getattr(namespace, name, None) is None: - setattr(namespace, name, value) - return getattr(namespace, name) - - -# =============== -# Formatting Help -# =============== - -class HelpFormatter(object): - """Formatter for generating usage messages and argument help strings. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def __init__(self, - prog, - indent_increment=2, - max_help_position=24, - width=None): - - # default setting for width - if width is None: - try: - width = int(_os.environ['COLUMNS']) - except (KeyError, ValueError): - width = 80 - width -= 2 - - self._prog = prog - self._indent_increment = indent_increment - self._max_help_position = max_help_position - self._width = width - - self._current_indent = 0 - self._level = 0 - self._action_max_length = 0 - - self._root_section = self._Section(self, None) - self._current_section = self._root_section - - self._whitespace_matcher = _re.compile(r'\s+') - self._long_break_matcher = _re.compile(r'\n\n\n+') - - # =============================== - # Section and indentation methods - # =============================== - def _indent(self): - self._current_indent += self._indent_increment - self._level += 1 - - def _dedent(self): - self._current_indent -= self._indent_increment - assert self._current_indent >= 0, 'Indent decreased below 0.' - self._level -= 1 - - class _Section(object): - - def __init__(self, formatter, parent, heading=None): - self.formatter = formatter - self.parent = parent - self.heading = heading - self.items = [] - - def format_help(self): - # format the indented section - if self.parent is not None: - self.formatter._indent() - join = self.formatter._join_parts - for func, args in self.items: - func(*args) - item_help = join([func(*args) for func, args in self.items]) - if self.parent is not None: - self.formatter._dedent() - - # return nothing if the section was empty - if not item_help: - return '' - - # add the heading if the section was non-empty - if self.heading is not SUPPRESS and self.heading is not None: - current_indent = self.formatter._current_indent - heading = '%*s%s:\n' % (current_indent, '', self.heading) - else: - heading = '' - - # join the section-initial newline, the heading and the help - return join(['\n', heading, item_help, '\n']) - - def _add_item(self, func, args): - self._current_section.items.append((func, args)) - - # ======================== - # Message building methods - # ======================== - def start_section(self, heading): - self._indent() - section = self._Section(self, self._current_section, heading) - self._add_item(section.format_help, []) - self._current_section = section - - def end_section(self): - self._current_section = self._current_section.parent - self._dedent() - - def add_text(self, text): - if text is not SUPPRESS and text is not None: - self._add_item(self._format_text, [text]) - - def add_usage(self, usage, actions, groups, prefix=None): - if usage is not SUPPRESS: - args = usage, actions, groups, prefix - self._add_item(self._format_usage, args) - - def add_argument(self, action): - if action.help is not SUPPRESS: - - # find all invocations - get_invocation = self._format_action_invocation - invocations = [get_invocation(action)] - for subaction in self._iter_indented_subactions(action): - invocations.append(get_invocation(subaction)) - - # update the maximum item length - invocation_length = max([len(s) for s in invocations]) - action_length = invocation_length + self._current_indent - self._action_max_length = max(self._action_max_length, - action_length) - - # add the item to the list - self._add_item(self._format_action, [action]) - - def add_arguments(self, actions): - for action in actions: - self.add_argument(action) - - # ======================= - # Help-formatting methods - # ======================= - def format_help(self): - help = self._root_section.format_help() - if help: - help = self._long_break_matcher.sub('\n\n', help) - help = help.strip('\n') + '\n' - return help - - def _join_parts(self, part_strings): - return ''.join([part - for part in part_strings - if part and part is not SUPPRESS]) - - def _format_usage(self, usage, actions, groups, prefix): - if prefix is None: - prefix = _('usage: ') - - # if usage is specified, use that - if usage is not None: - usage = usage % dict(prog=self._prog) - - # if no optionals or positionals are available, usage is just prog - elif usage is None and not actions: - usage = '%(prog)s' % dict(prog=self._prog) - - # if optionals and positionals are available, calculate usage - elif usage is None: - prog = '%(prog)s' % dict(prog=self._prog) - - # split optionals from positionals - optionals = [] - positionals = [] - for action in actions: - if action.option_strings: - optionals.append(action) - else: - positionals.append(action) - - # build full usage string - format = self._format_actions_usage - action_usage = format(optionals + positionals, groups) - usage = ' '.join([s for s in [prog, action_usage] if s]) - - # wrap the usage parts if it's too long - text_width = self._width - self._current_indent - if len(prefix) + len(usage) > text_width: - - # break usage into wrappable parts - part_regexp = r'\(.*?\)+|\[.*?\]+|\S+' - opt_usage = format(optionals, groups) - pos_usage = format(positionals, groups) - opt_parts = _re.findall(part_regexp, opt_usage) - pos_parts = _re.findall(part_regexp, pos_usage) - assert ' '.join(opt_parts) == opt_usage - assert ' '.join(pos_parts) == pos_usage - - # helper for wrapping lines - def get_lines(parts, indent, prefix=None): - lines = [] - line = [] - if prefix is not None: - line_len = len(prefix) - 1 - else: - line_len = len(indent) - 1 - for part in parts: - if line_len + 1 + len(part) > text_width: - lines.append(indent + ' '.join(line)) - line = [] - line_len = len(indent) - 1 - line.append(part) - line_len += len(part) + 1 - if line: - lines.append(indent + ' '.join(line)) - if prefix is not None: - lines[0] = lines[0][len(indent):] - return lines - - # if prog is short, follow it with optionals or positionals - if len(prefix) + len(prog) <= 0.75 * text_width: - indent = ' ' * (len(prefix) + len(prog) + 1) - if opt_parts: - lines = get_lines([prog] + opt_parts, indent, prefix) - lines.extend(get_lines(pos_parts, indent)) - elif pos_parts: - lines = get_lines([prog] + pos_parts, indent, prefix) - else: - lines = [prog] - - # if prog is long, put it on its own line - else: - indent = ' ' * len(prefix) - parts = opt_parts + pos_parts - lines = get_lines(parts, indent) - if len(lines) > 1: - lines = [] - lines.extend(get_lines(opt_parts, indent)) - lines.extend(get_lines(pos_parts, indent)) - lines = [prog] + lines - - # join lines into usage - usage = '\n'.join(lines) - - # prefix with 'usage:' - return '%s%s\n\n' % (prefix, usage) - - def _format_actions_usage(self, actions, groups): - # find group indices and identify actions in groups - group_actions = set() - inserts = {} - for group in groups: - try: - start = actions.index(group._group_actions[0]) - except ValueError: - continue - else: - end = start + len(group._group_actions) - if actions[start:end] == group._group_actions: - for action in group._group_actions: - group_actions.add(action) - if not group.required: - if start in inserts: - inserts[start] += ' [' - else: - inserts[start] = '[' - inserts[end] = ']' - else: - if start in inserts: - inserts[start] += ' (' - else: - inserts[start] = '(' - inserts[end] = ')' - for i in range(start + 1, end): - inserts[i] = '|' - - # collect all actions format strings - parts = [] - for i, action in enumerate(actions): - - # suppressed arguments are marked with None - # remove | separators for suppressed arguments - if action.help is SUPPRESS: - parts.append(None) - if inserts.get(i) == '|': - inserts.pop(i) - elif inserts.get(i + 1) == '|': - inserts.pop(i + 1) - - # produce all arg strings - elif not action.option_strings: - part = self._format_args(action, action.dest) - - # if it's in a group, strip the outer [] - if action in group_actions: - if part[0] == '[' and part[-1] == ']': - part = part[1:-1] - - # add the action string to the list - parts.append(part) - - # produce the first way to invoke the option in brackets - else: - option_string = action.option_strings[0] - - # if the Optional doesn't take a value, format is: - # -s or --long - if action.nargs == 0: - part = '%s' % option_string - - # if the Optional takes a value, format is: - # -s ARGS or --long ARGS - else: - default = action.dest.upper() - args_string = self._format_args(action, default) - part = '%s %s' % (option_string, args_string) - - # make it look optional if it's not required or in a group - if not action.required and action not in group_actions: - part = '[%s]' % part - - # add the action string to the list - parts.append(part) - - # insert things at the necessary indices - for i in sorted(inserts, reverse=True): - parts[i:i] = [inserts[i]] - - # join all the action items with spaces - text = ' '.join([item for item in parts if item is not None]) - - # clean up separators for mutually exclusive groups - open = r'[\[(]' - close = r'[\])]' - text = _re.sub(r'(%s) ' % open, r'\1', text) - text = _re.sub(r' (%s)' % close, r'\1', text) - text = _re.sub(r'%s *%s' % (open, close), r'', text) - text = _re.sub(r'\(([^|]*)\)', r'\1', text) - text = text.strip() - - # return the text - return text - - def _format_text(self, text): - if '%(prog)' in text: - text = text % dict(prog=self._prog) - text_width = self._width - self._current_indent - indent = ' ' * self._current_indent - return self._fill_text(text, text_width, indent) + '\n\n' - - def _format_action(self, action): - # determine the required width and the entry label - help_position = min(self._action_max_length + 2, - self._max_help_position) - help_width = self._width - help_position - action_width = help_position - self._current_indent - 2 - action_header = self._format_action_invocation(action) - - # ho nelp; start on same line and add a final newline - if not action.help: - tup = self._current_indent, '', action_header - action_header = '%*s%s\n' % tup - - # short action name; start on the same line and pad two spaces - elif len(action_header) <= action_width: - tup = self._current_indent, '', action_width, action_header - action_header = '%*s%-*s ' % tup - indent_first = 0 - - # long action name; start on the next line - else: - tup = self._current_indent, '', action_header - action_header = '%*s%s\n' % tup - indent_first = help_position - - # collect the pieces of the action help - parts = [action_header] - - # if there was help for the action, add lines of help text - if action.help: - help_text = self._expand_help(action) - help_lines = self._split_lines(help_text, help_width) - parts.append('%*s%s\n' % (indent_first, '', help_lines[0])) - for line in help_lines[1:]: - parts.append('%*s%s\n' % (help_position, '', line)) - - # or add a newline if the description doesn't end with one - elif not action_header.endswith('\n'): - parts.append('\n') - - # if there are any sub-actions, add their help as well - for subaction in self._iter_indented_subactions(action): - parts.append(self._format_action(subaction)) - - # return a single string - return self._join_parts(parts) - - def _format_action_invocation(self, action): - if not action.option_strings: - metavar, = self._metavar_formatter(action, action.dest)(1) - return metavar - - else: - parts = [] - - # if the Optional doesn't take a value, format is: - # -s, --long - if action.nargs == 0: - parts.extend(action.option_strings) - - # if the Optional takes a value, format is: - # -s ARGS, --long ARGS - else: - default = action.dest.upper() - args_string = self._format_args(action, default) - for option_string in action.option_strings: - parts.append('%s %s' % (option_string, args_string)) - - return ', '.join(parts) - - def _metavar_formatter(self, action, default_metavar): - if action.metavar is not None: - result = action.metavar - elif action.choices is not None: - choice_strs = [str(choice) for choice in action.choices] - result = '{%s}' % ','.join(choice_strs) - else: - result = default_metavar - - def format(tuple_size): - if isinstance(result, tuple): - return result - else: - return (result, ) * tuple_size - return format - - def _format_args(self, action, default_metavar): - get_metavar = self._metavar_formatter(action, default_metavar) - if action.nargs is None: - result = '%s' % get_metavar(1) - elif action.nargs == OPTIONAL: - result = '[%s]' % get_metavar(1) - elif action.nargs == ZERO_OR_MORE: - result = '[%s [%s ...]]' % get_metavar(2) - elif action.nargs == ONE_OR_MORE: - result = '%s [%s ...]' % get_metavar(2) - elif action.nargs == REMAINDER: - result = '...' - elif action.nargs == PARSER: - result = '%s ...' % get_metavar(1) - else: - formats = ['%s' for _ in range(action.nargs)] - result = ' '.join(formats) % get_metavar(action.nargs) - return result - - def _expand_help(self, action): - params = dict(vars(action), prog=self._prog) - for name in list(params): - if params[name] is SUPPRESS: - del params[name] - for name in list(params): - if hasattr(params[name], '__name__'): - params[name] = params[name].__name__ - if params.get('choices') is not None: - choices_str = ', '.join([str(c) for c in params['choices']]) - params['choices'] = choices_str - return self._get_help_string(action) % params - - def _iter_indented_subactions(self, action): - try: - get_subactions = action._get_subactions - except AttributeError: - pass - else: - self._indent() - for subaction in get_subactions(): - yield subaction - self._dedent() - - def _split_lines(self, text, width): - text = self._whitespace_matcher.sub(' ', text).strip() - return _textwrap.wrap(text, width) - - def _fill_text(self, text, width, indent): - text = self._whitespace_matcher.sub(' ', text).strip() - return _textwrap.fill(text, width, initial_indent=indent, - subsequent_indent=indent) - - def _get_help_string(self, action): - return action.help - - -class RawDescriptionHelpFormatter(HelpFormatter): - """Help message formatter which retains any formatting in descriptions. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def _fill_text(self, text, width, indent): - return ''.join([indent + line for line in text.splitlines(True)]) - - -class RawTextHelpFormatter(RawDescriptionHelpFormatter): - """Help message formatter which retains formatting of all help text. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def _split_lines(self, text, width): - return text.splitlines() - - -class ArgumentDefaultsHelpFormatter(HelpFormatter): - """Help message formatter which adds default values to argument help. - - Only the name of this class is considered a public API. All the methods - provided by the class are considered an implementation detail. - """ - - def _get_help_string(self, action): - help = action.help - if '%(default)' not in action.help: - if action.default is not SUPPRESS: - defaulting_nargs = [OPTIONAL, ZERO_OR_MORE] - if action.option_strings or action.nargs in defaulting_nargs: - help += ' (default: %(default)s)' - return help - - -# ===================== -# Options and Arguments -# ===================== - -def _get_action_name(argument): - if argument is None: - return None - elif argument.option_strings: - return '/'.join(argument.option_strings) - elif argument.metavar not in (None, SUPPRESS): - return argument.metavar - elif argument.dest not in (None, SUPPRESS): - return argument.dest - else: - return None - - -class ArgumentError(Exception): - """An error from creating or using an argument (optional or positional). - - The string value of this exception is the message, augmented with - information about the argument that caused it. - """ - - def __init__(self, argument, message): - self.argument_name = _get_action_name(argument) - self.message = message - - def __str__(self): - if self.argument_name is None: - format = '%(message)s' - else: - format = 'argument %(argument_name)s: %(message)s' - return format % dict(message=self.message, - argument_name=self.argument_name) - - -class ArgumentTypeError(Exception): - """An error from trying to convert a command line string to a type.""" - pass - - -# ============== -# Action classes -# ============== - -class Action(_AttributeHolder): - """Information about how to convert command line strings to Python objects. - - Action objects are used by an ArgumentParser to represent the information - needed to parse a single argument from one or more strings from the - command line. The keyword arguments to the Action constructor are also - all attributes of Action instances. - - Keyword Arguments: - - - option_strings -- A list of command-line option strings which - should be associated with this action. - - - dest -- The name of the attribute to hold the created object(s) - - - nargs -- The number of command-line arguments that should be - consumed. By default, one argument will be consumed and a single - value will be produced. Other values include: - - N (an integer) consumes N arguments (and produces a list) - - '?' consumes zero or one arguments - - '*' consumes zero or more arguments (and produces a list) - - '+' consumes one or more arguments (and produces a list) - Note that the difference between the default and nargs=1 is that - with the default, a single value will be produced, while with - nargs=1, a list containing a single value will be produced. - - - const -- The value to be produced if the option is specified and the - option uses an action that takes no values. - - - default -- The value to be produced if the option is not specified. - - - type -- The type which the command-line arguments should be converted - to, should be one of 'string', 'int', 'float', 'complex' or a - callable object that accepts a single string argument. If None, - 'string' is assumed. - - - choices -- A container of values that should be allowed. If not None, - after a command-line argument has been converted to the appropriate - type, an exception will be raised if it is not a member of this - collection. - - - required -- True if the action must always be specified at the - command line. This is only meaningful for optional command-line - arguments. - - - help -- The help string describing the argument. - - - metavar -- The name to be used for the option's argument with the - help string. If None, the 'dest' value will be used as the name. - """ - - def __init__(self, - option_strings, - dest, - nargs=None, - const=None, - default=None, - type=None, - choices=None, - required=False, - help=None, - metavar=None): - self.option_strings = option_strings - self.dest = dest - self.nargs = nargs - self.const = const - self.default = default - self.type = type - self.choices = choices - self.required = required - self.help = help - self.metavar = metavar - - def _get_kwargs(self): - names = [ - 'option_strings', - 'dest', - 'nargs', - 'const', - 'default', - 'type', - 'choices', - 'help', - 'metavar', - ] - return [(name, getattr(self, name)) for name in names] - - def __call__(self, parser, namespace, values, option_string=None): - raise NotImplementedError(_('.__call__() not defined')) - - -class _StoreAction(Action): - - def __init__(self, - option_strings, - dest, - nargs=None, - const=None, - default=None, - type=None, - choices=None, - required=False, - help=None, - metavar=None): - if nargs == 0: - raise ValueError('nargs for store actions must be > 0; if you ' - 'have nothing to store, actions such as store ' - 'true or store const may be more appropriate') - if const is not None and nargs != OPTIONAL: - raise ValueError('nargs must be %r to supply const' % OPTIONAL) - super(_StoreAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=nargs, - const=const, - default=default, - type=type, - choices=choices, - required=required, - help=help, - metavar=metavar) - - def __call__(self, parser, namespace, values, option_string=None): - setattr(namespace, self.dest, values) - - -class _StoreConstAction(Action): - - def __init__(self, - option_strings, - dest, - const, - default=None, - required=False, - help=None, - metavar=None): - super(_StoreConstAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=0, - const=const, - default=default, - required=required, - help=help) - - def __call__(self, parser, namespace, values, option_string=None): - setattr(namespace, self.dest, self.const) - - -class _StoreTrueAction(_StoreConstAction): - - def __init__(self, - option_strings, - dest, - default=False, - required=False, - help=None): - super(_StoreTrueAction, self).__init__( - option_strings=option_strings, - dest=dest, - const=True, - default=default, - required=required, - help=help) - - -class _StoreFalseAction(_StoreConstAction): - - def __init__(self, - option_strings, - dest, - default=True, - required=False, - help=None): - super(_StoreFalseAction, self).__init__( - option_strings=option_strings, - dest=dest, - const=False, - default=default, - required=required, - help=help) - - -class _AppendAction(Action): - - def __init__(self, - option_strings, - dest, - nargs=None, - const=None, - default=None, - type=None, - choices=None, - required=False, - help=None, - metavar=None): - if nargs == 0: - raise ValueError('nargs for append actions must be > 0; if arg ' - 'strings are not supplying the value to append, ' - 'the append const action may be more appropriate') - if const is not None and nargs != OPTIONAL: - raise ValueError('nargs must be %r to supply const' % OPTIONAL) - super(_AppendAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=nargs, - const=const, - default=default, - type=type, - choices=choices, - required=required, - help=help, - metavar=metavar) - - def __call__(self, parser, namespace, values, option_string=None): - items = _copy.copy(_ensure_value(namespace, self.dest, [])) - items.append(values) - setattr(namespace, self.dest, items) - - -class _AppendConstAction(Action): - - def __init__(self, - option_strings, - dest, - const, - default=None, - required=False, - help=None, - metavar=None): - super(_AppendConstAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=0, - const=const, - default=default, - required=required, - help=help, - metavar=metavar) - - def __call__(self, parser, namespace, values, option_string=None): - items = _copy.copy(_ensure_value(namespace, self.dest, [])) - items.append(self.const) - setattr(namespace, self.dest, items) - - -class _CountAction(Action): - - def __init__(self, - option_strings, - dest, - default=None, - required=False, - help=None): - super(_CountAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=0, - default=default, - required=required, - help=help) - - def __call__(self, parser, namespace, values, option_string=None): - new_count = _ensure_value(namespace, self.dest, 0) + 1 - setattr(namespace, self.dest, new_count) - - -class _HelpAction(Action): - - def __init__(self, - option_strings, - dest=SUPPRESS, - default=SUPPRESS, - help=None): - super(_HelpAction, self).__init__( - option_strings=option_strings, - dest=dest, - default=default, - nargs=0, - help=help) - - def __call__(self, parser, namespace, values, option_string=None): - parser.print_help() - parser.exit() - - -class _VersionAction(Action): - - def __init__(self, - option_strings, - version=None, - dest=SUPPRESS, - default=SUPPRESS, - help="show program's version number and exit"): - super(_VersionAction, self).__init__( - option_strings=option_strings, - dest=dest, - default=default, - nargs=0, - help=help) - self.version = version - - def __call__(self, parser, namespace, values, option_string=None): - version = self.version - if version is None: - version = parser.version - formatter = parser._get_formatter() - formatter.add_text(version) - parser.exit(message=formatter.format_help()) - - -class _SubParsersAction(Action): - - class _ChoicesPseudoAction(Action): - - def __init__(self, name, aliases, help): - metavar = dest = name - if aliases: - metavar += ' (%s)' % ', '.join(aliases) - sup = super(_SubParsersAction._ChoicesPseudoAction, self) - sup.__init__(option_strings=[], dest=dest, help=help, - metavar=metavar) - - def __init__(self, - option_strings, - prog, - parser_class, - dest=SUPPRESS, - help=None, - metavar=None): - - self._prog_prefix = prog - self._parser_class = parser_class - self._name_parser_map = {} - self._choices_actions = [] - - super(_SubParsersAction, self).__init__( - option_strings=option_strings, - dest=dest, - nargs=PARSER, - choices=self._name_parser_map, - help=help, - metavar=metavar) - - def add_parser(self, name, **kwargs): - # set prog from the existing prefix - if kwargs.get('prog') is None: - kwargs['prog'] = '%s %s' % (self._prog_prefix, name) - - aliases = kwargs.pop('aliases', ()) - - # create a pseudo-action to hold the choice help - if 'help' in kwargs: - help = kwargs.pop('help') - choice_action = self._ChoicesPseudoAction(name, aliases, help) - self._choices_actions.append(choice_action) - - # create the parser and add it to the map - parser = self._parser_class(**kwargs) - self._name_parser_map[name] = parser - - # make parser available under aliases also - for alias in aliases: - self._name_parser_map[alias] = parser - - return parser - - def _get_subactions(self): - return self._choices_actions - - def __call__(self, parser, namespace, values, option_string=None): - parser_name = values[0] - arg_strings = values[1:] - - # set the parser name if requested - if self.dest is not SUPPRESS: - setattr(namespace, self.dest, parser_name) - - # select the parser - try: - parser = self._name_parser_map[parser_name] - except KeyError: - tup = parser_name, ', '.join(self._name_parser_map) - msg = _('unknown parser %r (choices: %s)' % tup) - raise ArgumentError(self, msg) - - # parse all the remaining options into the namespace - # store any unrecognized options on the object, so that the top - # level parser can decide what to do with them - namespace, arg_strings = parser.parse_known_args(arg_strings, namespace) - if arg_strings: - vars(namespace).setdefault(_UNRECOGNIZED_ARGS_ATTR, []) - getattr(namespace, _UNRECOGNIZED_ARGS_ATTR).extend(arg_strings) - - -# ============== -# Type classes -# ============== - -class FileType(object): - """Factory for creating file object types - - Instances of FileType are typically passed as type= arguments to the - ArgumentParser add_argument() method. - - Keyword Arguments: - - mode -- A string indicating how the file is to be opened. Accepts the - same values as the builtin open() function. - - bufsize -- The file's desired buffer size. Accepts the same values as - the builtin open() function. - """ - - def __init__(self, mode='r', bufsize=None): - self._mode = mode - self._bufsize = bufsize - - def __call__(self, string): - # the special argument "-" means sys.std{in,out} - if string == '-': - if 'r' in self._mode: - return _sys.stdin - elif 'w' in self._mode: - return _sys.stdout - else: - msg = _('argument "-" with mode %r' % self._mode) - raise ValueError(msg) - - try: - # all other arguments are used as file names - if self._bufsize: - return open(string, self._mode, self._bufsize) - else: - return open(string, self._mode) - except IOError: - err = _sys.exc_info()[1] - message = _("can't open '%s': %s") - raise ArgumentTypeError(message % (string, err)) - - def __repr__(self): - args = [self._mode, self._bufsize] - args_str = ', '.join([repr(arg) for arg in args if arg is not None]) - return '%s(%s)' % (type(self).__name__, args_str) - -# =========================== -# Optional and Positional Parsing -# =========================== - -class Namespace(_AttributeHolder): - """Simple object for storing attributes. - - Implements equality by attribute names and values, and provides a simple - string representation. - """ - - def __init__(self, **kwargs): - for name in kwargs: - setattr(self, name, kwargs[name]) - - __hash__ = None - - def __eq__(self, other): - return vars(self) == vars(other) - - def __ne__(self, other): - return not (self == other) - - def __contains__(self, key): - return key in self.__dict__ - - -class _ActionsContainer(object): - - def __init__(self, - description, - prefix_chars, - argument_default, - conflict_handler): - super(_ActionsContainer, self).__init__() - - self.description = description - self.argument_default = argument_default - self.prefix_chars = prefix_chars - self.conflict_handler = conflict_handler - - # set up registries - self._registries = {} - - # register actions - self.register('action', None, _StoreAction) - self.register('action', 'store', _StoreAction) - self.register('action', 'store_const', _StoreConstAction) - self.register('action', 'store_true', _StoreTrueAction) - self.register('action', 'store_false', _StoreFalseAction) - self.register('action', 'append', _AppendAction) - self.register('action', 'append_const', _AppendConstAction) - self.register('action', 'count', _CountAction) - self.register('action', 'help', _HelpAction) - self.register('action', 'version', _VersionAction) - self.register('action', 'parsers', _SubParsersAction) - - # raise an exception if the conflict handler is invalid - self._get_handler() - - # action storage - self._actions = [] - self._option_string_actions = {} - - # groups - self._action_groups = [] - self._mutually_exclusive_groups = [] - - # defaults storage - self._defaults = {} - - # determines whether an "option" looks like a negative number - self._negative_number_matcher = _re.compile(r'^-\d+$|^-\d*\.\d+$') - - # whether or not there are any optionals that look like negative - # numbers -- uses a list so it can be shared and edited - self._has_negative_number_optionals = [] - - # ==================== - # Registration methods - # ==================== - def register(self, registry_name, value, object): - registry = self._registries.setdefault(registry_name, {}) - registry[value] = object - - def _registry_get(self, registry_name, value, default=None): - return self._registries[registry_name].get(value, default) - - # ================================== - # Namespace default accessor methods - # ================================== - def set_defaults(self, **kwargs): - self._defaults.update(kwargs) - - # if these defaults match any existing arguments, replace - # the previous default on the object with the new one - for action in self._actions: - if action.dest in kwargs: - action.default = kwargs[action.dest] - - def get_default(self, dest): - for action in self._actions: - if action.dest == dest and action.default is not None: - return action.default - return self._defaults.get(dest, None) - - - # ======================= - # Adding argument actions - # ======================= - def add_argument(self, *args, **kwargs): - """ - add_argument(dest, ..., name=value, ...) - add_argument(option_string, option_string, ..., name=value, ...) - """ - - # if no positional args are supplied or only one is supplied and - # it doesn't look like an option string, parse a positional - # argument - chars = self.prefix_chars - if not args or len(args) == 1 and args[0][0] not in chars: - if args and 'dest' in kwargs: - raise ValueError('dest supplied twice for positional argument') - kwargs = self._get_positional_kwargs(*args, **kwargs) - - # otherwise, we're adding an optional argument - else: - kwargs = self._get_optional_kwargs(*args, **kwargs) - - # if no default was supplied, use the parser-level default - if 'default' not in kwargs: - dest = kwargs['dest'] - if dest in self._defaults: - kwargs['default'] = self._defaults[dest] - elif self.argument_default is not None: - kwargs['default'] = self.argument_default - - # create the action object, and add it to the parser - action_class = self._pop_action_class(kwargs) - if not _callable(action_class): - raise ValueError('unknown action "%s"' % action_class) - action = action_class(**kwargs) - - # raise an error if the action type is not callable - type_func = self._registry_get('type', action.type, action.type) - if not _callable(type_func): - raise ValueError('%r is not callable' % type_func) - - return self._add_action(action) - - def add_argument_group(self, *args, **kwargs): - group = _ArgumentGroup(self, *args, **kwargs) - self._action_groups.append(group) - return group - - def add_mutually_exclusive_group(self, **kwargs): - group = _MutuallyExclusiveGroup(self, **kwargs) - self._mutually_exclusive_groups.append(group) - return group - - def _add_action(self, action): - # resolve any conflicts - self._check_conflict(action) - - # add to actions list - self._actions.append(action) - action.container = self - - # index the action by any option strings it has - for option_string in action.option_strings: - self._option_string_actions[option_string] = action - - # set the flag if any option strings look like negative numbers - for option_string in action.option_strings: - if self._negative_number_matcher.match(option_string): - if not self._has_negative_number_optionals: - self._has_negative_number_optionals.append(True) - - # return the created action - return action - - def _remove_action(self, action): - self._actions.remove(action) - - def _add_container_actions(self, container): - # collect groups by titles - title_group_map = {} - for group in self._action_groups: - if group.title in title_group_map: - msg = _('cannot merge actions - two groups are named %r') - raise ValueError(msg % (group.title)) - title_group_map[group.title] = group - - # map each action to its group - group_map = {} - for group in container._action_groups: - - # if a group with the title exists, use that, otherwise - # create a new group matching the container's group - if group.title not in title_group_map: - title_group_map[group.title] = self.add_argument_group( - title=group.title, - description=group.description, - conflict_handler=group.conflict_handler) - - # map the actions to their new group - for action in group._group_actions: - group_map[action] = title_group_map[group.title] - - # add container's mutually exclusive groups - # NOTE: if add_mutually_exclusive_group ever gains title= and - # description= then this code will need to be expanded as above - for group in container._mutually_exclusive_groups: - mutex_group = self.add_mutually_exclusive_group( - required=group.required) - - # map the actions to their new mutex group - for action in group._group_actions: - group_map[action] = mutex_group - - # add all actions to this container or their group - for action in container._actions: - group_map.get(action, self)._add_action(action) - - def _get_positional_kwargs(self, dest, **kwargs): - # make sure required is not specified - if 'required' in kwargs: - msg = _("'required' is an invalid argument for positionals") - raise TypeError(msg) - - # mark positional arguments as required if at least one is - # always required - if kwargs.get('nargs') not in [OPTIONAL, ZERO_OR_MORE]: - kwargs['required'] = True - if kwargs.get('nargs') == ZERO_OR_MORE and 'default' not in kwargs: - kwargs['required'] = True - - # return the keyword arguments with no option strings - return dict(kwargs, dest=dest, option_strings=[]) - - def _get_optional_kwargs(self, *args, **kwargs): - # determine short and long option strings - option_strings = [] - long_option_strings = [] - for option_string in args: - # error on strings that don't start with an appropriate prefix - if not option_string[0] in self.prefix_chars: - msg = _('invalid option string %r: ' - 'must start with a character %r') - tup = option_string, self.prefix_chars - raise ValueError(msg % tup) - - # strings starting with two prefix characters are long options - option_strings.append(option_string) - if option_string[0] in self.prefix_chars: - if len(option_string) > 1: - if option_string[1] in self.prefix_chars: - long_option_strings.append(option_string) - - # infer destination, '--foo-bar' -> 'foo_bar' and '-x' -> 'x' - dest = kwargs.pop('dest', None) - if dest is None: - if long_option_strings: - dest_option_string = long_option_strings[0] - else: - dest_option_string = option_strings[0] - dest = dest_option_string.lstrip(self.prefix_chars) - if not dest: - msg = _('dest= is required for options like %r') - raise ValueError(msg % option_string) - dest = dest.replace('-', '_') - - # return the updated keyword arguments - return dict(kwargs, dest=dest, option_strings=option_strings) - - def _pop_action_class(self, kwargs, default=None): - action = kwargs.pop('action', default) - return self._registry_get('action', action, action) - - def _get_handler(self): - # determine function from conflict handler string - handler_func_name = '_handle_conflict_%s' % self.conflict_handler - try: - return getattr(self, handler_func_name) - except AttributeError: - msg = _('invalid conflict_resolution value: %r') - raise ValueError(msg % self.conflict_handler) - - def _check_conflict(self, action): - - # find all options that conflict with this option - confl_optionals = [] - for option_string in action.option_strings: - if option_string in self._option_string_actions: - confl_optional = self._option_string_actions[option_string] - confl_optionals.append((option_string, confl_optional)) - - # resolve any conflicts - if confl_optionals: - conflict_handler = self._get_handler() - conflict_handler(action, confl_optionals) - - def _handle_conflict_error(self, action, conflicting_actions): - message = _('conflicting option string(s): %s') - conflict_string = ', '.join([option_string - for option_string, action - in conflicting_actions]) - raise ArgumentError(action, message % conflict_string) - - def _handle_conflict_resolve(self, action, conflicting_actions): - - # remove all conflicting options - for option_string, action in conflicting_actions: - - # remove the conflicting option - action.option_strings.remove(option_string) - self._option_string_actions.pop(option_string, None) - - # if the option now has no option string, remove it from the - # container holding it - if not action.option_strings: - action.container._remove_action(action) - - -class _ArgumentGroup(_ActionsContainer): - - def __init__(self, container, title=None, description=None, **kwargs): - # add any missing keyword arguments by checking the container - update = kwargs.setdefault - update('conflict_handler', container.conflict_handler) - update('prefix_chars', container.prefix_chars) - update('argument_default', container.argument_default) - super_init = super(_ArgumentGroup, self).__init__ - super_init(description=description, **kwargs) - - # group attributes - self.title = title - self._group_actions = [] - - # share most attributes with the container - self._registries = container._registries - self._actions = container._actions - self._option_string_actions = container._option_string_actions - self._defaults = container._defaults - self._has_negative_number_optionals = \ - container._has_negative_number_optionals - - def _add_action(self, action): - action = super(_ArgumentGroup, self)._add_action(action) - self._group_actions.append(action) - return action - - def _remove_action(self, action): - super(_ArgumentGroup, self)._remove_action(action) - self._group_actions.remove(action) - - -class _MutuallyExclusiveGroup(_ArgumentGroup): - - def __init__(self, container, required=False): - super(_MutuallyExclusiveGroup, self).__init__(container) - self.required = required - self._container = container - - def _add_action(self, action): - if action.required: - msg = _('mutually exclusive arguments must be optional') - raise ValueError(msg) - action = self._container._add_action(action) - self._group_actions.append(action) - return action - - def _remove_action(self, action): - self._container._remove_action(action) - self._group_actions.remove(action) - - -class ArgumentParser(_AttributeHolder, _ActionsContainer): - """Object for parsing command line strings into Python objects. - - Keyword Arguments: - - prog -- The name of the program (default: sys.argv[0]) - - usage -- A usage message (default: auto-generated from arguments) - - description -- A description of what the program does - - epilog -- Text following the argument descriptions - - parents -- Parsers whose arguments should be copied into this one - - formatter_class -- HelpFormatter class for printing help messages - - prefix_chars -- Characters that prefix optional arguments - - fromfile_prefix_chars -- Characters that prefix files containing - additional arguments - - argument_default -- The default value for all arguments - - conflict_handler -- String indicating how to handle conflicts - - add_help -- Add a -h/-help option - """ - - def __init__(self, - prog=None, - usage=None, - description=None, - epilog=None, - version=None, - parents=[], - formatter_class=HelpFormatter, - prefix_chars='-', - fromfile_prefix_chars=None, - argument_default=None, - conflict_handler='error', - add_help=True): - - if version is not None: - import warnings - warnings.warn( - """The "version" argument to ArgumentParser is deprecated. """ - """Please use """ - """"add_argument(..., action='version', version="N", ...)" """ - """instead""", DeprecationWarning) - - superinit = super(ArgumentParser, self).__init__ - superinit(description=description, - prefix_chars=prefix_chars, - argument_default=argument_default, - conflict_handler=conflict_handler) - - # default setting for prog - if prog is None: - prog = _os.path.basename(_sys.argv[0]) - - self.prog = prog - self.usage = usage - self.epilog = epilog - self.version = version - self.formatter_class = formatter_class - self.fromfile_prefix_chars = fromfile_prefix_chars - self.add_help = add_help - - add_group = self.add_argument_group - self._positionals = add_group(_('positional arguments')) - self._optionals = add_group(_('optional arguments')) - self._subparsers = None - - # register types - def identity(string): - return string - self.register('type', None, identity) - - # add help and version arguments if necessary - # (using explicit default to override global argument_default) - if '-' in prefix_chars: - default_prefix = '-' - else: - default_prefix = prefix_chars[0] - if self.add_help: - self.add_argument( - default_prefix+'h', default_prefix*2+'help', - action='help', default=SUPPRESS, - help=_('show this help message and exit')) - if self.version: - self.add_argument( - default_prefix+'v', default_prefix*2+'version', - action='version', default=SUPPRESS, - version=self.version, - help=_("show program's version number and exit")) - - # add parent arguments and defaults - for parent in parents: - self._add_container_actions(parent) - try: - defaults = parent._defaults - except AttributeError: - pass - else: - self._defaults.update(defaults) - - # ======================= - # Pretty __repr__ methods - # ======================= - def _get_kwargs(self): - names = [ - 'prog', - 'usage', - 'description', - 'version', - 'formatter_class', - 'conflict_handler', - 'add_help', - ] - return [(name, getattr(self, name)) for name in names] - - # ================================== - # Optional/Positional adding methods - # ================================== - def add_subparsers(self, **kwargs): - if self._subparsers is not None: - self.error(_('cannot have multiple subparser arguments')) - - # add the parser class to the arguments if it's not present - kwargs.setdefault('parser_class', type(self)) - - if 'title' in kwargs or 'description' in kwargs: - title = _(kwargs.pop('title', 'subcommands')) - description = _(kwargs.pop('description', None)) - self._subparsers = self.add_argument_group(title, description) - else: - self._subparsers = self._positionals - - # prog defaults to the usage message of this parser, skipping - # optional arguments and with no "usage:" prefix - if kwargs.get('prog') is None: - formatter = self._get_formatter() - positionals = self._get_positional_actions() - groups = self._mutually_exclusive_groups - formatter.add_usage(self.usage, positionals, groups, '') - kwargs['prog'] = formatter.format_help().strip() - - # create the parsers action and add it to the positionals list - parsers_class = self._pop_action_class(kwargs, 'parsers') - action = parsers_class(option_strings=[], **kwargs) - self._subparsers._add_action(action) - - # return the created parsers action - return action - - def _add_action(self, action): - if action.option_strings: - self._optionals._add_action(action) - else: - self._positionals._add_action(action) - return action - - def _get_optional_actions(self): - return [action - for action in self._actions - if action.option_strings] - - def _get_positional_actions(self): - return [action - for action in self._actions - if not action.option_strings] - - # ===================================== - # Command line argument parsing methods - # ===================================== - def parse_args(self, args=None, namespace=None): - args, argv = self.parse_known_args(args, namespace) - if argv: - msg = _('unrecognized arguments: %s') - self.error(msg % ' '.join(argv)) - return args - - def parse_known_args(self, args=None, namespace=None): - # args default to the system args - if args is None: - args = _sys.argv[1:] - - # default Namespace built from parser defaults - if namespace is None: - namespace = Namespace() - - # add any action defaults that aren't present - for action in self._actions: - if action.dest is not SUPPRESS: - if not hasattr(namespace, action.dest): - if action.default is not SUPPRESS: - setattr(namespace, action.dest, action.default) - - # add any parser defaults that aren't present - for dest in self._defaults: - if not hasattr(namespace, dest): - setattr(namespace, dest, self._defaults[dest]) - - # parse the arguments and exit if there are any errors - try: - namespace, args = self._parse_known_args(args, namespace) - if hasattr(namespace, _UNRECOGNIZED_ARGS_ATTR): - args.extend(getattr(namespace, _UNRECOGNIZED_ARGS_ATTR)) - delattr(namespace, _UNRECOGNIZED_ARGS_ATTR) - return namespace, args - except ArgumentError: - err = _sys.exc_info()[1] - self.error(str(err)) - - def _parse_known_args(self, arg_strings, namespace): - # replace arg strings that are file references - if self.fromfile_prefix_chars is not None: - arg_strings = self._read_args_from_files(arg_strings) - - # map all mutually exclusive arguments to the other arguments - # they can't occur with - action_conflicts = {} - for mutex_group in self._mutually_exclusive_groups: - group_actions = mutex_group._group_actions - for i, mutex_action in enumerate(mutex_group._group_actions): - conflicts = action_conflicts.setdefault(mutex_action, []) - conflicts.extend(group_actions[:i]) - conflicts.extend(group_actions[i + 1:]) - - # find all option indices, and determine the arg_string_pattern - # which has an 'O' if there is an option at an index, - # an 'A' if there is an argument, or a '-' if there is a '--' - option_string_indices = {} - arg_string_pattern_parts = [] - arg_strings_iter = iter(arg_strings) - for i, arg_string in enumerate(arg_strings_iter): - - # all args after -- are non-options - if arg_string == '--': - arg_string_pattern_parts.append('-') - for arg_string in arg_strings_iter: - arg_string_pattern_parts.append('A') - - # otherwise, add the arg to the arg strings - # and note the index if it was an option - else: - option_tuple = self._parse_optional(arg_string) - if option_tuple is None: - pattern = 'A' - else: - option_string_indices[i] = option_tuple - pattern = 'O' - arg_string_pattern_parts.append(pattern) - - # join the pieces together to form the pattern - arg_strings_pattern = ''.join(arg_string_pattern_parts) - - # converts arg strings to the appropriate and then takes the action - seen_actions = set() - seen_non_default_actions = set() - - def take_action(action, argument_strings, option_string=None): - seen_actions.add(action) - argument_values = self._get_values(action, argument_strings) - - # error if this argument is not allowed with other previously - # seen arguments, assuming that actions that use the default - # value don't really count as "present" - if argument_values is not action.default: - seen_non_default_actions.add(action) - for conflict_action in action_conflicts.get(action, []): - if conflict_action in seen_non_default_actions: - msg = _('not allowed with argument %s') - action_name = _get_action_name(conflict_action) - raise ArgumentError(action, msg % action_name) - - # take the action if we didn't receive a SUPPRESS value - # (e.g. from a default) - if argument_values is not SUPPRESS: - action(self, namespace, argument_values, option_string) - - # function to convert arg_strings into an optional action - def consume_optional(start_index): - - # get the optional identified at this index - option_tuple = option_string_indices[start_index] - action, option_string, explicit_arg = option_tuple - - # identify additional optionals in the same arg string - # (e.g. -xyz is the same as -x -y -z if no args are required) - match_argument = self._match_argument - action_tuples = [] - while True: - - # if we found no optional action, skip it - if action is None: - extras.append(arg_strings[start_index]) - return start_index + 1 - - # if there is an explicit argument, try to match the - # optional's string arguments to only this - if explicit_arg is not None: - arg_count = match_argument(action, 'A') - - # if the action is a single-dash option and takes no - # arguments, try to parse more single-dash options out - # of the tail of the option string - chars = self.prefix_chars - if arg_count == 0 and option_string[1] not in chars: - action_tuples.append((action, [], option_string)) - char = option_string[0] - option_string = char + explicit_arg[0] - new_explicit_arg = explicit_arg[1:] or None - optionals_map = self._option_string_actions - if option_string in optionals_map: - action = optionals_map[option_string] - explicit_arg = new_explicit_arg - else: - msg = _('ignored explicit argument %r') - raise ArgumentError(action, msg % explicit_arg) - - # if the action expect exactly one argument, we've - # successfully matched the option; exit the loop - elif arg_count == 1: - stop = start_index + 1 - args = [explicit_arg] - action_tuples.append((action, args, option_string)) - break - - # error if a double-dash option did not use the - # explicit argument - else: - msg = _('ignored explicit argument %r') - raise ArgumentError(action, msg % explicit_arg) - - # if there is no explicit argument, try to match the - # optional's string arguments with the following strings - # if successful, exit the loop - else: - start = start_index + 1 - selected_patterns = arg_strings_pattern[start:] - arg_count = match_argument(action, selected_patterns) - stop = start + arg_count - args = arg_strings[start:stop] - action_tuples.append((action, args, option_string)) - break - - # add the Optional to the list and return the index at which - # the Optional's string args stopped - assert action_tuples - for action, args, option_string in action_tuples: - take_action(action, args, option_string) - return stop - - # the list of Positionals left to be parsed; this is modified - # by consume_positionals() - positionals = self._get_positional_actions() - - # function to convert arg_strings into positional actions - def consume_positionals(start_index): - # match as many Positionals as possible - match_partial = self._match_arguments_partial - selected_pattern = arg_strings_pattern[start_index:] - arg_counts = match_partial(positionals, selected_pattern) - - # slice off the appropriate arg strings for each Positional - # and add the Positional and its args to the list - for action, arg_count in zip(positionals, arg_counts): - args = arg_strings[start_index: start_index + arg_count] - start_index += arg_count - take_action(action, args) - - # slice off the Positionals that we just parsed and return the - # index at which the Positionals' string args stopped - positionals[:] = positionals[len(arg_counts):] - return start_index - - # consume Positionals and Optionals alternately, until we have - # passed the last option string - extras = [] - start_index = 0 - if option_string_indices: - max_option_string_index = max(option_string_indices) - else: - max_option_string_index = -1 - while start_index <= max_option_string_index: - - # consume any Positionals preceding the next option - next_option_string_index = min([ - index - for index in option_string_indices - if index >= start_index]) - if start_index != next_option_string_index: - positionals_end_index = consume_positionals(start_index) - - # only try to parse the next optional if we didn't consume - # the option string during the positionals parsing - if positionals_end_index > start_index: - start_index = positionals_end_index - continue - else: - start_index = positionals_end_index - - # if we consumed all the positionals we could and we're not - # at the index of an option string, there were extra arguments - if start_index not in option_string_indices: - strings = arg_strings[start_index:next_option_string_index] - extras.extend(strings) - start_index = next_option_string_index - - # consume the next optional and any arguments for it - start_index = consume_optional(start_index) - - # consume any positionals following the last Optional - stop_index = consume_positionals(start_index) - - # if we didn't consume all the argument strings, there were extras - extras.extend(arg_strings[stop_index:]) - - # if we didn't use all the Positional objects, there were too few - # arg strings supplied. - if positionals: - self.error(_('too few arguments')) - - # make sure all required actions were present, and convert defaults. - for action in self._actions: - if action not in seen_actions: - if action.required: - name = _get_action_name(action) - self.error(_('argument %s is required') % name) - else: - # Convert action default now instead of doing it before - # parsing arguments to avoid calling convert functions - # twice (which may fail) if the argument was given, but - # only if it was defined already in the namespace - if (action.default is not None and - isinstance(action.default, basestring) and - hasattr(namespace, action.dest) and - action.default is getattr(namespace, action.dest)): - setattr(namespace, action.dest, - self._get_value(action, action.default)) - - # make sure all required groups had one option present - for group in self._mutually_exclusive_groups: - if group.required: - for action in group._group_actions: - if action in seen_non_default_actions: - break - - # if no actions were used, report the error - else: - names = [_get_action_name(action) - for action in group._group_actions - if action.help is not SUPPRESS] - msg = _('one of the arguments %s is required') - self.error(msg % ' '.join(names)) - - # return the updated namespace and the extra arguments - return namespace, extras - - def _read_args_from_files(self, arg_strings): - # expand arguments referencing files - new_arg_strings = [] - for arg_string in arg_strings: - - # for regular arguments, just add them back into the list - if arg_string[0] not in self.fromfile_prefix_chars: - new_arg_strings.append(arg_string) - - # replace arguments referencing files with the file content - else: - try: - args_file = open(arg_string[1:]) - try: - arg_strings = [] - for arg_line in args_file.read().splitlines(): - for arg in self.convert_arg_line_to_args(arg_line): - arg_strings.append(arg) - arg_strings = self._read_args_from_files(arg_strings) - new_arg_strings.extend(arg_strings) - finally: - args_file.close() - except IOError: - err = _sys.exc_info()[1] - self.error(str(err)) - - # return the modified argument list - return new_arg_strings - - def convert_arg_line_to_args(self, arg_line): - return [arg_line] - - def _match_argument(self, action, arg_strings_pattern): - # match the pattern for this action to the arg strings - nargs_pattern = self._get_nargs_pattern(action) - match = _re.match(nargs_pattern, arg_strings_pattern) - - # raise an exception if we weren't able to find a match - if match is None: - nargs_errors = { - None: _('expected one argument'), - OPTIONAL: _('expected at most one argument'), - ONE_OR_MORE: _('expected at least one argument'), - } - default = _('expected %s argument(s)') % action.nargs - msg = nargs_errors.get(action.nargs, default) - raise ArgumentError(action, msg) - - # return the number of arguments matched - return len(match.group(1)) - - def _match_arguments_partial(self, actions, arg_strings_pattern): - # progressively shorten the actions list by slicing off the - # final actions until we find a match - result = [] - for i in range(len(actions), 0, -1): - actions_slice = actions[:i] - pattern = ''.join([self._get_nargs_pattern(action) - for action in actions_slice]) - match = _re.match(pattern, arg_strings_pattern) - if match is not None: - result.extend([len(string) for string in match.groups()]) - break - - # return the list of arg string counts - return result - - def _parse_optional(self, arg_string): - # if it's an empty string, it was meant to be a positional - if not arg_string: - return None - - # if it doesn't start with a prefix, it was meant to be positional - if not arg_string[0] in self.prefix_chars: - return None - - # if the option string is present in the parser, return the action - if arg_string in self._option_string_actions: - action = self._option_string_actions[arg_string] - return action, arg_string, None - - # if it's just a single character, it was meant to be positional - if len(arg_string) == 1: - return None - - # if the option string before the "=" is present, return the action - if '=' in arg_string: - option_string, explicit_arg = arg_string.split('=', 1) - if option_string in self._option_string_actions: - action = self._option_string_actions[option_string] - return action, option_string, explicit_arg - - # search through all possible prefixes of the option string - # and all actions in the parser for possible interpretations - option_tuples = self._get_option_tuples(arg_string) - - # if multiple actions match, the option string was ambiguous - if len(option_tuples) > 1: - options = ', '.join([option_string - for action, option_string, explicit_arg in option_tuples]) - tup = arg_string, options - self.error(_('ambiguous option: %s could match %s') % tup) - - # if exactly one action matched, this segmentation is good, - # so return the parsed action - elif len(option_tuples) == 1: - option_tuple, = option_tuples - return option_tuple - - # if it was not found as an option, but it looks like a negative - # number, it was meant to be positional - # unless there are negative-number-like options - if self._negative_number_matcher.match(arg_string): - if not self._has_negative_number_optionals: - return None - - # if it contains a space, it was meant to be a positional - if ' ' in arg_string: - return None - - # it was meant to be an optional but there is no such option - # in this parser (though it might be a valid option in a subparser) - return None, arg_string, None - - def _get_option_tuples(self, option_string): - result = [] - - # option strings starting with two prefix characters are only - # split at the '=' - chars = self.prefix_chars - if option_string[0] in chars and option_string[1] in chars: - if '=' in option_string: - option_prefix, explicit_arg = option_string.split('=', 1) - else: - option_prefix = option_string - explicit_arg = None - for option_string in self._option_string_actions: - if option_string.startswith(option_prefix): - action = self._option_string_actions[option_string] - tup = action, option_string, explicit_arg - result.append(tup) - - # single character options can be concatenated with their arguments - # but multiple character options always have to have their argument - # separate - elif option_string[0] in chars and option_string[1] not in chars: - option_prefix = option_string - explicit_arg = None - short_option_prefix = option_string[:2] - short_explicit_arg = option_string[2:] - - for option_string in self._option_string_actions: - if option_string == short_option_prefix: - action = self._option_string_actions[option_string] - tup = action, option_string, short_explicit_arg - result.append(tup) - elif option_string.startswith(option_prefix): - action = self._option_string_actions[option_string] - tup = action, option_string, explicit_arg - result.append(tup) - - # shouldn't ever get here - else: - self.error(_('unexpected option string: %s') % option_string) - - # return the collected option tuples - return result - - def _get_nargs_pattern(self, action): - # in all examples below, we have to allow for '--' args - # which are represented as '-' in the pattern - nargs = action.nargs - - # the default (None) is assumed to be a single argument - if nargs is None: - nargs_pattern = '(-*A-*)' - - # allow zero or one arguments - elif nargs == OPTIONAL: - nargs_pattern = '(-*A?-*)' - - # allow zero or more arguments - elif nargs == ZERO_OR_MORE: - nargs_pattern = '(-*[A-]*)' - - # allow one or more arguments - elif nargs == ONE_OR_MORE: - nargs_pattern = '(-*A[A-]*)' - - # allow any number of options or arguments - elif nargs == REMAINDER: - nargs_pattern = '([-AO]*)' - - # allow one argument followed by any number of options or arguments - elif nargs == PARSER: - nargs_pattern = '(-*A[-AO]*)' - - # all others should be integers - else: - nargs_pattern = '(-*%s-*)' % '-*'.join('A' * nargs) - - # if this is an optional action, -- is not allowed - if action.option_strings: - nargs_pattern = nargs_pattern.replace('-*', '') - nargs_pattern = nargs_pattern.replace('-', '') - - # return the pattern - return nargs_pattern - - # ======================== - # Value conversion methods - # ======================== - def _get_values(self, action, arg_strings): - # for everything but PARSER args, strip out '--' - if action.nargs not in [PARSER, REMAINDER]: - arg_strings = [s for s in arg_strings if s != '--'] - - # optional argument produces a default when not present - if not arg_strings and action.nargs == OPTIONAL: - if action.option_strings: - value = action.const - else: - value = action.default - if isinstance(value, basestring): - value = self._get_value(action, value) - self._check_value(action, value) - - # when nargs='*' on a positional, if there were no command-line - # args, use the default if it is anything other than None - elif (not arg_strings and action.nargs == ZERO_OR_MORE and - not action.option_strings): - if action.default is not None: - value = action.default - else: - value = arg_strings - self._check_value(action, value) - - # single argument or optional argument produces a single value - elif len(arg_strings) == 1 and action.nargs in [None, OPTIONAL]: - arg_string, = arg_strings - value = self._get_value(action, arg_string) - self._check_value(action, value) - - # REMAINDER arguments convert all values, checking none - elif action.nargs == REMAINDER: - value = [self._get_value(action, v) for v in arg_strings] - - # PARSER arguments convert all values, but check only the first - elif action.nargs == PARSER: - value = [self._get_value(action, v) for v in arg_strings] - self._check_value(action, value[0]) - - # all other types of nargs produce a list - else: - value = [self._get_value(action, v) for v in arg_strings] - for v in value: - self._check_value(action, v) - - # return the converted value - return value - - def _get_value(self, action, arg_string): - type_func = self._registry_get('type', action.type, action.type) - if not _callable(type_func): - msg = _('%r is not callable') - raise ArgumentError(action, msg % type_func) - - # convert the value to the appropriate type - try: - result = type_func(arg_string) - - # ArgumentTypeErrors indicate errors - except ArgumentTypeError: - name = getattr(action.type, '__name__', repr(action.type)) - msg = str(_sys.exc_info()[1]) - raise ArgumentError(action, msg) - - # TypeErrors or ValueErrors also indicate errors - except (TypeError, ValueError): - name = getattr(action.type, '__name__', repr(action.type)) - msg = _('invalid %s value: %r') - raise ArgumentError(action, msg % (name, arg_string)) - - # return the converted value - return result - - def _check_value(self, action, value): - # converted value must be one of the choices (if specified) - if action.choices is not None and value not in action.choices: - tup = value, ', '.join(map(repr, action.choices)) - msg = _('invalid choice: %r (choose from %s)') % tup - raise ArgumentError(action, msg) - - # ======================= - # Help-formatting methods - # ======================= - def format_usage(self): - formatter = self._get_formatter() - formatter.add_usage(self.usage, self._actions, - self._mutually_exclusive_groups) - return formatter.format_help() - - def format_help(self): - formatter = self._get_formatter() - - # usage - formatter.add_usage(self.usage, self._actions, - self._mutually_exclusive_groups) - - # description - formatter.add_text(self.description) - - # positionals, optionals and user-defined groups - for action_group in self._action_groups: - formatter.start_section(action_group.title) - formatter.add_text(action_group.description) - formatter.add_arguments(action_group._group_actions) - formatter.end_section() - - # epilog - formatter.add_text(self.epilog) - - # determine help from format above - return formatter.format_help() - - def format_version(self): - import warnings - warnings.warn( - 'The format_version method is deprecated -- the "version" ' - 'argument to ArgumentParser is no longer supported.', - DeprecationWarning) - formatter = self._get_formatter() - formatter.add_text(self.version) - return formatter.format_help() - - def _get_formatter(self): - return self.formatter_class(prog=self.prog) - - # ===================== - # Help-printing methods - # ===================== - def print_usage(self, file=None): - if file is None: - file = _sys.stdout - self._print_message(self.format_usage(), file) - - def print_help(self, file=None): - if file is None: - file = _sys.stdout - self._print_message(self.format_help(), file) - - def print_version(self, file=None): - import warnings - warnings.warn( - 'The print_version method is deprecated -- the "version" ' - 'argument to ArgumentParser is no longer supported.', - DeprecationWarning) - self._print_message(self.format_version(), file) - - def _print_message(self, message, file=None): - if message: - if file is None: - file = _sys.stderr - file.write(message) - - # =============== - # Exiting methods - # =============== - def exit(self, status=0, message=None): - if message: - self._print_message(message, _sys.stderr) - _sys.exit(status) - - def error(self, message): - """error(message: string) - - Prints a usage message incorporating the message to stderr and - exits. - - If you override this in a subclass, it should not return -- it - should either exit or raise an exception. - """ - self.print_usage(_sys.stderr) - self.exit(2, _('%s: error: %s\n') % (self.prog, message)) diff --git a/libs/version.txt b/libs/version.txt index 823682624..fd884e307 100644 --- a/libs/version.txt +++ b/libs/version.txt @@ -1,7 +1,6 @@ # Bazarr dependencies alembic==1.13.1 aniso8601==9.0.1 -argparse==1.4.0 apprise==1.7.6 apscheduler<=3.10.4 attrs==23.2.0 From 115926d44068bf0302ad9a8e9795554a53c7b3f1 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 22 Sep 2024 12:22:17 -0400 Subject: [PATCH 69/78] no log: renamed all import test since it's broken and need rework in the future --- .../{test_all_import.py => test_all_import.py.to_be_reworked} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/bazarr/{test_all_import.py => test_all_import.py.to_be_reworked} (100%) diff --git a/tests/bazarr/test_all_import.py b/tests/bazarr/test_all_import.py.to_be_reworked similarity index 100% rename from tests/bazarr/test_all_import.py rename to tests/bazarr/test_all_import.py.to_be_reworked From 14a361dd97bb89204c748f60ef6052544d992dac Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Sun, 22 Sep 2024 12:53:24 -0400 Subject: [PATCH 70/78] Fixed SyntaxWarning in subzero language enforced in Python 3.12. #2656 --- custom_libs/subzero/language.py | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/custom_libs/subzero/language.py b/custom_libs/subzero/language.py index 3d556c0e1..99b64211c 100644 --- a/custom_libs/subzero/language.py +++ b/custom_libs/subzero/language.py @@ -162,14 +162,4 @@ class Language(Language_): return Language(*Language_.fromalpha3b(s).__getstate__()) -IETF_MATCH = ".+\.([^-.]+)(?:-[A-Za-z]+)?$" -ENDSWITH_LANGUAGECODE_RE = re.compile("\.([^-.]{2,3})(?:-[A-Za-z]{2,})?$") - - -def match_ietf_language(s, ietf=False): - language_match = re.match(".+\.([^\.]+)$" if not ietf - else IETF_MATCH, s) - if language_match and len(language_match.groups()) == 1: - language = language_match.groups()[0] - return language - return s +ENDSWITH_LANGUAGECODE_RE = re.compile(r"\.([^-.]{2,3})(?:-[A-Za-z]{2,})?$") From c69be93cd6bf9cf4ce6339052e938a3c5420e31f Mon Sep 17 00:00:00 2001 From: Hoang Dinh Date: Sun, 22 Sep 2024 10:28:08 -0700 Subject: [PATCH 71/78] Improved embeddedsubtitles provider by turning on Audio Sync during audio extraction process --- custom_libs/subliminal_patch/providers/whisperai.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/custom_libs/subliminal_patch/providers/whisperai.py b/custom_libs/subliminal_patch/providers/whisperai.py index d427f8ad2..866585cdb 100644 --- a/custom_libs/subliminal_patch/providers/whisperai.py +++ b/custom_libs/subliminal_patch/providers/whisperai.py @@ -143,7 +143,7 @@ def encode_audio_stream(path, ffmpeg_path, audio_stream_language=None): logger.debug(f"Whisper will only use the {audio_stream_language} audio stream for {path}") inp = inp[f'a:m:language:{audio_stream_language}'] - out, _ = inp.output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=16000) \ + out, _ = inp.output("-", format="s16le", acodec="pcm_s16le", ac=1, ar=16000, af="aresample=async=1") \ .run(cmd=[ffmpeg_path, "-nostdin"], capture_stdout=True, capture_stderr=True) except ffmpeg.Error as e: From 5e08898de82d62ecaf782aa1bb2032ff6304841d Mon Sep 17 00:00:00 2001 From: JayZed Date: Mon, 23 Sep 2024 19:17:12 -0400 Subject: [PATCH 72/78] Clear log file contents on Empty log --- bazarr/app/logger.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/bazarr/app/logger.py b/bazarr/app/logger.py index 8762d0355..8598912c9 100644 --- a/bazarr/app/logger.py +++ b/bazarr/app/logger.py @@ -172,9 +172,14 @@ def configure_logging(debug=False): logging.getLogger("rebulk").setLevel(logging.WARNING) logging.getLogger("stevedore.extension").setLevel(logging.CRITICAL) +def empty_file(filename): + # Open the log file in write mode to clear its contents + with open(filename, 'w'): + pass # Just opening and closing the file will clear it def empty_log(): fh.doRollover() + empty_file(get_log_file_path()) logging.info('BAZARR Log file emptied') From dd92f408b968dd7d241e262be78d5a4a84300bfc Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Wed, 25 Sep 2024 11:20:30 +0900 Subject: [PATCH 73/78] Fixed duplicated search result name for series and movies (#2682) --- frontend/src/components/Search.tsx | 41 +++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/frontend/src/components/Search.tsx b/frontend/src/components/Search.tsx index b506afee3..c0dde3bef 100644 --- a/frontend/src/components/Search.tsx +++ b/frontend/src/components/Search.tsx @@ -3,6 +3,7 @@ import { useNavigate } from "react-router-dom"; import { Autocomplete, ComboboxItem, OptionsFilter, Text } from "@mantine/core"; import { faSearch } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; +import { chain, includes } from "lodash"; import { useServerSearch } from "@/apis/hooks"; import { useDebouncedValue } from "@/utilities"; @@ -15,23 +16,45 @@ function useSearch(query: string) { const debouncedQuery = useDebouncedValue(query, 500); const { data } = useServerSearch(debouncedQuery, debouncedQuery.length >= 0); + const duplicates = chain(data) + .groupBy((item) => `${item.title} (${item.year})`) + .filter((group) => group.length > 1) + .map((group) => `${group[0].title} (${group[0].year})`) + .value(); + return useMemo( () => data?.map((v) => { - let link: string; - if (v.sonarrSeriesId) { - link = `/series/${v.sonarrSeriesId}`; - } else if (v.radarrId) { - link = `/movies/${v.radarrId}`; - } else { + const { link, displayName } = (() => { + const hasDuplicate = includes(duplicates, `${v.title} (${v.year})`); + + if (v.sonarrSeriesId) { + return { + link: `/series/${v.sonarrSeriesId}`, + displayName: hasDuplicate + ? `${v.title} (${v.year}) (S)` + : `${v.title} (${v.year})`, + }; + } + + if (v.radarrId) { + return { + link: `/movies/${v.radarrId}`, + displayName: hasDuplicate + ? `${v.title} (${v.year}) (M)` + : `${v.title} (${v.year})`, + }; + } + throw new Error("Unknown search result"); - } + })(); + return { - value: `${v.title} (${v.year})`, + value: displayName, link, }; }) ?? [], - [data], + [data, duplicates], ); } From 9d8d995d3af15c9955764487cb75edca340d1e17 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Wed, 25 Sep 2024 11:24:58 +0900 Subject: [PATCH 74/78] Fixed upload subtitle language (#2675) --- .../src/components/forms/MovieUploadForm.tsx | 92 ++++++++++------ .../src/components/forms/SeriesUploadForm.tsx | 103 +++++++++++------- .../forms/uploadFormSelectorTypes.tsx | 16 +++ frontend/src/pages/Movies/index.tsx | 3 +- 4 files changed, 139 insertions(+), 75 deletions(-) create mode 100644 frontend/src/components/forms/uploadFormSelectorTypes.tsx diff --git a/frontend/src/components/forms/MovieUploadForm.tsx b/frontend/src/components/forms/MovieUploadForm.tsx index 8e318d7ad..f7f8f47c5 100644 --- a/frontend/src/components/forms/MovieUploadForm.tsx +++ b/frontend/src/components/forms/MovieUploadForm.tsx @@ -1,9 +1,9 @@ -import { FunctionComponent, useEffect, useMemo } from "react"; +import React, { FunctionComponent, useEffect, useMemo } from "react"; import { Button, - Checkbox, Divider, MantineColor, + Select, Stack, Text, } from "@mantine/core"; @@ -17,8 +17,9 @@ import { } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ColumnDef } from "@tanstack/react-table"; -import { isString } from "lodash"; +import { isString, uniqBy } from "lodash"; import { useMovieSubtitleModification } from "@/apis/hooks"; +import { subtitlesTypeOptions } from "@/components/forms/uploadFormSelectorTypes"; import { Action, Selector } from "@/components/inputs"; import SimpleTable from "@/components/tables/SimpleTable"; import TextPopover from "@/components/TextPopover"; @@ -88,7 +89,7 @@ const MovieUploadForm: FunctionComponent = ({ const languages = useProfileItemsToLanguages(profile); const languageOptions = useSelectorOptions( - languages, + uniqBy(languages, "code2"), (v) => v.name, (v) => v.code2, ); @@ -207,34 +208,6 @@ const MovieUploadForm: FunctionComponent = ({ return {file.name}; }, }, - { - header: "Forced", - accessorKey: "forced", - cell: ({ row: { original, index } }) => { - return ( - { - action.mutate(index, { ...original, forced: checked }); - }} - > - ); - }, - }, - { - header: "HI", - accessorKey: "hi", - cell: ({ row: { original, index } }) => { - return ( - { - action.mutate(index, { ...original, hi: checked }); - }} - > - ); - }, - }, { header: "Language", accessorKey: "language", @@ -251,6 +224,61 @@ const MovieUploadForm: FunctionComponent = ({ ); }, }, + { + header: () => ( + { + if (value) { + action.update((item) => { + switch (value) { + case "hi": + return { ...item, hi: true, forced: false }; + case "forced": + return { ...item, hi: false, forced: true }; + case "normal": + return { ...item, hi: false, forced: false }; + default: + return item; + } + }); + } + }} + > + ), + accessorKey: "type", + cell: ({ row: { original, index } }) => { + return ( + + ); + }, + }, { id: "action", cell: ({ row: { index } }) => { diff --git a/frontend/src/components/forms/SeriesUploadForm.tsx b/frontend/src/components/forms/SeriesUploadForm.tsx index e4482cab4..9ae6308c9 100644 --- a/frontend/src/components/forms/SeriesUploadForm.tsx +++ b/frontend/src/components/forms/SeriesUploadForm.tsx @@ -1,9 +1,9 @@ -import { FunctionComponent, useEffect, useMemo } from "react"; +import React, { FunctionComponent, useEffect, useMemo } from "react"; import { Button, - Checkbox, Divider, MantineColor, + Select, Stack, Text, } from "@mantine/core"; @@ -17,12 +17,13 @@ import { } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ColumnDef } from "@tanstack/react-table"; -import { isString } from "lodash"; +import { isString, uniqBy } from "lodash"; import { useEpisodesBySeriesId, useEpisodeSubtitleModification, useSubtitleInfos, } from "@/apis/hooks"; +import { subtitlesTypeOptions } from "@/components/forms/uploadFormSelectorTypes"; import { Action, Selector } from "@/components/inputs"; import SimpleTable from "@/components/tables/SimpleTable"; import TextPopover from "@/components/TextPopover"; @@ -100,7 +101,7 @@ const SeriesUploadForm: FunctionComponent = ({ const profile = useLanguageProfileBy(series.profileId); const languages = useProfileItemsToLanguages(profile); const languageOptions = useSelectorOptions( - languages, + uniqBy(languages, "code2"), (v) => v.name, (v) => v.code2, ); @@ -235,42 +236,6 @@ const SeriesUploadForm: FunctionComponent = ({ return {name}; }, }, - { - header: "Forced", - accessorKey: "forced", - cell: ({ row: { original, index } }) => { - return ( - { - action.mutate(index, { - ...original, - forced: checked, - hi: checked ? false : original.hi, - }); - }} - > - ); - }, - }, - { - header: "HI", - accessorKey: "hi", - cell: ({ row: { original, index } }) => { - return ( - { - action.mutate(index, { - ...original, - hi: checked, - forced: checked ? false : original.forced, - }); - }} - > - ); - }, - }, { header: () => ( = ({ onChange={(value) => { if (value) { action.update((item) => { - item.language = value; - return item; + return { ...item, language: value }; }); } }} @@ -301,6 +265,61 @@ const SeriesUploadForm: FunctionComponent = ({ ); }, }, + { + header: () => ( + { + if (value) { + action.update((item) => { + switch (value) { + case "hi": + return { ...item, hi: true, forced: false }; + case "forced": + return { ...item, hi: false, forced: true }; + case "normal": + return { ...item, hi: false, forced: false }; + default: + return item; + } + }); + } + }} + > + ), + accessorKey: "type", + cell: ({ row: { original, index } }) => { + return ( + + ); + }, + }, { id: "episode", header: "Episode", diff --git a/frontend/src/components/forms/uploadFormSelectorTypes.tsx b/frontend/src/components/forms/uploadFormSelectorTypes.tsx new file mode 100644 index 000000000..168cdddb1 --- /dev/null +++ b/frontend/src/components/forms/uploadFormSelectorTypes.tsx @@ -0,0 +1,16 @@ +import { SelectorOption } from "@/components"; + +export const subtitlesTypeOptions: SelectorOption[] = [ + { + label: "Normal", + value: "normal", + }, + { + label: "Hearing-Impaired", + value: "hi", + }, + { + label: "Forced", + value: "forced", + }, +]; diff --git a/frontend/src/pages/Movies/index.tsx b/frontend/src/pages/Movies/index.tsx index 0429e1fdd..ef5a1ec0d 100644 --- a/frontend/src/pages/Movies/index.tsx +++ b/frontend/src/pages/Movies/index.tsx @@ -6,6 +6,7 @@ import { faBookmark as farBookmark } from "@fortawesome/free-regular-svg-icons"; import { faBookmark, faWrench } from "@fortawesome/free-solid-svg-icons"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { ColumnDef } from "@tanstack/react-table"; +import { uniqueId } from "lodash"; import { useMovieModification, useMoviesPagination } from "@/apis/hooks"; import { Action } from "@/components"; import { AudioList } from "@/components/bazarr"; @@ -95,7 +96,7 @@ const MovieView: FunctionComponent = () => { From c11bdf34fadd49ea39cc73e471cc9a3075e492f4 Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Wed, 25 Sep 2024 15:33:08 -0400 Subject: [PATCH 75/78] Fixed duplicate IDs in languages profile items --- bazarr/app/database.py | 29 ++++++++++++ bazarr/main.py | 4 +- bazarr/utilities/health.py | 21 ++++++++- frontend/src/Router/index.tsx | 2 + .../src/pages/Settings/Languages/table.tsx | 44 +++++++++++++++++-- 5 files changed, 94 insertions(+), 6 deletions(-) diff --git a/bazarr/app/database.py b/bazarr/app/database.py index 3780befea..b931c5f0f 100644 --- a/bazarr/app/database.py +++ b/bazarr/app/database.py @@ -528,3 +528,32 @@ def upgrade_languages_profile_hi_values(): .values({"items": json.dumps(items)}) .where(TableLanguagesProfiles.profileId == languages_profile.profileId) ) + + +def fix_languages_profiles_with_duplicate_ids(): + languages_profiles = database.execute( + select(TableLanguagesProfiles.profileId, TableLanguagesProfiles.items, TableLanguagesProfiles.cutoff)).all() + for languages_profile in languages_profiles: + if languages_profile.cutoff: + # ignore profiles that have a cutoff set + continue + languages_profile_ids = [] + languages_profile_has_duplicate = False + languages_profile_items = json.loads(languages_profile.items) + for items in languages_profile_items: + if items['id'] in languages_profile_ids: + languages_profile_has_duplicate = True + break + else: + languages_profile_ids.append(items['id']) + + if languages_profile_has_duplicate: + item_id = 0 + for items in languages_profile_items: + item_id += 1 + items['id'] = item_id + database.execute( + update(TableLanguagesProfiles) + .values({"items": json.dumps(languages_profile_items)}) + .where(TableLanguagesProfiles.profileId == languages_profile.profileId) + ) diff --git a/bazarr/main.py b/bazarr/main.py index 8fe9a43fd..c86f5a7b4 100644 --- a/bazarr/main.py +++ b/bazarr/main.py @@ -35,7 +35,8 @@ else: # there's missing embedded packages after a commit check_if_new_update() -from app.database import System, database, update, migrate_db, create_db_revision, upgrade_languages_profile_hi_values # noqa E402 +from app.database import (System, database, update, migrate_db, create_db_revision, upgrade_languages_profile_hi_values, + fix_languages_profiles_with_duplicate_ids) # noqa E402 from app.notifier import update_notifier # noqa E402 from languages.get_languages import load_language_in_db # noqa E402 from app.signalr_client import sonarr_signalr_client, radarr_signalr_client # noqa E402 @@ -50,6 +51,7 @@ if args.create_db_revision: else: migrate_db(app) upgrade_languages_profile_hi_values() + fix_languages_profiles_with_duplicate_ids() configure_proxy_func() diff --git a/bazarr/utilities/health.py b/bazarr/utilities/health.py index 36b1625f1..c1d3a6a3d 100644 --- a/bazarr/utilities/health.py +++ b/bazarr/utilities/health.py @@ -1,7 +1,9 @@ # coding=utf-8 +import json + from app.config import settings -from app.database import TableShowsRootfolder, TableMoviesRootfolder, database, select +from app.database import TableShowsRootfolder, TableMoviesRootfolder, TableLanguagesProfiles, database, select from app.event_handler import event_stream from .path_mappings import path_mappings from sonarr.rootfolder import check_sonarr_rootfolder @@ -47,4 +49,21 @@ def get_health_issues(): health_issues.append({'object': path_mappings.path_replace_movie(item.path), 'issue': item.error}) + # get languages profiles duplicate ids issues when there's a cutoff set + languages_profiles = database.execute( + select(TableLanguagesProfiles.items, TableLanguagesProfiles.name, TableLanguagesProfiles.cutoff)).all() + for languages_profile in languages_profiles: + if not languages_profile.cutoff: + # ignore profiles that don't have a cutoff set + continue + languages_profile_ids = [] + for items in json.loads(languages_profile.items): + if items['id'] in languages_profile_ids: + health_issues.append({'object': languages_profile.name, + 'issue': 'This languages profile has duplicate IDs. You need to edit this profile' + ' and make sure to select the proper cutoff if required.'}) + break + else: + languages_profile_ids.append(items['id']) + return health_issues diff --git a/frontend/src/Router/index.tsx b/frontend/src/Router/index.tsx index d600fc87d..8ccea87f9 100644 --- a/frontend/src/Router/index.tsx +++ b/frontend/src/Router/index.tsx @@ -270,6 +270,7 @@ function useRoutes(): CustomRouteObject[] { { path: "status", name: "Status", + badge: data?.status, element: ( @@ -309,6 +310,7 @@ function useRoutes(): CustomRouteObject[] { data?.sonarr_signalr, data?.radarr_signalr, data?.announcements, + data?.status, radarr, sonarr, ], diff --git a/frontend/src/pages/Settings/Languages/table.tsx b/frontend/src/pages/Settings/Languages/table.tsx index 03971a5cc..5cfefdfa9 100644 --- a/frontend/src/pages/Settings/Languages/table.tsx +++ b/frontend/src/pages/Settings/Languages/table.tsx @@ -2,7 +2,7 @@ import { FunctionComponent, useCallback, useMemo } from "react"; import { Badge, Button, Group } from "@mantine/core"; import { faTrash, faWrench } from "@fortawesome/free-solid-svg-icons"; import { ColumnDef } from "@tanstack/react-table"; -import { cloneDeep } from "lodash"; +import { cloneDeep, includes, maxBy } from "lodash"; import { Action } from "@/components"; import { anyCutoff, @@ -79,10 +79,10 @@ const Table: FunctionComponent = () => { }) => { return ( - {items.map((v) => { + {items.map((v, i) => { const isCutoff = v.id === cutoff || cutoff === anyCutoff; return ( - + ); })} @@ -148,9 +148,45 @@ const Table: FunctionComponent = () => { icon={faWrench} c="gray" onClick={() => { + const lastId = maxBy(profile.items, "id")?.id || 0; + + // We once had an issue on the past where there were duplicated + // item ids that needs to become unique upon editing. + const sanitizedProfile = { + ...cloneDeep(profile), + items: profile.items.reduce( + (acc, value) => { + const { ids, duplicatedIds, items } = acc; + + // We once had an issue on the past where there were duplicated + // item ids that needs to become unique upon editing. + if (includes(ids, value.id)) { + duplicatedIds.push(value.id); + items.push({ + ...value, + id: lastId + duplicatedIds.length, + }); + + return acc; + } + + ids.push(value.id); + items.push(value); + + return acc; + }, + { + ids: [] as number[], + duplicatedIds: [] as number[], + items: [] as typeof profile.items, + }, + ).items, + tag: profile.tag || undefined, + }; + modals.openContextModal(ProfileEditModal, { languages, - profile: cloneDeep(profile), + profile: sanitizedProfile, onComplete: updateProfile, }); }} From 25098e5e07533f9eea9602d6a37380aa68a86bbb Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Thu, 26 Sep 2024 21:37:34 -0400 Subject: [PATCH 76/78] Fixed database migration issue with postgresql. #2664 --- migrations/versions/b183a2ac0dd1_.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/migrations/versions/b183a2ac0dd1_.py b/migrations/versions/b183a2ac0dd1_.py index 3a8c16339..a36a0caac 100644 --- a/migrations/versions/b183a2ac0dd1_.py +++ b/migrations/versions/b183a2ac0dd1_.py @@ -7,6 +7,7 @@ Create Date: 2024-02-16 10:32:39.123456 """ from alembic import op import sqlalchemy as sa +from app.database import TableLanguagesProfiles # revision identifiers, used by Alembic. @@ -19,6 +20,9 @@ bind = op.get_context().bind def upgrade(): + op.execute(sa.update(TableLanguagesProfiles) + .values({TableLanguagesProfiles.originalFormat: 0}) + .where(TableLanguagesProfiles.originalFormat.is_(None))) if bind.engine.name == 'postgresql': with op.batch_alter_table('table_languages_profiles') as batch_op: batch_op.alter_column('originalFormat', type_=sa.Integer()) From 6297b4b83cbae86cfefb31eb8455fb2a1e83bedf Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Thu, 26 Sep 2024 21:49:38 -0400 Subject: [PATCH 77/78] Added database type, version and migration to System-->Status page. --- bazarr/api/system/status.py | 14 ++++++++++++++ frontend/src/pages/System/Status/index.tsx | 2 ++ frontend/src/types/system.d.ts | 2 ++ 3 files changed, 18 insertions(+) diff --git a/bazarr/api/system/status.py b/bazarr/api/system/status.py index 325f2fb61..cbc54949d 100644 --- a/bazarr/api/system/status.py +++ b/bazarr/api/system/status.py @@ -6,10 +6,12 @@ import logging from flask_restx import Resource, Namespace from tzlocal import get_localzone_name +from alembic.migration import MigrationContext from radarr.info import get_radarr_info from sonarr.info import get_sonarr_info from app.get_args import args +from app.database import engine, database, select from init import startTime from ..utils import authenticate @@ -34,6 +36,16 @@ class SystemStatus(Resource): timezone = "Exception while getting time zone name." logging.exception("BAZARR is unable to get configured time zone name.") + try: + database_version = ".".join([str(x) for x in engine.dialect.server_version_info]) + except Exception: + database_version = "" + + try: + database_migration = MigrationContext.configure(engine.connect()).get_current_revision() + except Exception: + database_migration = "unknown" + system_status = {} system_status.update({'bazarr_version': os.environ["BAZARR_VERSION"]}) system_status.update({'package_version': package_version}) @@ -41,6 +53,8 @@ class SystemStatus(Resource): system_status.update({'radarr_version': get_radarr_info.version()}) system_status.update({'operating_system': platform.platform()}) system_status.update({'python_version': platform.python_version()}) + system_status.update({'database_engine': f'{engine.dialect.name.capitalize()} {database_version}'}) + system_status.update({'database_migration': database_migration}) system_status.update({'bazarr_directory': os.path.dirname(os.path.dirname(os.path.dirname( os.path.dirname(__file__))))}) system_status.update({'bazarr_config_directory': args.config_dir}) diff --git a/frontend/src/pages/System/Status/index.tsx b/frontend/src/pages/System/Status/index.tsx index bcd0e175d..157935dfb 100644 --- a/frontend/src/pages/System/Status/index.tsx +++ b/frontend/src/pages/System/Status/index.tsx @@ -144,6 +144,8 @@ const SystemStatusView: FunctionComponent = () => { {status?.radarr_version} {status?.operating_system} {status?.python_version} + {status?.database_engine} + {status?.database_migration} {status?.bazarr_directory} {status?.bazarr_config_directory} diff --git a/frontend/src/types/system.d.ts b/frontend/src/types/system.d.ts index 544d969ae..5a477fb54 100644 --- a/frontend/src/types/system.d.ts +++ b/frontend/src/types/system.d.ts @@ -20,6 +20,8 @@ declare namespace System { bazarr_config_directory: string; bazarr_directory: string; bazarr_version: string; + database_engine: string; + database_migration: string; operating_system: string; package_version: string; python_version: string; From 0200bb96d98127ee32b6b66f8d6b9e21d4571a4d Mon Sep 17 00:00:00 2001 From: morpheus65535 Date: Thu, 26 Sep 2024 23:19:14 -0400 Subject: [PATCH 78/78] Fixed improper paths history logging for different tools --- bazarr/subtitles/tools/delete.py | 23 +++++++++++++++-------- bazarr/subtitles/tools/subsyncer.py | 9 +++++++-- bazarr/subtitles/tools/translate.py | 10 ++++++++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/bazarr/subtitles/tools/delete.py b/bazarr/subtitles/tools/delete.py index 8291c2ff9..6345a91f5 100644 --- a/bazarr/subtitles/tools/delete.py +++ b/bazarr/subtitles/tools/delete.py @@ -36,40 +36,47 @@ def delete_subtitles(media_type, language, forced, hi, media_path, subtitles_pat language_log += ':forced' language_string += ' forced' + if media_type == 'series': + pr = path_mappings.path_replace + prr = path_mappings.path_replace_reverse + else: + pr = path_mappings.path_replace_movie + prr = path_mappings.path_replace_reverse_movie + result = ProcessSubtitlesResult(message=f"{language_string} subtitles deleted from disk.", - reversed_path=path_mappings.path_replace_reverse(media_path), + reversed_path=prr(media_path), downloaded_language_code2=language_log, downloaded_provider=None, score=None, forced=None, subtitle_id=None, - reversed_subtitles_path=path_mappings.path_replace_reverse(subtitles_path), + reversed_subtitles_path=prr(subtitles_path), hearing_impaired=None) if media_type == 'series': try: - os.remove(path_mappings.path_replace(subtitles_path)) + os.remove(pr(subtitles_path)) except OSError: logging.exception(f'BAZARR cannot delete subtitles file: {subtitles_path}') - store_subtitles(path_mappings.path_replace_reverse(media_path), media_path) + store_subtitles(prr(media_path), media_path) return False else: history_log(0, sonarr_series_id, sonarr_episode_id, result) - store_subtitles(path_mappings.path_replace_reverse(media_path), media_path) + store_subtitles(prr(media_path), media_path) notify_sonarr(sonarr_series_id) event_stream(type='series', action='update', payload=sonarr_series_id) event_stream(type='episode-wanted', action='update', payload=sonarr_episode_id) return True else: try: - os.remove(path_mappings.path_replace_movie(subtitles_path)) + os.remove(pr(subtitles_path)) except OSError: logging.exception(f'BAZARR cannot delete subtitles file: {subtitles_path}') - store_subtitles_movie(path_mappings.path_replace_reverse_movie(media_path), media_path) + store_subtitles_movie(prr(media_path), media_path) return False else: history_log_movie(0, radarr_id, result) - store_subtitles_movie(path_mappings.path_replace_reverse_movie(media_path), media_path) + store_subtitles_movie(prr(media_path), media_path) notify_radarr(radarr_id) event_stream(type='movie-wanted', action='update', payload=radarr_id) return True diff --git a/bazarr/subtitles/tools/subsyncer.py b/bazarr/subtitles/tools/subsyncer.py index 5c7ae38b0..22b2b4f56 100644 --- a/bazarr/subtitles/tools/subsyncer.py +++ b/bazarr/subtitles/tools/subsyncer.py @@ -112,14 +112,19 @@ class SubSyncer: f"{offset_seconds} seconds and a framerate scale factor of " f"{f'{framerate_scale_factor:.2f}'}.") + if sonarr_series_id: + prr = path_mappings.path_replace_reverse + else: + prr = path_mappings.path_replace_reverse_movie + result = ProcessSubtitlesResult(message=message, - reversed_path=path_mappings.path_replace_reverse(self.reference), + reversed_path=prr(self.reference), downloaded_language_code2=srt_lang, downloaded_provider=None, score=None, forced=forced, subtitle_id=None, - reversed_subtitles_path=srt_path, + reversed_subtitles_path=prr(self.srtin), hearing_impaired=hi) if sonarr_episode_id: diff --git a/bazarr/subtitles/tools/translate.py b/bazarr/subtitles/tools/translate.py index 534200e20..2b80bf951 100644 --- a/bazarr/subtitles/tools/translate.py +++ b/bazarr/subtitles/tools/translate.py @@ -16,6 +16,7 @@ from radarr.history import history_log_movie from sonarr.history import history_log from subtitles.processing import ProcessSubtitlesResult from app.event_handler import show_progress, hide_progress +from utilities.path_mappings import path_mappings def translate_subtitles_file(video_path, source_srt_file, from_lang, to_lang, forced, hi, media_type, sonarr_series_id, @@ -104,14 +105,19 @@ def translate_subtitles_file(video_path, source_srt_file, from_lang, to_lang, fo message = f"{language_from_alpha2(from_lang)} subtitles translated to {language_from_alpha3(to_lang)}." + if media_type == 'series': + prr = path_mappings.path_replace_reverse + else: + prr = path_mappings.path_replace_reverse_movie + result = ProcessSubtitlesResult(message=message, - reversed_path=video_path, + reversed_path=prr(video_path), downloaded_language_code2=to_lang, downloaded_provider=None, score=None, forced=forced, subtitle_id=None, - reversed_subtitles_path=dest_srt_file, + reversed_subtitles_path=prr(dest_srt_file), hearing_impaired=hi) if media_type == 'series':