Skip to content

chatn0ir07/spotireader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 

Repository files navigation

spotireader

A python script, that monitors the dbus of Spotify and writes currently playing songs to a file, mainly for streaming purposes
"Spotireader" hooks to the DBus-Signal PropertiesChanged of org.freedesktop.DBus.Properties to monitor changes of org.mpris.MediaPlayer2.spotify and writes song name and artist to a file

Dependencies

"Spotireader" depends on:
  • dbus
  • glib
Make sure you have these installed


For Archusers:
sudo pacman -S dbus glib2
We also need some dependencies from AUR so go on and use your favorite AUR package manager (in my case yay)
yay -S python-dbus python-dbus-common python-gobject python-gobject2
that should be all

Setup

Pretty simple, download the spotireader.py, edit
SONG_FILE = "PATH"
and set PATH to whatever file you want (file not directory).
And youre ready to go, hookup Spotify and execute spotireader.py

User Extensions

If you have experience with Python or would like to play around, here is a JSON Representation of the b Parameter (Dictionary) of the Handler function:
{"Metadata": 
  {
  "mpris:trackid": "spotify:track:48Q3snZ8muPxDrZooxj3jB", 
  "mpris:length": 182000000, 
  "mpris:artUrl": "https://open.spotify.com/image/fd7d53574408812ff207362180d4c9b7e7c8eab0", 
  "xesam:album": "Inspiration", 
  "xesam:albumArtist": ["Unknown Brain"], 
  "xesam:artist": ["Unknown Brain"], 
  "xesam:autoRating": 0.58, 
  "xesam:discNumber": 1, 
  "xesam:title": "Inspiration", 
  "xesam:trackNumber": 1, 
  "xesam:url": 
  "https://open.spotify.com/track/48Q3snZ8muPxDrZooxj3jB"}, 
  "PlaybackStatus": "Playing"
  }
}

Troubeshooting


Should you encounter any problems, feel free to open a new issue
i will do my best to help you resolve your problem

About

A python script, that monitors Spotify and writes currently playing songs to a file

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages