1
0
Fork 0
mirror of https://github.com/morpheus65535/bazarr synced 2024-12-21 23:32:31 +00:00

Upgraded knowit to latest version to fix some long-lasting issue.

This commit is contained in:
morpheus65535 2024-07-04 21:27:34 -04:00
parent 8beebce2e4
commit 22ac838e9b
14 changed files with 35 additions and 29 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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