diff --git a/copyparty/authsrv.py b/copyparty/authsrv.py index 557d1333..28f649fc 100644 --- a/copyparty/authsrv.py +++ b/copyparty/authsrv.py @@ -475,8 +475,10 @@ class AuthSrv(object): # verify tags mentioned by -mt[mp] are used by -mte local_mtp = {} local_only_mtp = {} - for a in vol.flags.get("mtp", []) + vol.flags.get("mtm", []): - a = a.split("=")[0] + tags = vol.flags.get("mtp", []) + vol.flags.get("mtm", []) + tags = [x.split("=")[0] for x in tags] + tags = [y for x in tags for y in x.split(",")] + for a in tags: local_mtp[a] = True local = True for b in self.args.mtp or []: diff --git a/copyparty/mtag.py b/copyparty/mtag.py index 79258d1d..2de74435 100644 --- a/copyparty/mtag.py +++ b/copyparty/mtag.py @@ -4,6 +4,7 @@ from __future__ import print_function, unicode_literals import re import os import sys +import json import shutil import subprocess as sp @@ -394,8 +395,16 @@ class MTag(object): cmd = [fsenc(x) for x in cmd] v = sp.check_output(cmd, **args).strip() - if v: + if not v: + continue + + if "," not in tagname: ret[tagname] = v.decode("utf-8") + else: + v = json.loads(v) + for tag in tagname.split(","): + if tag and tag in v: + ret[tag] = v[tag] except: pass diff --git a/copyparty/up2k.py b/copyparty/up2k.py index 9fd7c9ee..085f5eae 100644 --- a/copyparty/up2k.py +++ b/copyparty/up2k.py @@ -533,7 +533,13 @@ class Up2k(object): for parser in self.flags[ptop]["mtp"]: orig = parser tag, parser = parser.split("=", 1) - if tag not in entags: + + skip = False + for t in tag.split(","): + if t and t not in entags: + skip = True + + if skip: continue audio[tag] = "y" @@ -683,8 +689,8 @@ class Up2k(object): entags = self.entags[ptop] parsers = {} for k, v in all_parsers.items(): - if ".dur" in entags: - if ".dur" in have: + if "ac" in entags or ".aq" in entags: + if "ac" in have or ".aq" in have: # is audio, require non-audio? if audio[k] == "n": continue @@ -701,6 +707,9 @@ class Up2k(object): # mp.pool.ThreadPool and concurrent.futures.ThreadPoolExecutor # both do crazy runahead so lets reinvent another wheel nw = os.cpu_count() if hasattr(os, "cpu_count") else 4 + if self.args.no_mtag_mt: + nw = 1 + if self.pending_tags is None: self.log("using {}x {}".format(nw, self.mtag.backend)) self.pending_tags = []