Skip to content

Commit 4144032

Browse files
committed
feat(mpris): sync playback status and metadata with D-Bus (linux only)
1 parent b7d346a commit 4144032

File tree

11 files changed

+334
-31
lines changed

11 files changed

+334
-31
lines changed

go.mod

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ require (
88
github.com/charmbracelet/lipgloss v1.1.0
99
github.com/gdrens/mpv v0.0.0-20220831113119-9a418870d1b5
1010
github.com/gen2brain/beeep v0.11.2
11+
github.com/godbus/dbus/v5 v5.2.2
1112
github.com/mattn/go-runewidth v0.0.19
1213
gopkg.in/yaml.v3 v3.0.1
1314
)
@@ -24,20 +25,22 @@ require (
2425
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
2526
github.com/esiqveland/notify v0.13.3 // indirect
2627
github.com/go-ole/go-ole v1.3.0 // indirect
27-
github.com/godbus/dbus/v5 v5.2.1 // indirect
2828
github.com/jackmordaunt/icns/v3 v3.0.1 // indirect
29+
github.com/kr/text v0.2.0 // indirect
2930
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
3031
github.com/mattn/go-isatty v0.0.20 // indirect
3132
github.com/mattn/go-localereader v0.0.1 // indirect
3233
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
3334
github.com/muesli/cancelreader v0.2.2 // indirect
3435
github.com/muesli/termenv v0.16.0 // indirect
3536
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 // indirect
37+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect
3638
github.com/rivo/uniseg v0.4.7 // indirect
3739
github.com/sergeymakinen/go-bmp v1.0.0 // indirect
3840
github.com/sergeymakinen/go-ico v1.0.0 // indirect
3941
github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af // indirect
4042
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
4143
golang.org/x/sys v0.39.0 // indirect
4244
golang.org/x/text v0.3.8 // indirect
45+
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f // indirect
4346
)

go.sum

