summaryrefslogtreecommitdiff
path: root/www/js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js')
-rw-r--r--www/js/musicpools.js69
-rw-r--r--www/js/shows.js49
2 files changed, 93 insertions, 25 deletions
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;
+};
diff --git a/www/js/shows.js b/www/js/shows.js
index 4dcb050..b050c25 100644
--- a/www/js/shows.js
+++ b/www/js/shows.js
@@ -297,32 +297,31 @@ function shows_updateList(data, status, req) {
var dblist = $(data).find("dropboxList");
var dbs = dblist.children();
dbs.each(function() {
- 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 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);
}
- );
+ });
$('#show-selector').val(shows_currentid);
shows_showSelected();
}