lastfmpris/README.md
2024-12-08 18:38:34 -08:00

2.5 KiB

lastfmpris

a rust application to scrobble your currently playing song on last.fm with mpris

limitations

unfortunately, because of how most mpris players work, the Track_Id (unique identifier for every song in the tracklist) object is very rarely supported, or, if supported, implemented incorrectly (looking at you, Cider) meaning it is impossible to tell if the track has been played twice in a row. this means you cannot have succssive scrobbles of the same song, sorry! besides this, i'd say the program is feature complete.

configuration

either run the program once and navigate to .config/lastmpris/config.ini or create the file and copy it from the config.example.ini file provided in this directory. once you do that, configure your authentication methods. the api keys are available here

you also have the option to define your mpris bus name, which will instead wait for your specified player instead of waiting for the first active player

how to install

if you're on a setup that uses nix, you can just use nix build or the provided devshell to build the application.

  1. the nix way

    simply just run it:

    nix run git+https://git.reidlab.pink/reidlab/lastfmpris.git
    

    or import it into your flake like so:

    lastfmpris.url = "git+https://git.reidlab.pink/reidlab/lastfmpris.git";
    

    and in your homeManagerConfiguration:

    imports = [
      inputs.lastfmpris.homeManagerModules.lastfmpris;
    ];
    

    and then use it as a service in your homeManagerConfiguration:

    services.lastfmpris = {
      enable = true;
      settings = {
        global = {
          # player_bus = "org.mpris.MediaPlayer2.mpv";
          username = "ILoveLastDotFm";
          password = builtins.readFile /etc/lastfm-password;
          api_key = builtins.readFile /etc/lastfm-api-key;
          api_secret = builtins.readFile /etc/lastfm-api-secret;
        }
      };
    };
    
  2. the normal way

    first, clone repository:

    git clone https://git.reidlab.pink/reidlab/lastfmpris && cd lastfmpris
    

    second, obtain dependencies (this will vary on your package manager, here, alpine is used)

    sudo apk add install pkgconf openssl dbus
    

    finally, run/build

    cargo run
    
    cargo build --release