Skip to content

Commit

Permalink
Update README.md and various docstrings
Browse files Browse the repository at this point in the history
  • Loading branch information
pawelad committed Nov 16, 2024
1 parent 3965ebc commit dd371e3
Show file tree
Hide file tree
Showing 3 changed files with 97 additions and 5 deletions.
84 changes: 83 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,81 @@
# music_snapshot
[![Package Version](https://img.shields.io/pypi/v/music_snapshot)][pypi music_snapshot]
[![Supported Python Versions](https://img.shields.io/pypi/pyversions/music_snapshot)][pypi music_snapshot]
[![Codecov](https://img.shields.io/codecov/c/github/pawelad/music_snapshot)][codecov music_snapshot]
[![License](https://img.shields.io/pypi/l/music_snapshot)][license]
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)][black]
[![py.typed](https://img.shields.io/badge/py-typed-FFD43B)][pep561]

Save a snapshot of your day as a Spotify playlist.

🚧 Work In Progress 🚧
<img></img>

## Installation
Since `music_snapshot` is a command line tool, the recommended installation method
is via [pipx]:

```console
$ pipx install music_snapshot
```

Of course, you can just install it directly from [PyPI] (ideally, inside a
[virtualenv]):

```console
$ python -m pip install music_snapshot
```

## Quick start

### Authentication
To use `music_snapshot` you need to authorize it with both Spotify and Last.fm.

To get Spotify client ID and secret, create an OAuth client in
[Spotify developer dashboard] (with the "Redirect URI" set to
`http://localhost:6600/music_snapshot`).

To get Last.fm API keys, you need create a [new Last.fm API account].

After obtaining all of the above, you need to run `music_snapshot authorize`
which will save your config data in `~/.music_snapshot` and allow you to create
new music snapshots with `music_snapshot create` subcommand.

### Usage
The default subcommand is `create`, which helps you create a new music snapshot
(Spotify playlist).

You can see all available subcommands and options by running `music_snapshot --help`:

```console
$ music_snapshot --help
Usage: music_snapshot [OPTIONS] COMMAND [ARGS]...
Save a snapshot of your day as a Spotify playlist.
Have you ever just let Spotify algorithm do its thing, keep going long after your
queue has finished and ended in a place you'd like to go back to? I'm here to help you
do just that.
A 'music snapshot' is a Spotify playlist that encapsulates a part of your music
playing history.
Unfortunately, because of Spotify API limitations (no accessible history of played
songs) the song history comes from your Last.fm account.
To use the app, you need to first create a new Spotify OAuth app in its developer
dashboard and get Last.fm API keys by creating a new API account. You can then use
those values in the authorize subcommand, which will also save the underlying data on
your disk.
╭─ Options ────────────────────────────────────────────────────────────────────────────╮
│ --version Show the version and exit. │
│ --help Show this message and exit. │
╰──────────────────────────────────────────────────────────────────────────────────────╯
╭─ Commands ───────────────────────────────────────────────────────────────────────────╮
│ authorize Authorize music_snapshot with Spotify and Last.fm. │
│ create Create a new music snapshot (Spotify playlist). │
╰──────────────────────────────────────────────────────────────────────────────────────╯
```

## Authors
Developed and maintained by [Paweł Adamczak][pawelad].
Expand All @@ -14,7 +88,15 @@ If you'd like to contribute, please take a look at the
Released under [Mozilla Public License 2.0][license].


[black]: https://github.com/psf/black
[codecov music_snapshot]: https://app.codecov.io/github/pawelad/music_snapshot
[contributing guide]: ./CONTRIBUTING.md
[github music_snapshot]: https://github.com/pawelad/music_snapshot
[license]: ./LICENSE
[new last.fm api account]: https://www.last.fm/api/account/create
[pawelad]: https://pawelad.me/
[pep561]: https://peps.python.org/pep-0561/
[pipx]: https://github.com/pypa/pipx
[pypi music_snapshot]: https://pypi.org/project/music_snapshot/
[spotify developer dashboard]: https://developer.spotify.com/dashboard
[virtualenv]: https://packaging.python.org/en/latest/guides/installing-using-pip-and-virtual-environments/
1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ dev = [

[project.urls]
Homepage = "https://music_snapshot.pawelad.dev/"
Documentation = "https://music_snapshot.readthedocs.io/"
GitHub = "https://github.com/pawelad/music_snapshot"
Issues = "https://github.com/pawelad/music_snapshot/issues"

Expand Down
17 changes: 14 additions & 3 deletions src/music_snapshot/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,15 @@ class MusicSnapshotContext:
def cli(ctx: click.Context) -> None:
"""Save a snapshot of your day as a Spotify playlist.
Because of Spotify API limitations (no accessible history of played songs) a
Last.fm account is required.
Have you ever just let Spotify algorithm do its thing, keep going long after
your queue has finished and ended in a place you'd like to go back to? I'm here
to help you do just that.
A 'music snapshot' is a Spotify playlist that encapsulates a part of your music
playing history.
Unfortunately, because of Spotify API limitations (no accessible history of
played songs) the song history comes from your Last.fm account.
To use the app, you need to first create a new Spotify OAuth app in its
[developer dashboard](https://developer.spotify.com/dashboard) and get Last.fm
Expand Down Expand Up @@ -235,7 +242,11 @@ def authorize(
@cli.command()
@click.pass_obj
def create(obj: MusicSnapshotContext) -> None:
"""Create a music snapshot."""
"""Create a new music snapshot (Spotify playlist).
A 'music snapshot' is a Spotify playlist that encapsulates a part of your music
playing history.
"""
now = datetime.now(UTC)
today = now.date()
page_size = 10
Expand Down

0 comments on commit dd371e3

Please sign in to comment.