Commit graph

17 commits

Author SHA1 Message Date
Danielle McLean 75206a97f1
Add extra for websockets support 2024-07-11 12:17:09 +10:00
Danielle McLean 60116fd616
Make PyObjC a Darwin-only dependency 2024-07-10 23:57:34 +10:00
Danielle McLean 00ba34bd0b
Refactor Cocoa stuff into a 'receiver'
The idea here is that there are other places that might want to know
what's playing, besides MPNowPlayingInfoCenter. For example, to expose
the now playing info to Übersicht efficiently, it needs to be available
from a web browser, ideally using WebSockets. So there could be a
receiver that runs a small WebSockets server and sends out now playing
info to anyone who connects.

Additionally, I hope to write receivers for MPRIS and for the System
Media Transport Controls on Windows, making mpd-now-playable equally
useful across all platforms.

None of this is implemented yet, of course, but I hope to get the
WebSockets receiver done pretty soon!

I'm going to keep the default behaviour unchanged. Unless you
explicitly configure different receivers in config.toml,
mpd-now-playable will just behave as an MPNowPlayingInfoCenter
integration as it's always done.
2024-07-09 12:52:49 +10:00
Danielle McLean 27d8c37139
Significantly overhaul configuration management
Everything now uses bog-standard Python dataclasses, with Pydantic
providing validation and type conversion through separate classes using
its type adapter feature. It's also possible to define your classes
using Pydantic's own model type directly, making the type adapter
unnecessary, but I didn't want to do things that way because no actual
validation is needed when constructing a Song instance for example.
Having Pydantic do its thing only on-demand was preferable.

I tried a number of validation libraries before settling on Pydantic for
this. It's not the fastest option out there (msgspec is I think), but it
makes adding support for third-party types like yarl.URL really easy, it
generates a nice clean JSON Schema which is easy enough to adjust to my
requirements through its GenerateJsonSchema hooks, and raw speed isn't
all that important anyway since this is a single-user desktop program
that reads its configuration file once on startup.

Also, MessagePack is now mandatory if you're caching to an external
service. It just didn't make a whole lot sense to explicitly install
mpd-now-playable's Redis or Memcached support and then use pickling with
them.

With all this fussing around done, I'm probably finally ready to
actually use that configuration file to configure new features! Yay!
2024-07-01 00:10:17 +10:00
Danielle McLean 3b7ddfa718
fix: handle missing environment variables more robustly 2024-06-28 14:14:24 +10:00
Danielle McLean fcf7254e64
Remove deprecated Ruff option from pyproject.toml 2024-06-23 17:32:29 +10:00
Danielle McLean 3cb5db7528
Add field descriptions to the config schema :) 2024-06-22 20:12:23 +10:00
Danielle McLean 8e982e8a6b
Fixups to placate Ruff linter 2024-06-22 18:39:10 +10:00
Danielle McLean dc037a0a4b
Support a TOML configuration file
The new config file currently only configures the same options that were
already available through environment variables. However I have ideas
for additional features that would be much nicer to support using a
structured configuration format like TOML rather than environment
variables, so config files exist now!

The previous environment variables are still supported and will be used
if you don't have a config file. I plan to keep supporting the MPD_HOST
and MPD_PORT environment variables forever since they're shared with
other MPD clients such as mpc, but I may eventually drop the environment
variables specific to mpd-now-playable in a future release.
2024-06-22 18:19:39 +10:00
Danielle McLean 796e3df87d
Display mpd-now-playable version on launch 2024-06-22 13:17:14 +10:00
Danielle McLean c7773bf324
Allow installing persistent cache drivers for album art 2024-05-14 13:24:21 +10:00
Danielle McLean 628ac9ae6a
Improve metadata for PyPI 2023-12-06 14:32:36 +11:00
Danielle McLean 6ac8034bbe
Load package version from Git tags 2023-12-02 13:31:56 +11:00
Danielle McLean 3eefc351f7
Include logo.svg in build process 2023-12-02 13:25:56 +11:00
Danielle McLean 06cae0fc0a
Swap to aiocache because it's easier to use in custom ways 2023-11-27 15:39:53 +11:00
Danielle McLean d4df24b7aa
Move library stubs to stubs/ for typeshed consistency 2023-11-27 10:56:34 +11:00
Danielle McLean dae3e49783
Initial commit: set up project and dependencies 2023-11-27 10:39:10 +11:00