Skip to content
This repository has been archived by the owner on May 3, 2019. It is now read-only.

Commit

Permalink
Add support for ympd
Browse files Browse the repository at this point in the history
Close #118
  • Loading branch information
ColinDuquesnoy committed Oct 21, 2017
1 parent f6ea3a8 commit ae6e580
Show file tree
Hide file tree
Showing 4 changed files with 187 additions and 0 deletions.
60 changes: 60 additions & 0 deletions plugins/ympd/integration.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
function getPlaybackStatus() {
var playIcon = document.getElementById("play-icon").className;
if (playIcon === "glyphicon glyphicon-play") {
return mellowplayer.PlaybackStatus.PAUSED;
}
else {
return mellowplayer.PlaybackStatus.PLAYING;
}
}

function update() {
return {
"playbackStatus": getPlaybackStatus(),
"canSeek": true,
"canGoNext": true,
"canGoPrevious": true,
"canAddToFavorites": false,
"volume": 1,
"duration": current_song.totalTime,
"position": toSeconds(document.getElementById("counter").innerText.split("/")[0].trim()),
"songId": current_song.currentSongId,
"songTitle": $('#currenttrack').text(),
"artistName": $('#artist').text(),
"albumTitle": $('#album').text(),
"artUrl": 'https://colinduquesnoy.github.io/MellowPlayer/img/img_mellow-icon.svg',
"isFavorite": false
};
}

function play() {
clickPlay();
}

function pause() {
clickPlay();
}

function goNext() {
socket.send('MPD_API_SET_NEXT');
}

function goPrevious() {
socket.send('MPD_API_SET_PREV');
}

function setVolume(volume) {

}

function addToFavorites() {

}

function removeFromFavorites() {

}

function seekToPosition(position) {
socket.send("MPD_API_SET_SEEK,"+current_song.currentSongId+","+position);
}
111 changes: 111 additions & 0 deletions plugins/ympd/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions plugins/ympd/metadata.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
author=Colin Duquesnoy
author_website=https://github.com/ColinDuquesnoy
icon=logo.svg
name=ympd
supported_platforms=All
url=http://localhost:8080
version=1.0
9 changes: 9 additions & 0 deletions plugins/ympd/theme.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"accent": "#3684bd",
"background": "#ffffff",
"foreground": "#505050",
"primary": "#3a3a3a",
"primaryForeground": "#ffffff",
"secondary": "#4a4a4a",
"secondaryForeground": "#ffffff"
}

0 comments on commit ae6e580

Please sign in to comment.