From d3c40a423e24aae99ba3211f5d5b1d04176edf0c Mon Sep 17 00:00:00 2001 From: ed Date: Mon, 25 Jul 2022 01:21:34 +0200 Subject: [PATCH] mutagen: support nullduration tags --- copyparty/mtag.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/copyparty/mtag.py b/copyparty/mtag.py index b790823f..b291a2fd 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -437,8 +437,10 @@ class MTag(object): return r1 def get_mutagen(self, abspath: str) -> dict[str, Union[str, float]]: + ret: dict[str, Union[str, float]] = {} + if not bos.path.isfile(abspath): - return {} + return ret import mutagen @@ -450,7 +452,10 @@ class MTag(object): return self.get_ffprobe(abspath) if self.can_ffprobe else {} sz = bos.path.getsize(abspath) - ret = {".q": (0, int((sz / md.info.length) / 128))} + try: + ret = {".q": (0, int((sz / md.info.length) / 128))} + except: + pass for attr, k, norm in [ ["codec", "ac", unicode],