flac2lib is a simple script I've made (and then expanded with like a milion random ideas) for myself for easier music library management, specifically batch converting flac files into mp3 with regard to my mp3 music library schema.
- Python 3
- Pydub (
pip install pydub
) - ffmpeg / libav (required by Pydub)
- PyYAML (
pip install PyYAML
) - opencv-python (
pip install opencv-python
)
Download the files
- Clone the repo:
git clone https://github.com/PokerFacowaty/flac2lib
- ... or simply download
flac2lib.py
andconfig.yaml
and store them in the same directory
- Open
config.yaml
- By default, the file will look like this:
# Docs: https://github.com/PokerFacowaty/flac2lib
flac_albums_dir:
dst_albums_dir:
entire: False
num_albums_to_show: 10
dir_name_prompts: True
latest: False
get_cover_art: True
default_cover_art_name: cover # copied straight to the album folder
cover_art_suffixes: ['jpg', 'png', 'jpeg']
destination_format: mp3
ffmpeg_params: -q:a 2
# For the MP3 preset, use the "ffmpeg option" table in this article
# of the ffmpeg docs:
# https://trac.ffmpeg.org/wiki/Encode/MP3
# Use for other formats accordingly.
Explanations for all config entries:
flac_albums_dir:
- the directory that contains album folders with flac filesdst_albums_dir:
- the destination directory for converted filesentire:
- convert entire albums without asking for a list of songs to be converted;False
by defaultnum_albums_to_show
- the amount of albums that should be listed when albums are presented to be chosen;10
by default, ignored whenentire:
is set toTrue
or the-e / --entire
option is useddir_name_prompts
- prompt about album/artist folder paths, uses ARTIST and ALBUM tags for dir and subdir without asking ifFalse
;True
by defaultlatest
- pick the most recently modified flac folder;False
by defaultget_cover_art
- copy the cover art;True
by defaultdefault_cover_art_name
- the default name for the main cover art without its suffix;cover
by defaultcover_art_suffixes
- a list of accepted covert art suffixes;['jpg', 'png', 'jpeg']
by defaultdestination_format
- the format that flacs will be converted toffmpeg_params
- additional ffmpeg parameters, the preset / bitrate for MP3 should be specified here;-q:a 2
(VB2) by default
To use flac2lib, simply start it when in the same directory:
python flac2lib.py
(or if you have Python 2 installed)
python3 flac2lib.py
-h, --help
- show help-c, --config <file>
- use a custom config file-e, --entire
- convert the entire directory-s, --source <dir>
- specify the source album directory-d, --destination <dir>
- specify the destination album directory-l, --latest
- only convert the most recently modified folder in the flac albums directory--skip-cover-art
- skip the process of copying covert art entirely--skip-dir-prompts
- skip prompts about album/artist folder paths, use ARTIST and ALBUM tags for dir and subdir without asking--compilation
- skip the prompt about whether a compilation tag should be added, mark the album as a compilation--not-compilation
- see above
- Fixing case-sensitivity for retrieving artist and album names from tags
- Showing covert art's size when listing
- Fixing main cover art for multi-CD albums (is copied to the main directory and therefore usually not found by players which are looking inside the final (ex.
Disc 1
directory)) - Warning about potential non-allowed characters in filepaths (especially with Windows in mind)
- An option to download cover art (MusicBrainz? covers.musichoarders.xyz?)
- Marking the album as a compilation
- Queueing files as to not wait for conversions