From: Andrew Carr Date: Fri, 21 May 2021 01:38:19 +0000 (+0000) Subject: Dirble option and functionality removed X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=3fe238b169715cde49ddfdf219a63a7bda54d6ad;p=ympd.git Dirble option and functionality removed Dirble is no longer available and per the author/old-owner, will probably not be coming back. This commit removes the configuration option and the code used to access dirble. Everything else still appears to be functional. re: https://dev.to/confact/what-happened-with-dirble-k3g --- diff --git a/README.md b/README.md index 4bf91f2..1d7fb81 100644 --- a/README.md +++ b/README.md @@ -34,7 +34,6 @@ Usage: ./ympd [OPTION]... -h, --host connect to mpd at host [localhost] -p, --port connect to mpd at port [6600] -w, --webport [ip:] listen interface/port for webserver [8080] - -d, --dirbletoken Dirble API token -u, --user drop priviliges to user after socket bind -V, --version get version --help this help @@ -54,12 +53,6 @@ To run ympd with SSL support: # ./ympd -w "ssl://8081:/path/to/ssl.pem" ``` -Dirble support --------------- - -1. Get an API-key from http://dirble.com -2. Add the key at ```var TOKEN = "";```, in ```mpd.js```. - Copyright --------- diff --git a/contrib/init.debian b/contrib/init.debian index 6b328f0..f57c702 100755 --- a/contrib/init.debian +++ b/contrib/init.debian @@ -24,7 +24,6 @@ YMPD_USER=nobody MPD_HOST=localhost MPD_PORT=6600 WEB_PORT=8080 -DIRBLE_API_TOKEN=2e223c9909593b94fc6577361a #DIGEST=--digest /path/to/htdigest #LOCALPORT=8080 @@ -38,7 +37,7 @@ DIRBLE_API_TOKEN=2e223c9909593b94fc6577361a # Load the VERBOSE setting and other rcS variables [ -f /etc/default/rcS ] && . /etc/default/rcS -DAEMON_OPT="--user $YMPD_USER --mpdpass '$MPD_PASSWORD' --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT --dirbletoken $DIRBLE_API_TOKEN $DIGEST $LOCALPORT" +DAEMON_OPT="--user $YMPD_USER --mpdpass '$MPD_PASSWORD' --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT $DIGEST $LOCALPORT" do_start() { diff --git a/contrib/ympd.default b/contrib/ympd.default index b1bf9fd..6591516 100644 --- a/contrib/ympd.default +++ b/contrib/ympd.default @@ -2,6 +2,5 @@ MPD_HOST=localhost MPD_PORT=6600 MPD_PASSWORD= WEB_PORT=8080 -DIRBLE_API_TOKEN=2e223c9909593b94fc6577361a #DIGEST=--digest /path/to/htdigest #LOCALPORT=--localport 8080 diff --git a/contrib/ympd.service b/contrib/ympd.service index 5037dad..1502f40 100644 --- a/contrib/ympd.service +++ b/contrib/ympd.service @@ -28,11 +28,10 @@ Environment=MPD_PORT=6600 Environment=MPD_PASSWORD= Environment=WEB_PORT=8080 Environment=YMPD_USER=nobody -Environment=DIRBLE_API_TOKEN=2e223c9909593b94fc6577361a Environment=DIGEST= Environment=LOCALPORT= EnvironmentFile=/etc/default/ympd -ExecStart=/usr/bin/ympd --user $USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT --dirbletoken $DIRBLE_API_TOKEN $DIGEST $LOCALPORT +ExecStart=/usr/bin/ympd --user $USER --webport $WEB_PORT --host $MPD_HOST --port $MPD_PORT $DIGEST $LOCALPORT Type=simple [Install] diff --git a/htdocs/index.html b/htdocs/index.html index 86592e2..1cf62cf 100644 --- a/htdocs/index.html +++ b/htdocs/index.html @@ -35,7 +35,6 @@ @@ -137,28 +136,6 @@ -
-

Loading...

