Compare commits

..

2 Commits

Author SHA1 Message Date
JSC
502feea035 fix: Enable lint job in CI workflow
All checks were successful
Backend CI / lint (push) Successful in 9m26s
Backend CI / test (push) Successful in 4m4s
2025-08-01 02:09:45 +02:00
JSC
5fdc7aae85 fix: Lint fixes of last errors in app 2025-08-01 02:08:36 +02:00
4 changed files with 30 additions and 23 deletions

View File

@@ -9,28 +9,28 @@ on:
- main - main
jobs: jobs:
# lint: lint:
# runs-on: ubuntu-latest runs-on: ubuntu-latest
# steps: steps:
# - name: Checkout code - name: Checkout code
# uses: actions/checkout@v4 uses: actions/checkout@v4
# - name: "Set up python" - name: "Set up python"
# uses: actions/setup-python@v5 uses: actions/setup-python@v5
# with: with:
# python-version-file: "pyproject.toml" python-version-file: "pyproject.toml"
# - name: Install uv - name: Install uv
# uses: astral-sh/setup-uv@v6 uses: astral-sh/setup-uv@v6
# with: with:
# enable-cache: true enable-cache: true
# - name: Install requirements - name: Install requirements
# run: uv sync --locked --all-extras --dev run: uv sync --locked --all-extras --dev
# - name: Run linter - name: Run linter
# run: uv run ruff check run: uv run ruff check --exclude tests
test: test:
runs-on: ubuntu-latest runs-on: ubuntu-latest

View File

@@ -45,7 +45,7 @@ async def lifespan(_app: FastAPI) -> AsyncGenerator[None, None]:
logger.info("Extraction processor stopped") logger.info("Extraction processor stopped")
def create_app(): def create_app() -> FastAPI:
"""Create and configure the FastAPI application.""" """Create and configure the FastAPI application."""
app = FastAPI(lifespan=lifespan) app = FastAPI(lifespan=lifespan)

View File

@@ -63,7 +63,7 @@ class PlaylistService:
# Fallback to main playlist if no current playlist is set # Fallback to main playlist if no current playlist is set
return await self.get_main_playlist() return await self.get_main_playlist()
async def create_playlist( async def create_playlist( # noqa: PLR0913
self, self,
user_id: int, user_id: int,
name: str, name: str,
@@ -101,7 +101,7 @@ class PlaylistService:
logger.info("Created playlist '%s' for user %s", name, user_id) logger.info("Created playlist '%s' for user %s", name, user_id)
return playlist return playlist
async def update_playlist( async def update_playlist( # noqa: PLR0913
self, self,
playlist_id: int, playlist_id: int,
user_id: int, user_id: int,

View File

@@ -1,5 +1,6 @@
"""Sound normalizer service for normalizing audio files using ffmpeg loudnorm.""" """Sound normalizer service for normalizing audio files using ffmpeg loudnorm."""
import asyncio
import json import json
import os import os
import re import re
@@ -138,7 +139,9 @@ class SoundNormalizerService:
stream = ffmpeg.output(stream, str(output_path), **output_args) stream = ffmpeg.output(stream, str(output_path), **output_args)
stream = ffmpeg.overwrite_output(stream) stream = ffmpeg.overwrite_output(stream)
ffmpeg.run(stream, quiet=True, overwrite_output=True) await asyncio.to_thread(
ffmpeg.run, stream, quiet=True, overwrite_output=True,
)
logger.info("One-pass normalization completed: %s", output_path) logger.info("One-pass normalization completed: %s", output_path)
except Exception: except Exception:
@@ -176,7 +179,9 @@ class SoundNormalizerService:
# Run first pass and capture output # Run first pass and capture output
try: try:
result = ffmpeg.run(stream, capture_stderr=True, quiet=True) result = await asyncio.to_thread(
ffmpeg.run, stream, capture_stderr=True, quiet=True,
)
analysis_output = result[1].decode("utf-8") analysis_output = result[1].decode("utf-8")
except ffmpeg.Error as e: except ffmpeg.Error as e:
logger.exception( logger.exception(
@@ -256,7 +261,9 @@ class SoundNormalizerService:
stream = ffmpeg.overwrite_output(stream) stream = ffmpeg.overwrite_output(stream)
try: try:
ffmpeg.run(stream, quiet=True, overwrite_output=True) await asyncio.to_thread(
ffmpeg.run, stream, quiet=True, overwrite_output=True,
)
logger.info("Two-pass normalization completed: %s", output_path) logger.info("Two-pass normalization completed: %s", output_path)
except ffmpeg.Error as e: except ffmpeg.Error as e:
logger.exception( logger.exception(