Merge remote-tracking branch 'origin/development' into development

pull/2575/head v1.4.4-beta.20
morpheus65535 4 months ago
commit ca7f68bbc8

@ -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

@ -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

@ -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"
}

@ -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",

@ -25,7 +25,7 @@ const TextPopover: FunctionComponent<TextPopoverProps> = ({
opened={hovered}
label={text}
{...tooltip}
style={{ textWrap: "pretty" }}
style={{ textWrap: "wrap" }}
>
<div ref={ref}>{children}</div>
</Tooltip>

@ -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

@ -1,6 +1,6 @@
Metadata-Version: 2.1
Name: fese
Version: 0.2.9
Version: 0.3.0
Summary: A library to extract FFmpeg subtitle streams
Author-email: Vitiko Nogales <averroista@protonmail.com>
Requires-Python: >=3.7

@ -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

@ -1,5 +1,5 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.42.0)
Generator: setuptools (70.3.0)
Root-Is-Purelib: true
Tag: py3-none-any

@ -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()

@ -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"),
},
}

@ -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

@ -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
):

Loading…
Cancel
Save