audio-transcode-watcher 0.7.1__tar.gz → 0.8.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.github/workflows/tests.yml +8 -2
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/CHANGELOG.md +28 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/CLAUDE.md +1 -1
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/Dockerfile +4 -2
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/PKG-INFO +5 -3
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/README.md +3 -2
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/config.example.yaml +17 -4
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/ROADMAP.md +1 -1
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/configuration.md +71 -9
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/getting-started.md +2 -2
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/how-it-works.md +3 -3
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/pyproject.toml +3 -1
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/__init__.py +1 -1
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/config.py +60 -1
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/encoder.py +22 -2
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/main.py +2 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/sync.py +275 -25
- audio_transcode_watcher-0.8.0/src/audio_transcode_watcher/utils.py +429 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/watcher.py +30 -15
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_config.py +58 -0
- audio_transcode_watcher-0.8.0/tests/test_source_formats.py +656 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_sync.py +558 -5
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_utils.py +22 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_watcher.py +106 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tools/verify_sync.py +188 -148
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/uv.lock +35 -8
- audio_transcode_watcher-0.7.1/src/audio_transcode_watcher/utils.py +0 -236
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/.gitignore +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/README.md +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/config.yaml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/hooks/commit-msg +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/hooks/post-checkout +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/hooks/post-merge +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/hooks/pre-commit +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/hooks/pre-push +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/hooks/prepare-commit-msg +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.beads/metadata.json +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.claude/settings.json +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.coderabbit.yaml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.github/FUNDING.yml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.github/dependabot.yml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.github/workflows/dockerhub-description.yml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.github/workflows/release.yml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.github/workflows/stale.yml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/.gitignore +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/AGENTS.md +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/LICENSE +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/SECURITY.md +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/codecov.yml +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/development.md +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/images/banner.svg +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/images/icon.png +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/images/icon.svg +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/images/social-preview.png +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/docs/usage.md +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/lyrics.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/manifest.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/replaygain.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/__init__.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/conftest.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_encoder.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_lyrics.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_main.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_manifest.py +0 -0
- {audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/tests/test_replaygain.py +0 -0
|
@@ -47,10 +47,16 @@ jobs:
|
|
|
47
47
|
python-version: '3.14'
|
|
48
48
|
cache: 'pip'
|
|
49
49
|
|
|
50
|
-
- name: Install package
|
|
50
|
+
- name: Install package with dev tools
|
|
51
51
|
run: |
|
|
52
52
|
python -m pip install --upgrade pip
|
|
53
|
-
pip install -e .
|
|
53
|
+
pip install -e ".[dev]"
|
|
54
|
+
|
|
55
|
+
- name: Ruff lint
|
|
56
|
+
run: ruff check --output-format=github .
|
|
57
|
+
|
|
58
|
+
- name: Ruff format
|
|
59
|
+
run: ruff format --check .
|
|
54
60
|
|
|
55
61
|
- name: Check imports
|
|
56
62
|
run: |
|
|
@@ -2,6 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
All notable changes to this project are documented here. The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and the project uses [Semantic Versioning](https://semver.org/).
|
|
4
4
|
|
|
5
|
+
## [0.8.0] - 2026-11-23
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `settings.ignored_files` keeps folders and files in the source folder out of every output, for example the `.stversions/` folder where a sync tool keeps old versions. Each entry is a path relative to the source folder. Each folder or file name in it can be a pattern with `*`, `?` and `[...]`, case-sensitive, and an entry that starts with `**/` matches at any depth, like `**/.stversions` or `**/*.wav`. Any other entry starts at the top of the source. The watcher treats an ignored path as if it were not there. A sync does not read ignored folders, and file events inside them do nothing. An ignored lossless file no longer hides a lossy file with the same name. Outputs and `.lrc` copies whose only source is ignored are removed like any orphan, so copies made before the entry existed are cleaned up. They come back if the entry is removed. If every audio file in the source is ignored, the safety guard treats the source as empty and removes nothing. Each full sync logs one INFO line with the counts. An entry with a `..` part, or one that is only `**`, stops the watcher at startup. With the key unset, nothing changes. See [Ignored paths](docs/configuration.md#ignored-paths). Thanks to @delete-44 for the idea and the first version (#50).
|
|
10
|
+
- `source.formats` lists the source formats to process, for example `formats: [alac]` for an Apple Lossless library. The names are `flac`, `alac`, `wav`, `aiff`, `ape`, `wavpack`, `tta`, `tak`, `mp3`, `aac`, `vorbis`, `opus` and `wma`. A file in a format the list leaves out is treated like an ignored path: it gets no outputs, its old outputs are removed as orphans, and if no listed format is left the safety guard removes nothing. An unknown name, an empty list or a value that is not a list stops the watcher at startup with an error that lists the valid names. With the key unset, every format is processed, as before. See [Start from any format](docs/configuration.md#start-from-any-format).
|
|
11
|
+
|
|
12
|
+
### Fixed
|
|
13
|
+
|
|
14
|
+
- An ALAC `.m4a` source is now treated as lossless. Before, every `.m4a` counted as AAC, so an ALAC file was copied unchanged into an AAC output, which left a lossless file in the AAC folder, and it was never encoded into a FLAC or WAV output. The watcher now asks `ffprobe` which codec an `.m4a` holds, once per file version. An ALAC source is encoded into every output, and it wins over a lossy file with the same name, as a FLAC does. A FLAC next to an ALAC file of the same name still wins, also when it arrives after the ALAC file was encoded. An `.m4a` that `ffprobe` cannot read logs one WARNING and is treated as AAC, as before.
|
|
15
|
+
- An encode from an M4A source into an ALAC or AAC output keeps the ReplayGain, MusicBrainz and other freeform tags, in UTF-8 or UTF-16. FFmpeg drops them, and they were only copied back from FLAC, Ogg, APE and ID3 sources.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- The image is built on `python:3.15-slim`.
|
|
20
|
+
|
|
21
|
+
### Upgrading
|
|
22
|
+
|
|
23
|
+
- Outputs that an ALAC source got before this release are made again on the next sync. In an AAC output, the lossless copy is replaced by a real AAC file. In a FLAC or WAV output, the old `.m4a` copy is removed as an orphan and an encode takes its place. Copies and transcodes in other outputs are encoded again once. Each replaced file logs one INFO line. The watcher only replaces a file that the output's manifest says it made. For files older than 0.6.1, or after the manifest was deleted, remove the old copies by hand or start once with `force_reencode: true`.
|
|
24
|
+
|
|
25
|
+
## [0.7.2] - 2026-10-21
|
|
26
|
+
|
|
27
|
+
### Security
|
|
28
|
+
|
|
29
|
+
- The image no longer trusts the eight eMudhra (emSign) intermediates whose private keys leaked in October 2026: certifi goes to 2026.10.19 and the system `ca-certificates` to the trixie-security release that distrusts them. Before, a certificate minted with those keys for any site was accepted, lyrics lookups included.
|
|
30
|
+
|
|
5
31
|
## [0.7.1] - 2026-10-07
|
|
6
32
|
|
|
7
33
|
### Fixed
|
|
@@ -72,6 +98,8 @@ All notable changes to this project are documented here. The format follows [Kee
|
|
|
72
98
|
- Lossy copies are written through a temp file and renamed, like encodes, so a half-written copy is never visible.
|
|
73
99
|
- `force_reencode: true` purges the outputs once at startup. It used to purge them again on every periodic sync, which re-encoded the whole library every five minutes.
|
|
74
100
|
|
|
101
|
+
[0.8.0]: https://github.com/GeiserX/audio-transcode-watcher/releases/tag/v0.8.0
|
|
102
|
+
[0.7.2]: https://github.com/GeiserX/audio-transcode-watcher/releases/tag/v0.7.2
|
|
75
103
|
[0.7.1]: https://github.com/GeiserX/audio-transcode-watcher/releases/tag/v0.7.1
|
|
76
104
|
[0.7.0]: https://github.com/GeiserX/audio-transcode-watcher/releases/tag/v0.7.0
|
|
77
105
|
[0.6.2]: https://github.com/GeiserX/audio-transcode-watcher/releases/tag/v0.6.2
|
|
@@ -41,7 +41,7 @@ docker-compose up -d
|
|
|
41
41
|
- Safety guards prevent accidental mass deletion if folders appear empty
|
|
42
42
|
- Configuration via YAML file, not environment variables
|
|
43
43
|
|
|
44
|
-
*Generated by [LynxPrompt](https://lynxprompt.
|
|
44
|
+
*Generated by [LynxPrompt](https://lynxprompt.geiser.cloud) CLI*
|
|
45
45
|
|
|
46
46
|
<!-- BEGIN BEADS INTEGRATION v:1 profile:minimal hash:6cd5cc61 -->
|
|
47
47
|
## Beads Issue Tracker
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
FROM python:3.
|
|
1
|
+
FROM python:3.15-slim
|
|
2
2
|
|
|
3
|
-
# Install FFmpeg for transcoding
|
|
3
|
+
# Install FFmpeg for transcoding. The base image's ca-certificates 20250419 still
|
|
4
|
+
# trusts the compromised eMudhra intermediates; trixie-security distrusts them.
|
|
4
5
|
RUN apt-get update && apt-get install -y --no-install-recommends ffmpeg \
|
|
6
|
+
&& apt-get install -y --only-upgrade ca-certificates \
|
|
5
7
|
&& rm -rf /var/lib/apt/lists/*
|
|
6
8
|
|
|
7
9
|
# Set working directory
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: audio-transcode-watcher
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.8.0
|
|
4
4
|
Summary: Watch a source folder and automatically transcode audio files to multiple formats
|
|
5
5
|
Project-URL: Homepage, https://github.com/GeiserX/audio-transcode-watcher
|
|
6
6
|
Project-URL: Repository, https://github.com/GeiserX/audio-transcode-watcher
|
|
@@ -27,6 +27,7 @@ Provides-Extra: dev
|
|
|
27
27
|
Requires-Dist: pytest-cov>=4.0.0; extra == 'dev'
|
|
28
28
|
Requires-Dist: pytest-mock>=3.12.0; extra == 'dev'
|
|
29
29
|
Requires-Dist: pytest>=8.0.0; extra == 'dev'
|
|
30
|
+
Requires-Dist: ruff==0.17.6; extra == 'dev'
|
|
30
31
|
Description-Content-Type: text/markdown
|
|
31
32
|
|
|
32
33
|
<p align="center">
|
|
@@ -51,7 +52,8 @@ Keep one library in several formats: lossless for the archive, lossy for phones
|
|
|
51
52
|
- Watches the source folder and reacts to new, changed, renamed and deleted files.
|
|
52
53
|
- Writes any number of outputs in one pass, in ALAC, AAC, MP3, Opus, FLAC or WAV at the bitrate you pick.
|
|
53
54
|
- Mirrors the Artist/Album folder tree in every output.
|
|
54
|
-
-
|
|
55
|
+
- Starts from any format: FLAC, ALAC, WAV, AIFF and the other lossless formats, or lossy files. `source.formats` picks which ones to process.
|
|
56
|
+
- Copies lossy sources (MP3, AAC, Ogg, Opus, WMA) unchanged instead of inflating them into a lossless output.
|
|
55
57
|
- Fails loudly on a source that does not decode cleanly, and writes no output for it.
|
|
56
58
|
- Keeps ReplayGain, MusicBrainz ids, ISRC, label and sort tags in ALAC and AAC copies.
|
|
57
59
|
- Optionally measures every file and writes ReplayGain 2.0 track gain into the source and every output, so the whole library plays at one volume.
|
|
@@ -67,7 +69,7 @@ Keep one library in several formats: lossless for the archive, lossy for phones
|
|
|
67
69
|
curl -fsSL -o config.yaml https://raw.githubusercontent.com/GeiserX/audio-transcode-watcher/main/config.example.yaml
|
|
68
70
|
docker run -d --name audio_transcoder -e CONFIG_FILE=/app/config.yaml \
|
|
69
71
|
-v ./config.yaml:/app/config.yaml:ro -v /path/to/flac:/music/flac:ro -v /path/to/mp3:/music/mp3 \
|
|
70
|
-
drumsergio/audio-transcoder:0.
|
|
72
|
+
drumsergio/audio-transcoder:0.8.0
|
|
71
73
|
```
|
|
72
74
|
|
|
73
75
|
Edit `config.yaml` first so its outputs match the folders you mount; the example writes ALAC, MP3 and AAC. [Getting started](https://github.com/GeiserX/audio-transcode-watcher/blob/main/docs/getting-started.md) has Docker Compose and the full `docker run`.
|
|
@@ -20,7 +20,8 @@ Keep one library in several formats: lossless for the archive, lossy for phones
|
|
|
20
20
|
- Watches the source folder and reacts to new, changed, renamed and deleted files.
|
|
21
21
|
- Writes any number of outputs in one pass, in ALAC, AAC, MP3, Opus, FLAC or WAV at the bitrate you pick.
|
|
22
22
|
- Mirrors the Artist/Album folder tree in every output.
|
|
23
|
-
-
|
|
23
|
+
- Starts from any format: FLAC, ALAC, WAV, AIFF and the other lossless formats, or lossy files. `source.formats` picks which ones to process.
|
|
24
|
+
- Copies lossy sources (MP3, AAC, Ogg, Opus, WMA) unchanged instead of inflating them into a lossless output.
|
|
24
25
|
- Fails loudly on a source that does not decode cleanly, and writes no output for it.
|
|
25
26
|
- Keeps ReplayGain, MusicBrainz ids, ISRC, label and sort tags in ALAC and AAC copies.
|
|
26
27
|
- Optionally measures every file and writes ReplayGain 2.0 track gain into the source and every output, so the whole library plays at one volume.
|
|
@@ -36,7 +37,7 @@ Keep one library in several formats: lossless for the archive, lossy for phones
|
|
|
36
37
|
curl -fsSL -o config.yaml https://raw.githubusercontent.com/GeiserX/audio-transcode-watcher/main/config.example.yaml
|
|
37
38
|
docker run -d --name audio_transcoder -e CONFIG_FILE=/app/config.yaml \
|
|
38
39
|
-v ./config.yaml:/app/config.yaml:ro -v /path/to/flac:/music/flac:ro -v /path/to/mp3:/music/mp3 \
|
|
39
|
-
drumsergio/audio-transcoder:0.
|
|
40
|
+
drumsergio/audio-transcoder:0.8.0
|
|
40
41
|
```
|
|
41
42
|
|
|
42
43
|
Edit `config.yaml` first so its outputs match the folders you mount; the example writes ALAC, MP3 and AAC. [Getting started](https://github.com/GeiserX/audio-transcode-watcher/blob/main/docs/getting-started.md) has Docker Compose and the full `docker run`.
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Audio Transcode Watcher Configuration (0.
|
|
1
|
+
# Audio Transcode Watcher Configuration (0.8.0)
|
|
2
2
|
# ======================================
|
|
3
3
|
#
|
|
4
4
|
# This configuration file defines the source folder and output destinations
|
|
@@ -6,12 +6,17 @@
|
|
|
6
6
|
#
|
|
7
7
|
# Mount this file into the container and set CONFIG_FILE=/app/config.yaml
|
|
8
8
|
|
|
9
|
-
# Source folder containing original audio files (FLAC, WAV, etc.)
|
|
10
|
-
# Lossy sources (mp3,
|
|
9
|
+
# Source folder containing original audio files (FLAC, ALAC, WAV, etc.)
|
|
10
|
+
# Lossy sources (mp3, aac, ogg, opus, wma) are copied unchanged into
|
|
11
11
|
# lossless outputs, and into lossy outputs of the same codec; they are only
|
|
12
|
-
# transcoded into a lossy output of another codec.
|
|
12
|
+
# transcoded into a lossy output of another codec. An .m4a file is probed:
|
|
13
|
+
# ALAC counts as lossless and is encoded like FLAC, AAC counts as lossy.
|
|
13
14
|
source:
|
|
14
15
|
path: /music/flac
|
|
16
|
+
# Source formats to process (default: all of them). Files in other formats
|
|
17
|
+
# are treated as absent, like ignored_files. Names: flac, alac, wav, aiff,
|
|
18
|
+
# ape, wavpack, tta, tak, mp3, aac, vorbis, opus, wma
|
|
19
|
+
# formats: [flac, alac]
|
|
15
20
|
|
|
16
21
|
# Output destinations - define as many as you need
|
|
17
22
|
outputs:
|
|
@@ -65,6 +70,14 @@ settings:
|
|
|
65
70
|
# Fetch synced .lrc lyrics online; nothing is written when none are found
|
|
66
71
|
fetch_lyrics: true
|
|
67
72
|
|
|
73
|
+
# Paths inside the source folder to treat as absent (default: none), e.g.
|
|
74
|
+
# a sync tool's version folder. Each folder or file name can be a pattern
|
|
75
|
+
# (* ? [..]); a leading **/ matches at any depth. Outputs whose only source
|
|
76
|
+
# is ignored are removed as orphans, and come back if the entry goes.
|
|
77
|
+
# ignored_files:
|
|
78
|
+
# - "**/.stversions"
|
|
79
|
+
# - "**/*.wav"
|
|
80
|
+
|
|
68
81
|
# Seconds between periodic full syncs (default: 300)
|
|
69
82
|
sync_interval_seconds: 300
|
|
70
83
|
|
|
@@ -8,6 +8,8 @@ Configuration is provided via a YAML file. Set the `CONFIG_FILE` environment var
|
|
|
8
8
|
# Source folder containing original audio files
|
|
9
9
|
source:
|
|
10
10
|
path: /music/flac
|
|
11
|
+
# Source formats to process (default: all of them). See below.
|
|
12
|
+
# formats: [flac, alac, wav]
|
|
11
13
|
|
|
12
14
|
# Output destinations -- define as many as you need
|
|
13
15
|
outputs:
|
|
@@ -61,6 +63,11 @@ settings:
|
|
|
61
63
|
# Auto-fetch synced .lrc lyrics (default: true)
|
|
62
64
|
fetch_lyrics: true
|
|
63
65
|
|
|
66
|
+
# Paths inside the source folder to skip, with * ? [..] and ** patterns
|
|
67
|
+
# (default: none). See below.
|
|
68
|
+
ignored_files:
|
|
69
|
+
- "**/.stversions"
|
|
70
|
+
|
|
64
71
|
# Seconds between periodic full syncs (default: 300)
|
|
65
72
|
sync_interval_seconds: 300
|
|
66
73
|
|
|
@@ -69,6 +76,30 @@ settings:
|
|
|
69
76
|
corrupt_source: skip
|
|
70
77
|
```
|
|
71
78
|
|
|
79
|
+
### Ignored paths
|
|
80
|
+
|
|
81
|
+
`ignored_files` lists folders and files that the watcher treats as if they were not in the source folder. They get no encode, no copy, no ReplayGain tag, no lyrics and no sidecar copy. One use is the version folder of a sync tool, such as Syncthing's `.stversions/`, which keeps old copies of files inside the library.
|
|
82
|
+
|
|
83
|
+
```yaml
|
|
84
|
+
settings:
|
|
85
|
+
ignored_files:
|
|
86
|
+
- ".stversions/" # this folder, at the top of the source
|
|
87
|
+
- "**/.stversions" # a folder with this name at any depth
|
|
88
|
+
- "**/*.wav" # every WAV file
|
|
89
|
+
- "*/Live" # a Live folder one level down, like Artist/Live
|
|
90
|
+
- "Artist/Album/03.flac" # one file
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- Each entry is a path relative to `source.path`. It is compared with each path one folder or file name at a time, and it matches whole names: `.stversions` means that folder and everything in it, but not `.stversions-old/`.
|
|
94
|
+
- A name in an entry can be a pattern: `*` matches any run of characters, `?` matches one character and `[...]` matches one character from the set, as in Python's `fnmatch`. Matching is case-sensitive, so `*.wav` does not match `TAKE.WAV`. A name that is exactly equal always matches, so `Live [1999]` still means that folder.
|
|
95
|
+
- `**` matches any number of folders, or none. An entry that starts with `**/` matches at any depth. Any other entry starts at the top of the source, so `.stversions` does not match `Artist/.stversions/`.
|
|
96
|
+
- A sync does not read ignored folders at all. A file moved into an ignored folder counts as deleted, and a file moved out of one counts as new.
|
|
97
|
+
- An ignored lossless file no longer wins over a lossy file with the same name. With `**/*.flac`, `Song.mp3` next to `Song.flac` gets its own outputs. An output that `Song.flac` made under the shared name, such as `Song.m4a` in an AAC output, is made again from `Song.mp3`. Remove the entry, and `Song.flac` wins again.
|
|
98
|
+
- Outputs are derived data. The next full sync removes outputs and `.lrc` copies whose only source is ignored, like any other orphan. This also cleans up files that got into the outputs before you added the entry. Remove the entry, and the next sync makes them again.
|
|
99
|
+
- If no audio file in the source is left after the entries apply, the source counts as empty. The safety guard stops the sync, logs a WARNING that names `ignored_files`, and removes nothing.
|
|
100
|
+
- Each full sync logs one INFO line with the number of ignored folders it did not read and the number of other ignored audio files it skipped.
|
|
101
|
+
- The value must be a list. A plain string, an empty entry, `/`, `**` or an entry with a `..` part stops the watcher at startup with an error.
|
|
102
|
+
|
|
72
103
|
### Damaged sources
|
|
73
104
|
|
|
74
105
|
A source that fails the strict decode (see [Corrupt sources](how-it-works.md#corrupt-sources)) is handled by `corrupt_source`:
|
|
@@ -114,18 +145,49 @@ Writing the tags changes the source file's size and modification time. The watch
|
|
|
114
145
|
|
|
115
146
|
`whisper_fallback` and `whisper_model` were removed in 0.6.0 along with the Whisper lyrics fallback. A config that still sets them loads, and the first load logs one warning that they are ignored.
|
|
116
147
|
|
|
117
|
-
##
|
|
148
|
+
## Start from any format
|
|
149
|
+
|
|
150
|
+
The source folder can hold any of these formats, mixed. `source.formats` lists the ones to process. Leave it out and every format is processed.
|
|
151
|
+
|
|
152
|
+
| Name | Kind | Extensions |
|
|
153
|
+
|-----------|----------|------------------|
|
|
154
|
+
| `flac` | Lossless | `.flac` |
|
|
155
|
+
| `alac` | Lossless | `.m4a` `.alac` |
|
|
156
|
+
| `wav` | Lossless | `.wav` |
|
|
157
|
+
| `aiff` | Lossless | `.aiff` `.aif` |
|
|
158
|
+
| `ape` | Lossless | `.ape` |
|
|
159
|
+
| `wavpack` | Lossless | `.wv` |
|
|
160
|
+
| `tta` | Lossless | `.tta` |
|
|
161
|
+
| `tak` | Lossless | `.tak` |
|
|
162
|
+
| `mp3` | Lossy | `.mp3` |
|
|
163
|
+
| `aac` | Lossy | `.m4a` `.aac` |
|
|
164
|
+
| `vorbis` | Lossy | `.ogg` |
|
|
165
|
+
| `opus` | Lossy | `.opus` |
|
|
166
|
+
| `wma` | Lossy | `.wma` |
|
|
167
|
+
|
|
168
|
+
An `.m4a` file holds either ALAC or AAC. The watcher asks `ffprobe` which one. It asks once per file, and again only when the file's size or modification time changes. If `ffprobe` cannot read the file, the watcher logs one WARNING and treats the file as AAC.
|
|
169
|
+
|
|
170
|
+
For example, to use an ALAC library as the source and leave its few AAC files alone:
|
|
171
|
+
|
|
172
|
+
```yaml
|
|
173
|
+
source:
|
|
174
|
+
path: /music/apple-lossless
|
|
175
|
+
formats: [alac]
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
- A file whose format is not in the list is treated like a path in [`ignored_files`](#ignored-paths). It gets no encode, no copy, no ReplayGain tag, no lyrics and no sidecar copy, and file events for it do nothing. The next full sync removes outputs whose only source it was, like any other orphan.
|
|
179
|
+
- A lossless file left out of the list no longer wins over a lossy file with the same name. With `formats: [mp3]`, `Song.mp3` next to `Song.flac` gets its own outputs.
|
|
180
|
+
- If no file in a listed format is left, the source counts as empty. The safety guard stops the sync, logs a WARNING that names `source.formats`, and removes nothing.
|
|
181
|
+
- Each full sync logs one INFO line with the number of audio files it skipped. When `source.formats` leaves something out, the startup log shows the list.
|
|
182
|
+
- Names are not case-sensitive. An unknown name, an empty list or a value that is not a list stops the watcher at startup with an error that lists the valid names.
|
|
118
183
|
|
|
119
|
-
|
|
120
|
-
|----------|--------------------------------------------------------------------|
|
|
121
|
-
| Lossless | `.flac` `.alac` `.wav` `.aiff` `.aif` `.ape` `.wv` `.tta` `.tak` |
|
|
122
|
-
| Lossy | `.mp3` `.aac` `.m4a` `.ogg` `.opus` `.wma` |
|
|
184
|
+
### Lossless and lossy sources
|
|
123
185
|
|
|
124
|
-
A lossless source is encoded to every output.
|
|
186
|
+
A lossless source is encoded to every output. That includes an ALAC source: it is encoded into an AAC, MP3 or Opus output, and into a FLAC or WAV output. Into an ALAC output it is encoded too, the same way a FLAC source is encoded into a FLAC output. The audio comes out bit for bit the same, and the encode checks that the source decodes cleanly. The ReplayGain, MusicBrainz and other tags in the source's M4A atoms are carried into ALAC and AAC outputs (see [Tags in ALAC and AAC outputs](#tags-in-alac-and-aac-outputs)).
|
|
125
187
|
|
|
126
|
-
A lossy source is never encoded into a lossless output, because that only makes a big file that looks lossless. It is copied there unchanged, with its own extension, so an ALAC folder can hold `.m4a` encodes next to `.mp3` or `.ogg` copies. Into a lossy output it is copied unchanged when it already has that output's codec (`.mp3` into `mp3`, `.m4a` or `.aac` into `aac`, `.opus` into `opus`) and transcoded otherwise. Copies keep their tags and cover as they are.
|
|
188
|
+
A lossy source is never encoded into a lossless output, because that only makes a big file that looks lossless. It is copied there unchanged, with its own extension, so an ALAC folder can hold `.m4a` encodes next to `.mp3` or `.ogg` copies. Into a lossy output it is copied unchanged when it already has that output's codec (`.mp3` into `mp3`, an AAC `.m4a` or an `.aac` into `aac`, `.opus` into `opus`) and transcoded otherwise. Copies keep their tags and cover as they are.
|
|
127
189
|
|
|
128
|
-
When a lossless and a lossy file share a name in the source folder, the lossless one is used for every output. If the lossy file came first and was already copied or transcoded, that file is replaced by an encode of the lossless one as soon as it is processed. To tell those files apart, each output folder keeps a hidden `.atw-manifest.json` recording which source made each file and whether it was an encode, a copy or a transcode. Deleting it is safe: files it does not know about are treated as they were before 0.6.1.
|
|
190
|
+
When a lossless and a lossy file share a name in the source folder, the lossless one is used for every output. If the lossy file came first and was already copied or transcoded, that file is replaced by an encode of the lossless one as soon as it is processed. When an ALAC `.m4a` shares a name with a FLAC or another lossless file that has its own extension, that other file is used, because the ALAC file is usually a copy of it. This also holds when the FLAC arrives after the ALAC file was encoded: its encode replaces the ALAC one. To tell those files apart, each output folder keeps a hidden `.atw-manifest.json` recording which source made each file and whether it was an encode, a copy or a transcode. Deleting it is safe: files it does not know about are treated as they were before 0.6.1.
|
|
129
191
|
|
|
130
192
|
## Portable limits (channels and sample rate)
|
|
131
193
|
|
|
@@ -152,7 +214,7 @@ docker exec audio_transcoder find /music/aac -name '*.m4a' -exec sh -c 'ffprobe
|
|
|
152
214
|
|
|
153
215
|
## Tags in ALAC and AAC outputs
|
|
154
216
|
|
|
155
|
-
FFmpeg writes the standard MP4 atoms (title, artist, album and so on). After an ALAC or AAC encode, the tags FFmpeg drops are copied from the source under the names MusicBrainz Picard uses, so Picard, TagLib (Navidrome, Jellyfin), foobar2000 and iTunes all read them:
|
|
217
|
+
FFmpeg writes the standard MP4 atoms (title, artist, album and so on). After an ALAC or AAC encode, the tags FFmpeg drops are copied from the source under the names MusicBrainz Picard uses, also when the source is an M4A file that already has them, so Picard, TagLib (Navidrome, Jellyfin), foobar2000 and iTunes all read them:
|
|
156
218
|
|
|
157
219
|
| Source tag | MP4 atom |
|
|
158
220
|
|----------------------------------------------|-------------------------------------------------------|
|
|
@@ -29,7 +29,7 @@ outputs:
|
|
|
29
29
|
```yaml
|
|
30
30
|
services:
|
|
31
31
|
audio-transcoder:
|
|
32
|
-
image: drumsergio/audio-transcoder:0.
|
|
32
|
+
image: drumsergio/audio-transcoder:0.8.0
|
|
33
33
|
container_name: audio_transcoder
|
|
34
34
|
environment:
|
|
35
35
|
- TZ=Europe/Madrid
|
|
@@ -60,6 +60,6 @@ docker run -d \
|
|
|
60
60
|
-v /path/to/flac:/music/flac:ro \
|
|
61
61
|
-v /path/to/mp3:/music/mp3 \
|
|
62
62
|
--restart unless-stopped \
|
|
63
|
-
drumsergio/audio-transcoder:0.
|
|
63
|
+
drumsergio/audio-transcoder:0.8.0
|
|
64
64
|
```
|
|
65
65
|
|
|
@@ -6,10 +6,10 @@
|
|
|
6
6
|
- **Modified files** are re-encoded to all outputs
|
|
7
7
|
- **Renamed files** trigger deletion of old outputs and creation of new ones
|
|
8
8
|
- **Deleted files** have their corresponding outputs removed
|
|
9
|
-
3. **Orphan cleanup** -- Removes output files that no longer have a matching source. It reads the source folder again just before, and skips any file younger than 120 seconds or whose source is being processed, so a file that arrives during a long sync keeps its output.
|
|
9
|
+
3. **Orphan cleanup** -- Removes output files that no longer have a matching source. It reads the source folder again just before, and skips any file younger than 120 seconds or whose source is being processed, so a file that arrives during a long sync keeps its output. Paths listed in [`ignored_files`](configuration.md#ignored-paths) count as absent: the scan does not enter ignored folders, and outputs whose only source is ignored are removed.
|
|
10
10
|
4. **Lyrics sync** -- Fetches synced `.lrc` lyrics from online databases (LRCLIB and the other syncedlyrics providers). When nothing usable comes back, no file is written. A result made of one repeated token, with fewer than 4 timed lines, or with only an advertisement line is rejected and the reason is logged. The `.lrc` gets the source file's owner and mode 0664.
|
|
11
11
|
|
|
12
|
-
Lossy sources are copied rather than encoded where that keeps quality honest; see [
|
|
12
|
+
Lossy sources are copied rather than encoded where that keeps quality honest, and an ALAC `.m4a` counts as lossless; see [Start from any format](configuration.md#start-from-any-format). `source.formats` limits which formats are processed; a file in a format it leaves out counts as absent, like an ignored path.
|
|
13
13
|
|
|
14
14
|
## Provenance manifest
|
|
15
15
|
|
|
@@ -47,7 +47,7 @@ When source files or directories are deleted, the corresponding outputs and empt
|
|
|
47
47
|
|
|
48
48
|
The service includes multiple guards to prevent data loss:
|
|
49
49
|
|
|
50
|
-
- If the source folder appears empty, no deletions are performed
|
|
50
|
+
- If the source folder appears empty, no deletions are performed. A source whose audio files all match `ignored_files` counts as empty
|
|
51
51
|
- If any output folder appears empty, no deletions are performed
|
|
52
52
|
- All writes are atomic -- encoding and copying happen to a `.tmp__ff` file that is moved into place only on success
|
|
53
53
|
- Cleanup leaves `.tmp__ff` files younger than 10 minutes alone, since they may belong to an encode still running
|
|
@@ -5,7 +5,7 @@ build-backend = "hatchling.build"
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "audio-transcode-watcher"
|
|
7
7
|
|
|
8
|
-
version = "0.
|
|
8
|
+
version = "0.8.0"
|
|
9
9
|
|
|
10
10
|
description = "Watch a source folder and automatically transcode audio files to multiple formats"
|
|
11
11
|
readme = "README.md"
|
|
@@ -40,6 +40,8 @@ dev = [
|
|
|
40
40
|
"pytest>=8.0.0",
|
|
41
41
|
"pytest-cov>=4.0.0",
|
|
42
42
|
"pytest-mock>=3.12.0",
|
|
43
|
+
# Pinned so CI and local runs lint with the same rules.
|
|
44
|
+
"ruff==0.17.6",
|
|
43
45
|
]
|
|
44
46
|
|
|
45
47
|
[project.scripts]
|
|
@@ -11,6 +11,8 @@ from typing import Any
|
|
|
11
11
|
|
|
12
12
|
import yaml
|
|
13
13
|
|
|
14
|
+
from .utils import SOURCE_FORMATS, ignore_entry_parts
|
|
15
|
+
|
|
14
16
|
logger = logging.getLogger(__name__)
|
|
15
17
|
|
|
16
18
|
# Settings that older releases read and this one ignores. A config that
|
|
@@ -135,11 +137,14 @@ class Config:
|
|
|
135
137
|
|
|
136
138
|
source_path: str
|
|
137
139
|
outputs: list[OutputConfig] = field(default_factory=list)
|
|
140
|
+
# source.formats: the source formats to process (default: all of them)
|
|
141
|
+
source_formats: frozenset[str] = frozenset(SOURCE_FORMATS)
|
|
138
142
|
force_reencode: bool = False
|
|
139
143
|
allow_initial_bulk_encode: bool = True # Allow encoding when outputs are empty
|
|
140
144
|
parallel_workers: int = 4 # Number of parallel encoding workers
|
|
141
145
|
stability_timeout: float = 60.0
|
|
142
146
|
min_stable_seconds: float = 1.0
|
|
147
|
+
ignored_files: list[str] = field(default_factory=list)
|
|
143
148
|
fetch_lyrics: bool = True # Auto-fetch .lrc lyrics via syncedlyrics
|
|
144
149
|
sync_interval_seconds: int = 300 # Seconds between periodic full syncs
|
|
145
150
|
corrupt_source: str = "skip" # Default for outputs that don't set it
|
|
@@ -164,6 +169,21 @@ class Config:
|
|
|
164
169
|
):
|
|
165
170
|
raise ValueError("sync_interval_seconds must be a number greater than 0")
|
|
166
171
|
|
|
172
|
+
# "ignored_files:" with no items loads as None.
|
|
173
|
+
if self.ignored_files is None:
|
|
174
|
+
self.ignored_files = []
|
|
175
|
+
# A plain string would be read one character at a time, an empty,
|
|
176
|
+
# "/" or "**" item would match every file, and ".." points outside
|
|
177
|
+
# the source folder, so all of them are refused here.
|
|
178
|
+
if not isinstance(self.ignored_files, list) or not all(
|
|
179
|
+
isinstance(p, str) and _valid_ignore_entry(p) for p in self.ignored_files
|
|
180
|
+
):
|
|
181
|
+
raise ValueError(
|
|
182
|
+
"settings.ignored_files must be a list of paths inside the source folder"
|
|
183
|
+
)
|
|
184
|
+
|
|
185
|
+
self.source_formats = _check_source_formats(self.source_formats)
|
|
186
|
+
|
|
167
187
|
if not self.outputs:
|
|
168
188
|
raise ValueError("At least one output is required")
|
|
169
189
|
|
|
@@ -177,6 +197,16 @@ class Config:
|
|
|
177
197
|
if len(paths) != len(set(paths)):
|
|
178
198
|
raise ValueError("Duplicate output paths detected")
|
|
179
199
|
|
|
200
|
+
@property
|
|
201
|
+
def formats_restricted(self) -> bool:
|
|
202
|
+
"""True if source.formats leaves out at least one source format."""
|
|
203
|
+
return self.source_formats != frozenset(SOURCE_FORMATS)
|
|
204
|
+
|
|
205
|
+
@property
|
|
206
|
+
def filters_sources(self) -> bool:
|
|
207
|
+
"""True if ignored_files or source.formats keeps any source out."""
|
|
208
|
+
return bool(self.ignored_files) or self.formats_restricted
|
|
209
|
+
|
|
180
210
|
@property
|
|
181
211
|
def output_paths(self) -> list[str]:
|
|
182
212
|
"""Get list of all output directory paths."""
|
|
@@ -199,15 +229,21 @@ class Config:
|
|
|
199
229
|
outputs = [OutputConfig.from_dict(o) for o in data.get("outputs", [])]
|
|
200
230
|
settings = data.get("settings", {})
|
|
201
231
|
_warn_deprecated_settings(settings)
|
|
232
|
+
source = data.get("source", {})
|
|
233
|
+
# Only a key that is present is checked, so "formats:" with no
|
|
234
|
+
# items (None) is refused instead of meaning "all".
|
|
235
|
+
formats = {"source_formats": source["formats"]} if "formats" in source else {}
|
|
202
236
|
|
|
203
237
|
return cls(
|
|
204
|
-
source_path=
|
|
238
|
+
source_path=source.get("path", ""),
|
|
205
239
|
outputs=outputs,
|
|
240
|
+
**formats,
|
|
206
241
|
force_reencode=settings.get("force_reencode", False),
|
|
207
242
|
allow_initial_bulk_encode=settings.get("allow_initial_bulk_encode", True),
|
|
208
243
|
parallel_workers=settings.get("parallel_workers", 4),
|
|
209
244
|
stability_timeout=settings.get("stability_timeout", 60.0),
|
|
210
245
|
min_stable_seconds=settings.get("min_stable_seconds", 1.0),
|
|
246
|
+
ignored_files=settings.get("ignored_files", []),
|
|
211
247
|
fetch_lyrics=settings.get("fetch_lyrics", True),
|
|
212
248
|
sync_interval_seconds=settings.get("sync_interval_seconds", 300),
|
|
213
249
|
corrupt_source=settings.get("corrupt_source", "skip"),
|
|
@@ -230,6 +266,29 @@ class Config:
|
|
|
230
266
|
return cls.from_dict(data)
|
|
231
267
|
|
|
232
268
|
|
|
269
|
+
def _check_source_formats(value: Any) -> frozenset[str]:
|
|
270
|
+
"""Return source.formats as a set of names, or raise naming the valid ones."""
|
|
271
|
+
if isinstance(value, frozenset):
|
|
272
|
+
names = value
|
|
273
|
+
elif isinstance(value, list) and all(isinstance(v, str) for v in value):
|
|
274
|
+
names = frozenset(v.strip().lower() for v in value)
|
|
275
|
+
else:
|
|
276
|
+
names = None
|
|
277
|
+
if not names or not names <= SOURCE_FORMATS.keys():
|
|
278
|
+
unknown = sorted(names - SOURCE_FORMATS.keys()) if names else []
|
|
279
|
+
problem = f" Unknown: {', '.join(unknown)}." if unknown else ""
|
|
280
|
+
raise ValueError(
|
|
281
|
+
f"source.formats must be a non-empty list of format names.{problem}"
|
|
282
|
+
f" Valid: {', '.join(SOURCE_FORMATS)}"
|
|
283
|
+
)
|
|
284
|
+
return names
|
|
285
|
+
|
|
286
|
+
|
|
287
|
+
def _valid_ignore_entry(entry: str) -> bool:
|
|
288
|
+
parts = ignore_entry_parts(entry)
|
|
289
|
+
return bool(parts) and os.pardir not in parts and set(parts) != {"**"}
|
|
290
|
+
|
|
291
|
+
|
|
233
292
|
def _warn_deprecated_settings(settings: dict[str, Any]) -> None:
|
|
234
293
|
"""Log one warning per process for settings that are accepted but ignored."""
|
|
235
294
|
global _deprecation_warned
|
|
@@ -9,7 +9,7 @@ from collections.abc import Callable
|
|
|
9
9
|
|
|
10
10
|
import mutagen
|
|
11
11
|
from mutagen.apev2 import APETextValue
|
|
12
|
-
from mutagen.mp4 import MP4, MP4FreeForm
|
|
12
|
+
from mutagen.mp4 import MP4, AtomDataType, MP4FreeForm, MP4Tags
|
|
13
13
|
|
|
14
14
|
from .config import OutputConfig
|
|
15
15
|
from .utils import nfc_path
|
|
@@ -397,13 +397,23 @@ def _source_tag_values(source: str) -> dict[str, list[str]]:
|
|
|
397
397
|
|
|
398
398
|
Vorbis comments (FLAC, Ogg, Opus) and APEv2 (APE, WavPack, TAK) store
|
|
399
399
|
them under the same names; ID3 (WAV, AIFF, MP3) uses TXXX and a few
|
|
400
|
-
standard frames
|
|
400
|
+
standard frames; an M4A source (ALAC or AAC) already has the atoms,
|
|
401
|
+
which FFmpeg drops on the encode all the same.
|
|
401
402
|
"""
|
|
402
403
|
audio = mutagen.File(source)
|
|
403
404
|
if audio is None or audio.tags is None:
|
|
404
405
|
return {}
|
|
405
406
|
tags = audio.tags
|
|
406
407
|
|
|
408
|
+
if isinstance(tags, MP4Tags):
|
|
409
|
+
found: dict[str, list[str]] = {}
|
|
410
|
+
for name, atom in MP4_TAG_ATOMS.items():
|
|
411
|
+
values = [_mp4_text(v) for v in tags.get(atom, [])]
|
|
412
|
+
values = [v for v in values if v.strip()]
|
|
413
|
+
if values:
|
|
414
|
+
found[name] = values
|
|
415
|
+
return found
|
|
416
|
+
|
|
407
417
|
# Name -> values, with keys upper-cased for case-insensitive lookup.
|
|
408
418
|
plain: dict[str, list[str]] = {}
|
|
409
419
|
is_id3 = hasattr(tags, "getall")
|
|
@@ -438,6 +448,16 @@ def _source_tag_values(source: str) -> dict[str, list[str]]:
|
|
|
438
448
|
return out
|
|
439
449
|
|
|
440
450
|
|
|
451
|
+
def _mp4_text(value: object) -> str:
|
|
452
|
+
"""Text of an MP4 tag value: a freeform atom is UTF-8 or UTF-16BE bytes."""
|
|
453
|
+
if isinstance(value, MP4FreeForm):
|
|
454
|
+
utf16 = value.dataformat == AtomDataType.UTF16
|
|
455
|
+
return bytes(value).decode("utf-16-be" if utf16 else "utf-8", "replace")
|
|
456
|
+
if isinstance(value, bytes):
|
|
457
|
+
return value.decode("utf-8", "replace")
|
|
458
|
+
return str(value)
|
|
459
|
+
|
|
460
|
+
|
|
441
461
|
def copy_mp4_tags(source: str, dest: str) -> int:
|
|
442
462
|
"""
|
|
443
463
|
Copy the MP4_TAG_ATOMS tags from *source* into the MP4 file *dest*.
|
{audio_transcode_watcher-0.7.1 → audio_transcode_watcher-0.8.0}/src/audio_transcode_watcher/main.py
RENAMED
|
@@ -58,6 +58,8 @@ def main() -> int:
|
|
|
58
58
|
|
|
59
59
|
# Log configuration
|
|
60
60
|
logger.info("Source: %s", config.source_path)
|
|
61
|
+
if config.formats_restricted:
|
|
62
|
+
logger.info("Source formats: %s", ", ".join(sorted(config.source_formats)))
|
|
61
63
|
for output in config.outputs:
|
|
62
64
|
logger.info(
|
|
63
65
|
"Output: %s (%s%s) -> %s",
|