/debussy

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

Primary LanguageRustGNU Affero General Public License v3.0AGPL-3.0

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!"
}