Create a simple web page to listen to audio files in a directory
The package is available on PyPI and you can install it using pip/conda.
pip install earwormThis tool can generate a simple HTML page from a directory of music files. The tool can read metadata from files directly (currently only supports MP3 files and ID3 tags). But, if you have files which are not MP3, you can use a CSV file with the metadata.
The CSV file must have the following columns filename and title, and
any additional ones you may want. A template can be generated using the tool --
see step 3 below.
-
To get started create a sample config file:
earworm make-config -c config.yml
-
Change the value of
music_dirto the directory where you have your music files. If you wish to use a CSV file for the metadata, add ametadata_csventry to the config.metadata_csv: "/path/to/metadata.csv"
-
You can generate a template for the
metadata.csvfrom yourmusic_dirby runningearwormwith theupdate-csvsub-command. Once the CSV file is generated, add ametadata_csventry pointing to this file to your config. -
Run
earwormto generate a directory calledoutputwith anindex.html,music/directory with all the music files that have "valid metadata", and acovers/directory with the cover images for the albums. -
You can specify the
<title>of the page by using thetitleconfig var -
If the
base_urlparameter is specified, anog:imagetag is added to the page, using the latest song's cover image. -
Open the
index.htmlin your browser to view the playlist locally. -
If you have access to a webserver, you can just sync the output directory to your webserver.
-
If you don't have access to a webserver you can use something like Google Drive or Dropbox to host this as a static website.
-
A new music file can be added to an existing music directory and site using the
add-audiosubcommand.earworm add-audio -c config.yml -i ~/Downloads/cover-image.jpg ~/Music/covers/song123.mp3
When working on the source (py/html/CSS/JS) of the site, you can automatically
generate the html each time you make any changes to the input files using
entr.
ls /path/to/config-file $(git ls-files) | entr earworm --config /path/to/config-fileTo change the JS files, you need to have rollup installed and you can run the
rollup watcher (rollup -w -c rollup.config.js) to build the bundle.js.