Using go.dbus with omxplayer on a raspberry Pi

I am trying to use the D-Bus interface in omxplayer to control a running video. I am trying to use this go.dbus library found here: https://github.com/guelfey/go.dbus

The omxplayer documentation provides a dbuscontrol.sh script that I can use successfully. It sets some environments with variables, and then can use dbus-send to query omxplayer.

I try to reproduce this in Go, but I keep getting the error "The name org.mpris.MediaPlayer2 was not provided by any files.

Here is my code:

package main import ( "encoding/json" "fmt" "os" "github.com/guelfey/go.dbus" "github.com/guelfey/go.dbus/introspect" ) func main() { os.Setenv("OMXPLAYER_DBUS_ADDR", "/tmp/omxplayerdbus.pi") os.Setenv("OMXPLAYER_DBUS_PID", "/tmp/omxplayerdbus.pi.pid") conn, err := dbus.SessionBus() if err != nil { panic(err) } node, err := introspect.Call(conn.Object("org.mpris.MediaPlayer2.omxplayer", "/org/mpris/MediaPlayer2")) if err != nil { fmt.Println(err) } data, _ := json.MarshalIndent(node, "", " ") var s []string err = conn.BusObject().Call("org.freedesktop.DBus.ListNames", 0).Store(&s) if err != nil { fmt.Fprintln(os.Stderr, "Failed to get list of owned names:", err) os.Exit(1) } fmt.Println("Currently owned names on the session bus:") for _, v := range s { fmt.Println(v) } os.Stdout.Write(data) } 
+7
go raspberry-pi dbus omxplayer
source share

No one has answered this question yet.

See related questions:

4
In Go, if type T2 is based on type T1, is there any “inheritance” from T1 to T2?
2
Raspberry cover pi omxplayer + Gpio
one
Is there a minimal TV GUI for youtube-dl & omxplayer on raspberry pi?
one
Raspberry Pi Omxplayer OpenCV
0
Play matching videos using omxplayer and dbus
0
How can I kill omxplayer player on raspberry Pi using Python
0
Pause OMXPLAYER seeks 6 seconds with --live
0
GUI render above omxplayer on Raspberry Pi 3
0
Go String after variable declaration
0
Assign extra field when unmarshalling a JSON object for GO struct

All Articles