diff --git a/bazarr/utilities/video_analyzer.py b/bazarr/utilities/video_analyzer.py index bfa75542e..dc9afacee 100644 --- a/bazarr/utilities/video_analyzer.py +++ b/bazarr/utilities/video_analyzer.py @@ -305,9 +305,7 @@ def parse_video_metadata(file, file_size, episode_file_id=None, movie_file_id=No # or if we have mediainfo available elif mediainfo_path: try: - # disabling mediainfo path temporarily until issue with knowit is fixed. - # data["mediainfo"] = know(video_path=file, context={"provider": "mediainfo", "mediainfo": mediainfo_path}) - data["mediainfo"] = know(video_path=file, context={"provider": "mediainfo"}) + data["mediainfo"] = know(video_path=file, context={"provider": "mediainfo", "mediainfo": mediainfo_path}) except KnowitException as e: logging.error(f"BAZARR mediainfo cannot analyze this video file {file}. Could it be corrupted? {e}") return None diff --git a/libs/knowit-0.5.2.dist-info/INSTALLER b/libs/knowit-0.5.3.dist-info/INSTALLER similarity index 100% rename from libs/knowit-0.5.2.dist-info/INSTALLER rename to libs/knowit-0.5.3.dist-info/INSTALLER diff --git a/libs/knowit-0.5.2.dist-info/LICENSE b/libs/knowit-0.5.3.dist-info/LICENSE similarity index 100% rename from libs/knowit-0.5.2.dist-info/LICENSE rename to libs/knowit-0.5.3.dist-info/LICENSE diff --git a/libs/knowit-0.5.2.dist-info/METADATA b/libs/knowit-0.5.3.dist-info/METADATA similarity index 98% rename from libs/knowit-0.5.2.dist-info/METADATA rename to libs/knowit-0.5.3.dist-info/METADATA index d864653ea..f47f60f0d 100644 --- a/libs/knowit-0.5.2.dist-info/METADATA +++ b/libs/knowit-0.5.3.dist-info/METADATA @@ -1,12 +1,12 @@ Metadata-Version: 2.1 Name: knowit -Version: 0.5.2 +Version: 0.5.3 Summary: Know better your media files Home-page: https://github.com/ratoaq2/knowit License: MIT Keywords: video,mkv,mp4,mediainfo,metadata,movie,episode,tv,shows,series Author: Rato -Requires-Python: >=3.8.1,<4.0.0 +Requires-Python: >=3.9.0,<4.0.0 Classifier: Development Status :: 5 - Production/Stable Classifier: Intended Audience :: Developers Classifier: License :: OSI Approved :: MIT License @@ -18,12 +18,11 @@ Classifier: Programming Language :: Python :: 3.10 Classifier: Programming Language :: Python :: 3.11 Classifier: Programming Language :: Python :: 3.12 Classifier: Programming Language :: Python :: 3 :: Only -Classifier: Programming Language :: Python :: 3.8 Classifier: Topic :: Multimedia :: Video Classifier: Topic :: Software Development :: Libraries :: Python Modules Requires-Dist: babelfish (>=0.6.0,<0.7.0) Requires-Dist: enzyme (>=0.4.1,<0.5.0) -Requires-Dist: pint (>=0.20.1,<0.21.0) +Requires-Dist: pint (>=0.20.1,<0.22.0) Requires-Dist: pymediainfo (>=6.0.1,<7.0.0) Requires-Dist: pyyaml (>=6.0,<7.0) Requires-Dist: trakit (>=0.2.1,<0.3.0) diff --git a/libs/knowit-0.5.2.dist-info/RECORD b/libs/knowit-0.5.3.dist-info/RECORD similarity index 65% rename from libs/knowit-0.5.2.dist-info/RECORD rename to libs/knowit-0.5.3.dist-info/RECORD index 29cfe5d12..c4a1e9788 100644 --- a/libs/knowit-0.5.2.dist-info/RECORD +++ b/libs/knowit-0.5.3.dist-info/RECORD @@ -1,20 +1,20 @@ -../../bin/knowit,sha256=YW-jqGyoTDCtZ5CMgl9CaHRH1Z9BH2Uq38nD29WGYaA,237 -knowit-0.5.2.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 -knowit-0.5.2.dist-info/LICENSE,sha256=R8zPEs6FTm1j_QfmnmUjM63LiqD44a7-C6hWnoCh-8M,1061 -knowit-0.5.2.dist-info/METADATA,sha256=NQekkp65oE2PFb16Ndf8vZjy-f_eglkyxlmLa4ufABk,9182 -knowit-0.5.2.dist-info/RECORD,, -knowit-0.5.2.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 -knowit-0.5.2.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88 -knowit-0.5.2.dist-info/entry_points.txt,sha256=IuayIkjKpJlQRE1a7lN4axDUR6d13l5obIbpXuL3gsc,47 +../../bin/knowit,sha256=VqcR7w0JoAIAiHTJ_VmoiEcl-TWfAD3N3AvwOmhVJ6w,240 +knowit-0.5.3.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4 +knowit-0.5.3.dist-info/LICENSE,sha256=R8zPEs6FTm1j_QfmnmUjM63LiqD44a7-C6hWnoCh-8M,1061 +knowit-0.5.3.dist-info/METADATA,sha256=_fzw9UzG4zpVnYXbrwicSgdNcYfiT7TYOhvfwNlR08k,9132 +knowit-0.5.3.dist-info/RECORD,, +knowit-0.5.3.dist-info/REQUESTED,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0 +knowit-0.5.3.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88 +knowit-0.5.3.dist-info/entry_points.txt,sha256=IuayIkjKpJlQRE1a7lN4axDUR6d13l5obIbpXuL3gsc,47 knowit/__init__.py,sha256=TxzHZ2jeocfO1t5sOLMEt5GJXT4FUJrSsUDM463oO0M,1269 knowit/__main__.py,sha256=W-A3O0IO37SA5Tjsney8I2TGEfwaiwbgBxIcDPIguh4,6243 knowit/api.py,sha256=LFaWZamIeBeNhEG6YNv8mJELqTV_Oo8TfifONWHQuXc,3890 -knowit/config.py,sha256=Syvq9bWj1pcaZWS1M67jb9XKebtGIHfE-UgwuaBEoqo,2006 +knowit/config.py,sha256=GSiyDXu5mKZiHedmcs4eu9iohBwwjvNAiIOG4uybfNU,2175 knowit/core.py,sha256=7YMpLMjrIWSTvNoGYsQot3ZImITRJijxAZYdA-yN_e4,7457 knowit/defaults.yml,sha256=oWilBJyi0FkIwyOGQpz7q3Ax1pTmTSIG-ekYJpqWlJc,11748 knowit/properties/__init__.py,sha256=VvBTxa9wdzQ1ka6XtXibe7m_XUWRyQ_N0DW1q_S-Wms,504 knowit/properties/audio.py,sha256=wbW8Oq5VcbTUC-MdmVZh7pVC2sz4c0bSS-NcmF0Kz6U,1340 -knowit/properties/general.py,sha256=VVbGVryFd1d9zH73vZ743mSR80udWSqdcx9fEbzzNbg,4580 +knowit/properties/general.py,sha256=ipAHNJFfECfY6fwFWqXP6YFg3__I9coM695YoVlJyCU,4761 knowit/properties/subtitle.py,sha256=HY-MN6ZIQS4Vw6_Eu3mTWRX6yKZ-c47viye8Y1R2U_0,303 knowit/properties/video.py,sha256=KfDQ0b-ndLtNgYtW4ScSDQ2MZipzuLhU8yrDtgdjzlU,3154 knowit/provider.py,sha256=GHwOS_bW-MxeWIUdlbWY89uGbOzx3bLBRKnZB1e9mb8,4300 @@ -24,10 +24,10 @@ knowit/providers/ffmpeg.py,sha256=vq1FQu8Huct4vBEt52poFNupP1D8Chm2FKj367BmcB4,11 knowit/providers/mediainfo.py,sha256=PQxBfeN75M79NGeKXL3rYfbYOJf2H1Hp0XWuBdwD4f4,16163 knowit/providers/mkvmerge.py,sha256=s8n1K3nmUcnbOIRfVCGcD7WELUCrIkCzFHWLvTy9JdI,10511 knowit/rules/__init__.py,sha256=lBOmgKQ_h5qcgNlV6bdVWwus2lyO96wdwmezdVubhg8,330 -knowit/rules/audio.py,sha256=r3U0IwVADJICVzirV-vya6BwHd3NJUGOmP_obyZ0HRg,3295 +knowit/rules/audio.py,sha256=-adiFZjG6Rowam6ZmnwuhLSujR8ud_lILGa4Vc4ib9E,3351 knowit/rules/general.py,sha256=78Io4Pda8TWZyeBw3aiGl9Ry0OfmguxAtEd_pvabtis,904 knowit/rules/subtitle.py,sha256=a7R1Jst8U-j1gig7CJJS15uywoiedLkADIkr2b8wnm4,771 knowit/rules/video.py,sha256=yjXiKgmf__q4Ol6kECof5R8TGhq7cHuBoEt5o8aQbw8,2297 -knowit/serializer.py,sha256=pX9-xxkX09rT0PXe4jcXcp-fDW7BdXlz0PCtckDvAZ0,6526 +knowit/serializer.py,sha256=Y3vuKeAVLEnpAbv8WRqZRCiF9p-f4fcCcwMOcPVc47Q,6525 knowit/units.py,sha256=TFPAh8Pv9cV9ltDIj9dAd966rrEEsL8_Fgy1nQcSs08,824 -knowit/utils.py,sha256=YwtW10A5UXQv6aqwdVon4RdLN-9sOjOCEqO4AVvmYM4,4268 +knowit/utils.py,sha256=Sif7QWpMyvUy0ZKSCIkx_BOauzFJDy_AEetg2mLVT3Y,4273 diff --git a/libs/knowit-0.5.2.dist-info/REQUESTED b/libs/knowit-0.5.3.dist-info/REQUESTED similarity index 100% rename from libs/knowit-0.5.2.dist-info/REQUESTED rename to libs/knowit-0.5.3.dist-info/REQUESTED diff --git a/libs/knowit-0.5.2.dist-info/WHEEL b/libs/knowit-0.5.3.dist-info/WHEEL similarity index 100% rename from libs/knowit-0.5.2.dist-info/WHEEL rename to libs/knowit-0.5.3.dist-info/WHEEL diff --git a/libs/knowit-0.5.2.dist-info/entry_points.txt b/libs/knowit-0.5.3.dist-info/entry_points.txt similarity index 100% rename from libs/knowit-0.5.2.dist-info/entry_points.txt rename to libs/knowit-0.5.3.dist-info/entry_points.txt diff --git a/libs/knowit/config.py b/libs/knowit/config.py index 833139923..d7641a16f 100644 --- a/libs/knowit/config.py +++ b/libs/knowit/config.py @@ -2,9 +2,13 @@ import os import typing from logging import NullHandler, getLogger -from pkg_resources import resource_stream import yaml +try: + from importlib.resources import files +except ImportError: + from importlib_resources import files # type: ignore[assignment,no-redef,import-not-found] + from knowit.serializer import get_yaml_loader logger = getLogger(__name__) @@ -28,7 +32,8 @@ class Config: def build(cls, path: typing.Optional[typing.Union[str, os.PathLike]] = None) -> 'Config': """Build config instance.""" loader = get_yaml_loader() - with resource_stream('knowit', 'defaults.yml') as stream: + config_file = files(__package__).joinpath('defaults.yml') + with config_file.open('rb') as stream: cfgs = [yaml.load(stream, Loader=loader)] if path: diff --git a/libs/knowit/properties/general.py b/libs/knowit/properties/general.py index c522f87fc..701b9adbf 100644 --- a/libs/knowit/properties/general.py +++ b/libs/knowit/properties/general.py @@ -81,7 +81,11 @@ class Language(Property[babelfish.Language]): """Handle languages.""" try: if len(value) == 3: - return babelfish.Language.fromalpha3b(value) + try: + return babelfish.Language.fromalpha3b(value) + except babelfish.Error: + # Try alpha3t if alpha3b fails + return babelfish.Language.fromalpha3t(value) return babelfish.Language.fromietf(value) except (babelfish.Error, ValueError): diff --git a/libs/knowit/rules/audio.py b/libs/knowit/rules/audio.py index b35d36437..bcc4c7e06 100644 --- a/libs/knowit/rules/audio.py +++ b/libs/knowit/rules/audio.py @@ -1,5 +1,5 @@ import typing -from decimal import Decimal +from decimal import Decimal, InvalidOperation from logging import NullHandler, getLogger from knowit.core import Rule @@ -53,8 +53,8 @@ class AudioChannelsRule(Rule): c = Decimal('0.0') for i in position.split('/'): try: - c += Decimal(i) - except ValueError: + c += Decimal(i.replace('.?', '')) + except (ValueError, InvalidOperation): logger.debug('Invalid %s: %s', self.description, i) pass diff --git a/libs/knowit/serializer.py b/libs/knowit/serializer.py index 4922dc7f2..6543edfb8 100644 --- a/libs/knowit/serializer.py +++ b/libs/knowit/serializer.py @@ -143,7 +143,7 @@ def format_duration( seconds = int(seconds - (minutes * 60)) if profile == 'human': if hours > 0: - return f'{hours} hours {minutes:02d} minutes { seconds:02d} seconds' + return f'{hours} hours {minutes:02d} minutes {seconds:02d} seconds' if minutes > 0: return f'{minutes} minutes {seconds:02d} seconds' return f'{seconds} seconds' diff --git a/libs/knowit/utils.py b/libs/knowit/utils.py index 2bb0ed74b..4d80103ec 100644 --- a/libs/knowit/utils.py +++ b/libs/knowit/utils.py @@ -122,7 +122,7 @@ def build_path_candidates( def round_decimal(value: Decimal, min_digits=0, max_digits: typing.Optional[int] = None): - exponent = value.normalize().as_tuple().exponent + exponent = int(value.normalize().as_tuple().exponent) if exponent >= 0: return round(value, min_digits) diff --git a/libs/version.txt b/libs/version.txt index 09235fb12..1eaf9a16a 100644 --- a/libs/version.txt +++ b/libs/version.txt @@ -24,7 +24,7 @@ guessit==3.8.0 h11==0.14.0 inflect==7.0.0 jsonschema<=4.17.3 # newer version require other compiled dependency -knowit==0.5.2 +knowit==0.5.3 Mako==1.3.2 pycountry==23.12.11 pyrsistent==0.20.0