mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add mtp debug mode
This commit is contained in:
parent
a7f921abb9
commit
c930d8f773
|
@ -627,6 +627,7 @@ def run_argparse(argv: list[str], formatter: Any, retry: bool) -> argparse.Names
|
|||
ap2.add_argument("--no-mtag-ff", action="store_true", help="never use FFprobe as tag reader; is probably safer")
|
||||
ap2.add_argument("--mtag-mt", metavar="CORES", type=int, default=CORES, help="num cpu cores to use for tag scanning")
|
||||
ap2.add_argument("--mtag-v", action="store_true", help="verbose tag scanning; print errors from mtp subprocesses and such")
|
||||
ap2.add_argument("--mtag-vv", action="store_true", help="debug mtp settings")
|
||||
ap2.add_argument("-mtm", metavar="M=t,t,t", type=u, action="append", help="add/replace metadata mapping")
|
||||
ap2.add_argument("-mte", metavar="M,M,M", type=u, help="tags to index/display (comma-sep.)",
|
||||
default="circle,album,.tn,artist,title,.bpm,key,.dur,.q,.vq,.aq,vc,ac,fmt,res,.fps,ahash,vhash")
|
||||
|
|
|
@ -1424,6 +1424,10 @@ class Up2k(object):
|
|||
if tag in parser.tags:
|
||||
parsers[parser.tag] = parser
|
||||
|
||||
if self.args.mtag_vv:
|
||||
t = "parsers for {}: \033[0m{}"
|
||||
self.log(t.format(ptop, list(parsers.keys())), "1;30")
|
||||
|
||||
self.mtp_parsers[ptop] = parsers
|
||||
|
||||
q = "select count(w) from mt where k = 't:mtp'"
|
||||
|
@ -1552,6 +1556,8 @@ class Up2k(object):
|
|||
try:
|
||||
all_parsers = self.mtp_parsers[ptop]
|
||||
except:
|
||||
if self.args.mtag_vv:
|
||||
self.log("no mtp defined for {}".format(ptop), "1;30")
|
||||
return {}
|
||||
|
||||
entags = self.entags[ptop]
|
||||
|
@ -1561,9 +1567,15 @@ class Up2k(object):
|
|||
if "ac" in have or ".aq" in have:
|
||||
# is audio, require non-audio?
|
||||
if v.audio == "n":
|
||||
if self.args.mtag_vv:
|
||||
t = "skip mtp {}; is no-audio, have audio"
|
||||
self.log(t.format(k), "1;30")
|
||||
continue
|
||||
# is not audio, require audio?
|
||||
elif v.audio == "y":
|
||||
if self.args.mtag_vv:
|
||||
t = "skip mtp {}; is audio, have no-audio"
|
||||
self.log(t.format(k), "1;30")
|
||||
continue
|
||||
|
||||
if v.ext:
|
||||
|
@ -1574,6 +1586,9 @@ class Up2k(object):
|
|||
break
|
||||
|
||||
if not match:
|
||||
if self.args.mtag_vv:
|
||||
t = "skip mtp {}; need file-ext {}, have {}"
|
||||
self.log(t.format(k, v.ext, abspath.rsplit(".")[-1]), "1;30")
|
||||
continue
|
||||
|
||||
parsers[k] = v
|
||||
|
@ -1619,8 +1634,16 @@ class Up2k(object):
|
|||
|
||||
try:
|
||||
if not qe.mtp:
|
||||
if self.args.mtag_vv:
|
||||
t = "tag-thr: {}({})"
|
||||
self.log(t.format(self.mtag.backend, qe.abspath), "1;30")
|
||||
|
||||
tags = self.mtag.get(qe.abspath)
|
||||
else:
|
||||
if self.args.mtag_vv:
|
||||
t = "tag-thr: {}({})"
|
||||
self.log(t.format(list(qe.mtp.keys()), qe.abspath), "1;30")
|
||||
|
||||
tags = self.mtag.get_bin(qe.mtp, qe.abspath, qe.oth_tags)
|
||||
vtags = [
|
||||
"\033[36m{} \033[33m{}".format(k, v) for k, v in tags.items()
|
||||
|
@ -1651,7 +1674,7 @@ class Up2k(object):
|
|||
wark: str,
|
||||
abspath: str,
|
||||
ip: str,
|
||||
at: float
|
||||
at: float,
|
||||
) -> int:
|
||||
"""will mutex"""
|
||||
assert self.mtag
|
||||
|
@ -2966,6 +2989,12 @@ class Up2k(object):
|
|||
tags = self.mtag.get(abspath)
|
||||
ntags1 = len(tags)
|
||||
parsers = self._get_parsers(ptop, tags, abspath)
|
||||
if self.args.mtag_vv:
|
||||
t = "parsers({}): {}\n{} {} tags: {}".format(
|
||||
ptop, list(parsers.keys()), ntags1, self.mtag.backend, tags
|
||||
)
|
||||
self.log(t)
|
||||
|
||||
if parsers:
|
||||
tags["up_ip"] = ip
|
||||
tags["up_at"] = at
|
||||
|
|
Loading…
Reference in a new issue