Update README

- Add intro
- Add setup instructions
- Remove obsolete dev notes
- Remove db queries (they're in the repo's livebook)
This commit is contained in:
Claudio Ortolina
2024-11-28 14:49:26 +00:00
parent 60fef06dc1
commit 7ffd0c375b
+19 -37
View File
@@ -1,48 +1,30 @@
# Music Library
Music Library is an application to manage a collection of music records in different physical formats.
## Features
- Import records from MusicBrainz, with optional override of specific pieces of data
- Manage a collection and a wishlist of records, with ways to quickly search and filter based on records' metadata
- Integration with Last.fm (display latest scrobbles, and where possible connect them with records in the collection or wishlist)
- Some basic stats
- All data stored in a single SQLite database for portability and ease of backup/restore
- Ideal for deployment on a server with limited resources (1CPU, 512MB RAM)
## Setup
To start your Phoenix server:
- Run `mix setup` to install and setup dependencies
- Setup necessary environment variables:
- `LAST_FM_USER`: the Last.fm username used to populate the Scrobble Activity
- `LAST_FM_API_KEY`: the Last.fm API key used to fetch the Scrobble Activity
If using `direnv`, one can create a `.envrc.local` file for configuration variables, and a `.secrets` file for secrets. Both are automatically sourced via the `.envrc` file in the repo.
- Start Phoenix endpoint with `mix phx.server` or inside IEx with `iex -S mix phx.server`
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser.
Now you can visit [`localhost:4000`](http://localhost:4000) from your browser. The default password for development is `change me`.
Ready to run in production? Please [check our deployment guides](https://hexdocs.pm/phoenix/deployment.html).
## Learn more
- Official website: <https://www.phoenixframework.org/>
- Guides: <https://hexdocs.pm/phoenix/overview.html>
- Docs: <https://hexdocs.pm/phoenix>
- Forum: <https://elixirforum.com/c/phoenix-forum>
- Source: <https://github.com/phoenixframework/phoenix>
## Dev Notes
### Search
- SQLite supports full-text search via the built-in FTS5 extension, which is enabled by default and loaded in the Elixir Driver.
The extension requires building a virtual table that holds the data to be searched. This seems to be akin to a materialized view.
- To have fuzzy search, another extension needs to be loaded.
[Exqlite](https://github.com/elixir-sqlite/exqlite?tab=readme-ov-file) recommends using [ExSqlean](https://github.com/mindreframer/ex_sqlean),
which in turn uses [Sqlean](https://github.com/mindreframer/sqlean), but the extension is NOT part of the ExSQlean set.
Need to investigate with forking and PR.
### Queries
- To get the count of records per genre:
```
select genre.value, count(genre.value) as c from records, json_each(records.genres) genre group by genre.value order by c desc;
```
- To get the count of records per artist:
```
select json_extract(artist.value, '$.name') AS name, count(1) as c from records, json_each(records.artists) artist group by name order by c desc;
```
Note that this query would fail to disambiguate artists with the same name - can be fixed by using the artist `musicbrainz_id`.
The application is setup for deployment on Fly.io.
### CI