Lines changed: 11 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,30 +10,17 @@ github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlv
1010
github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
1111
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
1212
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
13-
github.com/charmbracelet/colorprofile v0.4.1 h1:a1lO03qTrSIRaK8c3JRxJDZOvhvIeSco3ej+ngLk1kk=
14-
github.com/charmbracelet/colorprofile v0.4.1/go.mod h1:U1d9Dljmdf9DLegaJ0nGZNJvoXAhayhmidOdcBwAvKk=
1513
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
1614
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
1715
github.com/charmbracelet/x/ansi v0.10.1 h1:rL3Koar5XvX0pHGfovN03f5cxLbCF2YvLeyz7D2jVDQ=
1816
github.com/charmbracelet/x/ansi v0.10.1/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
19-
github.com/charmbracelet/x/ansi v0.11.3 h1:6DcVaqWI82BBVM/atTyq6yBoRLZFBsnoDoX9GCu2YOI=
20-
github.com/charmbracelet/x/ansi v0.11.3/go.mod h1:yI7Zslym9tCJcedxz5+WBq+eUGMJT0bM06Fqy1/Y4dI=
2117
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd h1:vy0GVL4jeHEwG5YOXDmi86oYw2yuYUGqz6a8sLwg0X8=
2218
github.com/charmbracelet/x/cellbuf v0.0.13-0.20250311204145-2c3ea96c31dd/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
23-
github.com/charmbracelet/x/cellbuf v0.0.14 h1:iUEMryGyFTelKW3THW4+FfPgi4fkmKnnaLOXuc+/Kj4=
24-
github.com/charmbracelet/x/cellbuf v0.0.14/go.mod h1:P447lJl49ywBbil/KjCk2HexGh4tEY9LH0/1QrZZ9rA=
2519
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
2620
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
27-
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
28-
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
29-
github.com/clipperhouse/displaywidth v0.6.2 h1:ZDpTkFfpHOKte4RG5O/BOyf3ysnvFswpyYrV7z2uAKo=
30-
github.com/clipperhouse/displaywidth v0.6.2/go.mod h1:R+kHuzaYWFkTm7xoMmK1lFydbci4X2CicfbGstSGg0o=
31-
github.com/clipperhouse/stringish v0.1.1 h1:+NSqMOr3GR6k1FdRhhnXrLfztGzuG+VuFDfatpWHKCs=
32-
github.com/clipperhouse/stringish v0.1.1/go.mod h1:v/WhFtE1q0ovMta2+m+UbpZ+2/HEXNWYXQgCt4hdOzA=
3321
github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY=
3422
github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
35-
github.com/clipperhouse/uax29/v2 v2.3.0 h1:SNdx9DVUqMoBuBoW3iLOj4FQv3dN5mDtuqwuhIGpJy4=
36-
github.com/clipperhouse/uax29/v2 v2.3.0/go.mod h1:Wn1g7MK6OoeDT0vL+Q0SQLDz/KpfsVRgg6W7ihQeh4g=
23+
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
3724
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
3825
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
3926
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -48,14 +35,16 @@ github.com/gen2brain/beeep v0.11.2/go.mod h1:jQVvuwnLuwOcdctHn/uyh8horSBNJ8uGb9C
4835
github.com/go-ole/go-ole v1.3.0 h1:Dt6ye7+vXGIKZ7Xtk4s6/xVdGDQynvom7xCFEdWr6uE=
4936
github.com/go-ole/go-ole v1.3.0/go.mod h1:5LS6F96DhAwUc7C+1HLexzMXY1xGRSryjyPPKW6zv78=
5037
github.com/godbus/dbus/v5 v5.1.0/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=
51-
github.com/godbus/dbus/v5 v5.2.1 h1:I4wwMdWSkmI57ewd+elNGwLRf2/dtSaFz1DujfWYvOk=
52-
github.com/godbus/dbus/v5 v5.2.1/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
38+
github.com/godbus/dbus/v5 v5.2.2 h1:TUR3TgtSVDmjiXOgAAyaZbYmIeP3DPkld3jgKGV8mXQ=
39+
github.com/godbus/dbus/v5 v5.2.2/go.mod h1:3AAv2+hPq5rdnr5txxxRwiGjPXamgoIHgz9FPBfOp3c=
5340
github.com/jackmordaunt/icns/v3 v3.0.1 h1:xxot6aNuGrU+lNgxz5I5H0qSeCjNKp8uTXB1j8D4S3o=
5441
github.com/jackmordaunt/icns/v3 v3.0.1/go.mod h1:5sHL59nqTd2ynTnowxB/MDQFhKNqkK8X687uKNygaSQ=
42+
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
43+
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
44+
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
45+
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
5546
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
5647
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
57-
github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag=
58-
github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
5948
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
6049
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
6150
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
@@ -70,6 +59,8 @@ github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc
7059
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
7160
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646 h1:zYyBkD/k9seD2A7fsi6Oo2LfFZAehjjQMERAvZLEDnQ=
7261
github.com/nfnt/resize v0.0.0-20180221191011-83c6a9932646/go.mod h1:jpp1/29i3P1S/RLdc7JQKbRpFeM1dOBd8T9ki5s+AY8=
62+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e h1:fD57ERR4JtEqsWbfPhv4DMiApHyliiK5xCTNVSPiaAs=
63+
github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno=
7364
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
7465
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
7566
github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ=
@@ -91,18 +82,16 @@ github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavM
9182
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
9283
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561 h1:MDc5xs78ZrZr3HMQugiXOAkSZtfTpbJLDr/lwfgO53E=
9384
golang.org/x/exp v0.0.0-20220909182711-5c715a9e8561/go.mod h1:cyybsKvd6eL0RnXn6p/Grxp8F5bW7iYuBgsNCOHpMYE=
94-
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
9585
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9686
golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9787
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
9888
golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk=
9989
golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks=
10090
golang.org/x/text v0.3.8 h1:nAL+RVCQ9uMn3vJZbV+MRnydTJFPf8qqY42YiA6MrqY=
10191
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
102-
golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU=
103-
golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY=
104-
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
10592
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
93+
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f h1:BLraFXnmrev5lT+xlilqcH8XK9/i0At2xKjWk4p6zsU=
94+
gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
10695
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
10796
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
10897
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=

