mirror of
https://github.com/9001/copyparty.git
synced 2025-08-17 09:02:15 -06:00
add opus mimetype
This commit is contained in:
parent
3948214050
commit
81e281f703
|
@ -271,7 +271,7 @@ def run_argparse(argv, formatter):
|
|||
ap2.add_argument("--no-mtag-mt", action="store_true", help="disable tag-read parallelism")
|
||||
ap2.add_argument("-mtm", metavar="M=t,t,t", action="append", type=str, help="add/replace metadata mapping")
|
||||
ap2.add_argument("-mte", metavar="M,M,M", type=str, help="tags to index/display (comma-sep.)",
|
||||
default="circle,album,.tn,artist,title,.bpm,key,.dur,.q,.vq,.aq,acodec,vcodec,res,.fps")
|
||||
default="circle,album,.tn,artist,title,.bpm,key,.dur,.q,.vq,.aq,ac,vc,res,.fps")
|
||||
ap2.add_argument("-mtp", metavar="M=[f,]bin", action="append", type=str, help="read tag M using bin")
|
||||
ap2.add_argument("--srch-time", metavar="SEC", type=int, default=30, help="search deadline")
|
||||
|
||||
|
|
|
@ -1117,7 +1117,7 @@ class HttpCli(object):
|
|||
self.send_headers(
|
||||
length=upper - lower,
|
||||
status=status,
|
||||
mime=guess_mime(req_path)[0],
|
||||
mime=guess_mime(req_path),
|
||||
)
|
||||
|
||||
logmsg += unicode(status) + logtail
|
||||
|
|
|
@ -75,6 +75,13 @@ IMPLICATIONS = [
|
|||
]
|
||||
|
||||
|
||||
MIMES = {
|
||||
"md": "text/plain; charset=UTF-8",
|
||||
"opus": "audio/ogg; codecs=opus",
|
||||
"webp": "image/webp",
|
||||
}
|
||||
|
||||
|
||||
REKOBO_KEY = {
|
||||
v: ln.split(" ", 1)[0]
|
||||
for ln in """
|
||||
|
@ -945,13 +952,12 @@ def unescape_cookie(orig):
|
|||
|
||||
|
||||
def guess_mime(url, fallback="application/octet-stream"):
|
||||
if url.endswith(".md"):
|
||||
return ["text/plain; charset=UTF-8"]
|
||||
try:
|
||||
_, ext = url.rsplit(".", 1)
|
||||
except:
|
||||
return fallback
|
||||
|
||||
if url.endswith(".webp"):
|
||||
return ["image/webp"]
|
||||
|
||||
return mimetypes.guess_type(url) or fallback
|
||||
return MIMES.get(ext) or mimetypes.guess_type(url)[0] or fallback
|
||||
|
||||
|
||||
def runcmd(*argv):
|
||||
|
|
Loading…
Reference in a new issue