support multiple tags from mtp helpers

This commit is contained in:
ed 2021-05-29 03:43:14 +02:00
parent bf99445377
commit deea66ad0b
3 changed files with 26 additions and 6 deletions

View file

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

View file

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

View file

@ -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 = []