diff --git a/main.py b/main.py index e8a0d16..c25eb10 100644 --- a/main.py +++ b/main.py @@ -614,23 +614,34 @@ def podcast_rss(station: str, slug_with_ext: str, request: Request, db: Session @app.get("/live/{station}") def live_stream_redirect(station: str, db: Session = Depends(db_session)): + is_m3u = False + # Usuwamy sztuczne rozszerzenia dodane dla Mopidy if station.endswith(".aac"): station = station[:-4] elif station.endswith(".mp3"): station = station[:-4] + elif station.endswith(".m3u"): + station = station[:-4] + is_m3u = True 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" - # Doklejamy #.aac dla kompatybilności z Mopidy (GStreamer potrzebuje wskazówki) + 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" - # Doklejamy #.mp3 dla pełnej zgodności + 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) diff --git a/templates/base.html b/templates/base.html index 96688ce..0243167 100644 --- a/templates/base.html +++ b/templates/base.html @@ -93,8 +93,8 @@
- Stream 357 - Stream RNŚ + Stream 357 + Stream RNŚ Master OPML