Compare commits
4
Commits
release
...
6f71dbf68c
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6f71dbf68c | ||
|
|
fb6cb0baa2 | ||
|
|
db35c84cdb | ||
|
|
4fbb3e813e |
@@ -0,0 +1,66 @@
|
|||||||
|
name: CI
|
||||||
|
|
||||||
|
# Spustí se při pushi do devel/release a jde i ručně spustit z GUI.
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [devel, release]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
test:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: "3.12"
|
||||||
|
|
||||||
|
- name: Instalace Poetry
|
||||||
|
run: pip install poetry==2.4.1
|
||||||
|
|
||||||
|
- name: Instalace závislostí (vč. dev skupiny)
|
||||||
|
run: poetry install --no-interaction
|
||||||
|
|
||||||
|
- name: Ruff
|
||||||
|
run: poetry run ruff check .
|
||||||
|
|
||||||
|
- name: Mypy
|
||||||
|
run: poetry run mypy src
|
||||||
|
|
||||||
|
- name: Testy
|
||||||
|
run: poetry run pytest -q
|
||||||
|
|
||||||
|
build-and-push:
|
||||||
|
needs: test
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# Docker jméno musí být malými písmeny (Honza/Restreamer -> honza/restreamer)
|
||||||
|
- name: Název image
|
||||||
|
run: |
|
||||||
|
echo "IMAGE=gitea.doubynet.eu/$(echo '${{ github.repository }}' \
|
||||||
|
| tr '[:upper:]' '[:lower:]')" >> "$GITHUB_ENV"
|
||||||
|
|
||||||
|
# release -> latest (produkce), devel -> devel (staging)
|
||||||
|
- name: Značka podle větve
|
||||||
|
run: |
|
||||||
|
if [ "${{ github.ref_name }}" = "release" ]; then
|
||||||
|
echo "MOVING_TAG=latest" >> "$GITHUB_ENV"
|
||||||
|
else
|
||||||
|
echo "MOVING_TAG=devel" >> "$GITHUB_ENV"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Přihlášení do Gitea registry
|
||||||
|
run: |
|
||||||
|
echo '${{ secrets.REGISTRY_TOKEN }}' \
|
||||||
|
| docker login gitea.doubynet.eu -u '${{ github.actor }}' --password-stdin
|
||||||
|
|
||||||
|
- name: Build image
|
||||||
|
run: docker build -t "$IMAGE:$MOVING_TAG" -t "$IMAGE:${{ github.sha }}" .
|
||||||
|
|
||||||
|
- name: Push image
|
||||||
|
run: |
|
||||||
|
docker push "$IMAGE:$MOVING_TAG"
|
||||||
|
docker push "$IMAGE:${{ github.sha }}"
|
||||||
@@ -14,3 +14,13 @@ All notable changes to this project are documented in this file.
|
|||||||
(`channels.example.yaml`, `.env.example`).
|
(`channels.example.yaml`, `.env.example`).
|
||||||
- Unit test suite covering config parsing, URL expiry parsing, ffmpeg argument building, playlist generation, and
|
- Unit test suite covering config parsing, URL expiry parsing, ffmpeg argument building, playlist generation, and
|
||||||
broadcast fan-out.
|
broadcast fan-out.
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
|
||||||
|
- `/stream/{channel_id}` now forces the connection closed after each response (`Connection: close`) instead of
|
||||||
|
allowing keep-alive. Jellyfin's M3U tuner client (`SharedHttpStream`) was reusing a pooled keep-alive connection
|
||||||
|
still mid-stream from an earlier request and reading raw MPEG-TS bytes as if they were a fresh HTTP response,
|
||||||
|
failing with "Received an invalid status line".
|
||||||
|
- The yt-dlp resolver now correctly classifies which of the two `requested_formats` entries is audio when a live
|
||||||
|
stream is split into separate video-only and audio-only renditions; it previously relied on `acodec` being set,
|
||||||
|
which yt-dlp does not consistently do for audio-only formats, causing every resolve to fail.
|
||||||
|
|||||||
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
[project]
|
[project]
|
||||||
name = "restreamer"
|
name = "restreamer"
|
||||||
version = "0.1.0"
|
version = "1.0.0"
|
||||||
description = "Restreams YouTube livestreams as continuous local streams consumable by Jellyfin Live TV"
|
description = "Restreams YouTube livestreams as continuous local streams consumable by Jellyfin Live TV"
|
||||||
authors = [
|
authors = [
|
||||||
{name = "Jan Doubravsky",email = "jan.doubravsky@gmail.com"}
|
{name = "Jan Doubravsky",email = "jan.doubravsky@gmail.com"}
|
||||||
|
|||||||
@@ -42,6 +42,10 @@ async def _handle_stream(request: web.Request) -> web.StreamResponse:
|
|||||||
raise web.HTTPNotFound(text=f"Unknown channel '{channel_id}'")
|
raise web.HTTPNotFound(text=f"Unknown channel '{channel_id}'")
|
||||||
|
|
||||||
response = web.StreamResponse(status=200, headers={"Content-Type": MPEGTS_CONTENT_TYPE})
|
response = web.StreamResponse(status=200, headers={"Content-Type": MPEGTS_CONTENT_TYPE})
|
||||||
|
# A live stream is never meant to be pooled and reused for a later request; some HTTP
|
||||||
|
# clients (e.g. Jellyfin's SharedHttpStream) get fed stale bytes from a dangling
|
||||||
|
# keep-alive connection if we let one linger here. Force a fresh connection every time.
|
||||||
|
response.force_close()
|
||||||
await response.prepare(request)
|
await response.prepare(request)
|
||||||
|
|
||||||
queue = broadcaster.subscribe()
|
queue = broadcaster.subscribe()
|
||||||
@@ -51,7 +55,7 @@ async def _handle_stream(request: web.Request) -> web.StreamResponse:
|
|||||||
if chunk is None:
|
if chunk is None:
|
||||||
break
|
break
|
||||||
await response.write(chunk)
|
await response.write(chunk)
|
||||||
except ConnectionResetError:
|
except (ConnectionResetError, ConnectionAbortedError):
|
||||||
logger.debug("Client disconnected from channel '{}'", channel_id)
|
logger.debug("Client disconnected from channel '{}'", channel_id)
|
||||||
finally:
|
finally:
|
||||||
broadcaster.unsubscribe(queue)
|
broadcaster.unsubscribe(queue)
|
||||||
|
|||||||
Reference in New Issue
Block a user