From 645161bc8a9b473bd83a3f2ec31e938e0f1f79f8 Mon Sep 17 00:00:00 2001 From: Christian Krafft Date: Sat, 24 May 2014 18:23:45 +0200 Subject: [PATCH 01/55] add http-stream support, URL is hardcoded for now --- htdocs/css/mpd.css | 10 +++++++++- htdocs/css/mpd.min.css | 2 +- htdocs/index.html | 25 ++++++++++++++++++++----- htdocs/js/mpd.js | 19 +++++++++++++++++++ 4 files changed, 49 insertions(+), 7 deletions(-) diff --git a/htdocs/css/mpd.css b/htdocs/css/mpd.css index 360488f..f0d9055 100644 --- a/htdocs/css/mpd.css +++ b/htdocs/css/mpd.css @@ -15,6 +15,14 @@ body { margin-bottom: 0; } +#localvolumeslider { + width: 150px; +} + +#localvolumeslider .progress { + margin-bottom: 0; +} + #volume-icon { float: left; margin-right: 10px; @@ -83,4 +91,4 @@ td:last-child, td:first-child { position: relative; z-index: 9999; margin: 5px 0px; -} \ No newline at end of file +} diff --git a/htdocs/css/mpd.min.css b/htdocs/css/mpd.min.css index 509744a..b288ae0 100644 --- a/htdocs/css/mpd.min.css +++ b/htdocs/css/mpd.min.css @@ -1 +1 @@ -body{padding-top:50px;padding-bottom:50px}.starter-template{padding:40px 15px}#volumeslider{width:150px}#volumeslider .progress{margin-bottom:0}#volume-icon{float:left;margin-right:10px;margin-top:2px}#counter{font-size:24px;margin-top:-6px;margin-left:10px;min-width:50px}#search{margin-right:-10px}.btn-group-hover{opacity:20%}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);color:#428bca;background-color:#fdfdfd;border-color:#adadad}@media(max-width:1199px){#btn-responsive-block>.btn{padding:6px 12px;font-size:14px;border-radius:4px}}#salamisandwich td:nth-child(3),th:nth-child(3){text-align:right}tbody{cursor:pointer}td:last-child,td:first-child{width:30px}.notifications{position:fixed;z-index:9999}.notifications.top-right{right:10px;top:60px}.notifications>div{position:relative;z-index:9999;margin:5px 0} \ No newline at end of file +body{padding-top:50px;padding-bottom:50px}.starter-template{padding:40px 15px}#volumeslider{width:150px}#volumeslider .progress{margin-bottom:0}#volume-icon{float:left;margin-right:10px;margin-top:2px}#localvolumeslider{width:150px}#localvolumeslider .progress{margin-bottom:0}#volume-icon{float:left;margin-right:10px;margin-top:2px}#counter{font-size:24px;margin-top:-6px;margin-left:10px;min-width:50px}#search{margin-right:-10px}.btn-group-hover{opacity:20%}.btn:active,.btn.active{background-image:none;outline:0;-webkit-box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);box-shadow:inset 0 3px 5px rgba(0,0,0,0.125);color:#428bca;background-color:#fdfdfd;border-color:#adadad}@media(max-width:1199px){#btn-responsive-block>.btn{padding:6px 12px;font-size:14px;border-radius:4px}}#salamisandwich td:nth-child(3),th:nth-child(3){text-align:right}tbody{cursor:pointer}td:last-child,td:first-child{width:30px}.notifications{position:fixed;z-index:9999}.notifications.top-right{right:10px;top:60px}.notifications>div{position:relative;z-index:9999;margin:5px 0} diff --git a/htdocs/index.html b/htdocs/index.html index 0149a87..02f5d25 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -43,6 +43,11 @@
  • Settings
  • + - diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index b6db9af..9306ff3 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -98,6 +98,10 @@ $(document).ready(function(){ $("#volumeslider").on('slider.newValue', function(evt,data){ socket.send("MPD_API_SET_VOLUME,"+data.val); }); + $("#localvolumeslider").slider(0); + $("#localvolumeslider").on('slider.newValue', function(evt,data){ + document.getElementById("player").volume=data.val/100; + }); $('#progressbar').slider(0); $("#progressbar").on('slider.newValue', function(evt,data){ if(current_song && current_song.currentSongId >= 0) { @@ -299,6 +303,7 @@ function webSocketConnect() { var elapsed_seconds = obj.data.elapsedTime - elapsed_minutes * 60; $('#volumeslider').slider(obj.data.volume); + $('#localvolumeslider').slider(document.getElementById("player").volume*100); var progress = Math.floor(100*obj.data.elapsedTime/obj.data.totalTime); $('#progressbar').slider(progress); @@ -473,6 +478,20 @@ function clickPlay() { socket.send('MPD_API_SET_PAUSE'); } +function clickLocalPlay() { + var player = document.getElementById('player'); + player.src='http://mpd:8000/mpd.ogg'; + player.play(); + $("#localvolumeslider").slider(player.volume*100); +} + +function clickLocalStop() { + var player = document.getElementById('player'); + player.pause(); + player.src=''; + player.removeAttribute("src"); +} + function basename(path) { return path.split('/').reverse()[0]; } From 718ac3024e48d276f7d7fc0a7ca3e3488c675ebc Mon Sep 17 00:00:00 2001 From: Christian Krafft Date: Mon, 30 Jun 2014 17:34:38 +0200 Subject: [PATCH 02/55] make local playback controls better distinguishable from mpd controls by reordering and grouping them. also clean up markup by removing autoplay="false" which is not correct html5 Signed-off-by: Christian Krafft --- htdocs/index.html | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index 02f5d25..2b93920 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -49,6 +49,7 @@ From 379a5ffce3e4f58b7ac0087668e4dde14db08cfd Mon Sep 17 00:00:00 2001 From: Christian Krafft Date: Mon, 30 Jun 2014 21:25:26 +0200 Subject: [PATCH 03/55] save some characters --- htdocs/js/mpd.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 9306ff3..f0b2df1 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -100,7 +100,7 @@ $(document).ready(function(){ }); $("#localvolumeslider").slider(0); $("#localvolumeslider").on('slider.newValue', function(evt,data){ - document.getElementById("player").volume=data.val/100; + $("#player").volume=data.val/100; }); $('#progressbar').slider(0); $("#progressbar").on('slider.newValue', function(evt,data){ From 838237d854fa614d60cf7ee227ecfdcd0e299614 Mon Sep 17 00:00:00 2001 From: LaClaro Date: Tue, 11 Nov 2014 18:41:39 +0100 Subject: [PATCH 04/55] Patched files to include more columns in browsing and queue mode --- htdocs/js/mpd.js | 15 +++++++++++---- src/mpd_client.c | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 4 deletions(-) diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index b6db9af..08e08a9 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -137,6 +137,7 @@ function webSocketConnect() { return; var obj = JSON.parse(msg.data); + switch (obj.type) { case "queue": @@ -150,7 +151,9 @@ function webSocketConnect() { $('#salamisandwich > tbody').append( "" + (obj.data[song].pos + 1) + "" + - ""+ obj.data[song].title +"" + + ""+ obj.data[song].title +"" + + ""+ obj.data[song].album +"" + + ""+ obj.data[song].artist +"" + ""+ minutes + ":" + (seconds < 10 ? '0' : '') + seconds + ""); } @@ -192,6 +195,7 @@ function webSocketConnect() { "" + "" + "" + basename(obj.data[item].dir) + "" + + "" + "" ); break; @@ -199,7 +203,8 @@ function webSocketConnect() { $('#salamisandwich > tbody').append( "" + "" + - "" + basename(obj.data[item].plist) + "" + + "" + basename(obj.data[item].plist) + "" + + "" + "" ); break; @@ -210,8 +215,10 @@ function webSocketConnect() { $('#salamisandwich > tbody').append( "" + "" + - "" + obj.data[item].title +"" + - ""+ minutes + ":" + (seconds < 10 ? '0' : '') + seconds + + "" + obj.data[item].title + "" + + "" + obj.data[item].album + "" + + "" + obj.data[item].artist + "" + + "" + minutes + ":" + (seconds < 10 ? '0' : '') + seconds + "" ); break; diff --git a/src/mpd_client.c b/src/mpd_client.c index ea10178..76b079d 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -320,6 +320,30 @@ char* mpd_get_title(struct mpd_song const *song) return str; } +char* mpd_get_album(struct mpd_song const *song) +{ + char *str; + + str = (char *)mpd_song_get_tag(song, MPD_TAG_ALBUM, 0); + if(str == NULL){ + str = basename((char *)mpd_song_get_uri(song)); + } + + return str; +} + +char* mpd_get_artist(struct mpd_song const *song) +{ + char *str; + + str = (char *)mpd_song_get_tag(song, MPD_TAG_ARTIST, 0); + if(str == NULL){ + str = basename((char *)mpd_song_get_uri(song)); + } + + return str; +} + int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version) { struct mpd_status *status; @@ -413,6 +437,10 @@ int mpd_put_queue(char *buffer, unsigned int offset) cur += json_emit_int(cur, end - cur, mpd_song_get_pos(song)); cur += json_emit_raw_str(cur, end - cur, ",\"duration\":"); cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"artist\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"album\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song)); cur += json_emit_raw_str(cur, end - cur, ",\"title\":"); cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song)); cur += json_emit_raw_str(cur, end - cur, "},"); @@ -469,6 +497,10 @@ int mpd_put_browse(char *buffer, char *path, unsigned int offset) cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song)); cur += json_emit_raw_str(cur, end - cur, ",\"duration\":"); cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"artist\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"album\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song)); cur += json_emit_raw_str(cur, end - cur, ",\"title\":"); cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song)); cur += json_emit_raw_str(cur, end - cur, "},"); From f3aef08a7a53dd2dfb9ee261a60496dd2397052f Mon Sep 17 00:00:00 2001 From: LaClaro Date: Tue, 11 Nov 2014 18:50:21 +0100 Subject: [PATCH 05/55] Patched files to include more columns in browsing and queue mode --- htdocs/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/htdocs/index.html b/htdocs/index.html index 0149a87..0b6717c 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -107,7 +107,9 @@ # - Title + Titel + Album + Artist Duration From 8b29d444968cfd613d08feb64113768136f4da9a Mon Sep 17 00:00:00 2001 From: LaClaro Date: Tue, 11 Nov 2014 18:52:05 +0100 Subject: [PATCH 06/55] Patched files to include more columns in browsing and queue mode --- htdocs/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/htdocs/index.html b/htdocs/index.html index 0b6717c..776b40d 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -107,7 +107,7 @@ # - Titel + Title Album Artist Duration From df3ba1c04cc76b22b7a17ab49635b19f46fb5420 Mon Sep 17 00:00:00 2001 From: LaClaro Date: Thu, 20 Nov 2014 20:17:16 +0100 Subject: [PATCH 07/55] Added more columns also to the search --- src/mpd_client.c | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/src/mpd_client.c b/src/mpd_client.c index 76b079d..2fcc16f 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -344,6 +344,18 @@ char* mpd_get_artist(struct mpd_song const *song) return str; } +char* mpd_get_year(struct mpd_song const *song) +{ + char *str; + + str = (char *)mpd_song_get_tag(song, MPD_TAG_DATE, 0); + if(str == NULL){ + str = basename((char *)mpd_song_get_uri(song)); + } + + return str; +} + int mpd_put_state(char *buffer, int *current_song_id, unsigned *queue_version) { struct mpd_status *status; @@ -495,12 +507,12 @@ int mpd_put_browse(char *buffer, char *path, unsigned int offset) song = mpd_entity_get_song(entity); cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":"); cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song)); - cur += json_emit_raw_str(cur, end - cur, ",\"duration\":"); - cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song)); - cur += json_emit_raw_str(cur, end - cur, ",\"artist\":"); - cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song)); cur += json_emit_raw_str(cur, end - cur, ",\"album\":"); cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"artist\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"duration\":"); + cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song)); cur += json_emit_raw_str(cur, end - cur, ",\"title\":"); cur += json_emit_quoted_str(cur, end - cur, mpd_get_title(song)); cur += json_emit_raw_str(cur, end - cur, "},"); @@ -557,6 +569,10 @@ int mpd_search(char *buffer, char *searchstr) while((song = mpd_recv_song(mpd.conn)) != NULL) { cur += json_emit_raw_str(cur, end - cur, "{\"type\":\"song\",\"uri\":"); cur += json_emit_quoted_str(cur, end - cur, mpd_song_get_uri(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"album\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_get_album(song)); + cur += json_emit_raw_str(cur, end - cur, ",\"artist\":"); + cur += json_emit_quoted_str(cur, end - cur, mpd_get_artist(song)); cur += json_emit_raw_str(cur, end - cur, ",\"duration\":"); cur += json_emit_int(cur, end - cur, mpd_song_get_duration(song)); cur += json_emit_raw_str(cur, end - cur, ",\"title\":"); From cb82047228d891095e6575e2b63ea71b3830bac0 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Sun, 27 Sep 2015 17:52:13 +0200 Subject: [PATCH 08/55] removed filename to not depend on the format mpd is streaming add load() before play() for mobile safari --- htdocs/index.html | 2 +- htdocs/js/mpd.js | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index d3133e4..deb1926 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -65,7 +65,7 @@ - +
    -
    - + + -
    - -
    -
    + @@ -248,7 +241,12 @@ MPD Password is set - + +
    +
    + + +
    diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 5dc91ad..e85192c 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -157,10 +157,6 @@ $(document).ready(function(){ $("#volumeslider").on('slider.newValue', function(evt,data){ socket.send("MPD_API_SET_VOLUME,"+data.val); }); - $("#localvolumeslider").slider(0); - $("#localvolumeslider").on('slider.newValue', function(evt,data){ - $("#player").volume=data.val/100; - }); $('#progressbar').slider(0); $("#progressbar").on('slider.newValue', function(evt,data){ if(current_song && current_song.currentSongId >= 0) { @@ -375,7 +371,6 @@ function webSocketConnect() { var elapsed_seconds = obj.data.elapsedTime - elapsed_minutes * 60; $('#volumeslider').slider(obj.data.volume); - $('#localvolumeslider').slider(document.getElementById("player").volume*100); var progress = Math.floor(100*obj.data.elapsedTime/obj.data.totalTime); $('#progressbar').slider(progress); @@ -474,6 +469,7 @@ function webSocketConnect() { break; case "mpdhost": $('#mpdhost').val(obj.data.host); + setLocalStream(obj.data.host); $('#mpdport').val(obj.data.port); if(obj.data.passwort_set) $('#mpd_password_set').removeClass('hide'); @@ -581,17 +577,41 @@ function clickPlay() { function clickLocalPlay() { var player = document.getElementById('player'); - player.src='http://mpd:8000/'; - player.load(); - player.play(); - $("#localvolumeslider").slider(player.volume*100); + $("#localplay-icon").removeClass("glyphicon-play").removeClass("glyphicon-pause"); + + if ( player.paused ) { + if ( $("#localstream").val() == "" ) { + $("#localstream").change(function(){ clickLocalPlay(); $(this).unbind("change"); }); + $("#localplay-icon").addClass("glyphicon-play"); + getHost(); + return; + } + player.src = $("#localstream").val(); + console.log("playing mpd stream: " + player.src); + player.load(); + player.play(); + $("#localplay-icon").addClass("glyphicon-pause"); + } else { + player.pause(); + player.src=''; + player.removeAttribute("src"); + $("#localplay-icon").addClass("glyphicon-play"); + } } -function clickLocalStop() { - var player = document.getElementById('player'); - player.pause(); - player.src=''; - player.removeAttribute("src"); +function setLocalStream(mpdhost) { + if ( $("#localstream").val() != "" ) + return; + + var mpdstream = "http://"; + if ( mpdhost == "127.0.0.1" ) + mpdstream += window.location.hostname; + else + mpdstream += mpdhost; + mpdstream += ":8000/"; + $("#mpdstream").val(mpdstream); + $("#localstream").val(mpdstream); + $("#localstream").change(); } function basename(path) { @@ -648,6 +668,7 @@ function getHost() { $('#mpdhost').keypress(onEnter); $('#mpdport').keypress(onEnter); + $('#mpdstream').keypress(onEnter); $('#mpd_pw').keypress(onEnter); $('#mpd_pw_con').keypress(onEnter); } @@ -720,6 +741,7 @@ function confirmSettings() { socket.send('MPD_API_SET_MPDPASS,'+$('#mpd_pw').val()); } socket.send('MPD_API_SET_MPDHOST,'+$('#mpdport').val()+','+$('#mpdhost').val()); + $("#localstream").val($("#mpdstream").val()); $('#settings').modal('hide'); } From d87c762bb8f7ff2a1a225882a80befd677faa3cb Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Fri, 9 Oct 2015 12:12:31 +0200 Subject: [PATCH 12/55] streamline design with original design --- htdocs/index.html | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/index.html b/htdocs/index.html index 9202850..9018d14 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -53,6 +53,9 @@ + + +
    From 686eb4f5d2d9cb61f6611a1bf80e5f44a072b710 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Thu, 15 Oct 2015 15:46:28 +0200 Subject: [PATCH 13/55] skip authorization for websockets, since mobile safari does not support it --- src/ympd.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ympd.c b/src/ympd.c index 15fa1f9..7c63167 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -62,7 +62,8 @@ static int server_callback(struct mg_connection *c, enum mg_event ev) { return callback_http(c); #endif case MG_AUTH: - if ( gpass == NULL ) + // no auth for websockets since mobile safari does not support it + if ( (gpass == NULL) || (c->is_websocket) ) return MG_TRUE; else { if ( (fp = fopen(gpass, "r")) != NULL ) { From 264ce34ae9d6795bbde5a1c4ff2ab9ef1aa71e2f Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Fri, 16 Oct 2015 15:28:04 +0200 Subject: [PATCH 14/55] fix toolbar layout --- htdocs/index.html | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index 9018d14..f954071 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -62,19 +62,19 @@
    -
    - - + + +
    -
    + From 4643f1cdcb95a0025be6aca66140b6d2f82e8613 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Wed, 21 Oct 2015 19:24:38 +0200 Subject: [PATCH 15/55] use cookies to store streamurl and added minimal player --- CMakeLists.txt | 1 + htdocs/index.html | 6 +++- htdocs/js/mpd.js | 43 ++++++++++++++++------------- htdocs/player.html | 68 ++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 98 insertions(+), 20 deletions(-) create mode 100644 htdocs/player.html diff --git a/CMakeLists.txt b/CMakeLists.txt index 7bd4b70..21b085d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,6 +36,7 @@ file(GLOB RESOURCES htdocs/css/*.min.css htdocs/fonts/* htdocs/index.html + htdocs/player.html ) set(SOURCES diff --git a/htdocs/index.html b/htdocs/index.html index f954071..26981fb 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -61,13 +61,17 @@
    + + diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index e85192c..f172e4c 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -580,17 +580,19 @@ function clickLocalPlay() { $("#localplay-icon").removeClass("glyphicon-play").removeClass("glyphicon-pause"); if ( player.paused ) { - if ( $("#localstream").val() == "" ) { - $("#localstream").change(function(){ clickLocalPlay(); $(this).unbind("change"); }); + var mpdstream = $.cookie("mpdstream"); + + if ( mpdstream ) { + player.src = mpdstream; + console.log("playing mpd stream: " + player.src); + player.load(); + player.play(); + $("#localplay-icon").addClass("glyphicon-pause"); + } else { + $("#mpdstream").change(function(){ clickLocalPlay(); $(this).unbind("change"); }); $("#localplay-icon").addClass("glyphicon-play"); getHost(); - return; } - player.src = $("#localstream").val(); - console.log("playing mpd stream: " + player.src); - player.load(); - player.play(); - $("#localplay-icon").addClass("glyphicon-pause"); } else { player.pause(); player.src=''; @@ -600,18 +602,21 @@ function clickLocalPlay() { } function setLocalStream(mpdhost) { - if ( $("#localstream").val() != "" ) - return; + var mpdstream = $.cookie("mpdstream"); + + if ( !mpdstream ) { + mpdstream = "http://"; + if ( mpdhost == "127.0.0.1" ) + mpdstream += window.location.hostname; + else + mpdstream += mpdhost; + mpdstream += ":8000/"; + + $.cookie("mpdstream", mpdstream, { expires: 424242 }); + } - var mpdstream = "http://"; - if ( mpdhost == "127.0.0.1" ) - mpdstream += window.location.hostname; - else - mpdstream += mpdhost; - mpdstream += ":8000/"; $("#mpdstream").val(mpdstream); - $("#localstream").val(mpdstream); - $("#localstream").change(); + $("#mpdstream").change(); } function basename(path) { @@ -741,7 +746,7 @@ function confirmSettings() { socket.send('MPD_API_SET_MPDPASS,'+$('#mpd_pw').val()); } socket.send('MPD_API_SET_MPDHOST,'+$('#mpdport').val()+','+$('#mpdhost').val()); - $("#localstream").val($("#mpdstream").val()); + $.cookie("mpdstream", $("#mpdstream").val(), { expires: 424242 }); $('#settings').modal('hide'); } diff --git a/htdocs/player.html b/htdocs/player.html new file mode 100644 index 0000000..83b4621 --- /dev/null +++ b/htdocs/player.html @@ -0,0 +1,68 @@ + + + + + + + + + + + ympd player + + + + + + + + + + + + + +
    +
    +
    + + +
    +
    +
    + + + + + + + + From 84ad2b06a77d20406c394a5f6b399f7a28426f33 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Fri, 13 Nov 2015 10:32:36 +0100 Subject: [PATCH 16/55] fix digest argument type --- src/ympd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ympd.c b/src/ympd.c index 7c63167..b5f2a3d 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -96,7 +96,7 @@ int main(int argc, char **argv) strcpy(mpd.host, "127.0.0.1"); static struct option long_options[] = { - {"digest", optional_argument, 0, 'd'}, + {"digest", required_argument, 0, 'd'}, {"host", required_argument, 0, 'h'}, {"port", required_argument, 0, 'p'}, {"webport", required_argument, 0, 'w'}, From 6f54187ea914070c7a70ed0da317c4116e919109 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Fri, 13 Nov 2015 15:07:07 +0100 Subject: [PATCH 17/55] add digest option to contrib files --- contrib/init.debian | 3 ++- contrib/ympd.default | 1 + contrib/ympd.service | 3 ++- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/init.debian b/contrib/init.debian index 5c10bdf..e1c6fab 100755 --- a/contrib/init.debian +++ b/contrib/init.debian @@ -24,6 +24,7 @@ YMPD_USER=nobody MPD_HOST=localhost MPD_PORT=6600 WEB_PORT=8080 +#DIGEST=--digest /path/to/htdigest # Exit if the package is not installed @@ -35,7 +36,7 @@ WEB_PORT=8080 # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS -DAEMON_OPT="--user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT" +DAEMON_OPT="--user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT $DIGEST" do_start() { diff --git a/contrib/ympd.default b/contrib/ympd.default index c7bbcda..184b2ed 100644 --- a/contrib/ympd.default +++ b/contrib/ympd.default @@ -2,3 +2,4 @@ MPD_HOST=localhost MPD_PORT=6600 WEB_PORT=8080 YMPD_USER=nobody +#DIGEST=--digest /path/to/htdigest diff --git a/contrib/ympd.service b/contrib/ympd.service index 2289550..4969337 100644 --- a/contrib/ympd.service +++ b/contrib/ympd.service @@ -7,8 +7,9 @@ Environment=MPD_HOST=localhost Environment=MPD_PORT=6600 Environment=WEB_PORT=8080 Environment=YMPD_USER=nobody +Environment=DIGEST= EnvironmentFile=/etc/default/ympd -ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT +ExecStart=/usr/bin/ympd --user $YMPD_USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT $DIGEST Type=simple [Install] From d72c10cd8c1fe6f3fab06b9a25c886f92c6bd1c0 Mon Sep 17 00:00:00 2001 From: SuperBFG7 Date: Mon, 23 Nov 2015 11:10:11 +0100 Subject: [PATCH 18/55] simplify toolbar --- htdocs/index.html | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/htdocs/index.html b/htdocs/index.html index e36c28e..8914565 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -35,7 +35,9 @@ @@ -55,18 +57,16 @@ - + +
    + @@ -74,8 +74,8 @@
    - - + +