fix: serve file:// art URLs in /art endpoint for YouTube/Firefox MPRIS
This commit is contained in:
parent
38acb8bccb
commit
9738b4a6af
1 changed files with 8 additions and 3 deletions
|
|
@ -119,6 +119,10 @@ class ControlHandler(BaseHTTPRequestHandler):
|
||||||
self.write_json(404, {"error": "no art"})
|
self.write_json(404, {"error": "no art"})
|
||||||
return
|
return
|
||||||
try:
|
try:
|
||||||
|
if art_url.startswith("file://"):
|
||||||
|
body = open(art_url[7:], "rb").read()
|
||||||
|
ctype = "image/png" if art_url.endswith(".png") else "image/jpeg"
|
||||||
|
else:
|
||||||
resp = requests.get(art_url, timeout=5)
|
resp = requests.get(art_url, timeout=5)
|
||||||
body = resp.content
|
body = resp.content
|
||||||
ctype = resp.headers.get("Content-Type", "image/jpeg")
|
ctype = resp.headers.get("Content-Type", "image/jpeg")
|
||||||
|
|
@ -163,6 +167,7 @@ class ControlHandler(BaseHTTPRequestHandler):
|
||||||
self.send_response(status)
|
self.send_response(status)
|
||||||
self.send_header("Content-Type", "application/json")
|
self.send_header("Content-Type", "application/json")
|
||||||
self.send_header("Content-Length", str(len(body)))
|
self.send_header("Content-Length", str(len(body)))
|
||||||
|
self.send_header("Access-Control-Allow-Origin", "*")
|
||||||
self.end_headers()
|
self.end_headers()
|
||||||
self.wfile.write(body)
|
self.wfile.write(body)
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue