Public Access
Add MA_URL to download covers through a reverse proxy
The jail can't reach Music Assistant's port 8095. MA_URL replaces the host of Music Assistant's image URLs when downloading. fetch-covers now stops at the first connection failure instead of stalling on every album, and image connections time out after 3 seconds. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -63,3 +63,15 @@ def test_find_album_needs_exact_names():
|
||||
]
|
||||
assert library.find_album("Tool", "Lateralus").image == "http://img/1"
|
||||
assert library.find_album("Mogwai", "Lateralus") is None
|
||||
|
||||
|
||||
def test_ma_url_replaces_music_assistant_host_for_downloads():
|
||||
library, seen = _library_with_images({
|
||||
"https://ma.example/imageproxy/abc?size=0":
|
||||
httpx.Response(200, content=b"jpg", headers={"content-type": "image/jpeg"}),
|
||||
})
|
||||
library._ma_url = httpx.URL("https://ma.example")
|
||||
assert library.fetch_image("http://172.16.40.250:8095/imageproxy/abc?size=0") == (b"jpg", "image/jpeg")
|
||||
assert str(seen[0].url) == "https://ma.example/imageproxy/abc?size=0"
|
||||
# Without MA_URL the address is used as Music Assistant reports it.
|
||||
assert MusicLibrary("http://ha", "t", client=httpx.Client()).image_download_url("http://x:8095/a") == "http://x:8095/a"
|
||||
|
||||
Reference in New Issue
Block a user