Skip to content

Commit 464e1fe

Browse files
committed
3.0.037
1 parent 43eb6dd commit 464e1fe

File tree

3 files changed

+18
-16
lines changed

3 files changed

+18
-16
lines changed

library/utils/strings.py

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -329,20 +329,23 @@ def duration(seconds) -> str:
329329
if seconds is None or math.isnan(seconds) or seconds == 0:
330330
return ""
331331

332-
test = humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="minutes", format="%0.0f")
332+
try:
333+
test = humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="minutes", format="%0.0f")
333334

334-
PRECISION_YEARS = 3
335-
if len(test.split(",")) >= PRECISION_YEARS:
336-
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="hours", format="%0.0f")
335+
PRECISION_YEARS = 3
336+
if len(test.split(",")) >= PRECISION_YEARS:
337+
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="hours", format="%0.0f")
337338

338-
PRECISION_MONTHS = 2
339-
if len(test.split(",")) >= PRECISION_MONTHS:
340-
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="hours", format="%0.0f")
339+
PRECISION_MONTHS = 2
340+
if len(test.split(",")) >= PRECISION_MONTHS:
341+
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="hours", format="%0.0f")
341342

342-
if int(seconds) > 10 * 60:
343-
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="minutes", format="%0.0f")
343+
if int(seconds) > 10 * 60:
344+
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="minutes", format="%0.0f")
344345

345-
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="seconds", format="%0.0f")
346+
return humanize.precisedelta(timedelta(seconds=int(seconds)), minimum_unit="seconds", format="%0.0f")
347+
except OverflowError:
348+
return ""
346349

347350

348351
def relative_datetime(seconds) -> str:

pdm.lock

Lines changed: 4 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ deluxe = [
4848
"pdf2image",
4949
"pillow",
5050
"PyExifTool",
51-
"pymcdm",
51+
"pymcdm<1.3", # dominant_alts.size > 0 ValueError should be a warning instead...
5252
"pyvirtualdisplay",
5353
"qbittorrent-api",
5454
"scikit-learn",

0 commit comments

Comments
 (0)