Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Last.fm -> Discord RPC

This small script polls Last.fm for a user's currently playing track and updates Discord Rich Presence using the pypresence module.

Requirements

  • Python 3.8+
  • Install dependencies:
pip install -r requirements.txt

Usage

You can provide credentials via a .env file.

Using a .env file

You can store sensitive credentials in a .env file and load it with --env-file (default is .env). The script uses python-dotenv to load the file before parsing arguments.

Environment variables:

  • LASTFM_USER — Last.fm username
  • LASTFM_API_KEY — Last.fm API key
  • DISCORD_APP_ID — Discord Application (Client) ID

Additional optional environment variables for authenticated/signed requests:

  • LASTFM_API_SECRET — Last.fm API secret to compute api_sig per the auth spec
  • LASTFM_SESSION_KEY — session key (sk) if you have an authenticated session (This can be obtained using the --auth arg (will automatically be saved to your .env file))

Options:

  • --interval — polling interval in seconds (default 15)
  • --verbose — enable verbose logging

Notes

  • this uses a json (default is cover_cache.json) file to store the urls of all previously accessed album art urls to reduce reliance on the Last.fm API
  • Discord Rich Presence can use uploaded assets, media proxy images (mp:{image_id}), or external URL assets when the client accepts them
  • map album and artist names to asset values with --asset-map; if no match is found, the script falls back to the fetched image URL, then to text-only presence unless --large-image-default is set

Files

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages