diff --git a/copyparty/bos/path.py b/copyparty/bos/path.py index ec5ca16d..6a77cb6e 100644 --- a/copyparty/bos/path.py +++ b/copyparty/bos/path.py @@ -21,6 +21,10 @@ def getsize(p): return os.path.getsize(fsenc(p)) +def isfile(p): + return os.path.isfile(fsenc(p)) + + def isdir(p): return os.path.isdir(fsenc(p)) diff --git a/copyparty/mtag.py b/copyparty/mtag.py index 9a5e5066..9d86b14f 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -413,6 +413,9 @@ class MTag(object): return r1 def get_mutagen(self, abspath): + if not bos.path.isfile(abspath): + return {} + import mutagen try: @@ -458,10 +461,16 @@ class MTag(object): return self.normalize_tags(ret, md) def get_ffprobe(self, abspath): + if not bos.path.isfile(abspath): + return {} + ret, md = ffprobe(abspath) return self.normalize_tags(ret, md) def get_bin(self, parsers, abspath): + if not bos.path.isfile(abspath): + return {} + pypath = os.path.abspath(os.path.dirname(os.path.dirname(__file__))) pypath = [str(pypath)] + [str(x) for x in sys.path if x] pypath = str(os.pathsep.join(pypath)) diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 95670edf..e84a2e3b 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -998,7 +998,10 @@ class Up2k(object): except Exception as ex: msg = "failed to read tags from {}:\n{}" self.log(msg.format(abspath, ex), c=3) - return + return 0 + + if not bos.path.isfile(abspath): + return 0 if entags: tags = {k: v for k, v in tags.items() if k in entags}