v0.75.0: Preferences › General › Compress lossless imports to MP3

FLAC, WAV, AIFF and Apple Lossless files being imported are converted by
ffmpeg to an MP3 at 320/256/192/160/128 kbps (off by default) and the MP3
goes in the library, tags and cover art copied over. The original file is
only ever read. One song shows its progress in the status bar; more get a
window with a bar per song and Cancel / Done. Cancel takes back every song
the import added, finished ones included: the copies it made go to the
trash, and a file imported in place is never trashed.
This commit is contained in:
2026-10-21 22:28:49 -07:00
parent a43f0be9d8
commit fc1cd80d35
10 changed files with 1082 additions and 13 deletions
+21
View File
@@ -581,6 +581,27 @@ persistence) → GUI (Qt widgets that read the manager and connect to its signal
and hand over nothing. Every paste attempt is logged at INFO
(`lintunes.gui.info_dialog`), so it shows up in the journal.
- **`lintunes/importers/lossless.py`** + **`gui/compress_import.py`** —
Preferences › General › Importing, "Compress lossless imports to MP3"
(Round 106, a friend's request; **off by default**, pref
`import_compress` + `import_compress_kbps` ∈ 320/256/192/160/128). With it
on and a lossless file (FLAC/WAV/AIFF by suffix, `.m4a` only when its
codec is ALAC) in an import, `MainWindow.import_files` hands the **whole**
batch to `CompressImport` and returns `[]`: `CompressWorker` walks it in
order on a daemon thread (lossy files pass straight through, so a
playlist drop keeps its order), the `ffmpeg` CLI converts into a private
temp dir, tags and art are copied with mutagen (`copy_tags`, not
ffmpeg's mapping), and `file_importer.import_converted` *moves* the MP3
into the tree under the source's stem. **The source is only ever read.**
One file → the status-bar progress; more → `CompressProgress` (a bar per
song, Cancel/Done; closing while working only hides it). **Cancel takes
back every song the batch added, finished ones too**
(`LibraryManager.discard_imports`: the copies it made go to the trash, a
file imported in place from the music folder is never trashed). So the
batch's playlist inserts use `add_tracks_to_playlist(undoable=False)` —
an undo step left behind would put back ids Cancel removed. A lossless
file already in the library isn't converted again.
- **`lintunes/fingerprint.py`** — "Identify Track…": Chromaprint's `fpcalc`
CLI (detected with `shutil.which`, the `ffmpeg_available()` pattern — a
runtime tool, never a pip dep) fingerprints the file, and AcoustID's web API