Skip to content

Commit

Permalink
Show player-supplied MPRIS Identity instead of dbus interface part if…
Browse files Browse the repository at this point in the history
… available
  • Loading branch information
jgibbon committed Feb 26, 2023
1 parent eee8816 commit 9945c8d
Show file tree
Hide file tree
Showing 16 changed files with 41 additions and 32 deletions.
13 changes: 11 additions & 2 deletions main/qml/lib/MprisPlayingScanner.qml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@ Item {

property bool mprisIsPlaying: false
property string mprisPlayingService
property string mprisPlayingName: {
var match = mprisPlayingService.match(/([^.]+)$/);
property string mprisPlayingName
function getNameFromService(service) {
var match = service.match(/([^.]+)$/);
return match ? match[0] : '';
}

Expand Down Expand Up @@ -83,14 +84,21 @@ Item {
service: dbusService
path: '/org/mpris/MediaPlayer2'
iface: 'org.mpris.MediaPlayer2.Player'
property DBusInterface playerInfo: DBusInterface {
service: dbif.service
path: dbif.path
iface: 'org.mpris.MediaPlayer2'
}
property bool isPlaying: false
onIsPlayingChanged: {
if(isPlaying) {
scanner.mprisPlayingService = service;
scanner.mprisPlayingName = playerInfo.getProperty('Identity') || getNameFromService(service);
scanner.mprisIsPlaying = true;
} else {
if(scanner.mprisPlayingService === service) {
scanner.mprisPlayingService = '';
scanner.mprisPlayingName = '';
scanner.mprisIsPlaying = false;
}
}
Expand All @@ -108,6 +116,7 @@ Item {
Component.onDestruction: {
if(scanner.mprisPlayingService === service) {
scanner.mprisPlayingService = '';
scanner.mprisPlayingName = '';
scanner.mprisIsPlaying = false;
}
}
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-de.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ ziehe herunter für Einstellungen</translation>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Autostart: %1 spielt ab</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation>gestoppt…</translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ pull down for options</translation>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Autostart: %1 is playing</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation>stopped…</translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ tira hacia abajo para opciones</translation>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Inicio automático: %1 se está reproduciendo</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation>detenido...</translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-fi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-fr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Démarrage auto : %1 est en train d&apos;être joué</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-hu.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Automatikus indítás: %1 lejátszása</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-it.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Autostart: %1 in riproduzione</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-nl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Autostart: %1 wordt afgespeeld</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-nl_BE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Autostart: %1 wordt afgespeeld</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-pl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Autostart: %1 jest odtwarzany</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation>zatrzymany...</translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Автозапуск: % 1 играет</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-sl_SI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ za možnosti potegni navzdol</translation>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Samodejni zagon: %1 se predvaja</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation>zaustavljeno ...</translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-sv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ dra ner för alternativ</translation>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>Autostart: %1 spelas</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation>stoppad...</translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber-zh.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,13 +81,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation>自动启动: %1 正在播放</translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation>已停止…</translation>
Expand Down
4 changes: 2 additions & 2 deletions main/translations/harbour-slumber.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ pull down for options</source>
<context>
<name>MprisPlayingScanner</name>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="27"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="28"/>
<source>Autostart: %1 is playing</source>
<extracomment>Notification text: %1 is the identifier of the current media player. This string is prefixed with &quot;slumber &quot;: &quot;slumber Autostart: …&quot;</extracomment>
<translation type="unfinished"></translation>
</message>
<message>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="32"/>
<location filename="../qml/lib/MprisPlayingScanner.qml" line="33"/>
<source>stopped…</source>
<extracomment>Notification text: Current media player has stopped. This string is prefixed with &quot;slumber &quot;: &quot;slumber stopped…&quot;</extracomment>
<translation type="unfinished"></translation>
Expand Down

0 comments on commit 9945c8d

Please sign in to comment.