blob: 59726645bc82269646f2beeb1e25427f32beb3d7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
|
https://github.com/quassel/quassel/pull/617
From c2ddbb99ed25c96e7f8eefd7eeff88f6d10c3875 Mon Sep 17 00:00:00 2001
From: Andrew Udvare <audvare@gmail.com>
Date: Fri, 3 May 2024 04:15:21 -0400
Subject: [PATCH] data/scripts/mpris: update to use current MPRIS D-Bus
interface
Update documentation
Allow for . in the name of the player name
Strip xesam: from the result
---
data/scripts/mpris | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/data/scripts/mpris b/data/scripts/mpris
index c483c7214a..ace8a573de 100755
--- a/data/scripts/mpris
+++ b/data/scripts/mpris
@@ -23,21 +23,21 @@
# Simple script to read metadata from mpris compatible mediaplayers via dbus.
#
# Run it like this:
-# mpris amarok
+# mpris strawberry
#
# The script fills all fields exported by the player's dbusinterface.
-# They are defined here: http://wiki.xmms2.xmms.se/wiki/MPRIS_Metadata
+# They are defined here: https://www.freedesktop.org/wiki/Specifications/mpris-spec/metadata/#fields
#
# To see which fields are actually available from your player,
# call something like this from a terminal:
#
-# qdbus org.mpris.amarok /Player GetMetadata
+# qdbus org.mpris.MediaPlayer2.strawberry /org/mpris/MediaPlayer2 Metadata
# or
-# qdbus org.mpris.vlc /Player GetMetadata
+# qdbus org.mpris.MediaPlayer2.mpv /org/mpris/MediaPlayer2 Metadata
# etc.
-#
+#
# Every field is available in the data hash 'd' via
-# $d{"NAME_OF_FIELD"}
+# $d{"NAME_OF_FIELD"} (without the 'xesam:' prefix)
# To edit the output just change the marked line accordingly.
use strict;
@@ -48,11 +48,11 @@ if($#ARGV < 0) {
exit 1;
}
-die "Please don't use any special characters in playername." if($ARGV[0] =~ /[^\w\d_-]/);
+die "Please don't use any special characters in playername." if($ARGV[0] =~ /[^\.\w\d_-]/);
-open(IN,"qdbus org.mpris.".$ARGV[0]." /Player GetMetadata|") or die "Couldn't get dbus result.";
+open(IN,"qdbus org.mpris.MediaPlayer2.".$ARGV[0]." /org/mpris/MediaPlayer2 Metadata|") or die "Couldn't get dbus result.";
while(<IN>) {
- $d{$1} = $2 if(/^([^:]+):\s+([^\n]+)/);
+ $d{$1} = $2 if(/^xesam:([^:]+):\s+([^\n]+)/);
}
close IN;
|