summaryrefslogtreecommitdiff
path: root/www/js/shows.js
diff options
context:
space:
mode:
Diffstat (limited to 'www/js/shows.js')
-rw-r--r--www/js/shows.js45
1 files changed, 27 insertions, 18 deletions
diff --git a/www/js/shows.js b/www/js/shows.js
index 33beb60..1dde924 100644
--- a/www/js/shows.js
+++ b/www/js/shows.js
@@ -20,6 +20,7 @@
* along with rhwebimport. If not, see <http://www.gnu.org/licenses/>.
*/
+var rivendell = null;
var shows_currentid;
var shows_list = [];
var shows_current;
@@ -29,21 +30,25 @@ var shows_clock;
function shows_deleteCart(cart) {
- data = { COMMAND: 13, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: cart };
- $.post("/rd-bin/rdxport.cgi", data, null, "xml").done(function() { shows_updateGroupCartInfo(cart); });
+ rivendell.removeCart(cart, function() {
+ shows_updateGroupCartInfo(cart);
+ });
}
function shows_importAddCut(cart, dz, file) {
- data = { COMMAND: 10, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: cart };
- $.post("/rd-bin/rdxport.cgi", data, null, "xml").done(function() { dz.processQueue(); })
- .fail(function(xhr, status, err) { shows_importFileUploadError(cart, dz, file, err, xhr); });
+ rivendell.addCut(cart, function() {
+ dz.processQueue();
+ }).fail(function(xhr, status, err) {
+ shows_importFileUploadError(cart, dz, file, err, xhr);
+ });
}
function shows_importAddCart(cart, dz, file) {
- data = { COMMAND: 12, LOGIN_NAME: auth_username, PASSWORD: auth_token,
- GROUP_NAME: shows_current.group.name, TYPE: 'audio', CART_NUMBER: cart };
- $.post("/rd-bin/rdxport.cgi", data, null, "xml").done(function() { shows_importAddCut(cart, dz, file); })
- .fail(function(xhr, status, err) { shows_importFileUploadError(cart, dz, file, err, xhr); });
+ rivendell.addCart(shows_current.group.name, 'audio', cart, function() {
+ shows_importAddCut(cart, dz, file);
+ }).fail(function(xhr, status, err) {
+ shows_importFileUploadError(cart, dz, file, err, xhr);
+ });
}
function shows_importCartCancel(cart, dz) {
@@ -206,10 +211,13 @@ function shows_newImportErrorEntry(cart, msg) {
}
function shows_updateGroupCartInfo(cart) {
- data = { COMMAND: 7, LOGIN_NAME: auth_username, PASSWORD: auth_token, CART_NUMBER: cart, INCLUDE_CUTS: 1 };
- $.post("/rd-bin/rdxport.cgi", data, shows_updateGroupCartList, "xml")
- .fail(function() { delete shows_group_carts[cart]; shows_redrawCartEntry(cart); })
- .done(function() { shows_redrawCartEntry(cart); });
+ rivendell.listCart(cart, 1, function(data) {
+ shows_updateGroupCartList(data);
+ shows_redrawCartEntry(cart);
+ }).fail(function() {
+ delete shows_group_carts[cart];
+ shows_redrawCartEntry(cart);
+ });
}
function shows_redrawCartEntry(cart) {
@@ -223,7 +231,7 @@ function shows_updateCartListing() {
});
}
-function shows_updateGroupCartList(data, status, req) {
+function shows_updateGroupCartList(data) {
var cartlist = $(data).find("cartList");
var carts = cartlist.children();
carts.each(function() {
@@ -268,12 +276,10 @@ function shows_showSelected() {
$('#show-length').text(shows_current.length + ' Min.');
shows_log_carts = [];
- data = { COMMAND: 22, LOGIN_NAME: auth_username, PASSWORD: auth_token, NAME: shows_current.log };
- lcd = $.post("/rd-bin/rdxport.cgi", data, shows_updateLogCartList, "xml");
+ var lcd = rivendell.listLog(shows_current.log, shows_updateLogCartList);
shows_group_carts = {};
- data = { COMMAND: 6, LOGIN_NAME: auth_username, PASSWORD: auth_token, GROUP_NAME: shows_current.group.name, INCLUDE_CUTS: 1 };
- gcd = $.post("/rd-bin/rdxport.cgi", data, shows_updateGroupCartList, "xml");
+ var gcd = rivendell.listCarts(shows_current.group.name, 1, shows_updateGroupCartList);
$.when(lcd, gcd).done(
function(lcres, gcres) {
@@ -322,6 +328,8 @@ function shows_updateList(data, status, req) {
}
function shows_init() {
+ rivendell = new Rivendell.Rivendell(auth_username, auth_token, '/rd-bin/rdxport.cgi');
+ rivendell.setListDropboxesEndpoint('/rh-bin/listdropboxes.cgi');
shows_currentid = sessionStorage.getItem("shows_currentid");
shows_list = [];
data = { LOGIN_NAME: auth_username, PASSWORD: auth_token };
@@ -337,4 +345,5 @@ function shows_cleanup() {
shows_list = [];
shows_group_carts = {};
shows_log_carts = [];
+ rivendell = null;
}