diff options
author | Peter Grassberger <petertheone@gmail.com> | 2015-12-28 12:27:07 (GMT) |
---|---|---|
committer | Peter Grassberger <petertheone@gmail.com> | 2015-12-28 12:27:07 (GMT) |
commit | cb39c5af79db63c721123d9f488eda0d9c4fda63 (patch) | |
tree | b93b8893de09ccd7df81b970a2923a361c94b582 | |
parent | 17d6568c4da2901e083770d3a6f683d3d98ff488 (diff) |
client uses type to filter dropboxes
-rw-r--r-- | www/js/jingles.js | 6 | ||||
-rw-r--r-- | www/js/musicpools.js | 8 | ||||
-rw-r--r-- | www/js/rivendell.rh.js | 5 | ||||
-rw-r--r-- | www/js/shows.js | 47 |
4 files changed, 28 insertions, 38 deletions
diff --git a/www/js/jingles.js b/www/js/jingles.js index ca52269..1aa2489 100644 --- a/www/js/jingles.js +++ b/www/js/jingles.js @@ -51,13 +51,9 @@ JingleGroupList.prototype.fetch = function() { $('#app-jingles .groups').html(''); var self = this; - rivendell.listDropboxes(function(groupsXml, status, req) { + rivendell.listDropboxes('jingle', function(groupsXml, status, req) { var dbs = $(groupsXml).find("dropboxList").children(); dbs.each(function(index, groupXml) { - if ($('type', groupXml).text() !== 'jingle') { - return true; // continue - } - var jingleGroup = new JingleGroup( $('jingle-title', groupXml).text(), $('group', groupXml).text(), diff --git a/www/js/musicpools.js b/www/js/musicpools.js index cfaec13..2035dfc 100644 --- a/www/js/musicpools.js +++ b/www/js/musicpools.js @@ -46,15 +46,11 @@ var Musicpools = function() { Musicpools.prototype.fetch = function() { var self = this; - rivendell.listDropboxes(function(groupsXml, status, req) { + rivendell.listDropboxes('musicpool', function(groupsXml, status, req) { self.musicpools = []; var dbs = $(groupsXml).find("dropboxList").children(); dbs.each(function(index, groupXml) { - if ($('type', groupXml).text() !== 'musicpool') { - return true; // continue - } - var musicpool = new Musicpool( $('musicpool-title', groupXml).text(), $('musicpool-clock', groupXml).text(), @@ -77,7 +73,7 @@ Musicpools.prototype.updateSelector = function() { $('#musicpool-selector').find('option').remove(); // todo: add from list - this.musicpools.each(function(index, musicpool) { + $(this.musicpools).each(function(index, musicpool) { var name = musicpool.title + ' (' + musicpool.clock + ')'; $('#musicpool-selector').append($('<option>').attr('value', musicpool.title).text(name)); }); diff --git a/www/js/rivendell.rh.js b/www/js/rivendell.rh.js index 25891f2..7f92222 100644 --- a/www/js/rivendell.rh.js +++ b/www/js/rivendell.rh.js @@ -29,10 +29,11 @@ Rivendell.Rivendell.prototype.setMusicgridEndpoint = function(musicgridEndpoint) this.musicgridEndpoint = musicgridEndpoint; }; -Rivendell.Rivendell.prototype.listDropboxes = function(success) { +Rivendell.Rivendell.prototype.listDropboxes = function(type, success) { var command = { LOGIN_NAME: this.username, - PASSWORD: this.token + PASSWORD: this.token, + TYPE: type }; return $.post(this.listDropboxesEndpoint, command, success, 'xml'); }; diff --git a/www/js/shows.js b/www/js/shows.js index b050c25..61c774e 100644 --- a/www/js/shows.js +++ b/www/js/shows.js @@ -297,30 +297,27 @@ function shows_updateList(data, status, req) { var dblist = $(data).find("dropboxList"); var dbs = dblist.children(); dbs.each(function() { - var type = $(this).find('type').text(); - if(type == 'show') { - var show = { - id: $(this).find('show-id').text(), - title: $(this).find('show-title').text(), - dow: $(this).find('show-dayofweek').text(), - rhythm: $(this).find('show-rhythm').text(), - starttime: $(this).find('show-starttime').text(), - length: $(this).find('show-length').text(), - log: $(this).find('show-log').text(), - group: { - name: $(this).find('group').text(), - lowcart: $(this).find('group-low-cart').text(), - highcart: $(this).find('group-high-cart').text() - }, - normlevel: $(this).find('normalization-level').text(), - trimlevel: $(this).find('autotrim-level').text() - }; - - var name = show.title + ' (' + show.rhythm + ', ' + weekday[show.dow] + ', ' + show.starttime + ', ' + show.length + ' Min.)'; - $('#show-selector').append($('<option>').attr('value',show.id).text(name)); - - shows_list.push(show); - } + var show = { + id: $(this).find('show-id').text(), + title: $(this).find('show-title').text(), + dow: $(this).find('show-dayofweek').text(), + rhythm: $(this).find('show-rhythm').text(), + starttime: $(this).find('show-starttime').text(), + length: $(this).find('show-length').text(), + log: $(this).find('show-log').text(), + group: { + name: $(this).find('group').text(), + lowcart: $(this).find('group-low-cart').text(), + highcart: $(this).find('group-high-cart').text() + }, + normlevel: $(this).find('normalization-level').text(), + trimlevel: $(this).find('autotrim-level').text() + }; + + var name = show.title + ' (' + show.rhythm + ', ' + weekday[show.dow] + ', ' + show.starttime + ', ' + show.length + ' Min.)'; + $('#show-selector').append($('<option>').attr('value',show.id).text(name)); + + shows_list.push(show); }); $('#show-selector').val(shows_currentid); shows_showSelected(); @@ -331,7 +328,7 @@ function shows_init() { rivendell.setListDropboxesEndpoint('/rh-bin/listdropboxes.cgi'); shows_currentid = sessionStorage.getItem("shows_currentid"); shows_list = []; - rivendell.listDropboxes(shows_updateList); + rivendell.listDropboxes('show', shows_updateList); drawClock('Do, 1.1.1970', '00:00:00', 0); clock_add_callback(drawClock); } |