Skip to content
/ debussy Public

CLI emitting json when song changes on Linux. Uses MPRIS and dbus to receive events

License

Notifications You must be signed in to change notification settings

cjrh/debussy

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

debussy

CLI emitting json when song changes on Linux. Uses MPRIS and dbus to receive events

demo

In the example below, I'm using the Gnome application Shortwave to listen to internet radio. The app is detected, and then each track change is received, and logged, and a json payload generated:

$ RUST_LOG=info debussy
 INFO  debussy > Found Shortwave (on bus org.mpris.MediaPlayer2.de.haeckerfelix.Shortwave)
 INFO  debussy > Radio Paradise (320k)::::Mark Knopfler - Don't You Get It
{"player":"Radio Paradise (320k)","artist":"Radio Paradise (320k)","title":"Mark Knopfler - Don't You Get It"}

The logs go to stderr, but the json goes to stdout. This means that output can be received by other tools in a unix pipeline. For example, streaming the json data to the program jq:

$ debussy | jq
   Compiling debussy v0.1.0 (/home/caleb/tmp/dbustest/debussy)
    Finished dev [unoptimized + debuginfo] target(s) in 0.63s
     Running `target/debug/debussy`
{
  "player": "Radio Paradise (320k)",
  "artist": "Radio Paradise (320k)",
  "title": "Heilung - Anona"
}
{
  "player": "Radio Paradise (320k)",
  "artist": "Radio Paradise (320k)",
  "title": "The Beatles - Help!"
}

About

CLI emitting json when song changes on Linux. Uses MPRIS and dbus to receive events

Topics

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published

Languages