mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
support multiple tags from mtp helpers
This commit is contained in:
parent
bf99445377
commit
deea66ad0b
|
@ -475,8 +475,10 @@ class AuthSrv(object):
|
||||||
# verify tags mentioned by -mt[mp] are used by -mte
|
# verify tags mentioned by -mt[mp] are used by -mte
|
||||||
local_mtp = {}
|
local_mtp = {}
|
||||||
local_only_mtp = {}
|
local_only_mtp = {}
|
||||||
for a in vol.flags.get("mtp", []) + vol.flags.get("mtm", []):
|
tags = vol.flags.get("mtp", []) + vol.flags.get("mtm", [])
|
||||||
a = a.split("=")[0]
|
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_mtp[a] = True
|
||||||
local = True
|
local = True
|
||||||
for b in self.args.mtp or []:
|
for b in self.args.mtp or []:
|
||||||
|
|
|
@ -4,6 +4,7 @@ from __future__ import print_function, unicode_literals
|
||||||
import re
|
import re
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
|
import json
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess as sp
|
import subprocess as sp
|
||||||
|
|
||||||
|
@ -394,8 +395,16 @@ class MTag(object):
|
||||||
|
|
||||||
cmd = [fsenc(x) for x in cmd]
|
cmd = [fsenc(x) for x in cmd]
|
||||||
v = sp.check_output(cmd, **args).strip()
|
v = sp.check_output(cmd, **args).strip()
|
||||||
if v:
|
if not v:
|
||||||
|
continue
|
||||||
|
|
||||||
|
if "," not in tagname:
|
||||||
ret[tagname] = v.decode("utf-8")
|
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:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -533,7 +533,13 @@ class Up2k(object):
|
||||||
for parser in self.flags[ptop]["mtp"]:
|
for parser in self.flags[ptop]["mtp"]:
|
||||||
orig = parser
|
orig = parser
|
||||||
tag, parser = parser.split("=", 1)
|
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
|
continue
|
||||||
|
|
||||||
audio[tag] = "y"
|
audio[tag] = "y"
|
||||||
|
@ -683,8 +689,8 @@ class Up2k(object):
|
||||||
entags = self.entags[ptop]
|
entags = self.entags[ptop]
|
||||||
parsers = {}
|
parsers = {}
|
||||||
for k, v in all_parsers.items():
|
for k, v in all_parsers.items():
|
||||||
if ".dur" in entags:
|
if "ac" in entags or ".aq" in entags:
|
||||||
if ".dur" in have:
|
if "ac" in have or ".aq" in have:
|
||||||
# is audio, require non-audio?
|
# is audio, require non-audio?
|
||||||
if audio[k] == "n":
|
if audio[k] == "n":
|
||||||
continue
|
continue
|
||||||
|
@ -701,6 +707,9 @@ class Up2k(object):
|
||||||
# mp.pool.ThreadPool and concurrent.futures.ThreadPoolExecutor
|
# mp.pool.ThreadPool and concurrent.futures.ThreadPoolExecutor
|
||||||
# both do crazy runahead so lets reinvent another wheel
|
# both do crazy runahead so lets reinvent another wheel
|
||||||
nw = os.cpu_count() if hasattr(os, "cpu_count") else 4
|
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:
|
if self.pending_tags is None:
|
||||||
self.log("using {}x {}".format(nw, self.mtag.backend))
|
self.log("using {}x {}".format(nw, self.mtag.backend))
|
||||||
self.pending_tags = []
|
self.pending_tags = []
|
||||||
|
|
Loading…
Reference in a new issue