Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 20 additions & 9 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,6 @@ jobs:
run: |
pip install pytest

# mkvmerge + mediainfo are AudioCleaner's own runtime dependencies
# (bundled with the Windows build). Installing them here lets the
# integration suite (tests/test_integration_fixtures.py) exercise
# the real tools instead of only mocks.
- name: Install mkvtoolnix & mediainfo
run: |
sudo apt-get update
Expand All @@ -48,12 +44,8 @@ jobs:
pytest tests/ -v

windows-build:
name: PyInstaller build test (Windows)
name: PyInstaller build & launch smoke test (Windows)
runs-on: windows-latest
# Build-only smoke test: confirms the app still packages into a
# working .exe with PySide6 + the bundled MediaInfo/libcurl binaries.
# It does not run the packaged exe (no display/media tools available
# on the runner) -- that's still a manual release-checklist step.
steps:
- uses: actions/checkout@v4

Expand All @@ -79,3 +71,22 @@ jobs:
exit 1
}
Write-Host "Build OK: $((Get-Item dist/AudioCleaner.exe).Length) bytes"

- name: Launch executable smoke test
shell: pwsh
run: |
$exe = (Resolve-Path "dist/AudioCleaner.exe").Path
$proc = Start-Process -FilePath $exe -PassThru
try {
Start-Sleep -Seconds 8
if ($proc.HasExited) {
Write-Error "AudioCleaner.exe exited during the launch smoke test with code $($proc.ExitCode)"
exit 1
}
Write-Host "Launch OK: process remained running for 8 seconds"
}
finally {
if (-not $proc.HasExited) {
Stop-Process -Id $proc.Id -Force -ErrorAction SilentlyContinue
}
}
58 changes: 16 additions & 42 deletions audiocleaner/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@
# --- Cache / rules versioning ---
# Bump SCANNER_VERSION whenever probe.py's extraction logic changes in a way
# that could change what a cached FileProbeResult contains (new fields, new
# matching logic, etc). Bump RULES_VERSION whenever track-selection logic
# changes (codec_rank.py) in a way that could change *decisions* made from
# an unchanged probe result. Either bump invalidates old cache entries, so a
# stale cache never silently keeps applying pre-change decisions.
# matching logic, etc). This is the version ProbeCache uses to invalidate
# stale probe data. RULES_VERSION identifies track-selection rules and can be
# recorded by callers/history when decision semantics change; changing it does
# not invalidate probe data because codec-ranking changes do not alter the
# underlying MediaInfo/mkvmerge facts stored in the cache.
SCANNER_VERSION = "2"
RULES_VERSION = "2"

Expand All @@ -30,22 +31,21 @@
# Ordered best -> worst. Keys are internal codec identifiers produced by
# codec_rank.classify_audio_track(). Lower index = higher priority.
CODEC_PRIORITY = [
"truehd_atmos", # Dolby TrueHD + Atmos
"dtsx", # DTS:X
"truehd", # Dolby TrueHD
"dts_hd_ma", # DTS-HD Master Audio
"lpcm", # LPCM
"flac", # FLAC
"eac3", # Dolby Digital Plus (E-AC3)
"dts", # DTS (core)
"ac3", # Dolby Digital (AC3)
"aac", # AAC
"mp3", # MP3
"truehd_atmos",
"dtsx",
"truehd",
"dts_hd_ma",
"lpcm",
"flac",
"eac3",
"dts",
"ac3",
"aac",
"mp3",
]

CODEC_RANK = {codec: i for i, codec in enumerate(CODEC_PRIORITY)}

# Human-readable labels for logs / UI.
CODEC_LABELS = {
"truehd_atmos": "Dolby TrueHD + Atmos",
"dtsx": "DTS:X",
Expand All @@ -61,41 +61,15 @@
"unknown": "Unknown",
}

# English language tags as they appear in MKV/mkvmerge/mediainfo output.
ENGLISH_LANG_CODES = {"eng", "en", "en-us", "en-gb"}

# --- Commentary tracks ---
# Off by default: commentary tracks are treated like any other extra audio
# track and stripped. When on, the single best non-commentary track is
# still chosen as "the" kept track, but commentary track(s) are kept
# alongside it rather than being removed.
DEFAULT_KEEP_COMMENTARY = False

# --- Subtitle language filtering ---
# Off by default, so existing behaviour (subtitles are never touched) is
# unchanged unless a user explicitly opts in. When on, only subtitle
# tracks matching a language in DEFAULT_SUBTITLE_LANGUAGES are kept,
# *plus* any track flagged Forced regardless of language (these are
# usually foreign-dialogue captions within an otherwise-English film that
# people expect kept even when everything else in that language is
# stripped).
DEFAULT_SUBTITLE_FILTER_ENABLED = False
DEFAULT_SUBTITLE_LANGUAGES = {"eng"}

# Cache file name written into the target root folder.
CACHE_FILENAME = ".audiocleaner_cache.json"

# Log file name written into the target root folder.
LOG_FILENAME = "audiocleaner_log.txt"

MKV_EXTENSIONS = {".mkv"}

# --- Watch mode ---
# How often the watcher re-scans the folder tree for new/changed files.
WATCH_POLL_INTERVAL_SECONDS = 15

# How long a file's size must stay unchanged before it's considered fully
# copied and safe to process. User-adjustable in the GUI; this is just the
# default (matches the "wait a minute or two" guidance for Radarr/Sonarr
# moving files into the library folder).
WATCH_DEFAULT_SETTLE_SECONDS = 120
Loading
Loading