forked from salomvary/soundcleod
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* MPRIS interface for desktop media player integration with artwork URL * Snap build with minimal permissions * Application Icon * Change in handling of menu shortcuts (needs testing on MacOS and Windows!)
- Loading branch information
1 parent
3067210
commit dfb5d63
Showing
6 changed files
with
466 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
'use strict' | ||
|
||
// it's currently impossible to expose chrome's native media session interface | ||
// when using snap because chrome does not allow setting the name of the session. | ||
// hence we re-implement it here. As a bonus, we get artwork support. | ||
|
||
const Player = require('mpris-service') | ||
|
||
module.exports = function mpris(soundcloud) { | ||
const player = Player({ | ||
name: 'soundcleod', | ||
identity: 'Player for SoundCloud', | ||
supportedInterfaces: ['player'] | ||
}) | ||
|
||
player.on('playpause', () => soundcloud.playPause()) | ||
|
||
player.on('next', () => soundcloud.nextTrack()) | ||
|
||
player.on('previous', () => soundcloud.previousTrack()) | ||
|
||
soundcloud.on('play-new-track', (metadata) => { | ||
setMetadata(metadata) | ||
}) | ||
|
||
soundcloud.on('play', () => { | ||
player.playbackStatus = 'Playing' | ||
}) | ||
|
||
soundcloud.on('pause', () => { | ||
player.playbackStatus = 'Paused' | ||
}) | ||
|
||
function setMetadata(metadata) { | ||
player.metadata = { | ||
'mpris:artUrl': metadata.artworkURL, | ||
'xesam:title': metadata.title, | ||
'xesam:artist': [metadata.subtitle] | ||
} | ||
} | ||
} |
Oops, something went wrong.