internal/api/api.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -319,7 +319,7 @@ func SubsonicScrobble(id string, submission bool) {
319319
_, _ = subsonicGET("/scrobble", params)
320320
}
321321

322-
func SubsonicCoverArt(id string) ([]byte, error) {
322+
func SubsonicCoverArtUrl(id string, size int) string {
323323
baseUrl := AppConfig.URL + "/rest/getCoverArt"
324324

325325
salt := generateSalt()
@@ -328,7 +328,7 @@ func SubsonicCoverArt(id string) ([]byte, error) {
328328

329329
v := url.Values{}
330330
v.Set("id", id)
331-
v.Set("size", "50")
331+
v.Set("size", strconv.Itoa(size))
332332
v.Set("u", AppConfig.Username)
333333
v.Set("t", token)
334334
v.Set("s", salt)
@@ -337,7 +337,11 @@ func SubsonicCoverArt(id string) ([]byte, error) {
337337
v.Set("f", "json")
338338

339339
url := baseUrl + "?" + v.Encode()
340+
return url
341+
}
340342

343+
func SubsonicCoverArt(id string) ([]byte, error) {
344+
url := SubsonicCoverArtUrl(id, 50)
341345
resp, err := http.Get(url)
342346
if err != nil {
343347
return nil, err

internal/integration/common.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
package integration
2+
3+
type Metadata struct {
4+
Title string
5+
Artist string
6+
Album string
7+
Duration float64
8+
ImageURL string
9+
}
10+
11+
type Status string
12+
13+
const (
14+
StatusPlaying Status = "Playing"
15+
StatusPaused Status = "Paused"
16+
StatusStopped Status = "Stopped"
17+
)
18+
19+
type PlayPauseMsg struct{}
20+
type NextSongMsg struct{}
21+
type PreviousSongMsg struct{}
22+
23+
func (m Metadata) LengthInMicroseconds() int64 {
24+
return int64(m.Duration * 1000000)
25+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
//go:build darwin
2+
3+
package integration
4+
5+
import tea "github.com/charmbracelet/bubbletea"
6+
7+
type Instance struct{}
8+
9+
func Init(p *tea.Program) *Instance {
10+
11+
return nil
12+
}
13+
14+
func (ins *Instance) Close() {}
15+
16+
func (ins *Instance) UpdateStatus(status string) {}
17+
func (ins *Instance) UpdateMetadata(meta Metadata) {}
18+
19+
func (ins *Instance) GetStatus() string {
20+
return "Stopped"
21+
}
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
//go:build linux
2+
3+
package integration
4+
5+
import (
6+
"log"
7+
8+
tea "github.com/charmbracelet/bubbletea"
9+
"github.com/godbus/dbus/v5"
10+
"github.com/godbus/dbus/v5/prop"
11+
)
12+
13+
type Instance struct {
14+
props *prop.Properties
15+
conn *dbus.Conn
16+
}
17+
18+
func Init(p *tea.Program) *Instance {
19+
conn, err := dbus.ConnectSessionBus()
20+
if err != nil {
21+
return nil
22+
}
23+
24+
ins := &Instance{conn: conn}
25+
26+
mp2 := &MediaPlayer2{Program: p}
27+
err = conn.Export(mp2, "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2.Player")
28+
if err != nil {
29+
log.Printf("MPRIS Export Error: %v", err)
30+
return nil
31+
}
32+
33+
err = conn.Export(mp2, "/org/mpris/MediaPlayer2", "org.mpris.MediaPlayer2")
34+
if err != nil {
35+
log.Printf("MPRIS Root Export Error: %v", err)
36+
}
37+
38+
ins.props, _ = prop.Export(
39+
conn,
40+
"/org/mpris/MediaPlayer2",
41+
map[string]map[string]*prop.Prop{
42+
"org.mpris.MediaPlayer2": rootProps,
43+
"org.mpris.MediaPlayer2.Player": playerProps,
44+
},
45+
)
46+
47+
reply, err := conn.RequestName("org.mpris.MediaPlayer2.subtui", dbus.NameFlagReplaceExisting)
48+
if err != nil || reply != dbus.RequestNameReplyPrimaryOwner {
49+
log.Printf("MPRIS Name Error: %v", err)
50+
}
51+
52+
return ins
53+
}
54+
55+
func (ins *Instance) GetStatus() string {
56+
if ins == nil || ins.props == nil {
57+
return "Stopped"
58+
}
59+
60+
variant, err := ins.props.Get("org.mpris.MediaPlayer2.Player", "PlaybackStatus")
61+
if err != nil {
62+
return "Stopped"
63+
}
64+
65+
if s, ok := variant.Value().(string); ok {
66+
return s
67+
}
68+
69+
return "Stopped"
70+
}
71+
72+
func (ins *Instance) UpdateStatus(status string) {
73+
if ins == nil {
74+
return
75+
}
76+
77+
_ = ins.props.Set("org.mpris.MediaPlayer2.Player", "PlaybackStatus", dbus.MakeVariant(string(status)))
78+
}
79+
80+
func (ins *Instance) UpdateMetadata(meta Metadata) {
81+
if ins == nil {
82+
return
83+
}
84+
85+
_ = ins.props.Set("org.mpris.MediaPlayer2.Player", "Metadata", dbus.MakeVariant(meta.ToMap()))
86+
}
87+
88+
func (ins *Instance) Close() {
89+
if ins != nil && ins.conn != nil {
90+
_ = ins.conn.Close()
91+
}
92+
}
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
//go:build linux
2+
3+
package integration
4+
5+
import (
6+
tea "github.com/charmbracelet/bubbletea"
7+
"github.com/godbus/dbus/v5"
8+
)
9+
10+
type MediaPlayer2 struct {
11+
Program *tea.Program
12+
}
13+
14+
func (m *MediaPlayer2) Play() *dbus.Error {
15+
if m.Program != nil {
16+
m.Program.Send(PlayPauseMsg{})
17+
}
18+
return nil
19+
}
20+
21+
func (m *MediaPlayer2) Pause() *dbus.Error {
22+
if m.Program != nil {
23+
m.Program.Send(PlayPauseMsg{})
24+
}
25+
return nil
26+
}
27+
28+
func (m *MediaPlayer2) PlayPause() *dbus.Error {
29+
if m.Program != nil {
30+
m.Program.Send(PlayPauseMsg{})
31+
}
32+
return nil
33+
}
34+
35+
func (m *MediaPlayer2) Next() *dbus.Error {
36+
if m.Program != nil {
37+
m.Program.Send(NextSongMsg{})
38+
}
39+
return nil
40+
}
41+
42+
func (m *MediaPlayer2) Previous() *dbus.Error {
43+
if m.Program != nil {
44+
m.Program.Send(PreviousSongMsg{})
45+
}
46+
return nil
47+
}
48+
49+
func (m *MediaPlayer2) Stop() *dbus.Error {
50+
if m.Program != nil {
51+
m.Program.Send(PlayPauseMsg{})
52+
}
53+
return nil
54+
}
55+
56+
func (m *MediaPlayer2) Quit() *dbus.Error {
57+
if m.Program != nil {
58+
m.Program.Quit()
59+
}
60+
return nil
61+
}
62+
63+
func (m *MediaPlayer2) Raise() *dbus.Error { return nil }

0 commit comments

Comments
 (0)