- - - - - - - - -
- - - - - - - - -
-
-
    diff --git a/htdocs/js/mpd.js b/htdocs/js/mpd.js index 3fbc71b..f82e866 100644 --- a/htdocs/js/mpd.js +++ b/htdocs/js/mpd.js @@ -27,13 +27,8 @@ var browsepath = ""; var lastSongTitle = ""; var current_song = new Object(); var MAX_ELEMENTS_PER_PAGE = 512; -var dirble_selected_cat = ""; -var dirble_catid = ""; -var dirble_page = 1; var isTouch = Modernizr.touch ? 1 : 0; var filter = ""; -var dirble_api_token = ""; -var dirble_stations = false; var app = $.sammy(function() { @@ -43,7 +38,6 @@ var app = $.sammy(function() { $('#breadcrump').addClass('hide'); $('#filter').addClass('hide'); $('#salamisandwich').removeClass('hide').find("tr:gt(0)").remove(); - $('#dirble_panel').addClass('hide'); socket.send('MPD_API_GET_QUEUE,'+pagination); $('#panel-heading').text("Queue"); @@ -74,7 +68,6 @@ var app = $.sammy(function() { $('#breadcrump').removeClass('hide').empty().append("
  • root
  • "); add_filter(); $('#salamisandwich').removeClass('hide').find("tr:gt(0)").remove(); - $('#dirble_panel').addClass('hide'); socket.send('MPD_API_GET_BROWSE,'+pagination+','+(browsepath ? browsepath : "/")); // Don't add all songs from root if (browsepath) { @@ -104,7 +97,6 @@ var app = $.sammy(function() { this.get(/\#\/search\/(.*)/, function() { current_app = 'search'; $('#salamisandwich').find("tr:gt(0)").remove(); - $('#dirble_panel').addClass('hide'); var searchstr = this.params['splat'][0]; $('#search > div > input').val(searchstr); @@ -113,60 +105,6 @@ var app = $.sammy(function() { $('#panel-heading').text("Search: "+searchstr); }); - this.get(/\#\/dirble\/(\d+)\/(\d+)/, function() { - - if (TOKEN === "") context.redirect("#/0"); - - prepare(); - current_app = 'dirble'; - $('#breadcrump').removeClass('hide').empty().append("
  • Categories
  • "+dirble_selected_cat+"
  • "); - $('#salamisandwich').addClass('hide'); - $('#dirble_panel').removeClass('hide'); - $('#dirble_loading').removeClass('hide'); - $('#dirble_left').find("tr:gt(0)").remove(); - $('#dirble_right').find("tr:gt(0)").remove(); - - $('#panel-heading').text("Dirble"); - $('#panel-heading-info').empty(); - - $('#dirble').addClass('active'); - - $('#next').addClass('hide'); - - if (this.params['splat'][1] > 1) $('#prev').removeClass('hide'); - else $('#prev').addClass('hide'); - - dirble_catid = this.params['splat'][0]; - dirble_page = this.params['splat'][1]; - - dirble_stations = true; - - if (dirble_api_token) { dirble_load_stations(); } - }); - - this.get(/\#\/dirble\//, function() { - - if (TOKEN === "") context.redirect("#/0"); - - prepare(); - current_app = 'dirble'; - $('#breadcrump').removeClass('hide').empty().append("
  • Categories
  • "); - $('#salamisandwich').addClass('hide'); - $('#dirble_panel').removeClass('hide'); - $('#dirble_loading').removeClass('hide'); - $('#dirble_left').find("tr:gt(0)").remove(); - $('#dirble_right').find("tr:gt(0)").remove(); - - $('#panel-heading').text("Dirble"); - $('#panel-heading-info').empty(); - - $('#dirble').addClass('active'); - - dirble_stations = false; - - if (dirble_api_token) { dirble_load_categories(); } - }); - this.get("/", function(context) { context.redirect("#/0"); }); @@ -260,8 +198,6 @@ $(document).ready(function(){ break; } }, true); - - if (TOKEN === "") $('#dirble').addClass('hide'); }); function webSocketConnect() { @@ -282,8 +218,6 @@ function webSocketConnect() { app.run(); /* emit initial request for output names */ socket.send('MPD_API_GET_OUTPUTS'); - /* emit initial request for dirble api token */ - socket.send('MPD_API_GET_DIRBLEAPITOKEN'); } socket.onmessage = function got_packet(msg) { @@ -667,19 +601,7 @@ function webSocketConnect() { if(obj.data.passwort_set) $('#mpd_password_set').removeClass('hide'); break; - case 'dirbleapitoken': - dirble_api_token = obj.data; - - if (dirble_api_token) { - $('#dirble').removeClass('hide'); - - if (dirble_stations) { dirble_load_stations(); } - else { dirble_load_categories(); } - - } else { - $('#dirble').addClass('hide'); - } - break; + case 'error': $('.top-right').notify({ message:{text: obj.data}, @@ -969,16 +891,12 @@ $('.page-btn').on('click', function (e) { switch ($(this).text()) { case "Next": - if (current_app == "dirble") dirble_page++; - else pagination += MAX_ELEMENTS_PER_PAGE; + pagination += MAX_ELEMENTS_PER_PAGE; break; case "Previous": - if (current_app == "dirble") dirble_page-- - else { - pagination -= MAX_ELEMENTS_PER_PAGE; - if(pagination <= 0) - pagination = 0; - } + pagination -= MAX_ELEMENTS_PER_PAGE; + if(pagination <= 0) + pagination = 0; break; } @@ -989,9 +907,6 @@ $('.page-btn').on('click', function (e) { case "browse": app.setLocation('#/browse/'+pagination+'/'+browsepath); break; - case "dirble": - app.setLocation("#/dirble/"+dirble_catid+"/"+dirble_page); - break; } e.preventDefault(); }); @@ -1085,161 +1000,6 @@ $(document).keydown(function(e){ e.preventDefault(); }); -function dirble_load_categories() { - - dirble_page = 1; - - $.getJSON( "https://api.dirble.com/v2/categories?token=" + dirble_api_token, function( data ) { - - $('#dirble_loading').addClass('hide'); - - data = data.sort(function(a, b) { - return (a.title > b.title) ? 1 : 0; - }); - - var max = data.length - data.length%2; - - for(i = 0; i < max; i+=2) { - - $('#dirble_left > tbody').append( - ""+data[i].title+"" - ); - - $('#dirble_right > tbody').append( - ""+data[i+1].title+"" - ); - } - - if (max != data.length) { - $('#dirble_left > tbody').append( - ""+data[max].title+"" - ); - } - - $('#dirble_left > tbody > tr > td').on({ - click: function() { - dirble_selected_cat = $(this).text(); - dirble_catid = $(this).attr("catid"); - app.setLocation("#/dirble/"+dirble_catid+"/"+dirble_page); - } - }); - - $('#dirble_right > tbody > tr > td').on({ - click: function() { - dirble_selected_cat = $(this).text(); - dirble_catid = $(this).attr("catid"); - app.setLocation("#/dirble/"+dirble_catid+"/"+dirble_page); - } - }); - }); -} - - -function dirble_load_stations() { - - $.getJSON( "https://api.dirble.com/v2/category/"+dirble_catid+"/stations?page="+dirble_page+"&per_page=20&token=" + dirble_api_token, function( data ) { - - $('#dirble_loading').addClass('hide'); - if (data.length == 20) $('#next').removeClass('hide'); - - var max = data.length - data.length%2; - - for(i = 0; i < max; i+=2) { - - $('#dirble_left > tbody').append( - ""+data[i].name+"" - ); - $('#dirble_right > tbody').append( - ""+data[i+1].name+"" - ); - } - - if (max != data.length) { - $('#dirble_left > tbody').append( - ""+data[max].name+"" - ); - } - - $('#dirble_left > tbody > tr > td').on({ - click: function() { - var _this = $(this); - - $.getJSON( "https://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=" + dirble_api_token, function( data ) { - - socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); - $('.top-right').notify({ - message:{ - text: _this.text() + " added" - } - }).show(); - }); - }, - mouseenter: function() { - var _this = $(this); - - $(this).last().append( - "" + - "").find('a').click(function(e) { - e.stopPropagation(); - - $.getJSON( "https://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=" + dirble_api_token, function( data ) { - - socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); - $('.top-right').notify({ - message:{ - text: _this.text() + " added" - } - }).show(); - }); - }).fadeTo('fast',1); - }, - - mouseleave: function(){ - $(this).last().find("a").stop().remove(); - } - }); - - $('#dirble_right> tbody > tr > td').on({ - click: function() { - var _this = $(this); - - $.getJSON( "https://api.dirble.com/v2/station/"+$(this).attr("radioid")+"?token=" + dirble_api_token, function( data ) { - - socket.send("MPD_API_ADD_TRACK," + data.streams[0].stream); - $('.top-right').notify({ - message:{ - text: _this.text() + " added" - } - }).show(); - }); - }, - mouseenter: function() { - var _this = $(this); - - $(this).last().append( - "" + - "").find('a').click(function(e) { - e.stopPropagation(); - - $.getJSON( "https://api.dirble.com/v2/station/"+_this.attr("radioid")+"?token=" + dirble_api_token, function( data ) { - - socket.send("MPD_API_ADD_PLAY_TRACK," + data.streams[0].stream); - $('.top-right').notify({ - message:{ - text: _this.text() + " added" - } - }).show(); - }); - }).fadeTo('fast',1); - }, - - mouseleave: function(){ - $(this).last().find("a").stop().remove(); - } - }); - }); -} - function set_filter (c) { filter = c; $('#filter > a').removeClass('active'); diff --git a/src/mpd_client.c b/src/mpd_client.c index 5700f0b..cf6b847 100644 --- a/src/mpd_client.c +++ b/src/mpd_client.c @@ -30,7 +30,6 @@ /* forward declaration */ static int mpd_notify_callback(struct mg_connection *c, enum mg_event ev); -char dirble_api_token[28]; struct t_mpd mpd; const char * mpd_cmd_strs[] = { @@ -66,8 +65,7 @@ int callback_mpd(struct mg_connection *c) return MG_TRUE; if(mpd.conn_state != MPD_CONNECTED && cmd_id != MPD_API_SET_MPDHOST && - cmd_id != MPD_API_GET_MPDHOST && cmd_id != MPD_API_SET_MPDPASS && - cmd_id != MPD_API_GET_DIRBLEAPITOKEN) + cmd_id != MPD_API_GET_MPDHOST && cmd_id != MPD_API_SET_MPDPASS) return MG_TRUE; switch(cmd_id) @@ -293,10 +291,6 @@ out_host_change: "{\"host\" : \"%s\", \"port\": \"%d\", \"passwort_set\": %s}" "}", mpd.host, mpd.port, mpd.password ? "true" : "false"); break; - case MPD_API_GET_DIRBLEAPITOKEN: - n = snprintf(mpd.buf, MAX_SIZE, "{\"type\":\"dirbleapitoken\", \"" - "data\": \"%s\"}", dirble_api_token); - break; case MPD_API_SET_MPDPASS: p_charbuf = strdup(c->content); if(strcmp(strtok(p_charbuf, ","), "MPD_API_SET_MPDPASS")) diff --git a/src/mpd_client.h b/src/mpd_client.h index cf89b72..a3585f5 100644 --- a/src/mpd_client.h +++ b/src/mpd_client.h @@ -40,7 +40,6 @@ X(MPD_API_GET_QUEUE) \ X(MPD_API_GET_BROWSE) \ X(MPD_API_GET_MPDHOST) \ - X(MPD_API_GET_DIRBLEAPITOKEN) \ X(MPD_API_ADD_TRACK) \ X(MPD_API_ADD_PLAY_TRACK) \ X(MPD_API_ADD_PLAYLIST) \ @@ -102,8 +101,6 @@ struct t_mpd { extern struct t_mpd mpd; -extern char dirble_api_token[28]; - struct t_mpd_client_session { int song_id; unsigned queue_version; diff --git a/src/ympd.c b/src/ympd.c index 8d3f90d..3464cc6 100644 --- a/src/ympd.c +++ b/src/ympd.c @@ -101,7 +101,6 @@ int main(int argc, char **argv) {"port", required_argument, 0, 'p'}, {"localport", required_argument, 0, 'l'}, {"webport", required_argument, 0, 'w'}, - {"dirbletoken", required_argument, 0, 'd'}, {"user", required_argument, 0, 'u'}, {"version", no_argument, 0, 'v'}, {"help", no_argument, 0, 0 }, @@ -127,9 +126,6 @@ int main(int argc, char **argv) case 'w': webport = strdup(optarg); break; - case 'd': - strncpy(dirble_api_token, optarg, sizeof(dirble_api_token)); - break; case 'u': run_as_user = strdup(optarg); break; @@ -153,7 +149,6 @@ int main(int argc, char **argv) " -l, --localport \t\tskip authorization for local port\n" " -w, --webport [ip:]\tlisten interface/port for webserver [8080]\n" " -u, --user \t\tdrop priviliges to user after socket bind\n" - " -d, --dirbletoken \tDirble API token\n" " -v, --version\t\t\tget version\n" " -m, --mpdpass \tspecifies the password to use when connecting to mpd\n" " --help\t\t\t\tthis help\n"