Metadata-Version: 2.1
Name: earworm
Version: 0.3.2
Summary: Create a simple web page to listen to audio files in a directory
Home-page: https://punchagan.github.io/earworm/
Author: Puneeth Chaganti
Author-email: punchagan@muse-amuse.in
Requires-Python: >=3.6.1,<4.0.0
Classifier: Development Status :: 5 - Production/Stable
Classifier: Environment :: Console
Classifier: License :: OSI Approved :: GNU Affero General Public License v3
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Topic :: Multimedia :: Sound/Audio :: Players
Requires-Dist: Jinja2 (>=3.0.1,<4.0.0)
Requires-Dist: Pillow (>=8.2.0,<9.0.0)
Requires-Dist: PyYAML (>=5.4.1,<6.0.0)
Requires-Dist: dataclasses (>=0.8,<0.9); python_version >= "3.6" and python_version < "3.7"
Requires-Dist: feedgen (>=0.9.0,<0.10.0)
Requires-Dist: python-dateutil (>=2.8.1,<3.0.0)
Requires-Dist: requests (>=2.25.1,<3.0.0)
Requires-Dist: tinytag (>=1.5.0,<2.0.0)
Requires-Dist: webassets (>=2.0,<3.0)
Project-URL: Repository, https://github.com/punchagan/earworm/
Description-Content-Type: text/markdown

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

```sh
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:


   ```sh
   earworm make-config -c config.yml
   ```

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

   ```yaml
   metadata_csv: "/path/to/metadata.csv"
   ```

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

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

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

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

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

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

1. If you don't have access to a webserver you can use something like [Google
   Drive](https://web.archive.org/web/20201127203126/https://www.ampercent.com/host-static-websites-google-driv/11070/)
   or
   [Dropbox](https://web.archive.org/web/20210117032036/https://www.ampercent.com/host-static-website-dropbox-free-webhosting/6426/)
   to host this as a static website.

## 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`.

```sh
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`.

