Skip to main content

Create a simple web page to listen to audio files in a directory

Project description

earworm

Create a simple web page to listen to audio files in a directory

Setup

The package is available on PyPI and you can install it using pip/conda.

pip install earworm

Usage

This 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.

  1. To get started create a sample config file:

    earworm make-config -c config.yml
    
  2. Change the value of music_dir to the directory where you have your music files. If you wish to use a CSV file for the metadata, add a metadata_csv entry to the config.

    metadata_csv: "/path/to/metadata.csv"
    
  3. You can generate a template for the metadata.csv from your music_dir by running earworm with the update-csv sub-command. Once the CSV file is generated, add a metadata_csv entry pointing to this file to your config.

  4. Run earworm to generate a directory called output with an index.html, music/ directory with all the music files that have "valid metadata", and a covers/ directory with the cover images for the albums.

  5. You can specify the <title> of the page by using the title config var

  6. If the base_url parameter is specified, an og:image tag is added to the page, using the latest song's cover image.

  7. Open the index.html in your browser to view the playlist locally.

  8. If you have access to a webserver, you can just sync the output directory to your webserver.

  9. 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.

  10. A new music file can be added to an existing music directory and site using the add-audio subcommand.

    earworm add-audio -c config.yml -i ~/Downloads/cover-image.jpg ~/Music/covers/song123.mp3
    

Dev Setup

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-file

JS toolchain

To 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.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

earworm-0.4.0.tar.gz (155.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

earworm-0.4.0-py3-none-any.whl (155.9 kB view details)

Uploaded Python 3

File details

Details for the file earworm-0.4.0.tar.gz.

File metadata

  • Download URL: earworm-0.4.0.tar.gz
  • Upload date:
  • Size: 155.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.19.0-29-generic

File hashes

Hashes for earworm-0.4.0.tar.gz
Algorithm Hash digest
SHA256 32c3c6d0e08a902adef9e7307f8c5b2da9c40b2a14c2346ad0cefd460f0da9b1
MD5 c3497440b55f1c5c60a12b2816cd6d10
BLAKE2b-256 db4b76a12f49c0a12b1ba40499ba1956d1b2c7c0bd2d0df7106b020f16e263fb

See more details on using hashes here.

File details

Details for the file earworm-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: earworm-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 155.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.4 Linux/5.19.0-29-generic

File hashes

Hashes for earworm-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f4485e79893d1094e51968c4185740c2c2cd6cdd13e3ed463ba9b43c75072b81
MD5 5e791b0b19484d5075fed891cce67451
BLAKE2b-256 5aec267d33d40a614580761b99f1a56c1f2dcd0886b6fc780959f955abef3db8

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page