mirror of
https://github.com/9001/copyparty.git
synced 2025-08-19 18:02:28 -06:00
more metadata-parser debug options
This commit is contained in:
parent
0063021012
commit
73bd2df2c6
|
@ -750,7 +750,7 @@ def run_argparse(argv: list[str], formatter: Any, retry: bool) -> argparse.Names
|
||||||
ap2.add_argument("--mtag-to", metavar="SEC", type=int, default=60, help="timeout for ffprobe tag-scan")
|
ap2.add_argument("--mtag-to", metavar="SEC", type=int, default=60, help="timeout for ffprobe tag-scan")
|
||||||
ap2.add_argument("--mtag-mt", metavar="CORES", type=int, default=CORES, help="num cpu cores to use for tag scanning")
|
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-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("--mtag-vv", action="store_true", help="debug mtp settings and mutagen/ffprobe parsers")
|
||||||
ap2.add_argument("-mtm", metavar="M=t,t,t", type=u, action="append", help="add/replace metadata mapping")
|
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.)",
|
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")
|
default="circle,album,.tn,artist,title,.bpm,key,.dur,.q,.vq,.aq,vc,ac,fmt,res,.fps,ahash,vhash")
|
||||||
|
|
|
@ -395,6 +395,10 @@ class MTag(object):
|
||||||
key = str(okey).replace(" ", "").replace("maj", "").replace("min", "m")
|
key = str(okey).replace(" ", "").replace("maj", "").replace("min", "m")
|
||||||
ret["key"] = REKOBO_LKEY.get(key.lower(), okey)
|
ret["key"] = REKOBO_LKEY.get(key.lower(), okey)
|
||||||
|
|
||||||
|
if self.args.mtag_vv:
|
||||||
|
zl = " ".join("\033[36m{} \033[33m{}".format(k, v) for k, v in ret.items())
|
||||||
|
self.log("norm: {}\033[0m".format(zl), "90")
|
||||||
|
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def compare(self, abspath: str) -> dict[str, Union[str, float]]:
|
def compare(self, abspath: str) -> dict[str, Union[str, float]]:
|
||||||
|
@ -446,6 +450,10 @@ class MTag(object):
|
||||||
try:
|
try:
|
||||||
md = File(fsenc(abspath), easy=True)
|
md = File(fsenc(abspath), easy=True)
|
||||||
assert md
|
assert md
|
||||||
|
if self.args.mtag_vv:
|
||||||
|
for zd in (md.info.__dict__, dict(md.tags)):
|
||||||
|
zl = ["\033[36m{} \033[33m{}".format(k, v) for k, v in zd.items()]
|
||||||
|
self.log("mutagen: {}\033[0m".format(" ".join(zl)), "90")
|
||||||
if not md.info.length and not md.info.codec:
|
if not md.info.length and not md.info.codec:
|
||||||
raise Exception()
|
raise Exception()
|
||||||
except:
|
except:
|
||||||
|
@ -495,6 +503,12 @@ class MTag(object):
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
ret, md = ffprobe(abspath, self.args.mtag_to)
|
ret, md = ffprobe(abspath, self.args.mtag_to)
|
||||||
|
|
||||||
|
if self.args.mtag_vv:
|
||||||
|
for zd in (ret, dict(md)):
|
||||||
|
zl = ["\033[36m{} \033[33m{}".format(k, v) for k, v in zd.items()]
|
||||||
|
self.log("ffprobe: {}\033[0m".format(" ".join(zl)), "90")
|
||||||
|
|
||||||
return self.normalize_tags(ret, md)
|
return self.normalize_tags(ret, md)
|
||||||
|
|
||||||
def get_bin(
|
def get_bin(
|
||||||
|
|
|
@ -1565,13 +1565,13 @@ class Up2k(object):
|
||||||
# is audio, require non-audio?
|
# is audio, require non-audio?
|
||||||
if v.audio == "n":
|
if v.audio == "n":
|
||||||
if self.args.mtag_vv:
|
if self.args.mtag_vv:
|
||||||
t = "skip mtp {}; is no-audio, have audio"
|
t = "skip mtp {}; want no-audio, got audio"
|
||||||
self.log(t.format(k), "90")
|
self.log(t.format(k), "90")
|
||||||
continue
|
continue
|
||||||
# is not audio, require audio?
|
# is not audio, require audio?
|
||||||
elif v.audio == "y":
|
elif v.audio == "y":
|
||||||
if self.args.mtag_vv:
|
if self.args.mtag_vv:
|
||||||
t = "skip mtp {}; is audio, have no-audio"
|
t = "skip mtp {}; want audio, got no-audio"
|
||||||
self.log(t.format(k), "90")
|
self.log(t.format(k), "90")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
@ -1584,7 +1584,7 @@ class Up2k(object):
|
||||||
|
|
||||||
if not match:
|
if not match:
|
||||||
if self.args.mtag_vv:
|
if self.args.mtag_vv:
|
||||||
t = "skip mtp {}; need file-ext {}, have {}"
|
t = "skip mtp {}; want file-ext {}, got {}"
|
||||||
self.log(t.format(k, v.ext, abspath.rsplit(".")[-1]), "90")
|
self.log(t.format(k, v.ext, abspath.rsplit(".")[-1]), "90")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue