fix: ensure .aac and .mp3 extensions are included in generated M3U playlists
This commit is contained in:
@@ -628,22 +628,26 @@ def live_stream_redirect(station: str, db: Session = Depends(db_session)):
|
||||
if station == "radio357":
|
||||
config_url = db.query(Config).filter_by(key="r357_live_url").first()
|
||||
target_url = config_url.value if config_url else "https://stream.rcs.revma.com/ye5kghkgcm0uv"
|
||||
if "#" not in target_url:
|
||||
target_url += "#.aac"
|
||||
|
||||
if is_m3u:
|
||||
m3u_content = f"#EXTM3U\n#EXTINF:-1,Radio 357\n{target_url}\n"
|
||||
from fastapi.responses import PlainTextResponse
|
||||
return PlainTextResponse(content=m3u_content, media_type="audio/x-mpegurl")
|
||||
if "#" not in target_url:
|
||||
target_url += "#.aac"
|
||||
|
||||
return RedirectResponse(url=target_url, status_code=302)
|
||||
elif station == "rns":
|
||||
config_url = db.query(Config).filter_by(key="rns_live_url").first()
|
||||
target_url = config_url.value if config_url else "https://stream.rcs.revma.com/4md4m0a0fs8uv"
|
||||
if "#" not in target_url:
|
||||
target_url += "#.mp3"
|
||||
|
||||
if is_m3u:
|
||||
m3u_content = f"#EXTM3U\n#EXTINF:-1,Radio Nowy Świat\n{target_url}\n"
|
||||
from fastapi.responses import PlainTextResponse
|
||||
return PlainTextResponse(content=m3u_content, media_type="audio/x-mpegurl")
|
||||
if "#" not in target_url:
|
||||
target_url += "#.mp3"
|
||||
|
||||
return RedirectResponse(url=target_url, status_code=302)
|
||||
else:
|
||||
raise HTTPException(status_code=404, detail="Brak streamu dla podanej stacji")
|
||||
|
||||
Reference in New Issue
Block a user