summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Grassberger <petertheone@gmail.com>2015-12-27 23:36:51 (GMT)
committerPeter Grassberger <petertheone@gmail.com>2015-12-27 23:36:51 (GMT)
commitd4af036bd683a8777e7251726168b7833272ea26 (patch)
tree95f1f36c17b7e3ac943735165f342bcf1886abd5
parenta60b7236d63882b73a02c26c6688e380810802cb (diff)
musicpools: get dropboxes and update selector
-rw-r--r--www/index.html6
-rw-r--r--www/js/musicpools.js69
2 files changed, 75 insertions, 0 deletions
diff --git a/www/index.html b/www/index.html
index fda9f7f..c082c43 100644
--- a/www/index.html
+++ b/www/index.html
@@ -161,6 +161,12 @@
<div id="app-musicpools" class="container-fluid">
<div class="alertbox"></div>
+ <div class="row-fluid">
+ <form class="well form-inline">
+ <label class="control-label" for="musicpool-selector"><h3>Musikpool auswählen</h3></label>&nbsp;&nbsp;
+ <select id="musicpool-selector" class="main-selector">
+ </select>
+ </form>
<div class="span12">
<h1>Musikpools</h1>
<p>
diff --git a/www/js/musicpools.js b/www/js/musicpools.js
index 1c968f9..cfaec13 100644
--- a/www/js/musicpools.js
+++ b/www/js/musicpools.js
@@ -22,8 +22,77 @@
'use strict';
+var rivendell = null;
+var musicpools = null;
+
function musicpools_init() {
+ rivendell = new Rivendell.Rivendell(auth_username, auth_token, '/rd-bin/rdxport.cgi');
+ rivendell.setListDropboxesEndpoint('/rh-bin/listdropboxes.cgi');
+ musicpools = new Musicpools();
}
function musicpools_cleanup() {
+ rivendell = null;
}
+
+// this and jinglegroups are basicly the same
+var Musicpools = function() {
+ // todo: get current Pool Id from session like shows?
+ this.currentPoolId = null;
+ this.musicpools = [];
+ this.fetch();
+};
+
+Musicpools.prototype.fetch = function() {
+ var self = this;
+
+ rivendell.listDropboxes(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(),
+ $('group', groupXml).text(),
+ $('group-description', groupXml).text(),
+ $('group-low-cart', groupXml).text(),
+ $('group-high-cart', groupXml).text(),
+ $('normalization-level', groupXml).text(),
+ $('autotrim-level', groupXml).text()
+ );
+
+ self.musicpools.push(musicpool);
+ });
+
+ self.updateSelector();
+ });
+};
+
+Musicpools.prototype.updateSelector = function() {
+ $('#musicpool-selector').find('option').remove();
+
+ // todo: add from list
+ this.musicpools.each(function(index, musicpool) {
+ var name = musicpool.title + ' (' + musicpool.clock + ')';
+ $('#musicpool-selector').append($('<option>').attr('value', musicpool.title).text(name));
+ });
+
+};
+
+// this and jinglegroup are basicly the same thing
+var Musicpool = function(title, clock, groupName, description, lowcart, highcart, normlevel, trimlevel) {
+ this.title = title;
+ this.clock = clock;
+
+ this.groupName = groupName;
+ this.description = description;
+ this.lowcart = lowcart;
+ this.highcart = highcart;
+ this.normlevel = normlevel;
+ this.trimlevel = trimlevel;
+};