We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents b243a22 + e149349 commit c03f1cbCopy full SHA for c03f1cb
1 file changed
services/mpris/mpris_unix.go
@@ -5,6 +5,8 @@ package mpris
5
import (
6
"sptlrx/player"
7
"strings"
8
+ "net/url"
9
+ "path/filepath"
10
11
"github.com/Pauloo27/go-mpris"
12
"github.com/godbus/dbus/v5"
@@ -79,6 +81,15 @@ func (c *Client) State() (*player.State, error) {
79
81
title = t
80
82
}
83
84
+ // In case the player uses the file name with extension as title
85
+ if u, ok := meta["xesam:url"].Value().(string); ok {
86
+ u, err := url.Parse(u)
87
+ if err == nil {
88
+ ext := filepath.Ext(u.Path)
89
+ title = strings.TrimSuffix(title, ext)
90
+ }
91
92
+
93
var artist string
94
switch a := meta["xesam:artist"].Value(); a.(type) {
95
case string:
0 commit comments