Skip to content

jreeee/ShowScrobbling

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

72 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

||:S:|| - ShowScrobbling

Version Badge pypresence Code style: black License: MIT

description

showscrobbling / shoscro / ||:S:|| is an inofficial discord rich presence last.fm scrobble displaying script written in python.

it checks your last.fm profile for a currently playing track and displays it on discord.

screenshot

goal

showscrobbling aims to be easy to use, lightweight and cross-platform

why?

i usually listen to music via youtube using Web Scrobbler, or local music players like rhythmbox. this means that i don't have a cool discord rpc to show off my amazing music taste like those spotify peeps, which i wanted to change. there are a couple of similar projects out there, see the similar projects list, but they weren't as straightforward / easy to use as i wanted, so i made my own.

setup

commandline:

# git clone https://github.com/jreeee/showscrobbling

# cd showscrobbling && ./setup.py

# pip install -r requirements.txt (or use your packet manager to install the reqs)

graphical:

download the repo/latest release and unzip it. before starting the programm please execute the setup.py file in a terminal and enter your username when prompted. this will create a file called constats.py in the framework folder where various static values reside. you'll also need to install the required libraries for shoscro to work

troubleshooting

should error occur after upgrading to a new version, run ./setup.py again and, when prompted, type 'u' to update the constants.py. this will update the file, keeping the set values you already set.

if you encounter any other issues, feel free to let me know by opening a issue :)

startup

after finishing the setup just start the program: open a terminal (emulator) of your choice and type ./showscrobbling.py. for windows i recommend git bash, but cmd and powershell should also work. it then automatically connects to your discord client and show which song you are listening to right now. after that it updates every 30s to fetch the currently playing song from last.fm.

general info

because shoscro is written in python, you can use it on Windows and Linux (probably also Mac) and with any scrobbler as long as that updates your lastfm page somewhat regularly.

screenshot

when another discord user clicks on your activity, they'll have two buttons, linking to the song page on lastfm and your profile respectively.

the ||:S:|| logo is inspired by music notation, in full it would techically be somehting like ||: S | $^{1}$ how :|| $^{2}$ crobbling | originally i wanted to incorporate imagery linked to music and the two S' into the logo directly, tho as the latter is generally best avoided, i leaned into the music notation a bit more, using the repetition symbol to imply two S' while just showing one. The Text-Logo uses (bold) pipe symbols and double points to recreate the repeat symbols, **|**|:S:|**|** in markdown. i prefer this over the unicode symbols.

caching

showscrobbling uses caching to locally store track metadata. by default data is stored in ~/.cache/showscrobbling/metadata.json. you can change this folder in the constants.py or using arguments to wherever you have r/w permissions. just make sure to add the tilde at the start for paths relative to your user or stick to absolute paths, otherwise python won't resolve the path correctly and the script won't work.

you can use the arg -C to check the cache which will display info as to which cache file is used, and its size. furthermore it will then check based on name and artist if there exist duplicate entries and merge them. after that it will check if there are mbid based entries with album mbid that are missing covers. based on those it will query musicbrainz for the missing covers and add them.

strictness

lastly, you also have the option to add a strictness values using -S. if a track misses data, it is added up like a bitmask and then compared to the strictness values.

a missing cover correspods to 4, missing album to 2 and missing length to 1. so if you want to purge e.g. entries without cover and length would be strictness 5 multiple ints can be provided, by default entries with values equal to 5, 6 and 7 are discarded.

strictness applies both to normal operation, where it decides which entries are written to cache and also for checking cache, where you can specify what kinds of entries should be discarded.

development

for linting and formatting the code, the setup.py provides a prompt to create a pre-commit hook. this uses black for formatting and pylint for linting. currently only the formatting has to pass for the commit to be valid and i use pylint more as reference.

requirements

  • python 3.9 or newer
  • urllib $^{1}$
  • pypresence $^{1}$

$^{1}$ also present in the requirements.txt

(also discord, your lastfm username and a working internet connection)

arguments

args default desc
-h | --help - displays help message, listing all args
-u | --user - your lastfm username
-l | --loglevel 1 program generated output, 0: silent -> 4: debug, default 1
-i | --image this default image link if there's none for the track
-r | --request 30 interval in seconds to request the lastfm api for most recent track
-c | --cache-path - abolute path were showscrobbling reads data from and writes data to, e.g. "~/git/showscrobbling/.cache/metadata.json"
-E | --enable-lfm-track-image - enable the use of the lfm track image. this is different from the lfm album image in that it is just a grey star sometimes (see issue #15). because of that, showscrobbling elects to ignore this imagelink by default
-C | --check-cache - info about the cached songs
-S | --strictness [5,6,7] int array determining the stricness for entries. usage: -S 4 5 for tracks that have no image and no image and length, details

similar projects

About

displays the track you're currently scrobbling in discord

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages