mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
move completely to fetch
This commit is contained in:
parent
ee899a7332
commit
9932bc3eb5
168 changed files with 948 additions and 945 deletions
|
@ -1,24 +0,0 @@
|
||||||
(function (globalScope) {
|
|
||||||
|
|
||||||
globalScope.HttpClient = {
|
|
||||||
|
|
||||||
param: function (params) {
|
|
||||||
return jQuery.param(params);
|
|
||||||
},
|
|
||||||
|
|
||||||
send: function (request) {
|
|
||||||
|
|
||||||
request.timeout = request.timeout || 30000;
|
|
||||||
|
|
||||||
try {
|
|
||||||
return jQuery.ajax(request);
|
|
||||||
} catch (err) {
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
|
||||||
deferred.reject();
|
|
||||||
return deferred.promise();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
})(window);
|
|
|
@ -68,8 +68,9 @@
|
||||||
|
|
||||||
if (promise == null) {
|
if (promise == null) {
|
||||||
|
|
||||||
promise = self.getUser(self.getCurrentUserId()).fail(function () {
|
promise = self.getUser(self.getCurrentUserId()).catch(function (err) {
|
||||||
currentUserPromise = null;
|
currentUserPromise = null;
|
||||||
|
throw err;
|
||||||
});
|
});
|
||||||
|
|
||||||
currentUserPromise = promise;
|
currentUserPromise = promise;
|
||||||
|
@ -123,7 +124,7 @@
|
||||||
name = name.split('&').join('-');
|
name = name.split('&').join('-');
|
||||||
name = name.split('?').join('-');
|
name = name.split('?').join('-');
|
||||||
|
|
||||||
var val = HttpClient.param({ name: name });
|
var val = paramsToString({ name: name });
|
||||||
return val.substring(val.indexOf('=') + 1).replace("'", '%27');
|
return val.substring(val.indexOf('=') + 1).replace("'", '%27');
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -188,27 +189,35 @@
|
||||||
throw new Error("Request cannot be null");
|
throw new Error("Request cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (includeAuthorization !== false) {
|
return self.fetch(request, includeAuthorization);
|
||||||
|
|
||||||
request.headers = request.headers || {};
|
|
||||||
self.setRequestHeaders(request.headers);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self.enableAutomaticNetworking === false || request.type != "GET") {
|
|
||||||
logger.log('Requesting url without automatic networking: ' + request.url);
|
|
||||||
return HttpClient.send(request).fail(onRequestFail);
|
|
||||||
}
|
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
|
||||||
self.ajaxWithFailover(request, deferred, true);
|
|
||||||
return deferred.promise();
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function getFetchPromise(request) {
|
function getFetchPromise(request) {
|
||||||
return fetch(request.url, {
|
|
||||||
headers: request.headers,
|
var headers = request.headers || {};
|
||||||
|
|
||||||
|
if (request.dataType == 'json') {
|
||||||
|
headers.accept = 'application/json';
|
||||||
|
}
|
||||||
|
|
||||||
|
var fetchRequest = {
|
||||||
|
headers: headers,
|
||||||
method: request.type
|
method: request.type
|
||||||
});
|
};
|
||||||
|
|
||||||
|
if (request.data) {
|
||||||
|
|
||||||
|
if (typeof request.data === 'string') {
|
||||||
|
fetchRequest.body = request.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contentType) {
|
||||||
|
|
||||||
|
headers['Content-Type'] = request.contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetch(request.url, fetchRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -220,52 +229,51 @@
|
||||||
throw new Error("Request cannot be null");
|
throw new Error("Request cannot be null");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
request.headers = request.headers || {};
|
||||||
|
|
||||||
if (includeAuthorization !== false) {
|
if (includeAuthorization !== false) {
|
||||||
|
|
||||||
request.headers = request.headers || {};
|
|
||||||
self.setRequestHeaders(request.headers);
|
self.setRequestHeaders(request.headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.enableAutomaticNetworking === false || request.type != "GET") {
|
if (self.enableAutomaticNetworking === false || request.type != "GET") {
|
||||||
logger.log('Requesting url without automatic networking: ' + request.url);
|
logger.log('Requesting url without automatic networking: ' + request.url);
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return getFetchPromise(request).then(function (response) {
|
||||||
|
|
||||||
getFetchPromise(request).then(function (response) {
|
|
||||||
|
|
||||||
if (response.status < 400) {
|
if (response.status < 400) {
|
||||||
resolve(response);
|
|
||||||
|
if (request.dataType == 'json' || request.headers.accept == 'application/json') {
|
||||||
|
return response.json();
|
||||||
|
} else {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
onFetchFail(request.url, response);
|
onFetchFail(request.url, response);
|
||||||
reject();
|
return Promise.reject(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, function () {
|
}, function () {
|
||||||
onFetchFail(request.url, {});
|
onFetchFail(request.url, {});
|
||||||
reject();
|
return Promise.reject({});
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return new Promise(function (resolve, reject) {
|
return self.fetchWithFailover(request, true);
|
||||||
|
|
||||||
self.fetchWithFailover(request, resolve, reject, true);
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
self.fetchJSON = function (url, includeAuthorization) {
|
self.getJSON = function (url, includeAuthorization) {
|
||||||
|
|
||||||
return self.fetch({
|
return self.fetch({
|
||||||
|
|
||||||
url: url,
|
url: url,
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
|
dataType: 'json',
|
||||||
headers: {
|
headers: {
|
||||||
accept: 'application/json'
|
accept: 'application/json'
|
||||||
}
|
}
|
||||||
|
|
||||||
}, includeAuthorization).then(function (response) {
|
}, includeAuthorization);
|
||||||
return response.json();
|
|
||||||
});
|
|
||||||
};
|
};
|
||||||
|
|
||||||
function switchConnectionMode(connectionMode) {
|
function switchConnectionMode(connectionMode) {
|
||||||
|
@ -303,15 +311,15 @@
|
||||||
|
|
||||||
var timeout = connectionMode == MediaBrowser.ConnectionMode.Local ? 7000 : 15000;
|
var timeout = connectionMode == MediaBrowser.ConnectionMode.Local ? 7000 : 15000;
|
||||||
|
|
||||||
HttpClient.send({
|
fetch(url + "/system/info/public", {
|
||||||
|
|
||||||
type: "GET",
|
method: 'GET',
|
||||||
url: url + "/system/info/public",
|
accept: 'application/json'
|
||||||
dataType: "json",
|
|
||||||
|
|
||||||
timeout: timeout
|
// Commenting this out since the fetch api doesn't have a timeout option yet
|
||||||
|
//timeout: timeout
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
logger.log("Reconnect succeeded to " + url);
|
logger.log("Reconnect succeeded to " + url);
|
||||||
|
|
||||||
|
@ -320,7 +328,7 @@
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
logger.log("Reconnect attempt failed to " + url);
|
logger.log("Reconnect attempt failed to " + url);
|
||||||
|
|
||||||
|
@ -347,19 +355,24 @@
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
self.fetchWithFailover = function (request, resolve, reject, enableReconnection) {
|
self.fetchWithFailover = function (request, enableReconnection) {
|
||||||
|
|
||||||
logger.log("Requesting " + request.url);
|
logger.log("Requesting " + request.url);
|
||||||
|
|
||||||
request.timeout = 30000;
|
request.timeout = 30000;
|
||||||
|
|
||||||
getFetchPromise(request).then(function (response) {
|
return getFetchPromise(request).then(function (response) {
|
||||||
|
|
||||||
if (response.status < 400) {
|
if (response.status < 400) {
|
||||||
resolve(response);
|
|
||||||
|
if (request.dataType == 'json' || request.headers.accept == 'application/json') {
|
||||||
|
return response.json();
|
||||||
|
} else {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
onFetchFail(request.url, response);
|
onFetchFail(request.url, response);
|
||||||
reject();
|
return Promise.reject(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
}, function () {
|
}, function () {
|
||||||
|
@ -373,18 +386,18 @@
|
||||||
|
|
||||||
var previousServerAddress = self.serverAddress();
|
var previousServerAddress = self.serverAddress();
|
||||||
|
|
||||||
tryReconnect().done(function () {
|
tryReconnect().then(function () {
|
||||||
|
|
||||||
logger.log("Reconnect succeesed");
|
logger.log("Reconnect succeesed");
|
||||||
request.url = request.url.replace(previousServerAddress, self.serverAddress());
|
request.url = request.url.replace(previousServerAddress, self.serverAddress());
|
||||||
|
|
||||||
self.fetchWithFailover(request, resolve, reject, false);
|
self.fetchWithFailover(request, false);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
logger.log("Reconnect failed");
|
logger.log("Reconnect failed");
|
||||||
onFetchFail(request.url, {});
|
onFetchFail(request.url, {});
|
||||||
reject();
|
return Promise.reject({});
|
||||||
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -392,55 +405,7 @@
|
||||||
logger.log("Reporting request failure");
|
logger.log("Reporting request failure");
|
||||||
|
|
||||||
onFetchFail(request.url, {});
|
onFetchFail(request.url, {});
|
||||||
reject();
|
return Promise.reject({});
|
||||||
}
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
self.ajaxWithFailover = function (request, deferred, enableReconnection) {
|
|
||||||
|
|
||||||
logger.log("Requesting " + request.url);
|
|
||||||
|
|
||||||
request.timeout = 30000;
|
|
||||||
|
|
||||||
HttpClient.send(request).done(function (response) {
|
|
||||||
|
|
||||||
deferred.resolve(response, 0);
|
|
||||||
|
|
||||||
}).fail(function (e, textStatus) {
|
|
||||||
|
|
||||||
logger.log("Request failed with textStatus " + textStatus + " to " + request.url);
|
|
||||||
|
|
||||||
var statusCode = parseInt(e.status || '0');
|
|
||||||
var isUserErrorCode = statusCode >= 400 && statusCode < 500;
|
|
||||||
|
|
||||||
// http://api.jquery.com/jQuery.ajax/
|
|
||||||
if (enableReconnection && !isUserErrorCode) {
|
|
||||||
|
|
||||||
logger.log("Attempting reconnection");
|
|
||||||
|
|
||||||
var previousServerAddress = self.serverAddress();
|
|
||||||
|
|
||||||
tryReconnect().done(function () {
|
|
||||||
|
|
||||||
logger.log("Reconnect succeesed");
|
|
||||||
request.url = request.url.replace(previousServerAddress, self.serverAddress());
|
|
||||||
|
|
||||||
self.ajaxWithFailover(request, deferred, false);
|
|
||||||
|
|
||||||
}).fail(function () {
|
|
||||||
|
|
||||||
logger.log("Reconnect failed");
|
|
||||||
onRetryRequestFail(request);
|
|
||||||
deferred.reject();
|
|
||||||
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
|
|
||||||
logger.log("Reporting request failure");
|
|
||||||
|
|
||||||
onRetryRequestFail(request);
|
|
||||||
deferred.reject();
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -453,14 +418,20 @@
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getJSON = function (url) {
|
function paramsToString(params) {
|
||||||
|
|
||||||
return self.ajax({
|
var values = [];
|
||||||
type: "GET",
|
|
||||||
url: url,
|
for (var key in params) {
|
||||||
dataType: "json"
|
|
||||||
});
|
var value = params[key];
|
||||||
};
|
|
||||||
|
if (value) {
|
||||||
|
values.push(encodeURIComponent(key) + "=" + encodeURIComponent(value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return values.join('&');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates an api url based on a handler name and query string parameters
|
* Creates an api url based on a handler name and query string parameters
|
||||||
|
@ -490,7 +461,7 @@
|
||||||
url += name;
|
url += name;
|
||||||
|
|
||||||
if (params) {
|
if (params) {
|
||||||
params = HttpClient.param(params);
|
params = paramsToString(params);
|
||||||
if (params) {
|
if (params) {
|
||||||
url += "?" + params;
|
url += "?" + params;
|
||||||
}
|
}
|
||||||
|
@ -632,7 +603,7 @@
|
||||||
|
|
||||||
var now = new Date().getTime();
|
var now = new Date().getTime();
|
||||||
|
|
||||||
self.get(url).done(function () {
|
self.get(url).then(function () {
|
||||||
|
|
||||||
var responseTimeSeconds = (new Date().getTime() - now) / 1000;
|
var responseTimeSeconds = (new Date().getTime() - now) / 1000;
|
||||||
var bytesPerSecond = byteSize / responseTimeSeconds;
|
var bytesPerSecond = byteSize / responseTimeSeconds;
|
||||||
|
@ -640,7 +611,7 @@
|
||||||
|
|
||||||
deferred.resolveWith(null, [bitrate]);
|
deferred.resolveWith(null, [bitrate]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -653,24 +624,24 @@
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
// First try a small amount so that we don't hang up their mobile connection
|
// First try a small amount so that we don't hang up their mobile connection
|
||||||
self.getDownloadSpeed(1000000).done(function (bitrate) {
|
self.getDownloadSpeed(1000000).then(function (bitrate) {
|
||||||
|
|
||||||
if (bitrate < 1000000) {
|
if (bitrate < 1000000) {
|
||||||
deferred.resolveWith(null, [Math.round(bitrate * .8)]);
|
deferred.resolveWith(null, [Math.round(bitrate * .8)]);
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
// If that produced a fairly high speed, try again with a larger size to get a more accurate result
|
// If that produced a fairly high speed, try again with a larger size to get a more accurate result
|
||||||
self.getDownloadSpeed(2400000).done(function (bitrate) {
|
self.getDownloadSpeed(2400000).then(function (bitrate) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [Math.round(bitrate * .8)]);
|
deferred.resolveWith(null, [Math.round(bitrate * .8)]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -692,7 +663,7 @@
|
||||||
self.getUrl("Users/" + userId + "/Items/" + itemId) :
|
self.getUrl("Users/" + userId + "/Items/" + itemId) :
|
||||||
self.getUrl("Items/" + itemId);
|
self.getUrl("Items/" + itemId);
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -706,7 +677,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("Users/" + userId + "/Items/Root");
|
var url = self.getUrl("Users/" + userId + "/Items/Root");
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getNotificationSummary = function (userId) {
|
self.getNotificationSummary = function (userId) {
|
||||||
|
@ -770,7 +741,8 @@
|
||||||
return self.ajax({
|
return self.ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url
|
url: url
|
||||||
}).always(done);
|
|
||||||
|
}).then(done, done);
|
||||||
}
|
}
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
@ -1215,7 +1187,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("System/Info");
|
var url = self.getUrl("System/Info");
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1225,7 +1197,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("System/Info/Public");
|
var url = self.getUrl("System/Info/Public");
|
||||||
|
|
||||||
return self.fetchJSON(url, false);
|
return self.getJSON(url, false);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getInstantMixFromItem = function (itemId, options) {
|
self.getInstantMixFromItem = function (itemId, options) {
|
||||||
|
@ -1249,7 +1221,7 @@
|
||||||
client: app
|
client: app
|
||||||
});
|
});
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.updateDisplayPreferences = function (id, obj, userId, app) {
|
self.updateDisplayPreferences = function (id, obj, userId, app) {
|
||||||
|
@ -1543,7 +1515,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("System/Configuration");
|
var url = self.getUrl("System/Configuration");
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2027,11 +1999,11 @@
|
||||||
url: url,
|
url: url,
|
||||||
data: data,
|
data: data,
|
||||||
contentType: "image/" + file.name.substring(file.name.lastIndexOf('.') + 1)
|
contentType: "image/" + file.name.substring(file.name.lastIndexOf('.') + 1)
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -2087,11 +2059,11 @@
|
||||||
url: url,
|
url: url,
|
||||||
data: data,
|
data: data,
|
||||||
contentType: "image/" + file.name.substring(file.name.lastIndexOf('.') + 1)
|
contentType: "image/" + file.name.substring(file.name.lastIndexOf('.') + 1)
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
@ -2185,7 +2157,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("Genres/" + self.encodeName(name), options);
|
var url = self.getUrl("Genres/" + self.encodeName(name), options);
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getMusicGenre = function (name, userId) {
|
self.getMusicGenre = function (name, userId) {
|
||||||
|
@ -2202,7 +2174,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("MusicGenres/" + self.encodeName(name), options);
|
var url = self.getUrl("MusicGenres/" + self.encodeName(name), options);
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getGameGenre = function (name, userId) {
|
self.getGameGenre = function (name, userId) {
|
||||||
|
@ -2219,7 +2191,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("GameGenres/" + self.encodeName(name), options);
|
var url = self.getUrl("GameGenres/" + self.encodeName(name), options);
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2239,7 +2211,7 @@
|
||||||
|
|
||||||
var url = self.getUrl("Artists/" + self.encodeName(name), options);
|
var url = self.getUrl("Artists/" + self.encodeName(name), options);
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2485,7 +2457,7 @@
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
if (self.onAuthenticated) {
|
if (self.onAuthenticated) {
|
||||||
self.onAuthenticated(self, result);
|
self.onAuthenticated(self, result);
|
||||||
|
@ -2493,7 +2465,7 @@
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -2528,11 +2500,11 @@
|
||||||
currentPassword: CryptoJS.SHA1(currentPassword).toString(),
|
currentPassword: CryptoJS.SHA1(currentPassword).toString(),
|
||||||
newPassword: CryptoJS.SHA1(newPassword).toString()
|
newPassword: CryptoJS.SHA1(newPassword).toString()
|
||||||
}
|
}
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -2565,11 +2537,11 @@
|
||||||
data: {
|
data: {
|
||||||
newPassword: CryptoJS.SHA1(newPassword).toString()
|
newPassword: CryptoJS.SHA1(newPassword).toString()
|
||||||
}
|
}
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -2862,7 +2834,7 @@
|
||||||
url = self.getUrl("Items", options);
|
url = self.getUrl("Items", options);
|
||||||
}
|
}
|
||||||
|
|
||||||
return self.fetchJSON(url);
|
return self.getJSON(url);
|
||||||
};
|
};
|
||||||
|
|
||||||
self.getChannels = function (query) {
|
self.getChannels = function (query) {
|
||||||
|
|
|
@ -83,13 +83,63 @@
|
||||||
return baseUrl + "/emby/" + handler;
|
return baseUrl + "/emby/" + handler;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getFetchPromise(request) {
|
||||||
|
|
||||||
|
var headers = request.headers || {};
|
||||||
|
|
||||||
|
if (request.dataType == 'json') {
|
||||||
|
headers.accept = 'application/json';
|
||||||
|
}
|
||||||
|
|
||||||
|
var fetchRequest = {
|
||||||
|
headers: headers,
|
||||||
|
method: request.type
|
||||||
|
};
|
||||||
|
|
||||||
|
if (request.data) {
|
||||||
|
|
||||||
|
if (typeof request.data === 'string') {
|
||||||
|
fetchRequest.body = request.data;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (request.contentType) {
|
||||||
|
|
||||||
|
headers['Content-Type'] = request.contentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
return fetch(request.url, fetchRequest);
|
||||||
|
}
|
||||||
|
|
||||||
|
function ajax(request) {
|
||||||
|
|
||||||
|
return getFetchPromise(request).then(function (response) {
|
||||||
|
|
||||||
|
if (response.status < 400) {
|
||||||
|
|
||||||
|
if (request.dataType == 'json' || request.headers.accept == 'application/json') {
|
||||||
|
return response.json();
|
||||||
|
} else {
|
||||||
|
return response;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
onFetchFail(request.url, response);
|
||||||
|
return Promise.reject(response);
|
||||||
|
}
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
onFetchFail(request.url, {});
|
||||||
|
return Promise.reject({});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function tryConnect(url, timeout) {
|
function tryConnect(url, timeout) {
|
||||||
|
|
||||||
url = getEmbyServerUrl(url, "system/info/public");
|
url = getEmbyServerUrl(url, "system/info/public");
|
||||||
|
|
||||||
logger.log('tryConnect url: ' + url);
|
logger.log('tryConnect url: ' + url);
|
||||||
|
|
||||||
return HttpClient.send({
|
return ajax({
|
||||||
|
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
|
@ -360,12 +410,12 @@
|
||||||
|
|
||||||
connectUser = null;
|
connectUser = null;
|
||||||
|
|
||||||
getConnectUser(credentials.ConnectUserId, credentials.ConnectAccessToken).done(function (user) {
|
getConnectUser(credentials.ConnectUserId, credentials.ConnectAccessToken).then(function (user) {
|
||||||
|
|
||||||
onConnectUserSignIn(user);
|
onConnectUserSignIn(user);
|
||||||
deferred.resolveWith(null, [[]]);
|
deferred.resolveWith(null, [[]]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.resolveWith(null, [[]]);
|
deferred.resolveWith(null, [[]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -387,7 +437,7 @@
|
||||||
|
|
||||||
var url = "https://connect.emby.media/service/user?id=" + userId;
|
var url = "https://connect.emby.media/service/user?id=" + userId;
|
||||||
|
|
||||||
return HttpClient.send({
|
return ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -412,7 +462,7 @@
|
||||||
|
|
||||||
url = getEmbyServerUrl(url, "Connect/Exchange?format=json&ConnectUserId=" + credentials.ConnectUserId);
|
url = getEmbyServerUrl(url, "Connect/Exchange?format=json&ConnectUserId=" + credentials.ConnectUserId);
|
||||||
|
|
||||||
return HttpClient.send({
|
return ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -420,15 +470,18 @@
|
||||||
"X-MediaBrowser-Token": server.ExchangeToken
|
"X-MediaBrowser-Token": server.ExchangeToken
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (auth) {
|
}).then(function (auth) {
|
||||||
|
|
||||||
server.UserId = auth.LocalUserId;
|
server.UserId = auth.LocalUserId;
|
||||||
server.AccessToken = auth.AccessToken;
|
server.AccessToken = auth.AccessToken;
|
||||||
|
return auth;
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
server.UserId = null;
|
server.UserId = null;
|
||||||
server.AccessToken = null;
|
server.AccessToken = null;
|
||||||
|
return Promise.reject();
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,7 +491,7 @@
|
||||||
|
|
||||||
var url = MediaBrowser.ServerInfo.getServerAddress(server, connectionMode);
|
var url = MediaBrowser.ServerInfo.getServerAddress(server, connectionMode);
|
||||||
|
|
||||||
HttpClient.send({
|
ajax({
|
||||||
|
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: getEmbyServerUrl(url, "System/Info"),
|
url: getEmbyServerUrl(url, "System/Info"),
|
||||||
|
@ -447,13 +500,13 @@
|
||||||
"X-MediaBrowser-Token": server.AccessToken
|
"X-MediaBrowser-Token": server.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (systemInfo) {
|
}).then(function (systemInfo) {
|
||||||
|
|
||||||
updateServerInfo(server, systemInfo);
|
updateServerInfo(server, systemInfo);
|
||||||
|
|
||||||
if (server.UserId) {
|
if (server.UserId) {
|
||||||
|
|
||||||
HttpClient.send({
|
ajax({
|
||||||
|
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: getEmbyServerUrl(url, "users/" + server.UserId),
|
url: getEmbyServerUrl(url, "users/" + server.UserId),
|
||||||
|
@ -462,12 +515,12 @@
|
||||||
"X-MediaBrowser-Token": server.AccessToken
|
"X-MediaBrowser-Token": server.AccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (user) {
|
}).then(function (user) {
|
||||||
|
|
||||||
onLocalUserSignIn(user);
|
onLocalUserSignIn(user);
|
||||||
deferred.resolveWith(null, [[]]);
|
deferred.resolveWith(null, [[]]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
server.UserId = null;
|
server.UserId = null;
|
||||||
server.AccessToken = null;
|
server.AccessToken = null;
|
||||||
|
@ -475,7 +528,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
server.UserId = null;
|
server.UserId = null;
|
||||||
server.AccessToken = null;
|
server.AccessToken = null;
|
||||||
|
@ -520,7 +573,7 @@
|
||||||
|
|
||||||
var localUser;
|
var localUser;
|
||||||
|
|
||||||
function onLocalUserDone() {
|
function onLocalUserDone(e) {
|
||||||
|
|
||||||
var image = getImageUrl(localUser);
|
var image = getImageUrl(localUser);
|
||||||
|
|
||||||
|
@ -528,7 +581,7 @@
|
||||||
{
|
{
|
||||||
localUser: localUser,
|
localUser: localUser,
|
||||||
name: connectUser ? connectUser.Name : (localUser ? localUser.Name : null),
|
name: connectUser ? connectUser.Name : (localUser ? localUser.Name : null),
|
||||||
canManageServer: localUser && localUser.Policy.IsAdministrator,
|
canManageServer: localUser ? localUser.Policy.IsAdministrator : false,
|
||||||
imageUrl: image.url,
|
imageUrl: image.url,
|
||||||
supportsImageParams: image.supportsParams
|
supportsImageParams: image.supportsParams
|
||||||
}]);
|
}]);
|
||||||
|
@ -537,9 +590,11 @@
|
||||||
function onEnsureConnectUserDone() {
|
function onEnsureConnectUserDone() {
|
||||||
|
|
||||||
if (apiClient && apiClient.getCurrentUserId()) {
|
if (apiClient && apiClient.getCurrentUserId()) {
|
||||||
apiClient.getCurrentUser().done(function (u) {
|
apiClient.getCurrentUser().then(function (u) {
|
||||||
localUser = u;
|
localUser = u;
|
||||||
}).always(onLocalUserDone);
|
onLocalUserDone();
|
||||||
|
|
||||||
|
}, onLocalUserDone);
|
||||||
} else {
|
} else {
|
||||||
onLocalUserDone();
|
onLocalUserDone();
|
||||||
}
|
}
|
||||||
|
@ -548,7 +603,7 @@
|
||||||
var credentials = credentialProvider.credentials();
|
var credentials = credentialProvider.credentials();
|
||||||
|
|
||||||
if (credentials.ConnectUserId && credentials.ConnectAccessToken && !(apiClient && apiClient.getCurrentUserId())) {
|
if (credentials.ConnectUserId && credentials.ConnectAccessToken && !(apiClient && apiClient.getCurrentUserId())) {
|
||||||
ensureConnectUser(credentials).always(onEnsureConnectUserDone);
|
ensureConnectUser(credentials).then(onEnsureConnectUserDone, onEnsureConnectUserDone);
|
||||||
} else {
|
} else {
|
||||||
onEnsureConnectUserDone();
|
onEnsureConnectUserDone();
|
||||||
}
|
}
|
||||||
|
@ -579,7 +634,7 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return DeferredBuilder.when(promises).done(function () {
|
return DeferredBuilder.when(promises).then(function () {
|
||||||
|
|
||||||
var credentials = credentialProvider.credentials();
|
var credentials = credentialProvider.credentials();
|
||||||
|
|
||||||
|
@ -624,7 +679,10 @@
|
||||||
serverId: serverInfo.Id
|
serverId: serverInfo.Id
|
||||||
};
|
};
|
||||||
|
|
||||||
return apiClient.logout().always(function () {
|
return apiClient.logout().then(function () {
|
||||||
|
|
||||||
|
Events.trigger(self, 'localusersignedout', [logoutInfo]);
|
||||||
|
}, function () {
|
||||||
|
|
||||||
Events.trigger(self, 'localusersignedout', [logoutInfo]);
|
Events.trigger(self, 'localusersignedout', [logoutInfo]);
|
||||||
});
|
});
|
||||||
|
@ -643,7 +701,7 @@
|
||||||
|
|
||||||
var url = "https://connect.emby.media/service/servers?userId=" + credentials.ConnectUserId;
|
var url = "https://connect.emby.media/service/servers?userId=" + credentials.ConnectUserId;
|
||||||
|
|
||||||
HttpClient.send({
|
ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -652,7 +710,7 @@
|
||||||
"X-Connect-UserToken": credentials.ConnectAccessToken
|
"X-Connect-UserToken": credentials.ConnectAccessToken
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (servers) {
|
}).then(function (servers) {
|
||||||
|
|
||||||
servers = servers.map(function (i) {
|
servers = servers.map(function (i) {
|
||||||
return {
|
return {
|
||||||
|
@ -668,7 +726,7 @@
|
||||||
|
|
||||||
deferred.resolveWith(null, [servers]);
|
deferred.resolveWith(null, [servers]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.resolveWith(null, [[]]);
|
deferred.resolveWith(null, [[]]);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -701,9 +759,9 @@
|
||||||
var connectServersPromise = getConnectServers(credentials);
|
var connectServersPromise = getConnectServers(credentials);
|
||||||
var findServersPromise = findServers();
|
var findServersPromise = findServers();
|
||||||
|
|
||||||
connectServersPromise.done(function (connectServers) {
|
connectServersPromise.then(function (connectServers) {
|
||||||
|
|
||||||
findServersPromise.done(function (foundServers) {
|
findServersPromise.then(function (foundServers) {
|
||||||
|
|
||||||
var servers = credentials.Servers.slice(0);
|
var servers = credentials.Servers.slice(0);
|
||||||
mergeServers(servers, foundServers);
|
mergeServers(servers, foundServers);
|
||||||
|
@ -748,7 +806,7 @@
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
require(['serverdiscovery'], function () {
|
require(['serverdiscovery'], function () {
|
||||||
ServerDiscovery.findServers(1000).done(function (foundServers) {
|
ServerDiscovery.findServers(1000).then(function (foundServers) {
|
||||||
|
|
||||||
var servers = foundServers.map(function (foundServer) {
|
var servers = foundServers.map(function (foundServer) {
|
||||||
|
|
||||||
|
@ -798,9 +856,9 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
self.getAvailableServers().done(function (servers) {
|
self.getAvailableServers().then(function (servers) {
|
||||||
|
|
||||||
self.connectToServers(servers).done(function (result) {
|
self.connectToServers(servers).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
|
@ -823,7 +881,7 @@
|
||||||
|
|
||||||
if (servers.length == 1) {
|
if (servers.length == 1) {
|
||||||
|
|
||||||
self.connectToServer(servers[0]).done(function (result) {
|
self.connectToServer(servers[0]).then(function (result) {
|
||||||
|
|
||||||
if (result.State == MediaBrowser.ConnectionState.Unavailable) {
|
if (result.State == MediaBrowser.ConnectionState.Unavailable) {
|
||||||
|
|
||||||
|
@ -842,7 +900,7 @@
|
||||||
var firstServer = servers.length ? servers[0] : null;
|
var firstServer = servers.length ? servers[0] : null;
|
||||||
// See if we have any saved credentials and can auto sign in
|
// See if we have any saved credentials and can auto sign in
|
||||||
if (firstServer) {
|
if (firstServer) {
|
||||||
self.connectToServer(firstServer).done(function (result) {
|
self.connectToServer(firstServer).then(function (result) {
|
||||||
|
|
||||||
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
||||||
|
|
||||||
|
@ -948,12 +1006,12 @@
|
||||||
|
|
||||||
logger.log('testing connection mode ' + mode + ' with server ' + server.Name);
|
logger.log('testing connection mode ' + mode + ' with server ' + server.Name);
|
||||||
|
|
||||||
tryConnect(address, timeout).done(function (result) {
|
tryConnect(address, timeout).then(function (result) {
|
||||||
|
|
||||||
logger.log('calling onSuccessfulConnection with connection mode ' + mode + ' with server ' + server.Name);
|
logger.log('calling onSuccessfulConnection with connection mode ' + mode + ' with server ' + server.Name);
|
||||||
onSuccessfulConnection(server, result, mode, options, deferred);
|
onSuccessfulConnection(server, result, mode, options, deferred);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
logger.log('test failed for connection mode ' + mode + ' with server ' + server.Name);
|
logger.log('test failed for connection mode ' + mode + ' with server ' + server.Name);
|
||||||
|
|
||||||
|
@ -977,10 +1035,14 @@
|
||||||
var credentials = credentialProvider.credentials();
|
var credentials = credentialProvider.credentials();
|
||||||
if (credentials.ConnectAccessToken) {
|
if (credentials.ConnectAccessToken) {
|
||||||
|
|
||||||
ensureConnectUser(credentials).done(function () {
|
ensureConnectUser(credentials).then(function () {
|
||||||
|
|
||||||
if (server.ExchangeToken) {
|
if (server.ExchangeToken) {
|
||||||
addAuthenticationInfoFromConnect(server, connectionMode, credentials).always(function () {
|
addAuthenticationInfoFromConnect(server, connectionMode, credentials).then(function () {
|
||||||
|
|
||||||
|
afterConnectValidated(server, credentials, systemInfo, connectionMode, true, options, deferred);
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
|
||||||
afterConnectValidated(server, credentials, systemInfo, connectionMode, true, options, deferred);
|
afterConnectValidated(server, credentials, systemInfo, connectionMode, true, options, deferred);
|
||||||
});
|
});
|
||||||
|
@ -1000,7 +1062,7 @@
|
||||||
|
|
||||||
if (verifyLocalAuthentication && server.AccessToken) {
|
if (verifyLocalAuthentication && server.AccessToken) {
|
||||||
|
|
||||||
validateAuthentication(server, connectionMode).done(function () {
|
validateAuthentication(server, connectionMode).then(function () {
|
||||||
|
|
||||||
afterConnectValidated(server, credentials, systemInfo, connectionMode, false, options, deferred);
|
afterConnectValidated(server, credentials, systemInfo, connectionMode, false, options, deferred);
|
||||||
});
|
});
|
||||||
|
@ -1075,7 +1137,7 @@
|
||||||
resolveWithFailure(deferred);
|
resolveWithFailure(deferred);
|
||||||
}
|
}
|
||||||
|
|
||||||
tryConnect(address, defaultTimeout).done(function (publicInfo) {
|
tryConnect(address, defaultTimeout).then(function (publicInfo) {
|
||||||
|
|
||||||
logger.log('connectToAddress ' + address + ' succeeded');
|
logger.log('connectToAddress ' + address + ' succeeded');
|
||||||
|
|
||||||
|
@ -1085,13 +1147,13 @@
|
||||||
};
|
};
|
||||||
updateServerInfo(server, publicInfo);
|
updateServerInfo(server, publicInfo);
|
||||||
|
|
||||||
self.connectToServer(server).done(function (result) {
|
self.connectToServer(server).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(onFail);
|
}, onFail);
|
||||||
|
|
||||||
}).fail(onFail);
|
}, onFail);
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
};
|
};
|
||||||
|
@ -1113,7 +1175,7 @@
|
||||||
|
|
||||||
var md5 = self.getConnectPasswordHash(password);
|
var md5 = self.getConnectPasswordHash(password);
|
||||||
|
|
||||||
HttpClient.send({
|
ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "https://connect.emby.media/service/user/authenticate",
|
url: "https://connect.emby.media/service/user/authenticate",
|
||||||
data: {
|
data: {
|
||||||
|
@ -1126,7 +1188,7 @@
|
||||||
"X-Application": appName + "/" + appVersion
|
"X-Application": appName + "/" + appVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
var credentials = credentialProvider.credentials();
|
var credentials = credentialProvider.credentials();
|
||||||
|
|
||||||
|
@ -1139,7 +1201,7 @@
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -1176,7 +1238,7 @@
|
||||||
|
|
||||||
var md5 = self.getConnectPasswordHash(password);
|
var md5 = self.getConnectPasswordHash(password);
|
||||||
|
|
||||||
HttpClient.send({
|
ajax({
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: "https://connect.emby.media/service/register",
|
url: "https://connect.emby.media/service/register",
|
||||||
data: {
|
data: {
|
||||||
|
@ -1191,11 +1253,11 @@
|
||||||
"X-CONNECT-TOKEN": "CONNECT-REGISTER"
|
"X-CONNECT-TOKEN": "CONNECT-REGISTER"
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
deferred.resolve(null, []);
|
deferred.resolve(null, []);
|
||||||
|
|
||||||
}).fail(function (e) {
|
}, function (e) {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
|
@ -1248,7 +1310,7 @@
|
||||||
|
|
||||||
var url = "https://connect.emby.media/service/servers?userId=" + self.connectUserId() + "&status=Waiting";
|
var url = "https://connect.emby.media/service/servers?userId=" + self.connectUserId() + "&status=Waiting";
|
||||||
|
|
||||||
return HttpClient.send({
|
return ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
|
@ -1299,7 +1361,7 @@
|
||||||
|
|
||||||
var url = "https://connect.emby.media/service/serverAuthorizations?serverId=" + server.ConnectServerId + "&userId=" + connectUserId;
|
var url = "https://connect.emby.media/service/serverAuthorizations?serverId=" + server.ConnectServerId + "&userId=" + connectUserId;
|
||||||
|
|
||||||
HttpClient.send({
|
ajax({
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
url: url,
|
url: url,
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -1307,7 +1369,7 @@
|
||||||
"X-Application": appName + "/" + appVersion
|
"X-Application": appName + "/" + appVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
}).always(onDone);
|
}).then(onDone, onDone);
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
};
|
};
|
||||||
|
@ -1328,14 +1390,12 @@
|
||||||
|
|
||||||
var url = "https://connect.emby.media/service/serverAuthorizations?serverId=" + serverId + "&userId=" + self.connectUserId();
|
var url = "https://connect.emby.media/service/serverAuthorizations?serverId=" + serverId + "&userId=" + self.connectUserId();
|
||||||
|
|
||||||
return HttpClient.send({
|
return fetch(url, {
|
||||||
type: "DELETE",
|
method: "DELETE",
|
||||||
url: url,
|
|
||||||
headers: {
|
headers: {
|
||||||
"X-Connect-UserToken": connectToken,
|
"X-Connect-UserToken": connectToken,
|
||||||
"X-Application": appName + "/" + appVersion
|
"X-Application": appName + "/" + appVersion
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1355,7 +1415,7 @@
|
||||||
|
|
||||||
var url = "https://connect.emby.media/service/ServerAuthorizations/accept?serverId=" + serverId + "&userId=" + self.connectUserId();
|
var url = "https://connect.emby.media/service/ServerAuthorizations/accept?serverId=" + serverId + "&userId=" + self.connectUserId();
|
||||||
|
|
||||||
return HttpClient.send({
|
return ajax({
|
||||||
type: "GET",
|
type: "GET",
|
||||||
url: url,
|
url: url,
|
||||||
headers: {
|
headers: {
|
||||||
|
@ -1370,7 +1430,7 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
self.getAvailableServers().done(function (servers) {
|
self.getAvailableServers().then(function (servers) {
|
||||||
|
|
||||||
var matchedServers = servers.filter(function (s) {
|
var matchedServers = servers.filter(function (s) {
|
||||||
return stringEqualsIgnoreCase(s.Id, apiClient.serverInfo().Id);
|
return stringEqualsIgnoreCase(s.Id, apiClient.serverInfo().Id);
|
||||||
|
@ -1385,7 +1445,7 @@
|
||||||
|
|
||||||
if (!match.DateLastLocalConnection) {
|
if (!match.DateLastLocalConnection) {
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
||||||
|
|
||||||
if (info.IsInNetwork) {
|
if (info.IsInNetwork) {
|
||||||
|
|
||||||
|
@ -1405,7 +1465,7 @@
|
||||||
|
|
||||||
onLocalCheckSuccess(feature, apiClient, deferred);
|
onLocalCheckSuccess(feature, apiClient, deferred);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
@ -1431,10 +1491,10 @@
|
||||||
|
|
||||||
function onLocalCheckSuccess(feature, apiClient, deferred) {
|
function onLocalCheckSuccess(feature, apiClient, deferred) {
|
||||||
|
|
||||||
apiClient.getRegistrationInfo(feature).done(function (result) {
|
apiClient.getRegistrationInfo(feature).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
LocalAssetManager.getCameraPhotos().done(function (photos) {
|
LocalAssetManager.getCameraPhotos().then(function (photos) {
|
||||||
|
|
||||||
if (!photos.length) {
|
if (!photos.length) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -17,7 +17,7 @@
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(server.Id);
|
var apiClient = connectionManager.getApiClient(server.Id);
|
||||||
|
|
||||||
apiClient.getContentUploadHistory().done(function (uploadHistory) {
|
apiClient.getContentUploadHistory().then(function (uploadHistory) {
|
||||||
|
|
||||||
photos = getFilesToUpload(photos, uploadHistory);
|
photos = getFilesToUpload(photos, uploadHistory);
|
||||||
|
|
||||||
|
@ -25,11 +25,11 @@
|
||||||
|
|
||||||
uploadNext(photos, 0, server, apiClient, deferred);
|
uploadNext(photos, 0, server, apiClient, deferred);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -67,10 +67,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uploadFile(files[index], apiClient).done(function () {
|
uploadFile(files[index], apiClient).then(function () {
|
||||||
|
|
||||||
uploadNext(files, index + 1, server, apiClient, deferred);
|
uploadNext(files, index + 1, server, apiClient, deferred);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
uploadNext(files, index + 1, server, apiClient, deferred);
|
uploadNext(files, index + 1, server, apiClient, deferred);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -93,12 +93,12 @@
|
||||||
|
|
||||||
Logger.log('Uploading file to ' + url);
|
Logger.log('Uploading file to ' + url);
|
||||||
|
|
||||||
new MediaBrowser.FileUpload().upload(file, name, url).done(function () {
|
new MediaBrowser.FileUpload().upload(file, name, url).then(function () {
|
||||||
|
|
||||||
Logger.log('File upload succeeded');
|
Logger.log('File upload succeeded');
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Logger.log('File upload failed');
|
Logger.log('File upload failed');
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
|
|
|
@ -8,26 +8,26 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
reportOfflineActions(apiClient, serverInfo).done(function () {
|
reportOfflineActions(apiClient, serverInfo).then(function () {
|
||||||
|
|
||||||
// Do the first data sync
|
// Do the first data sync
|
||||||
syncData(apiClient, serverInfo, false).done(function () {
|
syncData(apiClient, serverInfo, false).then(function () {
|
||||||
|
|
||||||
// Download new content
|
// Download new content
|
||||||
getNewMedia(apiClient, serverInfo, options).done(function () {
|
getNewMedia(apiClient, serverInfo, options).then(function () {
|
||||||
|
|
||||||
// Do the second data sync
|
// Do the second data sync
|
||||||
syncData(apiClient, serverInfo, false).done(function () {
|
syncData(apiClient, serverInfo, false).then(function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
};
|
};
|
||||||
|
@ -40,24 +40,24 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.getOfflineActions(serverInfo.Id).done(function (actions) {
|
LocalAssetManager.getOfflineActions(serverInfo.Id).then(function (actions) {
|
||||||
|
|
||||||
if (!actions.length) {
|
if (!actions.length) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
apiClient.reportOfflineActions(actions).done(function () {
|
apiClient.reportOfflineActions(actions).then(function () {
|
||||||
|
|
||||||
LocalAssetManager.deleteOfflineActions(actions).done(function () {
|
LocalAssetManager.deleteOfflineActions(actions).then(function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
|
@ -71,7 +71,7 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.getServerItemIds(serverInfo.Id).done(function (localIds) {
|
LocalAssetManager.getServerItemIds(serverInfo.Id).then(function (localIds) {
|
||||||
|
|
||||||
var request = {
|
var request = {
|
||||||
TargetId: apiClient.deviceId(),
|
TargetId: apiClient.deviceId(),
|
||||||
|
@ -79,13 +79,13 @@
|
||||||
OfflineUserIds: (serverInfo.Users || []).map(function (u) { return u.Id; })
|
OfflineUserIds: (serverInfo.Users || []).map(function (u) { return u.Id; })
|
||||||
};
|
};
|
||||||
|
|
||||||
apiClient.syncData(request).done(function (result) {
|
apiClient.syncData(request).then(function (result) {
|
||||||
|
|
||||||
afterSyncData(apiClient, serverInfo, syncUserItemAccess, result, deferred);
|
afterSyncData(apiClient, serverInfo, syncUserItemAccess, result, deferred);
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
|
@ -95,20 +95,20 @@
|
||||||
|
|
||||||
Logger.log('Begin afterSyncData');
|
Logger.log('Begin afterSyncData');
|
||||||
|
|
||||||
removeLocalItems(syncDataResult, serverInfo.Id).done(function (result) {
|
removeLocalItems(syncDataResult, serverInfo.Id).then(function (result) {
|
||||||
|
|
||||||
if (enableSyncUserItemAccess) {
|
if (enableSyncUserItemAccess) {
|
||||||
syncUserItemAccess(syncDataResult, serverInfo.Id).done(function () {
|
syncUserItemAccess(syncDataResult, serverInfo.Id).then(function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}
|
}
|
||||||
|
@ -134,10 +134,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
removeLocalItem(itemIdsToRemove[index], serverId).done(function () {
|
removeLocalItem(itemIdsToRemove[index], serverId).then(function () {
|
||||||
|
|
||||||
removeNextLocalItem(itemIdsToRemove, index + 1, serverId, deferred);
|
removeNextLocalItem(itemIdsToRemove, index + 1, serverId, deferred);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
removeNextLocalItem(itemIdsToRemove, index + 1, serverId, deferred);
|
removeNextLocalItem(itemIdsToRemove, index + 1, serverId, deferred);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -150,11 +150,11 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.removeLocalItem(itemId, serverId).done(function (localIds) {
|
LocalAssetManager.removeLocalItem(itemId, serverId).then(function (localIds) {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
|
@ -166,11 +166,11 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
apiClient.getReadySyncItems(apiClient.deviceId()).done(function (jobItems) {
|
apiClient.getReadySyncItems(apiClient.deviceId()).then(function (jobItems) {
|
||||||
|
|
||||||
getNextNewItem(jobItems, 0, apiClient, serverInfo, options, deferred);
|
getNextNewItem(jobItems, 0, apiClient, serverInfo, options, deferred);
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
@ -194,7 +194,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
getNewItem(jobItems[index], apiClient, serverInfo, options).done(goNext).fail(goNext);
|
getNewItem(jobItems[index], apiClient, serverInfo, options).then(goNext, goNext);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getNewItem(jobItem, apiClient, serverInfo, options) {
|
function getNewItem(jobItem, apiClient, serverInfo, options) {
|
||||||
|
@ -206,32 +206,32 @@
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
var libraryItem = jobItem.Item;
|
var libraryItem = jobItem.Item;
|
||||||
LocalAssetManager.createLocalItem(libraryItem, serverInfo, jobItem.OriginalFileName).done(function (localItem) {
|
LocalAssetManager.createLocalItem(libraryItem, serverInfo, jobItem.OriginalFileName).then(function (localItem) {
|
||||||
|
|
||||||
downloadMedia(apiClient, jobItem, localItem, options).done(function (isQueued) {
|
downloadMedia(apiClient, jobItem, localItem, options).then(function (isQueued) {
|
||||||
|
|
||||||
if (isQueued) {
|
if (isQueued) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getImages(apiClient, jobItem, localItem).done(function () {
|
getImages(apiClient, jobItem, localItem).then(function () {
|
||||||
|
|
||||||
getSubtitles(apiClient, jobItem, localItem).done(function () {
|
getSubtitles(apiClient, jobItem, localItem).then(function () {
|
||||||
|
|
||||||
apiClient.reportSyncJobItemTransferred(jobItem.SyncJobItemId).done(function () {
|
apiClient.reportSyncJobItemTransferred(jobItem.SyncJobItemId).then(function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
|
@ -254,19 +254,19 @@
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
LocalAssetManager.downloadFile(url, localPath, options.enableBackgroundTransfer, options.enableNewDownloads).done(function (path, isQueued) {
|
LocalAssetManager.downloadFile(url, localPath, options.enableBackgroundTransfer, options.enableNewDownloads).then(function (path, isQueued) {
|
||||||
|
|
||||||
if (isQueued) {
|
if (isQueued) {
|
||||||
deferred.resolveWith(null, [true]);
|
deferred.resolveWith(null, [true]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
LocalAssetManager.addOrUpdateLocalItem(localItem).done(function () {
|
LocalAssetManager.addOrUpdateLocalItem(localItem).then(function () {
|
||||||
|
|
||||||
deferred.resolveWith(null, [false]);
|
deferred.resolveWith(null, [false]);
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -334,7 +334,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
downloadImage(apiClient, serverId, itemId, imageTag, imageType).done(function () {
|
downloadImage(apiClient, serverId, itemId, imageTag, imageType).then(function () {
|
||||||
|
|
||||||
// For the sake of simplicity, limit to one image
|
// For the sake of simplicity, limit to one image
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -342,7 +342,7 @@
|
||||||
|
|
||||||
getNextImage(index + 1, apiClient, localItem, deferred);
|
getNextImage(index + 1, apiClient, localItem, deferred);
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadImage(apiClient, serverId, itemId, imageTag, imageType) {
|
function downloadImage(apiClient, serverId, itemId, imageTag, imageType) {
|
||||||
|
@ -352,7 +352,7 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.hasImage(serverId, itemId, imageTag).done(function (hasImage) {
|
LocalAssetManager.hasImage(serverId, itemId, imageTag).then(function (hasImage) {
|
||||||
|
|
||||||
if (hasImage) {
|
if (hasImage) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -365,11 +365,11 @@
|
||||||
api_key: apiClient.accessToken()
|
api_key: apiClient.accessToken()
|
||||||
});
|
});
|
||||||
|
|
||||||
LocalAssetManager.downloadImage(imageUrl, serverId, itemId, imageTag).done(function () {
|
LocalAssetManager.downloadImage(imageUrl, serverId, itemId, imageTag).then(function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -412,11 +412,11 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
getItemSubtitle(file, apiClient, jobItem, localItem, mediaSource).done(function () {
|
getItemSubtitle(file, apiClient, jobItem, localItem, mediaSource).then(function () {
|
||||||
|
|
||||||
getNextSubtitle(files, index + 1, apiClient, jobItem, localItem, mediaSource, deferred);
|
getNextSubtitle(files, index + 1, apiClient, jobItem, localItem, mediaSource, deferred);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
getNextSubtitle(files, index + 1, apiClient, jobItem, localItem, mediaSource, deferred);
|
getNextSubtitle(files, index + 1, apiClient, jobItem, localItem, mediaSource, deferred);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -445,14 +445,14 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.downloadSubtitles(url, localItem, subtitleStream).done(function (subtitlePath) {
|
LocalAssetManager.downloadSubtitles(url, localItem, subtitleStream).then(function (subtitlePath) {
|
||||||
|
|
||||||
subtitleStream.Path = subtitlePath;
|
subtitleStream.Path = subtitlePath;
|
||||||
LocalAssetManager.addOrUpdateLocalItem(localItem).done(function () {
|
LocalAssetManager.addOrUpdateLocalItem(localItem).then(function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
|
@ -483,10 +483,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
syncUserAccessForItem(itemIds[index], syncDataResult).done(function () {
|
syncUserAccessForItem(itemIds[index], syncDataResult).then(function () {
|
||||||
|
|
||||||
syncNextUserAccessForItem(itemIds, index + 1, syncDataResult, serverId, deferred);
|
syncNextUserAccessForItem(itemIds, index + 1, syncDataResult, serverId, deferred);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
syncNextUserAccessForItem(itemIds, index + 1, syncDataResult, serverId, deferred);
|
syncNextUserAccessForItem(itemIds, index + 1, syncDataResult, serverId, deferred);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -498,7 +498,7 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.getUserIdsWithAccess(itemId, serverId).done(function (savedUserIdsWithAccess) {
|
LocalAssetManager.getUserIdsWithAccess(itemId, serverId).then(function (savedUserIdsWithAccess) {
|
||||||
|
|
||||||
var userIdsWithAccess = syncDataResult.ItemUserAccess[itemId];
|
var userIdsWithAccess = syncDataResult.ItemUserAccess[itemId];
|
||||||
|
|
||||||
|
@ -508,12 +508,12 @@
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
LocalAssetManager.saveUserIdsWithAccess(itemId, serverId, userIdsWithAccess).done(function () {
|
LocalAssetManager.saveUserIdsWithAccess(itemId, serverId, userIdsWithAccess).then(function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
});
|
});
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
|
|
|
@ -31,11 +31,11 @@
|
||||||
|
|
||||||
require(['serversync'], function () {
|
require(['serversync'], function () {
|
||||||
|
|
||||||
new MediaBrowser.ServerSync(connectionManager).sync(server, options).done(function () {
|
new MediaBrowser.ServerSync(connectionManager).sync(server, options).then(function () {
|
||||||
|
|
||||||
syncNext(servers, index + 1, options, deferred);
|
syncNext(servers, index + 1, options, deferred);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
syncNext(servers, index + 1, options, deferred);
|
syncNext(servers, index + 1, options, deferred);
|
||||||
});
|
});
|
||||||
|
|
|
@ -24,10 +24,10 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
syncUser(users[index], apiClient).done(function () {
|
syncUser(users[index], apiClient).then(function () {
|
||||||
|
|
||||||
syncNext(users, index + 1, deferred, apiClient, server);
|
syncNext(users, index + 1, deferred, apiClient, server);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
syncNext(users, index + 1, deferred, apiClient, server);
|
syncNext(users, index + 1, deferred, apiClient, server);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -36,26 +36,26 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
apiClient.getOfflineUser(user.Id).done(function (result) {
|
apiClient.getOfflineUser(user.Id).then(function (result) {
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.saveOfflineUser(result).done(function () {
|
LocalAssetManager.saveOfflineUser(result).then(function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
// TODO: We should only delete if there's a 401 response
|
// TODO: We should only delete if there's a 401 response
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.deleteOfflineUser(user.Id).done(function () {
|
LocalAssetManager.deleteOfflineUser(user.Id).then(function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
reportCapabilities: false
|
reportCapabilities: false
|
||||||
};
|
};
|
||||||
|
|
||||||
connectionManager.connectToServer(server, connectionOptions).done(function (result) {
|
connectionManager.connectToServer(server, connectionOptions).then(function (result) {
|
||||||
|
|
||||||
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
if (result.State == MediaBrowser.ConnectionState.SignedIn) {
|
||||||
performSync(server, options, deferred);
|
performSync(server, options, deferred);
|
||||||
|
@ -30,7 +30,7 @@
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Logger.log('Unable to connect to server id: ' + server.Id);
|
Logger.log('Unable to connect to server id: ' + server.Id);
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
|
@ -62,13 +62,13 @@
|
||||||
|
|
||||||
require(['contentuploader'], function () {
|
require(['contentuploader'], function () {
|
||||||
|
|
||||||
new MediaBrowser.ContentUploader(connectionManager).uploadImages(server).done(function () {
|
new MediaBrowser.ContentUploader(connectionManager).uploadImages(server).then(function () {
|
||||||
|
|
||||||
Logger.log("ContentUploaded succeeded to server: " + server.Id);
|
Logger.log("ContentUploaded succeeded to server: " + server.Id);
|
||||||
|
|
||||||
nextAction();
|
nextAction();
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Logger.log("ContentUploaded failed to server: " + server.Id);
|
Logger.log("ContentUploaded failed to server: " + server.Id);
|
||||||
|
|
||||||
|
@ -88,13 +88,13 @@
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(server.Id);
|
var apiClient = connectionManager.getApiClient(server.Id);
|
||||||
|
|
||||||
new MediaBrowser.OfflineUserSync().sync(apiClient, server).done(function () {
|
new MediaBrowser.OfflineUserSync().sync(apiClient, server).then(function () {
|
||||||
|
|
||||||
Logger.log("OfflineUserSync succeeded to server: " + server.Id);
|
Logger.log("OfflineUserSync succeeded to server: " + server.Id);
|
||||||
|
|
||||||
syncMedia(server, options, deferred);
|
syncMedia(server, options, deferred);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Logger.log("OfflineUserSync failed to server: " + server.Id);
|
Logger.log("OfflineUserSync failed to server: " + server.Id);
|
||||||
|
|
||||||
|
@ -109,13 +109,13 @@
|
||||||
|
|
||||||
var apiClient = connectionManager.getApiClient(server.Id);
|
var apiClient = connectionManager.getApiClient(server.Id);
|
||||||
|
|
||||||
new MediaBrowser.MediaSync().sync(apiClient, server, options).done(function () {
|
new MediaBrowser.MediaSync().sync(apiClient, server, options).then(function () {
|
||||||
|
|
||||||
Logger.log("MediaSync succeeded to server: " + server.Id);
|
Logger.log("MediaSync succeeded to server: " + server.Id);
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Logger.log("MediaSync failed to server: " + server.Id);
|
Logger.log("MediaSync failed to server: " + server.Id);
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url
|
url: url
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
parentPathPromise = parentPathPromise.promise();
|
parentPathPromise = parentPathPromise.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
$.when(promise, parentPathPromise).done(function (response1, response2) {
|
$.when(promise, parentPathPromise).then(function (response1, response2) {
|
||||||
|
|
||||||
var folders = response1[0];
|
var folders = response1[0];
|
||||||
var parentPath = response2 && response2.length ? response2[0] || '' : '';
|
var parentPath = response2 && response2.length ? response2[0] || '' : '';
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
$('#txtDirectoryPickerPath', page).val("");
|
$('#txtDirectoryPickerPath', page).val("");
|
||||||
$('.results', page).html('');
|
$('.results', page).html('');
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
fileOptions.includeFiles = options.includeFiles;
|
fileOptions.includeFiles = options.includeFiles;
|
||||||
}
|
}
|
||||||
|
|
||||||
getSystemInfo().done(function (systemInfo) {
|
getSystemInfo().then(function (systemInfo) {
|
||||||
|
|
||||||
require(['components/paperdialoghelper'], function () {
|
require(['components/paperdialoghelper'], function () {
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
options.ProviderName = provider;
|
options.ProviderName = provider;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.getAvailableRemoteImages(options).done(function (result) {
|
ApiClient.getAvailableRemoteImages(options).then(function (result) {
|
||||||
|
|
||||||
renderRemoteImages(page, result, browsableImageType, options.startIndex, options.limit);
|
renderRemoteImages(page, result, browsableImageType, options.startIndex, options.limit);
|
||||||
|
|
||||||
|
@ -125,7 +125,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.downloadRemoteImage(options).done(function () {
|
ApiClient.downloadRemoteImage(options).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
var dlg = $(page).parents('paper-dialog')[0];
|
var dlg = $(page).parents('paper-dialog')[0];
|
||||||
|
@ -260,13 +260,12 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/imagedownloader/imagedownloader.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/imagedownloader/imagedownloader.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
currentItemId = itemId;
|
currentItemId = itemId;
|
||||||
currentItemType = itemType;
|
currentItemType = itemType;
|
||||||
|
|
||||||
|
@ -299,7 +298,9 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
reloadBrowsableImages(editorContent);
|
reloadBrowsableImages(editorContent);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
|
@ -31,7 +31,7 @@
|
||||||
|
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
|
|
||||||
ApiClient.getRemoteImageProviders(getBaseRemoteOptions()).done(function (providers) {
|
ApiClient.getRemoteImageProviders(getBaseRemoteOptions()).then(function (providers) {
|
||||||
|
|
||||||
if (providers.length) {
|
if (providers.length) {
|
||||||
$('.btnBrowseAllImages', page).removeClass('hide');
|
$('.btnBrowseAllImages', page).removeClass('hide');
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
$('.btnBrowseAllImages', page).addClass('hide');
|
$('.btnBrowseAllImages', page).addClass('hide');
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.getItemImageInfos(currentItem.Id).done(function (imageInfos) {
|
ApiClient.getItemImageInfos(currentItem.Id).then(function (imageInfos) {
|
||||||
|
|
||||||
renderStandardImages(page, item, imageInfos, providers);
|
renderStandardImages(page, item, imageInfos, providers);
|
||||||
renderBackdrops(page, item, imageInfos, providers);
|
renderBackdrops(page, item, imageInfos, providers);
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('HeaderDeleteImage'), function (result) {
|
Dashboard.confirm(Globalize.translate('DeleteImageConfirmation'), Globalize.translate('HeaderDeleteImage'), function (result) {
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
ApiClient.deleteItemImage(currentItem.Id, type, index).done(function () {
|
ApiClient.deleteItemImage(currentItem.Id, type, index).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
reload(page);
|
reload(page);
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
var type = this.getAttribute('data-imagetype');
|
var type = this.getAttribute('data-imagetype');
|
||||||
var index = parseInt(this.getAttribute('data-index'));
|
var index = parseInt(this.getAttribute('data-index'));
|
||||||
var newIndex = parseInt(this.getAttribute('data-newindex'));
|
var newIndex = parseInt(this.getAttribute('data-newindex'));
|
||||||
ApiClient.updateItemImageIndex(currentItem.Id, type, index, newIndex).done(function () {
|
ApiClient.updateItemImageIndex(currentItem.Id, type, index, newIndex).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
reload(page);
|
reload(page);
|
||||||
|
@ -192,7 +192,7 @@
|
||||||
function showImageDownloader(page, imageType) {
|
function showImageDownloader(page, imageType) {
|
||||||
require(['components/imagedownloader/imagedownloader'], function () {
|
require(['components/imagedownloader/imagedownloader'], function () {
|
||||||
|
|
||||||
ImageDownloader.show(currentItem.Id, currentItem.Type, imageType).done(function (hasChanged) {
|
ImageDownloader.show(currentItem.Id, currentItem.Type, imageType).then(function (hasChanged) {
|
||||||
|
|
||||||
if (hasChanged) {
|
if (hasChanged) {
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
|
@ -212,7 +212,7 @@
|
||||||
|
|
||||||
theme: options.theme
|
theme: options.theme
|
||||||
|
|
||||||
}).done(function (hasChanged) {
|
}).then(function (hasChanged) {
|
||||||
|
|
||||||
if (hasChanged) {
|
if (hasChanged) {
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
|
@ -233,13 +233,12 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/imageeditor/imageeditor.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/imageeditor/imageeditor.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
||||||
|
|
||||||
var dlg = PaperDialogHelper.createDialog({
|
var dlg = PaperDialogHelper.createDialog({
|
||||||
|
@ -269,12 +268,14 @@
|
||||||
var editorContent = dlg.querySelector('.editorContent');
|
var editorContent = dlg.querySelector('.editorContent');
|
||||||
reload(editorContent, item);
|
reload(editorContent, item);
|
||||||
|
|
||||||
$('.btnCloseDialog', dlg).on('click', function() {
|
$('.btnCloseDialog', dlg).on('click', function () {
|
||||||
|
|
||||||
PaperDialogHelper.close(dlg);
|
PaperDialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
|
@ -85,7 +85,7 @@
|
||||||
|
|
||||||
var imageType = $('#selectImageType', page).val();
|
var imageType = $('#selectImageType', page).val();
|
||||||
|
|
||||||
ApiClient.uploadItemImage(currentItemId, imageType, file).done(function () {
|
ApiClient.uploadItemImage(currentItemId, imageType, file).then(function () {
|
||||||
|
|
||||||
$('#uploadImage', page).val('').trigger('change');
|
$('#uploadImage', page).val('').trigger('change');
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
@ -125,13 +125,12 @@
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/imageuploader/imageuploader.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/imageuploader/imageuploader.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
currentItemId = itemId;
|
currentItemId = itemId;
|
||||||
|
|
||||||
var dlg = PaperDialogHelper.createDialog({
|
var dlg = PaperDialogHelper.createDialog({
|
||||||
|
@ -163,7 +162,9 @@
|
||||||
|
|
||||||
PaperDialogHelper.close(dlg);
|
PaperDialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
|
@ -69,7 +69,7 @@
|
||||||
data: JSON.stringify(lookupInfo),
|
data: JSON.stringify(lookupInfo),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function (results) {
|
}).then(function (results) {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
showIdentificationSearchResults(page, results);
|
showIdentificationSearchResults(page, results);
|
||||||
|
@ -213,14 +213,14 @@
|
||||||
data: JSON.stringify(currentSearchResult),
|
data: JSON.stringify(currentSearchResult),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
PaperDialogHelper.close(document.querySelector('.identifyDialog'));
|
PaperDialogHelper.close(document.querySelector('.identifyDialog'));
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
|
|
||||||
function showIdentificationForm(page, item) {
|
function showIdentificationForm(page, item) {
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
|
ApiClient.getJSON(ApiClient.getUrl("Items/" + item.Id + "/ExternalIdInfos")).then(function (idList) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
|
@ -281,13 +281,12 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/itemidentifier/itemidentifier.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/itemidentifier/itemidentifier.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
||||||
|
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
|
@ -325,7 +324,9 @@
|
||||||
showIdentificationForm(dlg, item);
|
showIdentificationForm(dlg, item);
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
type = null;
|
type = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).done(function () {
|
ApiClient.addVirtualFolder(name, type, currentOptions.refresh, paths).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
PaperDialogHelper.close(dlg);
|
PaperDialogHelper.close(dlg);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
Dashboard.alert(Globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||||
});
|
});
|
||||||
|
@ -188,13 +188,12 @@
|
||||||
|
|
||||||
require(['components/paperdialoghelper'], function () {
|
require(['components/paperdialoghelper'], function () {
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/medialibrarycreator/medialibrarycreator.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/medialibrarycreator/medialibrarycreator.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
var dlg = PaperDialogHelper.createDialog({
|
var dlg = PaperDialogHelper.createDialog({
|
||||||
size: 'small',
|
size: 'small',
|
||||||
theme: 'a',
|
theme: 'a',
|
||||||
|
@ -233,7 +232,9 @@
|
||||||
|
|
||||||
paths = [];
|
paths = [];
|
||||||
renderPaths(editorContent);
|
renderPaths(editorContent);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -10,12 +10,12 @@
|
||||||
|
|
||||||
var refreshAfterChange = currentOptions.refresh;
|
var refreshAfterChange = currentOptions.refresh;
|
||||||
|
|
||||||
ApiClient.addMediaPath(virtualFolder.Name, path, refreshAfterChange).done(function () {
|
ApiClient.addMediaPath(virtualFolder.Name, path, refreshAfterChange).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
refreshLibraryFromServer(page);
|
refreshLibraryFromServer(page);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
Dashboard.alert(Globalize.translate('ErrorAddingMediaPathToVirtualFolder'));
|
||||||
});
|
});
|
||||||
|
@ -36,12 +36,12 @@
|
||||||
|
|
||||||
var refreshAfterChange = currentOptions.refresh;
|
var refreshAfterChange = currentOptions.refresh;
|
||||||
|
|
||||||
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).done(function () {
|
ApiClient.removeMediaPath(virtualFolder.Name, location, refreshAfterChange).then(function () {
|
||||||
|
|
||||||
hasChanges = true;
|
hasChanges = true;
|
||||||
refreshLibraryFromServer($(button).parents('.editorContent')[0]);
|
refreshLibraryFromServer($(button).parents('.editorContent')[0]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('DefaultErrorMessage'));
|
Dashboard.alert(Globalize.translate('DefaultErrorMessage'));
|
||||||
});
|
});
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
function refreshLibraryFromServer(page) {
|
function refreshLibraryFromServer(page) {
|
||||||
|
|
||||||
ApiClient.getVirtualFolders().done(function (result) {
|
ApiClient.getVirtualFolders().then(function (result) {
|
||||||
|
|
||||||
var library = result.filter(function (f) {
|
var library = result.filter(function (f) {
|
||||||
|
|
||||||
|
@ -142,13 +142,12 @@
|
||||||
|
|
||||||
require(['components/paperdialoghelper'], function () {
|
require(['components/paperdialoghelper'], function () {
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/medialibraryeditor/medialibraryeditor.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/medialibraryeditor/medialibraryeditor.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
var dlg = PaperDialogHelper.createDialog({
|
var dlg = PaperDialogHelper.createDialog({
|
||||||
size: 'small',
|
size: 'small',
|
||||||
theme: 'a',
|
theme: 'a',
|
||||||
|
@ -184,7 +183,9 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
refreshLibraryFromServer(editorContent);
|
refreshLibraryFromServer(editorContent);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -39,13 +39,12 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/metadataeditor/metadataeditor.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/metadataeditor/metadataeditor.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
||||||
|
|
||||||
var dlg = document.createElement('paper-dialog');
|
var dlg = document.createElement('paper-dialog');
|
||||||
|
@ -88,7 +87,9 @@
|
||||||
PaperDialogHelper.close(dlg);
|
PaperDialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json"
|
dataType: "json"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: url
|
url: url
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
|
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
var url = 'Providers/Subtitles/Subtitles/' + id;
|
var url = 'Providers/Subtitles/Subtitles/' + id;
|
||||||
|
|
||||||
ApiClient.get(ApiClient.getUrl(url)).done(function (result) {
|
ApiClient.get(ApiClient.getUrl(url)).then(function (result) {
|
||||||
|
|
||||||
$('.subtitleContent', page).html(result);
|
$('.subtitleContent', page).html(result);
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ApiClient.getUrl(url)
|
url: ApiClient.getUrl(url)
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('MessageDownloadQueued'));
|
Dashboard.alert(Globalize.translate('MessageDownloadQueued'));
|
||||||
});
|
});
|
||||||
|
@ -78,7 +78,7 @@
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
url: ApiClient.getUrl(url)
|
url: ApiClient.getUrl(url)
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
reload(page, itemId);
|
reload(page, itemId);
|
||||||
});
|
});
|
||||||
|
@ -291,7 +291,7 @@
|
||||||
|
|
||||||
var url = ApiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
|
var url = ApiClient.getUrl('Items/' + currentItem.Id + '/RemoteSearch/Subtitles/' + language);
|
||||||
|
|
||||||
ApiClient.fetchJSON(url).then(function (results) {
|
ApiClient.getJSON(url).then(function (results) {
|
||||||
|
|
||||||
renderSearchResults(page, results);
|
renderSearchResults(page, results);
|
||||||
});
|
});
|
||||||
|
@ -331,13 +331,12 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/subtitleeditor/subtitleeditor.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/subtitleeditor/subtitleeditor.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
ApiClient.getItem(Dashboard.getCurrentUserId(), itemId).then(function (item) {
|
||||||
|
|
||||||
var dlg = PaperDialogHelper.createDialog();
|
var dlg = PaperDialogHelper.createDialog();
|
||||||
|
@ -365,7 +364,7 @@
|
||||||
var editorContent = dlg.querySelector('.editorContent');
|
var editorContent = dlg.querySelector('.editorContent');
|
||||||
reload(editorContent, item);
|
reload(editorContent, item);
|
||||||
|
|
||||||
ApiClient.getCultures().done(function (languages) {
|
ApiClient.getCultures().then(function (languages) {
|
||||||
|
|
||||||
fillLanguages(editorContent, languages);
|
fillLanguages(editorContent, languages);
|
||||||
});
|
});
|
||||||
|
@ -375,7 +374,9 @@
|
||||||
PaperDialogHelper.close(dlg);
|
PaperDialogHelper.close(dlg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
function onDialogClosed() {
|
function onDialogClosed() {
|
||||||
|
|
|
@ -67,7 +67,7 @@
|
||||||
var nextDay = new Date(date.getTime() + msPerDay - 2000);
|
var nextDay = new Date(date.getTime() + msPerDay - 2000);
|
||||||
|
|
||||||
Logger.log(nextDay);
|
Logger.log(nextDay);
|
||||||
channelsPromise.done(function (channelsResult) {
|
channelsPromise.then(function (channelsResult) {
|
||||||
|
|
||||||
ApiClient.getLiveTvPrograms({
|
ApiClient.getLiveTvPrograms({
|
||||||
UserId: Dashboard.getCurrentUserId(),
|
UserId: Dashboard.getCurrentUserId(),
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
EnableImages: false,
|
EnableImages: false,
|
||||||
SortBy: "StartDate"
|
SortBy: "StartDate"
|
||||||
|
|
||||||
}).done(function (programsResult) {
|
}).then(function (programsResult) {
|
||||||
|
|
||||||
renderGuide(page, date, channelsResult.Items, programsResult.Items);
|
renderGuide(page, date, channelsResult.Items, programsResult.Items);
|
||||||
|
|
||||||
|
@ -424,7 +424,7 @@
|
||||||
|
|
||||||
channelLimit = limit;
|
channelLimit = limit;
|
||||||
|
|
||||||
ApiClient.getLiveTvGuideInfo().done(function (guideInfo) {
|
ApiClient.getLiveTvGuideInfo().then(function (guideInfo) {
|
||||||
|
|
||||||
setDateRange(page, guideInfo);
|
setDateRange(page, guideInfo);
|
||||||
});
|
});
|
||||||
|
@ -434,11 +434,11 @@
|
||||||
|
|
||||||
$('.guideRequiresUnlock', page).hide();
|
$('.guideRequiresUnlock', page).hide();
|
||||||
|
|
||||||
RegistrationServices.validateFeature('livetv').done(function () {
|
RegistrationServices.validateFeature('livetv').then(function () {
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
reloadPageAfterValidation(page, 1000);
|
reloadPageAfterValidation(page, 1000);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
|
@ -469,13 +469,12 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/tvguide/tvguide.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/tvguide/tvguide.template.html'
|
|
||||||
|
|
||||||
}).done(function (template) {
|
|
||||||
|
|
||||||
|
var template = this.response;
|
||||||
var tabContent = options.element;
|
var tabContent = options.element;
|
||||||
tabContent.innerHTML = Globalize.translateDocument(template);
|
tabContent.innerHTML = Globalize.translateDocument(template);
|
||||||
|
|
||||||
|
@ -517,6 +516,8 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
self.refresh();
|
self.refresh();
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
};
|
};
|
||||||
});
|
});
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
|
|
||||||
var info = config.ListingProviders.filter(function (i) {
|
var info = config.ListingProviders.filter(function (i) {
|
||||||
return i.Id == providerId;
|
return i.Id == providerId;
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
|
|
||||||
function setCountry(info) {
|
function setCountry(info) {
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).then(function (result) {
|
ApiClient.getJSON(ApiClient.getUrl('LiveTv/ListingProviders/SchedulesDirect/Countries')).then(function (result) {
|
||||||
|
|
||||||
var countryList = [];
|
var countryList = [];
|
||||||
var i, length;
|
var i, length;
|
||||||
|
@ -108,13 +108,13 @@
|
||||||
data: JSON.stringify(info),
|
data: JSON.stringify(info),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
Dashboard.processServerConfigurationUpdateResult();
|
Dashboard.processServerConfigurationUpdateResult();
|
||||||
providerId = result.Id;
|
providerId = result.Id;
|
||||||
reload();
|
reload();
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('ErrorSavingTvProvider')
|
message: Globalize.translate('ErrorSavingTvProvider')
|
||||||
});
|
});
|
||||||
|
@ -137,7 +137,7 @@
|
||||||
|
|
||||||
var id = providerId;
|
var id = providerId;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
|
|
||||||
var info = config.ListingProviders.filter(function (i) {
|
var info = config.ListingProviders.filter(function (i) {
|
||||||
return i.Id == id;
|
return i.Id == id;
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
data: JSON.stringify(info),
|
data: JSON.stringify(info),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
if (options.showConfirmation !== false) {
|
if (options.showConfirmation !== false) {
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
}
|
}
|
||||||
$(self).trigger('submitted');
|
$(self).trigger('submitted');
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('ErrorAddingListingsToSchedulesDirect')
|
message: Globalize.translate('ErrorAddingListingsToSchedulesDirect')
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
}),
|
}),
|
||||||
dataType: 'json'
|
dataType: 'json'
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
$('#selectListing', page).html(result.map(function (o) {
|
$('#selectListing', page).html(result.map(function (o) {
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@
|
||||||
|
|
||||||
Dashboard.hideModalLoadingMsg();
|
Dashboard.hideModalLoadingMsg();
|
||||||
|
|
||||||
}).fail(function (result) {
|
}, function (result) {
|
||||||
|
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('ErrorGettingTvLineups')
|
message: Globalize.translate('ErrorGettingTvLineups')
|
||||||
|
|
12
dashboard-ui/cordova/android/iap.js
vendored
12
dashboard-ui/cordova/android/iap.js
vendored
|
@ -68,11 +68,11 @@
|
||||||
data: {
|
data: {
|
||||||
Parameters: JSON.stringify(result)
|
Parameters: JSON.stringify(result)
|
||||||
}
|
}
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
refreshPurchases();
|
refreshPurchases();
|
||||||
|
|
||||||
}).fail(function (e) {
|
}, function (e) {
|
||||||
|
|
||||||
refreshPurchases();
|
refreshPurchases();
|
||||||
});
|
});
|
||||||
|
@ -123,14 +123,14 @@
|
||||||
|
|
||||||
function isPlaybackUnlockedViaOldApp(deferred) {
|
function isPlaybackUnlockedViaOldApp(deferred) {
|
||||||
|
|
||||||
testDeviceId(ConnectionManager.deviceId()).done(function (isUnlocked) {
|
testDeviceId(ConnectionManager.deviceId()).then(function (isUnlocked) {
|
||||||
|
|
||||||
if (isUnlocked) {
|
if (isUnlocked) {
|
||||||
deferred.resolveWith(null, [true]);
|
deferred.resolveWith(null, [true]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
testDeviceId(device.uuid).done(function (isUnlocked) {
|
testDeviceId(device.uuid).then(function (isUnlocked) {
|
||||||
|
|
||||||
if (isUnlocked) {
|
if (isUnlocked) {
|
||||||
deferred.resolveWith(null, [true]);
|
deferred.resolveWith(null, [true]);
|
||||||
|
@ -159,11 +159,11 @@
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: 'https://mb3admin.com/admin/service/statistics/appAccess?application=AndroidV1&deviceId=' + deviceId
|
url: 'https://mb3admin.com/admin/service/statistics/appAccess?application=AndroidV1&deviceId=' + deviceId
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
appStorage.setItem(cacheKey, 'true');
|
appStorage.setItem(cacheKey, 'true');
|
||||||
|
|
||||||
}).fail(function (e) {
|
}, function (e) {
|
||||||
|
|
||||||
if (e.status == 404) {
|
if (e.status == 404) {
|
||||||
appStorage.setItem(cacheKey, 'false');
|
appStorage.setItem(cacheKey, 'false');
|
||||||
|
|
2
dashboard-ui/cordova/android/mediasession.js
vendored
2
dashboard-ui/cordova/android/mediasession.js
vendored
|
@ -156,7 +156,7 @@
|
||||||
|
|
||||||
Logger.log('binding remotecontrols to ' + player.name);
|
Logger.log('binding remotecontrols to ' + player.name);
|
||||||
|
|
||||||
player.getPlayerState().done(function (state) {
|
player.getPlayerState().then(function (state) {
|
||||||
|
|
||||||
if (state.NowPlayingItem) {
|
if (state.NowPlayingItem) {
|
||||||
player.beginPlayerUpdates();
|
player.beginPlayerUpdates();
|
||||||
|
|
2
dashboard-ui/cordova/chromecast.js
vendored
2
dashboard-ui/cordova/chromecast.js
vendored
|
@ -76,7 +76,7 @@
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
||||||
|
|
||||||
endpointInfo = info;
|
endpointInfo = info;
|
||||||
});
|
});
|
||||||
|
|
4
dashboard-ui/cordova/generaldevice.js
vendored
4
dashboard-ui/cordova/generaldevice.js
vendored
|
@ -148,7 +148,7 @@
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).done(function (playbackInfoResult) {
|
MediaController.getPlaybackInfo(item.Id, deviceProfile, startPosition).then(function (playbackInfoResult) {
|
||||||
|
|
||||||
if (validatePlaybackInfoResult(playbackInfoResult)) {
|
if (validatePlaybackInfoResult(playbackInfoResult)) {
|
||||||
|
|
||||||
|
@ -158,7 +158,7 @@
|
||||||
|
|
||||||
if (mediaSource.RequiresOpening) {
|
if (mediaSource.RequiresOpening) {
|
||||||
|
|
||||||
getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).done(function (openLiveStreamResult) {
|
getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).then(function (openLiveStreamResult) {
|
||||||
|
|
||||||
openLiveStreamResult.MediaSource.enableDirectPlay = supportsDirectPlay(openLiveStreamResult.MediaSource);
|
openLiveStreamResult.MediaSource.enableDirectPlay = supportsDirectPlay(openLiveStreamResult.MediaSource);
|
||||||
|
|
||||||
|
|
16
dashboard-ui/cordova/iap.js
vendored
16
dashboard-ui/cordova/iap.js
vendored
|
@ -123,24 +123,24 @@
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
promise = HttpClient.send({
|
promise = fetch("http://mb3admin.com/admin/service/appstore/register", {
|
||||||
type: "POST",
|
|
||||||
url: "http://mb3admin.com/admin/service/appstore/register",
|
method: 'POST',
|
||||||
data: JSON.stringify(postData),
|
body: JSON.stringify(postData),
|
||||||
contentType: "application/json",
|
|
||||||
headers: {
|
headers: {
|
||||||
"X-Emby-Token": "EMBY-APPLE-VALIDATE"
|
"X-Emby-Token": "EMBY-APPLE-VALIDATE",
|
||||||
|
"Content-Type": "application/json"
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
promise.done(function () {
|
promise.then(function () {
|
||||||
|
|
||||||
setCachedResult(cacheKey, true);
|
setCachedResult(cacheKey, true);
|
||||||
|
|
||||||
callback(true, product);
|
callback(true, product);
|
||||||
|
|
||||||
}).fail(function (e) {
|
}, function (e) {
|
||||||
|
|
||||||
if (e.status == 402) {
|
if (e.status == 402) {
|
||||||
|
|
||||||
|
|
6
dashboard-ui/cordova/imagestore.js
vendored
6
dashboard-ui/cordova/imagestore.js
vendored
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
//Logger.log('getImageUrl:' + originalUrl);
|
//Logger.log('getImageUrl:' + originalUrl);
|
||||||
|
|
||||||
getFileSystem().done(function (fileSystem) {
|
getFileSystem().then(function (fileSystem) {
|
||||||
var path = fileSystem.root.toURL() + "/emby/cache/" + key;
|
var path = fileSystem.root.toURL() + "/emby/cache/" + key;
|
||||||
|
|
||||||
resolveLocalFileSystemURL(path, function (fileEntry) {
|
resolveLocalFileSystemURL(path, function (fileEntry) {
|
||||||
|
@ -116,11 +116,11 @@
|
||||||
// return;
|
// return;
|
||||||
//}
|
//}
|
||||||
|
|
||||||
self.getImageUrl(url).done(function (localUrl) {
|
self.getImageUrl(url).then(function (localUrl) {
|
||||||
|
|
||||||
setImageIntoElement(elem, localUrl);
|
setImageIntoElement(elem, localUrl);
|
||||||
|
|
||||||
}).fail(onFail);
|
}, onFail);
|
||||||
};
|
};
|
||||||
|
|
||||||
var imageIdIndex = 1;
|
var imageIdIndex = 1;
|
||||||
|
|
2
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
2
dashboard-ui/cordova/ios/backgroundfetch.js
vendored
|
@ -40,7 +40,7 @@
|
||||||
var promise = LocalSync.sync(syncOptions);
|
var promise = LocalSync.sync(syncOptions);
|
||||||
|
|
||||||
if (reportToFetcher) {
|
if (reportToFetcher) {
|
||||||
promise.done(onSyncFinish).fail(onSyncFail);
|
promise.then(onSyncFinish, onSyncFail);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
4
dashboard-ui/cordova/ios/tabbar.js
vendored
4
dashboard-ui/cordova/ios/tabbar.js
vendored
|
@ -108,11 +108,11 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.getUserViews({}, user.Id).done(function (result) {
|
ApiClient.getUserViews({}, user.Id).then(function (result) {
|
||||||
|
|
||||||
onUserViewResponse(user, result.Items);
|
onUserViewResponse(user, result.Items);
|
||||||
|
|
||||||
}).fail(function (result) {
|
}, function (result) {
|
||||||
|
|
||||||
onUserViewResponse(user, []);
|
onUserViewResponse(user, []);
|
||||||
});
|
});
|
||||||
|
|
56
dashboard-ui/cordova/localassetmanager.js
vendored
56
dashboard-ui/cordova/localassetmanager.js
vendored
|
@ -17,13 +17,13 @@
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
getLocalItem(itemId, serverId).done(function (localItem) {
|
getLocalItem(itemId, serverId).then(function (localItem) {
|
||||||
|
|
||||||
if (localItem && localItem.Item.MediaSources.length) {
|
if (localItem && localItem.Item.MediaSources.length) {
|
||||||
|
|
||||||
var mediaSource = localItem.Item.MediaSources[0];
|
var mediaSource = localItem.Item.MediaSources[0];
|
||||||
|
|
||||||
fileExists(mediaSource.Path).done(function (exists) {
|
fileExists(mediaSource.Path).then(function (exists) {
|
||||||
|
|
||||||
if (exists) {
|
if (exists) {
|
||||||
deferred.resolveWith(null, [mediaSource]);
|
deferred.resolveWith(null, [mediaSource]);
|
||||||
|
@ -32,13 +32,14 @@
|
||||||
deferred.resolveWith(null, [null]);
|
deferred.resolveWith(null, [null]);
|
||||||
}
|
}
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deferred.resolveWith(null, [null]);
|
deferred.resolveWith(null, [null]);
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -348,7 +349,7 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
getLocalItem(itemId, serverId).done(function (item) {
|
getLocalItem(itemId, serverId).then(function (item) {
|
||||||
|
|
||||||
getOfflineItemsDb(function (db) {
|
getOfflineItemsDb(function (db) {
|
||||||
|
|
||||||
|
@ -359,16 +360,16 @@
|
||||||
var files = item.AdditionalFiles || [];
|
var files = item.AdditionalFiles || [];
|
||||||
files.push(item.LocalPath);
|
files.push(item.LocalPath);
|
||||||
|
|
||||||
deleteFiles(files).done(function () {
|
deleteFiles(files).then(function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
@ -386,9 +387,9 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
deleteFile(file).done(function () {
|
deleteFile(file).then(function () {
|
||||||
deleteNextFile(files, index + 1, deferred);
|
deleteNextFile(files, index + 1, deferred);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deleteNextFile(files, index + 1, deferred);
|
deleteNextFile(files, index + 1, deferred);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -420,7 +421,7 @@
|
||||||
|
|
||||||
function resolveFile(path, options, success, fail) {
|
function resolveFile(path, options, success, fail) {
|
||||||
|
|
||||||
getFileSystem().done(function (fileSystem) {
|
getFileSystem().then(function (fileSystem) {
|
||||||
|
|
||||||
fileSystem.root.getFile(path, options || { create: false }, success, fail);
|
fileSystem.root.getFile(path, options || { create: false }, success, fail);
|
||||||
});
|
});
|
||||||
|
@ -541,7 +542,7 @@
|
||||||
|
|
||||||
Logger.log('downloading: ' + url + ' to ' + localPath);
|
Logger.log('downloading: ' + url + ' to ' + localPath);
|
||||||
|
|
||||||
createDirectory(getParentDirectoryPath(localPath)).done(function () {
|
createDirectory(getParentDirectoryPath(localPath)).then(function () {
|
||||||
|
|
||||||
resolveFile(localPath, { create: true }, function (targetFile) {
|
resolveFile(localPath, { create: true }, function (targetFile) {
|
||||||
|
|
||||||
|
@ -593,7 +594,7 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));;
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
@ -626,7 +627,7 @@
|
||||||
|
|
||||||
Logger.log('downloading: ' + url + ' to ' + localPath);
|
Logger.log('downloading: ' + url + ' to ' + localPath);
|
||||||
|
|
||||||
createDirectory(getParentDirectoryPath(localPath)).done(function () {
|
createDirectory(getParentDirectoryPath(localPath)).then(function () {
|
||||||
|
|
||||||
resolveFile(localPath, { create: true }, function (targetFile) {
|
resolveFile(localPath, { create: true }, function (targetFile) {
|
||||||
|
|
||||||
|
@ -679,7 +680,7 @@
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
@ -702,11 +703,11 @@
|
||||||
parts.length = index + 1;
|
parts.length = index + 1;
|
||||||
var pathToCreate = parts.join('/');
|
var pathToCreate = parts.join('/');
|
||||||
|
|
||||||
createDirectoryInternal(pathToCreate).done(function () {
|
createDirectoryInternal(pathToCreate).then(function () {
|
||||||
|
|
||||||
createDirectoryPart(path, index + 1, deferred);
|
createDirectoryPart(path, index + 1, deferred);
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
}
|
}
|
||||||
|
|
||||||
function createDirectoryInternal(path) {
|
function createDirectoryInternal(path) {
|
||||||
|
@ -714,7 +715,7 @@
|
||||||
Logger.log('creating directory: ' + path);
|
Logger.log('creating directory: ' + path);
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
getFileSystem().done(function (fileSystem) {
|
getFileSystem().then(function (fileSystem) {
|
||||||
|
|
||||||
fileSystem.root.getDirectory(path, { create: true, exclusive: false }, function (targetFile) {
|
fileSystem.root.getDirectory(path, { create: true, exclusive: false }, function (targetFile) {
|
||||||
|
|
||||||
|
@ -727,7 +728,7 @@
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
@ -796,30 +797,31 @@
|
||||||
function hasImage(serverId, itemId, imageTag) {
|
function hasImage(serverId, itemId, imageTag) {
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
getImageLocalPath(serverId, itemId, imageTag).done(function (localPath) {
|
getImageLocalPath(serverId, itemId, imageTag).then(function (localPath) {
|
||||||
|
|
||||||
fileExists(localPath).done(function (exists) {
|
fileExists(localPath).then(function (exists) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [exists]);
|
deferred.resolveWith(null, [exists]);
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
function downloadImage(url, serverId, itemId, imageTag) {
|
function downloadImage(url, serverId, itemId, imageTag) {
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
getImageLocalPath(serverId, itemId, imageTag).done(function (localPath) {
|
getImageLocalPath(serverId, itemId, imageTag).then(function (localPath) {
|
||||||
|
|
||||||
downloadFile(url, localPath).done(function () {
|
downloadFile(url, localPath).then(function () {
|
||||||
|
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
|
}, getOnFail(deferred));
|
||||||
|
|
||||||
}).fail(getOnFail(deferred));
|
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
12
dashboard-ui/cordova/registrationservices.js
vendored
12
dashboard-ui/cordova/registrationservices.js
vendored
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
var prefix = $.browser.android ? 'android' : 'ios';
|
var prefix = $.browser.android ? 'android' : 'ios';
|
||||||
|
|
||||||
IapManager.isUnlockedOverride(feature).done(function (isUnlocked) {
|
IapManager.isUnlockedOverride(feature).then(function (isUnlocked) {
|
||||||
|
|
||||||
if (isUnlocked) {
|
if (isUnlocked) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IapManager.getSubscriptionOptions().done(function (subscriptionOptions) {
|
IapManager.getSubscriptionOptions().then(function (subscriptionOptions) {
|
||||||
|
|
||||||
if (subscriptionOptions.filter(function (p) {
|
if (subscriptionOptions.filter(function (p) {
|
||||||
return p.owned;
|
return p.owned;
|
||||||
|
@ -58,7 +58,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get supporter status
|
// Get supporter status
|
||||||
getRegistrationInfo(prefix + 'appunlock').done(onRegistrationInfoResponse).fail(function () {
|
getRegistrationInfo(prefix + 'appunlock').then(onRegistrationInfoResponse, function () {
|
||||||
onRegistrationInfoResponse({});
|
onRegistrationInfoResponse({});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -371,7 +371,7 @@
|
||||||
|
|
||||||
function validateSync(deferred) {
|
function validateSync(deferred) {
|
||||||
|
|
||||||
Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) {
|
Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
|
||||||
|
|
||||||
if (pluginSecurityInfo.IsMBSupporter) {
|
if (pluginSecurityInfo.IsMBSupporter) {
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
@ -384,7 +384,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
IapManager.getSubscriptionOptions().done(function (subscriptionOptions) {
|
IapManager.getSubscriptionOptions().then(function (subscriptionOptions) {
|
||||||
|
|
||||||
var dialogOptions = {
|
var dialogOptions = {
|
||||||
title: Globalize.translate('HeaderUnlockSync'),
|
title: Globalize.translate('HeaderUnlockSync'),
|
||||||
|
@ -396,7 +396,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get supporter status
|
// Get supporter status
|
||||||
getRegistrationInfo('Sync').done(onRegistrationInfoResponse).fail(function () {
|
getRegistrationInfo('Sync').then(onRegistrationInfoResponse, function () {
|
||||||
onRegistrationInfoResponse({});
|
onRegistrationInfoResponse({});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
2
dashboard-ui/cordova/remotecontrols.js
vendored
2
dashboard-ui/cordova/remotecontrols.js
vendored
|
@ -158,7 +158,7 @@
|
||||||
|
|
||||||
Logger.log('binding remotecontrols to MediaPlayer');
|
Logger.log('binding remotecontrols to MediaPlayer');
|
||||||
|
|
||||||
player.getPlayerState().done(function (state) {
|
player.getPlayerState().then(function (state) {
|
||||||
|
|
||||||
if (state.NowPlayingItem) {
|
if (state.NowPlayingItem) {
|
||||||
player.beginPlayerUpdates();
|
player.beginPlayerUpdates();
|
||||||
|
|
7
dashboard-ui/cordova/serverdiscovery.js
vendored
7
dashboard-ui/cordova/serverdiscovery.js
vendored
|
@ -146,17 +146,18 @@
|
||||||
|
|
||||||
var deferred = DeferredBuilder.Deferred();
|
var deferred = DeferredBuilder.Deferred();
|
||||||
|
|
||||||
deviceReadyPromise.done(function () {
|
deviceReadyPromise.then(function () {
|
||||||
|
|
||||||
try {
|
try {
|
||||||
findServersInternal(timeoutMs).done(function (result) {
|
findServersInternal(timeoutMs).then(function (result) {
|
||||||
|
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
deferred.resolveWith(null, [[]]);
|
deferred.resolveWith(null, [[]]);
|
||||||
});
|
});
|
||||||
|
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
deferred.resolveWith(null, [[]]);
|
deferred.resolveWith(null, [[]]);
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
function populateReviews(id, page) {
|
function populateReviews(id, page) {
|
||||||
|
|
||||||
ApiClient.getPackageReviews(id, null, null, 3).done(function (positive) {
|
ApiClient.getPackageReviews(id, null, null, 3).then(function (positive) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
|
@ -185,7 +185,7 @@
|
||||||
var promise2 = ApiClient.getInstalledPlugins();
|
var promise2 = ApiClient.getInstalledPlugins();
|
||||||
var promise3 = ApiClient.getPluginSecurityInfo();
|
var promise3 = ApiClient.getPluginSecurityInfo();
|
||||||
|
|
||||||
$.when(promise1, promise2, promise3).done(function (response1, response2, response3) {
|
$.when(promise1, promise2, promise3).then(function (response1, response2, response3) {
|
||||||
|
|
||||||
renderPackage(response1[0], response2[0], response3[0], page);
|
renderPackage(response1[0], response2[0], response3[0], page);
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.installPlugin(packageName, guid, updateClass, version).done(function () {
|
ApiClient.installPlugin(packageName, guid, updateClass, version).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
|
@ -281,7 +281,7 @@
|
||||||
var name = getParameterByName('name');
|
var name = getParameterByName('name');
|
||||||
var guid = getParameterByName('guid');
|
var guid = getParameterByName('guid');
|
||||||
|
|
||||||
ApiClient.getInstalledPlugins().done(function (plugins) {
|
ApiClient.getInstalledPlugins().then(function (plugins) {
|
||||||
|
|
||||||
var installedPlugin = plugins.filter(function (ip) {
|
var installedPlugin = plugins.filter(function (ip) {
|
||||||
return ip.Name == name;
|
return ip.Name == name;
|
||||||
|
|
|
@ -63,7 +63,7 @@
|
||||||
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
config.EnableDashboardResponseCaching = $('#chkEnableDashboardResponseCache', form).checked();
|
||||||
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
config.DashboardSourcePath = $('#txtDashboardSourcePath', form).val();
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
var promise2 = ApiClient.getInstalledPlugins();
|
var promise2 = ApiClient.getInstalledPlugins();
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).then(function (response1, response2) {
|
||||||
renderInstalled(page, response1[0], response2[0]);
|
renderInstalled(page, response1[0], response2[0]);
|
||||||
renderCatalog(page, response1[0], response2[0]);
|
renderCatalog(page, response1[0], response2[0]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,13 +38,13 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.deleteOriginalFileFromOrganizationResult(id).done(function () {
|
ApiClient.deleteOriginalFileFromOrganizationResult(id).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
reloadItems(page);
|
reloadItems(page);
|
||||||
|
|
||||||
}).fail(onApiFailure);
|
}, onApiFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -121,13 +121,13 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.performOrganization(id).done(function () {
|
ApiClient.performOrganization(id).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
reloadItems(page);
|
reloadItems(page);
|
||||||
|
|
||||||
}).fail(onApiFailure);
|
}, onApiFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -149,7 +149,7 @@
|
||||||
EndingEpisodeNumber: $('#txtEndingEpisode', form).val()
|
EndingEpisodeNumber: $('#txtEndingEpisode', form).val()
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.performEpisodeOrganization(resultId, options).done(function () {
|
ApiClient.performEpisodeOrganization(resultId, options).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
@ -157,20 +157,21 @@
|
||||||
|
|
||||||
reloadItems(page);
|
reloadItems(page);
|
||||||
|
|
||||||
}).fail(onApiFailure);
|
}, onApiFailure);
|
||||||
}
|
}
|
||||||
|
|
||||||
function reloadItems(page) {
|
function reloadItems(page) {
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getFileOrganizationResults(query).done(function (result) {
|
ApiClient.getFileOrganizationResults(query).then(function (result) {
|
||||||
|
|
||||||
currentResult = result;
|
currentResult = result;
|
||||||
renderResults(page, result);
|
renderResults(page, result);
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
}).fail(onApiFailure);
|
|
||||||
|
}, onApiFailure);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,9 +352,9 @@
|
||||||
|
|
||||||
$('.btnClearLog', page).on('click', function () {
|
$('.btnClearLog', page).on('click', function () {
|
||||||
|
|
||||||
ApiClient.clearOrganizationLog().done(function () {
|
ApiClient.clearOrganizationLog().then(function () {
|
||||||
reloadItems(page);
|
reloadItems(page);
|
||||||
}).fail(onApiFailure);
|
}, onApiFailure);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration('autoorganize').done(function (config) {
|
ApiClient.getNamedConfiguration('autoorganize').then(function (config) {
|
||||||
|
|
||||||
var tvOptions = config.TvOptions;
|
var tvOptions = config.TvOptions;
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
|
|
||||||
tvOptions.CopyOriginalFile = $('#copyOrMoveFile', form).val();
|
tvOptions.CopyOriginalFile = $('#copyOrMoveFile', form).val();
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration('autoorganize', config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration('autoorganize', config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -160,7 +160,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration('autoorganize').done(function (config) {
|
ApiClient.getNamedConfiguration('autoorganize').then(function (config) {
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
|
|
||||||
var channelId = getParameterByName('id');
|
var channelId = getParameterByName('id');
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl("Channels/" + channelId + "/Features")).then(function (features) {
|
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Features")).then(function (features) {
|
||||||
|
|
||||||
if (features.CanFilter) {
|
if (features.CanFilter) {
|
||||||
|
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
|
|
||||||
query.folderId = folderId;
|
query.folderId = folderId;
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl("Channels/" + channelId + "/Items", query)).then(function (result) {
|
ApiClient.getJSON(ApiClient.getUrl("Channels/" + channelId + "/Items", query)).then(function (result) {
|
||||||
|
|
||||||
// Scroll back up so they can see the results from the beginning
|
// Scroll back up so they can see the results from the beginning
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
@ -145,7 +145,9 @@
|
||||||
showSortMenu(page);
|
showSortMenu(page);
|
||||||
});
|
});
|
||||||
|
|
||||||
}).always(function () {
|
Dashboard.hideModalLoadingMsg();
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
|
||||||
Dashboard.hideModalLoadingMsg();
|
Dashboard.hideModalLoadingMsg();
|
||||||
});
|
});
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
query.UserId = Dashboard.getCurrentUserId();
|
query.UserId = Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl("Channels", query)).then(function (result) {
|
ApiClient.getJSON(ApiClient.getUrl("Channels", query)).then(function (result) {
|
||||||
|
|
||||||
// Scroll back up so they can see the results from the beginning
|
// Scroll back up so they can see the results from the beginning
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
|
@ -13,12 +13,12 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("channels").done(function (config) {
|
ApiClient.getNamedConfiguration("channels").then(function (config) {
|
||||||
|
|
||||||
// This should be null if empty
|
// This should be null if empty
|
||||||
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
|
config.PreferredStreamingWidth = $('#selectChannelResolution', form).val() || null;
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("channels", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("channels", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
@ -37,7 +37,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("channels").done(function (config) {
|
ApiClient.getNamedConfiguration("channels").then(function (config) {
|
||||||
|
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,9 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
Sections.loadLatestChannelItems(page.querySelector('.latestItems'), Dashboard.getCurrentUserId()).always(function() {
|
Sections.loadLatestChannelItems(page.querySelector('.latestItems'), Dashboard.getCurrentUserId()).then(function() {
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
}, function () {
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -323,7 +323,7 @@
|
||||||
return deferred.promise();
|
return deferred.promise();
|
||||||
}
|
}
|
||||||
|
|
||||||
return ApiClient.fetchJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
return ApiClient.getJSON(ApiClient.getUrl('System/Endpoint')).then(function (info) {
|
||||||
|
|
||||||
endpointInfo = info;
|
endpointInfo = info;
|
||||||
});
|
});
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
|
|
||||||
var page = $(form).parents('.page');
|
var page = $(form).parents('.page');
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("cinemamode").done(function (config) {
|
ApiClient.getNamedConfiguration("cinemamode").then(function (config) {
|
||||||
|
|
||||||
config.CustomIntroPath = $('#txtCustomIntrosPath', page).val();
|
config.CustomIntroPath = $('#txtCustomIntrosPath', page).val();
|
||||||
config.TrailerLimit = $('#txtNumTrailers', page).val();
|
config.TrailerLimit = $('#txtNumTrailers', page).val();
|
||||||
|
@ -44,7 +44,7 @@
|
||||||
config.EnableIntrosFromUpcomingStreamingMovies = $('.chkUpcomingStreamingTrailers', page).checked();
|
config.EnableIntrosFromUpcomingStreamingMovies = $('.chkUpcomingStreamingTrailers', page).checked();
|
||||||
config.EnableIntrosFromSimilarMovies = $('.chkOtherTrailers', page).checked();
|
config.EnableIntrosFromSimilarMovies = $('.chkOtherTrailers', page).checked();
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("cinemamode", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("cinemamode", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("cinemamode").done(function (config) {
|
ApiClient.getNamedConfiguration("cinemamode").then(function (config) {
|
||||||
|
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
|
|
||||||
|
|
|
@ -4,12 +4,12 @@
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
ConnectionManager.loginToConnect(username, password).done(function () {
|
ConnectionManager.loginToConnect(username, password).then(function () {
|
||||||
|
|
||||||
Dashboard.hideModalLoadingMsg();
|
Dashboard.hideModalLoadingMsg();
|
||||||
Dashboard.navigate('selectserver.html');
|
Dashboard.navigate('selectserver.html');
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
Dashboard.hideModalLoadingMsg();
|
Dashboard.hideModalLoadingMsg();
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
ConnectionManager.connect().done(function (result) {
|
ConnectionManager.connect().then(function (result) {
|
||||||
|
|
||||||
handleConnectionResult(page, result);
|
handleConnectionResult(page, result);
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@
|
||||||
|
|
||||||
var page = $(this).parents('.page');
|
var page = $(this).parents('.page');
|
||||||
|
|
||||||
ConnectionManager.signupForConnect($('#txtSignupEmail', page).val(), $('#txtSignupUsername', page).val(), $('#txtSignupPassword', page).val(), $('#txtSignupPasswordConfirm', page).val()).done(function () {
|
ConnectionManager.signupForConnect($('#txtSignupEmail', page).val(), $('#txtSignupUsername', page).val(), $('#txtSignupPassword', page).val(), $('#txtSignupPasswordConfirm', page).val()).then(function () {
|
||||||
|
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('MessageThankYouForConnectSignUp'),
|
message: Globalize.translate('MessageThankYouForConnectSignUp'),
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}).fail(function (result) {
|
}, function (result) {
|
||||||
|
|
||||||
if (result.errorCode == 'passwordmatch') {
|
if (result.errorCode == 'passwordmatch') {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
|
@ -282,11 +282,11 @@
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
ConnectionManager.connectToAddress(host).done(function (result) {
|
ConnectionManager.connectToAddress(host).then(function (result) {
|
||||||
|
|
||||||
handleConnectionResult(page, result);
|
handleConnectionResult(page, result);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
handleConnectionResult(page, {
|
handleConnectionResult(page, {
|
||||||
State: MediaBrowser.ConnectionState.Unavailable
|
State: MediaBrowser.ConnectionState.Unavailable
|
||||||
});
|
});
|
||||||
|
|
|
@ -52,18 +52,18 @@
|
||||||
Dashboard.showDashboardRefreshNotification();
|
Dashboard.showDashboardRefreshNotification();
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(function () {
|
ApiClient.updateServerConfiguration(config).then(function () {
|
||||||
|
|
||||||
refreshPageTitle(page);
|
refreshPageTitle(page);
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration(brandingConfigKey).done(function (brandingConfig) {
|
ApiClient.getNamedConfiguration(brandingConfigKey).then(function (brandingConfig) {
|
||||||
|
|
||||||
brandingConfig.LoginDisclaimer = form.querySelector('#txtLoginDisclaimer').value;
|
brandingConfig.LoginDisclaimer = form.querySelector('#txtLoginDisclaimer').value;
|
||||||
brandingConfig.CustomCss = form.querySelector('#txtCustomCss').value;
|
brandingConfig.CustomCss = form.querySelector('#txtCustomCss').value;
|
||||||
|
|
||||||
var cssChanged = currentBrandingOptions && brandingConfig.CustomCss != currentBrandingOptions.CustomCss;
|
var cssChanged = currentBrandingOptions && brandingConfig.CustomCss != currentBrandingOptions.CustomCss;
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration(brandingConfigKey, brandingConfig).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
|
|
||||||
if (cssChanged) {
|
if (cssChanged) {
|
||||||
Dashboard.showDashboardRefreshNotification();
|
Dashboard.showDashboardRefreshNotification();
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
|
|
||||||
var promise1 = ApiClient.getServerConfiguration();
|
var promise1 = ApiClient.getServerConfiguration();
|
||||||
|
|
||||||
var promise2 = ApiClient.fetchJSON(ApiClient.getUrl("Localization/Options"));
|
var promise2 = ApiClient.getJSON(ApiClient.getUrl("Localization/Options"));
|
||||||
|
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
|
|
||||||
|
@ -122,7 +122,7 @@
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration(brandingConfigKey).done(function (config) {
|
ApiClient.getNamedConfiguration(brandingConfigKey).then(function (config) {
|
||||||
|
|
||||||
currentBrandingOptions = config;
|
currentBrandingOptions = config;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
config.WanDdns = $('#txtDdns', form).val();
|
config.WanDdns = $('#txtDdns', form).val();
|
||||||
config.CertificatePath = $('#txtCertificatePath', form).val();
|
config.CertificatePath = $('#txtCertificatePath', form).val();
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
DashboardPage.lastAppUpdateCheck = null;
|
DashboardPage.lastAppUpdateCheck = null;
|
||||||
DashboardPage.lastPluginUpdateCheck = null;
|
DashboardPage.lastPluginUpdateCheck = null;
|
||||||
|
|
||||||
Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) {
|
Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
|
||||||
|
|
||||||
DashboardPage.renderSupporterIcon(page, pluginSecurityInfo);
|
DashboardPage.renderSupporterIcon(page, pluginSecurityInfo);
|
||||||
});
|
});
|
||||||
|
@ -120,7 +120,7 @@
|
||||||
Limit: 7
|
Limit: 7
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.getProductNews(query).done(function (result) {
|
ApiClient.getProductNews(query).then(function (result) {
|
||||||
|
|
||||||
var html = result.Items.map(function (item) {
|
var html = result.Items.map(function (item) {
|
||||||
|
|
||||||
|
@ -242,11 +242,11 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
apiClient.getSessions().done(function (sessions) {
|
apiClient.getSessions().then(function (sessions) {
|
||||||
|
|
||||||
DashboardPage.renderInfo(page, sessions, forceUpdate);
|
DashboardPage.renderInfo(page, sessions, forceUpdate);
|
||||||
});
|
});
|
||||||
apiClient.getScheduledTasks().done(function (tasks) {
|
apiClient.getScheduledTasks().then(function (tasks) {
|
||||||
|
|
||||||
DashboardPage.renderRunningTasks(page, tasks);
|
DashboardPage.renderRunningTasks(page, tasks);
|
||||||
});
|
});
|
||||||
|
@ -834,7 +834,7 @@
|
||||||
|
|
||||||
DashboardPage.lastAppUpdateCheck = new Date().getTime();
|
DashboardPage.lastAppUpdateCheck = new Date().getTime();
|
||||||
|
|
||||||
ApiClient.getAvailableApplicationUpdate().done(function (packageInfo) {
|
ApiClient.getAvailableApplicationUpdate().then(function (packageInfo) {
|
||||||
|
|
||||||
var version = packageInfo[0];
|
var version = packageInfo[0];
|
||||||
|
|
||||||
|
@ -892,7 +892,7 @@
|
||||||
|
|
||||||
DashboardPage.lastPluginUpdateCheck = new Date().getTime();
|
DashboardPage.lastPluginUpdateCheck = new Date().getTime();
|
||||||
|
|
||||||
ApiClient.getAvailablePluginUpdates().done(function (updates) {
|
ApiClient.getAvailablePluginUpdates().then(function (updates) {
|
||||||
|
|
||||||
var elem = $('#pPluginUpdates', page);
|
var elem = $('#pPluginUpdates', page);
|
||||||
|
|
||||||
|
@ -932,7 +932,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.installPlugin(name, guid, classification, version).done(function () {
|
ApiClient.installPlugin(name, guid, classification, version).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
|
@ -945,14 +945,14 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getScheduledTasks().done(function (tasks) {
|
ApiClient.getScheduledTasks().then(function (tasks) {
|
||||||
|
|
||||||
var task = tasks.filter(function (t) {
|
var task = tasks.filter(function (t) {
|
||||||
|
|
||||||
return t.Key == DashboardPage.systemUpdateTaskKey;
|
return t.Key == DashboardPage.systemUpdateTaskKey;
|
||||||
})[0];
|
})[0];
|
||||||
|
|
||||||
ApiClient.startScheduledTask(task.Id).done(function () {
|
ApiClient.startScheduledTask(task.Id).then(function () {
|
||||||
|
|
||||||
DashboardPage.pollForInfo(page);
|
DashboardPage.pollForInfo(page);
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@
|
||||||
|
|
||||||
var page = $.mobile.activePage;
|
var page = $.mobile.activePage;
|
||||||
|
|
||||||
ApiClient.stopScheduledTask(id).done(function () {
|
ApiClient.stopScheduledTask(id).then(function () {
|
||||||
|
|
||||||
DashboardPage.pollForInfo(page);
|
DashboardPage.pollForInfo(page);
|
||||||
});
|
});
|
||||||
|
@ -1170,7 +1170,7 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
||||||
var minDate = new Date();
|
var minDate = new Date();
|
||||||
minDate.setTime(minDate.getTime() - 86400000);
|
minDate.setTime(minDate.getTime() - 86400000);
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('System/ActivityLog/Entries', {
|
ApiClient.getJSON(ApiClient.getUrl('System/ActivityLog/Entries', {
|
||||||
|
|
||||||
startIndex: startIndex,
|
startIndex: startIndex,
|
||||||
limit: limit,
|
limit: limit,
|
||||||
|
@ -1313,7 +1313,7 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
||||||
|
|
||||||
function takeTour(page, userId) {
|
function takeTour(page, userId) {
|
||||||
|
|
||||||
Dashboard.loadSwipebox().done(function () {
|
Dashboard.loadSwipebox().then(function () {
|
||||||
|
|
||||||
$.swipebox([
|
$.swipebox([
|
||||||
{ href: 'css/images/tour/dashboard/dashboard.png', title: Globalize.translate('DashboardTourDashboard') },
|
{ href: 'css/images/tour/dashboard/dashboard.png', title: Globalize.translate('DashboardTourDashboard') },
|
||||||
|
@ -1366,7 +1366,7 @@ $(document).on('pageshow', "#dashboardPage", DashboardPage.onPageShow).on('pageb
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
Dashboard.getPluginSecurityInfo().done(function (pluginSecurityInfo) {
|
Dashboard.getPluginSecurityInfo().then(function (pluginSecurityInfo) {
|
||||||
|
|
||||||
if (!$('.customSupporterPromotion', page).length) {
|
if (!$('.customSupporterPromotion', page).length) {
|
||||||
$('.supporterPromotion', page).remove();
|
$('.supporterPromotion', page).remove();
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', { Id: id }));
|
var promise1 = ApiClient.getJSON(ApiClient.getUrl('Devices/Info', { Id: id }));
|
||||||
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Capabilities', { Id: id }));
|
var promise2 = ApiClient.getJSON(ApiClient.getUrl('Devices/Capabilities', { Id: id }));
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).then(function (response1, response2) {
|
||||||
|
|
||||||
load(page, response1[0], response2[0]);
|
load(page, response1[0], response2[0]);
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@
|
||||||
}),
|
}),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(Dashboard.processServerConfigurationUpdateResult);
|
}).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
}
|
}
|
||||||
|
|
||||||
function onSubmit() {
|
function onSubmit() {
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
Id: id
|
Id: id
|
||||||
})
|
})
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
loadData(page);
|
loadData(page);
|
||||||
});
|
});
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
function loadData(page) {
|
function loadData(page) {
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('Devices', {
|
ApiClient.getJSON(ApiClient.getUrl('Devices', {
|
||||||
|
|
||||||
SupportsPersistentIdentifier: true
|
SupportsPersistentIdentifier: true
|
||||||
|
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).then(function (response1, response2) {
|
||||||
|
|
||||||
|
|
||||||
load(page, response2[0].Items, response1[0]);
|
load(page, response2[0].Items, response1[0]);
|
||||||
|
@ -85,7 +85,7 @@
|
||||||
|
|
||||||
function save(page) {
|
function save(page) {
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("devices").done(function (config) {
|
ApiClient.getNamedConfiguration("devices").then(function (config) {
|
||||||
|
|
||||||
config.CameraUploadPath = $('#txtUploadPath', page).val();
|
config.CameraUploadPath = $('#txtUploadPath', page).val();
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@
|
||||||
|
|
||||||
config.EnableCameraUploadSubfolders = $('#chkSubfolder', page).checked();
|
config.EnableCameraUploadSubfolders = $('#chkSubfolder', page).checked();
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("devices", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("devices", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
var promise1 = getProfile();
|
var promise1 = getProfile();
|
||||||
var promise2 = ApiClient.getUsers();
|
var promise2 = ApiClient.getUsers();
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).then(function (response1, response2) {
|
||||||
|
|
||||||
currentProfile = response1[0];
|
currentProfile = response1[0];
|
||||||
|
|
||||||
|
@ -864,7 +864,7 @@
|
||||||
url: ApiClient.getUrl("Dlna/Profiles/" + id),
|
url: ApiClient.getUrl("Dlna/Profiles/" + id),
|
||||||
data: JSON.stringify(profile),
|
data: JSON.stringify(profile),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.alert('Settings saved.');
|
Dashboard.alert('Settings saved.');
|
||||||
});
|
});
|
||||||
|
@ -876,7 +876,7 @@
|
||||||
url: ApiClient.getUrl("Dlna/Profiles"),
|
url: ApiClient.getUrl("Dlna/Profiles"),
|
||||||
data: JSON.stringify(profile),
|
data: JSON.stringify(profile),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.navigate('dlnaprofiles.html');
|
Dashboard.navigate('dlnaprofiles.html');
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
|
ApiClient.getJSON(ApiClient.getUrl("Dlna/ProfileInfos")).then(function (result) {
|
||||||
|
|
||||||
renderProfiles(page, result);
|
renderProfiles(page, result);
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
url: ApiClient.getUrl("Dlna/Profiles/" + id)
|
url: ApiClient.getUrl("Dlna/Profiles/" + id)
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
ApiClient.getNamedConfiguration("dlna").then(function (config) {
|
||||||
|
|
||||||
config.EnableServer = $('#chkEnableServer', form).checked();
|
config.EnableServer = $('#chkEnableServer', form).checked();
|
||||||
config.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked();
|
config.BlastAliveMessages = $('#chkBlastAliveMessages', form).checked();
|
||||||
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
config.EnableMovieFolders = $('#chkEnableMovieFolders', form).checked();
|
config.EnableMovieFolders = $('#chkEnableMovieFolders', form).checked();
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("dlna", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
@ -52,7 +52,7 @@
|
||||||
var promise1 = ApiClient.getNamedConfiguration("dlna");
|
var promise1 = ApiClient.getNamedConfiguration("dlna");
|
||||||
var promise2 = ApiClient.getUsers();
|
var promise2 = ApiClient.getUsers();
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).then(function (response1, response2) {
|
||||||
|
|
||||||
loadPage(page, response1[0], response2[0]);
|
loadPage(page, response1[0], response2[0]);
|
||||||
|
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
ApiClient.getNamedConfiguration("dlna").then(function (config) {
|
||||||
|
|
||||||
config.EnablePlayTo = $('#chkEnablePlayTo', form).checked();
|
config.EnablePlayTo = $('#chkEnablePlayTo', form).checked();
|
||||||
config.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked();
|
config.EnableDebugLogging = $('#chkEnableDlnaDebugLogging', form).checked();
|
||||||
config.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val();
|
config.ClientDiscoveryIntervalSeconds = $('#txtClientDiscoveryInterval', form).val();
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("dlna", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("dlna", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
@ -38,7 +38,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("dlna").done(function (config) {
|
ApiClient.getNamedConfiguration("dlna").then(function (config) {
|
||||||
|
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
|
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
|
|
||||||
var promise1 = MetadataEditor.getItemPromise();
|
var promise1 = MetadataEditor.getItemPromise();
|
||||||
var promise2 = MetadataEditor.getCurrentItemId() ?
|
var promise2 = MetadataEditor.getCurrentItemId() ?
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('Items/' + MetadataEditor.getCurrentItemId() + '/MetadataEditor')) :
|
ApiClient.getJSON(ApiClient.getUrl('Items/' + MetadataEditor.getCurrentItemId() + '/MetadataEditor')) :
|
||||||
{};
|
{};
|
||||||
|
|
||||||
Promise.all([promise1, promise2]).then(function (responses) {
|
Promise.all([promise1, promise2]).then(function (responses) {
|
||||||
|
@ -901,7 +901,7 @@
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.updateItem(item).done(function () {
|
ApiClient.updateItem(item).then(function () {
|
||||||
|
|
||||||
var newContentType = $('#selectContentType', form).val() || '';
|
var newContentType = $('#selectContentType', form).val() || '';
|
||||||
|
|
||||||
|
@ -915,7 +915,7 @@
|
||||||
|
|
||||||
type: 'POST'
|
type: 'POST'
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
afterContentTypeUpdated();
|
afterContentTypeUpdated();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -106,7 +106,7 @@
|
||||||
|
|
||||||
var promise2 = ApiClient.getLiveTvChannels({ limit: 0 });
|
var promise2 = ApiClient.getLiveTvChannels({ limit: 0 });
|
||||||
|
|
||||||
$.when(promise2).done(function (response2) {
|
$.when(promise2).then(function (response2) {
|
||||||
|
|
||||||
var result = response2;
|
var result = response2;
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
|
|
||||||
function loadLiveTvChannels(service, openItems, callback) {
|
function loadLiveTvChannels(service, openItems, callback) {
|
||||||
|
|
||||||
ApiClient.getLiveTvChannels({ ServiceName: service, AddCurrentProgram: false }).done(function (result) {
|
ApiClient.getLiveTvChannels({ ServiceName: service, AddCurrentProgram: false }).then(function (result) {
|
||||||
|
|
||||||
var nodes = result.Items.map(function (i) {
|
var nodes = result.Items.map(function (i) {
|
||||||
|
|
||||||
|
@ -173,7 +173,7 @@
|
||||||
|
|
||||||
function loadMediaFolders(page, scope, openItems, callback) {
|
function loadMediaFolders(page, scope, openItems, callback) {
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl("Library/MediaFolders")).then(function (result) {
|
ApiClient.getJSON(ApiClient.getUrl("Library/MediaFolders")).then(function (result) {
|
||||||
|
|
||||||
var nodes = result.Items.map(function (n) {
|
var nodes = result.Items.map(function (n) {
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@
|
||||||
|
|
||||||
function initializeTree(page, currentUser, openItems, selectedId) {
|
function initializeTree(page, currentUser, openItems, selectedId) {
|
||||||
|
|
||||||
loadJsTree().done(function () {
|
loadJsTree().then(function () {
|
||||||
initializeTreeInternal(page, currentUser, openItems, selectedId);
|
initializeTreeInternal(page, currentUser, openItems, selectedId);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -428,7 +428,7 @@
|
||||||
|
|
||||||
if (id) {
|
if (id) {
|
||||||
|
|
||||||
ApiClient.getAncestorItems(id, user.Id).done(function (ancestors) {
|
ApiClient.getAncestorItems(id, user.Id).then(function (ancestors) {
|
||||||
|
|
||||||
var ids = ancestors.map(function (i) {
|
var ids = ancestors.map(function (i) {
|
||||||
return i.Id;
|
return i.Id;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("encoding").done(function (config) {
|
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
||||||
|
|
||||||
config.EnableDebugLogging = $('#chkEnableDebugEncodingLogging', form).checked();
|
config.EnableDebugLogging = $('#chkEnableDebugEncodingLogging', form).checked();
|
||||||
config.EncodingQuality = $('.radioEncodingQuality:checked', form).val();
|
config.EncodingQuality = $('.radioEncodingQuality:checked', form).val();
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
config.EncodingThreadCount = $('#selectThreadCount', form).val();
|
config.EncodingThreadCount = $('#selectThreadCount', form).val();
|
||||||
config.HardwareAccelerationType = $('#selectVideoDecoder', form).val();
|
config.HardwareAccelerationType = $('#selectVideoDecoder', form).val();
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("encoding", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("encoding", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
@ -77,7 +77,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("encoding").done(function (config) {
|
ApiClient.getNamedConfiguration("encoding").then(function (config) {
|
||||||
|
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
|
|
||||||
|
|
|
@ -178,7 +178,7 @@
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
MediaPlayer.createStreamInfo('Video', item, mediaSource, startPosition).done(function (streamInfo) {
|
MediaPlayer.createStreamInfo('Video', item, mediaSource, startPosition).then(function (streamInfo) {
|
||||||
|
|
||||||
var currentSrc = streamInfo.url;
|
var currentSrc = streamInfo.url;
|
||||||
|
|
||||||
|
@ -437,7 +437,7 @@
|
||||||
|
|
||||||
ApiClient.getItem(userId, itemId).then(function (item) {
|
ApiClient.getItem(userId, itemId).then(function (item) {
|
||||||
|
|
||||||
getVideoStreamInfo(item).done(function (streamInfo) {
|
getVideoStreamInfo(item).then(function (streamInfo) {
|
||||||
|
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
ExternalPlayer.showPlayerSelectionMenu(item, streamInfo.url, streamInfo.mimeType);
|
ExternalPlayer.showPlayerSelectionMenu(item, streamInfo.url, streamInfo.mimeType);
|
||||||
|
@ -460,7 +460,7 @@
|
||||||
|
|
||||||
function showPlayerSelectionMenu(item, url, mimeType) {
|
function showPlayerSelectionMenu(item, url, mimeType) {
|
||||||
|
|
||||||
ExternalPlayer.getExternalPlayers(url, mimeType).done(function (players) {
|
ExternalPlayer.getExternalPlayers(url, mimeType).then(function (players) {
|
||||||
showMenuForItem(item, players);
|
showMenuForItem(item, players);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -160,7 +160,7 @@
|
||||||
promises.push(loadSection(elem, userId, topParentId, section, sections.length == 1));
|
promises.push(loadSection(elem, userId, topParentId, section, sections.length == 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
$.when(promises).done(function () {
|
$.when(promises).then(function () {
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
LibraryBrowser.setLastRefreshed(page);
|
LibraryBrowser.setLastRefreshed(page);
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
EnteredUsername: $('#txtName', page).val()
|
EnteredUsername: $('#txtName', page).val()
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
processForgotPasswordResult(page, result);
|
processForgotPasswordResult(page, result);
|
||||||
});
|
});
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
Pin: $('#txtPin', page).val()
|
Pin: $('#txtPin', page).val()
|
||||||
}
|
}
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
processForgotPasswordResult(page, result);
|
processForgotPasswordResult(page, result);
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getGameGenres(Dashboard.getCurrentUserId(), query).done(function (result) {
|
ApiClient.getGameGenres(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||||
|
|
||||||
// Scroll back up so they can see the results from the beginning
|
// Scroll back up so they can see the results from the beginning
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
|
@ -254,7 +254,7 @@
|
||||||
LibraryBrowser.loadSavedQueryValues(viewkey, query);
|
LibraryBrowser.loadSavedQueryValues(viewkey, query);
|
||||||
QueryFilters.onPageShow(page, query);
|
QueryFilters.onPageShow(page, query);
|
||||||
|
|
||||||
LibraryBrowser.getSavedViewSetting(viewkey).done(function (val) {
|
LibraryBrowser.getSavedViewSetting(viewkey).then(function (val) {
|
||||||
|
|
||||||
if (val) {
|
if (val) {
|
||||||
$('#selectView', page).val(val).trigger('change');
|
$('#selectView', page).val(val).trigger('change');
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||||
|
|
||||||
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
|
$('#recentlyAddedItems', page).html(LibraryBrowser.getPosterViewHtml({
|
||||||
items: items,
|
items: items,
|
||||||
|
|
|
@ -20,7 +20,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).done(function (result) {
|
ApiClient.getStudios(Dashboard.getCurrentUserId(), query).then(function (result) {
|
||||||
|
|
||||||
// Scroll back up so they can see the results from the beginning
|
// Scroll back up so they can see the results from the beginning
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.getNextUpEpisodes(query).done(function (result) {
|
ApiClient.getNextUpEpisodes(query).then(function (result) {
|
||||||
|
|
||||||
if (result.Items.length) {
|
if (result.Items.length) {
|
||||||
page.querySelector('.noNextUpItems').classList.add('hide');
|
page.querySelector('.noNextUpItems').classList.add('hide');
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
EnableImageTypes: "Primary,Backdrop,Banner,Thumb"
|
||||||
};
|
};
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl("Shows/Upcoming", query)).then(function (result) {
|
ApiClient.getJSON(ApiClient.getUrl("Shows/Upcoming", query)).then(function (result) {
|
||||||
|
|
||||||
var items = result.Items;
|
var items = result.Items;
|
||||||
|
|
||||||
|
|
|
@ -165,7 +165,7 @@
|
||||||
|
|
||||||
function takeTour(page, userId) {
|
function takeTour(page, userId) {
|
||||||
|
|
||||||
Dashboard.loadSwipebox().done(function () {
|
Dashboard.loadSwipebox().then(function () {
|
||||||
|
|
||||||
$.swipebox([
|
$.swipebox([
|
||||||
{ href: 'css/images/tour/web/tourcontent.jpg', title: Globalize.translate('WebClientTourContent') },
|
{ href: 'css/images/tour/web/tourcontent.jpg', title: Globalize.translate('WebClientTourContent') },
|
||||||
|
|
|
@ -1090,7 +1090,7 @@
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
url: url
|
url: url
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
renderChildren(page, parentItem, user, context);
|
renderChildren(page, parentItem, user, context);
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
@ -1873,7 +1873,7 @@
|
||||||
type: "DELETE",
|
type: "DELETE",
|
||||||
url: ApiClient.getUrl("Videos/" + id + "/AlternateSources")
|
url: ApiClient.getUrl("Videos/" + id + "/AlternateSources")
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
@ -1934,7 +1934,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@
|
||||||
|
|
||||||
var itemsPromise = ApiClient.getItems(userId, query);
|
var itemsPromise = ApiClient.getItems(userId, query);
|
||||||
|
|
||||||
Promise.all([parentItemPromise, itemsPromise]).done(function (responses) {
|
Promise.all([parentItemPromise, itemsPromise]).then(function (responses) {
|
||||||
|
|
||||||
var item = responses[0];
|
var item = responses[0];
|
||||||
currentItem = item;
|
currentItem = item;
|
||||||
|
|
|
@ -435,7 +435,7 @@
|
||||||
|
|
||||||
playAllFromHere: function (fn, index) {
|
playAllFromHere: function (fn, index) {
|
||||||
|
|
||||||
fn(index, 100, "MediaSources,Chapters").done(function (result) {
|
fn(index, 100, "MediaSources,Chapters").then(function (result) {
|
||||||
|
|
||||||
MediaController.play({
|
MediaController.play({
|
||||||
items: result.Items
|
items: result.Items
|
||||||
|
@ -445,7 +445,7 @@
|
||||||
|
|
||||||
queueAllFromHere: function (query, index) {
|
queueAllFromHere: function (query, index) {
|
||||||
|
|
||||||
fn(index, 100, "MediaSources,Chapters").done(function (result) {
|
fn(index, 100, "MediaSources,Chapters").then(function (result) {
|
||||||
|
|
||||||
MediaController.queue({
|
MediaController.queue({
|
||||||
items: result.Items
|
items: result.Items
|
||||||
|
@ -577,7 +577,7 @@
|
||||||
|
|
||||||
playInExternalPlayer: function (id) {
|
playInExternalPlayer: function (id) {
|
||||||
|
|
||||||
Dashboard.loadExternalPlayer().done(function () {
|
Dashboard.loadExternalPlayer().then(function () {
|
||||||
ExternalPlayer.showMenu(id);
|
ExternalPlayer.showMenu(id);
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
|
@ -158,7 +158,7 @@
|
||||||
|
|
||||||
var id = this.getAttribute('data-itemid');
|
var id = this.getAttribute('data-itemid');
|
||||||
|
|
||||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), id).done(function (trailers) {
|
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), id).then(function (trailers) {
|
||||||
MediaController.play({ items: trailers });
|
MediaController.play({ items: trailers });
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -226,7 +226,7 @@
|
||||||
var albumid = card.getAttribute('data-albumid');
|
var albumid = card.getAttribute('data-albumid');
|
||||||
var artistid = card.getAttribute('data-artistid');
|
var artistid = card.getAttribute('data-artistid');
|
||||||
|
|
||||||
Dashboard.getCurrentUser().done(function (user) {
|
Dashboard.getCurrentUser().then(function (user) {
|
||||||
|
|
||||||
var items = [];
|
var items = [];
|
||||||
|
|
||||||
|
@ -495,7 +495,7 @@
|
||||||
MediaController.queue(itemId);
|
MediaController.queue(itemId);
|
||||||
break;
|
break;
|
||||||
case 'trailer':
|
case 'trailer':
|
||||||
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), itemId).done(function (trailers) {
|
ApiClient.getLocalTrailers(Dashboard.getCurrentUserId(), itemId).then(function (trailers) {
|
||||||
MediaController.play({ items: trailers });
|
MediaController.play({ items: trailers });
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
@ -645,7 +645,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
ApiClient.getJSON(ApiClient.getUrl('Users/' + userId + '/Items/Latest', options)).then(function (items) {
|
||||||
|
|
||||||
if (items.length == 1) {
|
if (items.length == 1) {
|
||||||
|
|
||||||
|
@ -1160,7 +1160,7 @@
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: ApiClient.getUrl("Videos/MergeVersions", { Ids: selection.join(',') })
|
url: ApiClient.getUrl("Videos/MergeVersions", { Ids: selection.join(',') })
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
hideSelections();
|
hideSelections();
|
||||||
|
|
|
@ -188,7 +188,7 @@
|
||||||
|
|
||||||
if (requiresDrawerRefresh || requiresDashboardDrawerRefresh) {
|
if (requiresDrawerRefresh || requiresDashboardDrawerRefresh) {
|
||||||
|
|
||||||
ConnectionManager.user(window.ApiClient).done(function (user) {
|
ConnectionManager.user(window.ApiClient).then(function (user) {
|
||||||
|
|
||||||
var drawer = document.querySelector('.mainDrawerPanel .mainDrawer');
|
var drawer = document.querySelector('.mainDrawerPanel .mainDrawer');
|
||||||
|
|
||||||
|
@ -389,7 +389,7 @@
|
||||||
|
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
|
|
||||||
apiClient.getUserViews({}, userId).done(function (result) {
|
apiClient.getUserViews({}, userId).then(function (result) {
|
||||||
|
|
||||||
var items = result.Items;
|
var items = result.Items;
|
||||||
|
|
||||||
|
@ -445,7 +445,7 @@
|
||||||
|
|
||||||
var apiClient = window.ApiClient;
|
var apiClient = window.ApiClient;
|
||||||
|
|
||||||
getUserViews(apiClient, userId).done(function (result) {
|
getUserViews(apiClient, userId).then(function (result) {
|
||||||
|
|
||||||
var items = result;
|
var items = result;
|
||||||
|
|
||||||
|
@ -786,7 +786,7 @@
|
||||||
updateLibraryNavLinks(page);
|
updateLibraryNavLinks(page);
|
||||||
requiresViewMenuRefresh = false;
|
requiresViewMenuRefresh = false;
|
||||||
|
|
||||||
ConnectionManager.user(window.ApiClient).done(addUserToHeader);
|
ConnectionManager.user(window.ApiClient).then(addUserToHeader);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
viewMenuBar.classList.remove('hide');
|
viewMenuBar.classList.remove('hide');
|
||||||
|
|
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
config.PathSubstitutions.splice(index, 1);
|
config.PathSubstitutions.splice(index, 1);
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(function () {
|
ApiClient.updateServerConfiguration(config).then(function () {
|
||||||
|
|
||||||
reload(page);
|
reload(page);
|
||||||
});
|
});
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
ApiClient.getServerConfiguration().then(function (config) {
|
ApiClient.getServerConfiguration().then(function (config) {
|
||||||
|
|
||||||
addSubstitution(page, config);
|
addSubstitution(page, config);
|
||||||
ApiClient.updateServerConfiguration(config).done(function () {
|
ApiClient.updateServerConfiguration(config).then(function () {
|
||||||
|
|
||||||
reload(page);
|
reload(page);
|
||||||
});
|
});
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
config.EnableAudioArchiveFiles = $('#chkEnableAudioArchiveFiles', form).checked();
|
config.EnableAudioArchiveFiles = $('#chkEnableAudioArchiveFiles', form).checked();
|
||||||
config.EnableVideoArchiveFiles = $('#chkEnableVideoArchiveFiles', form).checked();
|
config.EnableVideoArchiveFiles = $('#chkEnableVideoArchiveFiles', form).checked();
|
||||||
|
|
||||||
ApiClient.updateServerConfiguration(config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateServerConfiguration(config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
|
|
@ -108,7 +108,7 @@
|
||||||
HasAired: false,
|
HasAired: false,
|
||||||
SortBy: "StartDate"
|
SortBy: "StartDate"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderPrograms(page, result);
|
renderPrograms(page, result);
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@
|
||||||
|
|
||||||
query.UserId = Dashboard.getCurrentUserId();
|
query.UserId = Dashboard.getCurrentUserId();
|
||||||
|
|
||||||
ApiClient.getLiveTvChannels(query).done(function (result) {
|
ApiClient.getLiveTvChannels(query).then(function (result) {
|
||||||
|
|
||||||
renderChannels(page, viewPanel, result);
|
renderChannels(page, viewPanel, result);
|
||||||
|
|
||||||
|
|
|
@ -342,7 +342,7 @@
|
||||||
|
|
||||||
var id = elem.getAttribute('data-programid');
|
var id = elem.getAttribute('data-programid');
|
||||||
|
|
||||||
ApiClient.getLiveTvProgram(id, Dashboard.getCurrentUserId()).done(function (item) {
|
ApiClient.getLiveTvProgram(id, Dashboard.getCurrentUserId()).then(function (item) {
|
||||||
|
|
||||||
showOverlay(elem, item);
|
showOverlay(elem, item);
|
||||||
|
|
||||||
|
|
|
@ -15,19 +15,20 @@
|
||||||
|
|
||||||
function loadTemplate(page, type, providerId) {
|
function loadTemplate(page, type, providerId) {
|
||||||
|
|
||||||
HttpClient.send({
|
var xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('GET', 'components/tvproviders/' + type + '.template.html', true);
|
||||||
|
|
||||||
type: 'GET',
|
xhr.onload = function (e) {
|
||||||
url: 'components/tvproviders/' + type + '.template.html'
|
|
||||||
|
|
||||||
}).done(function (html) {
|
|
||||||
|
|
||||||
|
var html = this.response;
|
||||||
var elem = page.querySelector('.providerTemplate');
|
var elem = page.querySelector('.providerTemplate');
|
||||||
elem.innerHTML = Globalize.translateDocument(html);
|
elem.innerHTML = Globalize.translateDocument(html);
|
||||||
$(elem).trigger('create');
|
$(elem).trigger('create');
|
||||||
|
|
||||||
init(page, type, providerId);
|
init(page, type, providerId);
|
||||||
});
|
}
|
||||||
|
|
||||||
|
xhr.send();
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).on('pageshow', "#liveTvGuideProviderPage", function () {
|
$(document).on('pageshow', "#liveTvGuideProviderPage", function () {
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getLiveTvPrograms(query).done(function (result) {
|
ApiClient.getLiveTvPrograms(query).then(function (result) {
|
||||||
|
|
||||||
// Scroll back up so they can see the results from the beginning
|
// Scroll back up so they can see the results from the beginning
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
registrationInfo = null;
|
registrationInfo = null;
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('LiveTv/Registration', {
|
ApiClient.getJSON(ApiClient.getUrl('LiveTv/Registration', {
|
||||||
|
|
||||||
ProgramId: programId,
|
ProgramId: programId,
|
||||||
Feature: 'seriesrecordings'
|
Feature: 'seriesrecordings'
|
||||||
|
@ -84,7 +84,7 @@
|
||||||
var promise1 = ApiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
var promise1 = ApiClient.getNewLiveTvTimerDefaults({ programId: programId });
|
||||||
var promise2 = ApiClient.getLiveTvProgram(programId, Dashboard.getCurrentUserId());
|
var promise2 = ApiClient.getLiveTvProgram(programId, Dashboard.getCurrentUserId());
|
||||||
|
|
||||||
$.when(promise1, promise2).done(function (response1, response2) {
|
$.when(promise1, promise2).then(function (response1, response2) {
|
||||||
|
|
||||||
var defaults = response1[0];
|
var defaults = response1[0];
|
||||||
var program = response2[0];
|
var program = response2[0];
|
||||||
|
@ -142,7 +142,7 @@
|
||||||
|
|
||||||
var programId = getParameterByName('programid');
|
var programId = getParameterByName('programid');
|
||||||
|
|
||||||
ApiClient.getNewLiveTvTimerDefaults({ programId: programId }).done(function (item) {
|
ApiClient.getNewLiveTvTimerDefaults({ programId: programId }).then(function (item) {
|
||||||
|
|
||||||
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||||
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
|
|
||||||
if ($('#chkRecordSeries', form).checked()) {
|
if ($('#chkRecordSeries', form).checked()) {
|
||||||
|
|
||||||
ApiClient.createLiveTvSeriesTimer(item).done(function () {
|
ApiClient.createLiveTvSeriesTimer(item).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
Dashboard.navigate('livetv.html');
|
Dashboard.navigate('livetv.html');
|
||||||
|
@ -163,7 +163,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
ApiClient.createLiveTvTimer(item).done(function () {
|
ApiClient.createLiveTvTimer(item).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
Dashboard.navigate('livetv.html');
|
Dashboard.navigate('livetv.html');
|
||||||
|
@ -187,7 +187,7 @@
|
||||||
$('#seriesFields', page).show();
|
$('#seriesFields', page).show();
|
||||||
page.querySelector('.btnSubmitContainer').classList.remove('hide');
|
page.querySelector('.btnSubmitContainer').classList.remove('hide');
|
||||||
|
|
||||||
getRegistration(getParameterByName('programid')).done(function (regInfo) {
|
getRegistration(getParameterByName('programid')).then(function (regInfo) {
|
||||||
|
|
||||||
if (regInfo.IsValid) {
|
if (regInfo.IsValid) {
|
||||||
page.querySelector('.btnSubmitContainer').classList.remove('hide');
|
page.querySelector('.btnSubmitContainer').classList.remove('hide');
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getLiveTvRecordings(query).done(function (result) {
|
ApiClient.getLiveTvRecordings(query).then(function (result) {
|
||||||
|
|
||||||
// Scroll back up so they can see the results from the beginning
|
// Scroll back up so they can see the results from the beginning
|
||||||
window.scrollTo(0, 0);
|
window.scrollTo(0, 0);
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
if (query.GroupId) {
|
if (query.GroupId) {
|
||||||
|
|
||||||
ApiClient.getLiveTvRecordingGroup(query.GroupId).done(function (group) {
|
ApiClient.getLiveTvRecordingGroup(query.GroupId).then(function (group) {
|
||||||
$('.listName', page).html(group.Name);
|
$('.listName', page).html(group.Name);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -86,7 +86,7 @@
|
||||||
userId: Dashboard.getCurrentUserId(),
|
userId: Dashboard.getCurrentUserId(),
|
||||||
IsInProgress: true
|
IsInProgress: true
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderRecordings(page.querySelector('#activeRecordings'), result.Items);
|
renderRecordings(page.querySelector('#activeRecordings'), result.Items);
|
||||||
|
|
||||||
|
@ -98,7 +98,7 @@
|
||||||
limit: 12,
|
limit: 12,
|
||||||
IsInProgress: false
|
IsInProgress: false
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderRecordings(page.querySelector('#latestRecordings'), result.Items);
|
renderRecordings(page.querySelector('#latestRecordings'), result.Items);
|
||||||
});
|
});
|
||||||
|
@ -107,7 +107,7 @@
|
||||||
|
|
||||||
userId: Dashboard.getCurrentUserId()
|
userId: Dashboard.getCurrentUserId()
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderRecordingGroups(page, result.Items);
|
renderRecordingGroups(page, result.Items);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getLiveTvSeriesTimer(currentItem.Id).done(function (item) {
|
ApiClient.getLiveTvSeriesTimer(currentItem.Id).then(function (item) {
|
||||||
|
|
||||||
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||||
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||||
|
@ -114,7 +114,7 @@
|
||||||
|
|
||||||
item.Days = getDays(form);
|
item.Days = getDays(form);
|
||||||
|
|
||||||
ApiClient.updateLiveTvSeriesTimer(item).done(function () {
|
ApiClient.updateLiveTvSeriesTimer(item).then(function () {
|
||||||
Dashboard.alert(Globalize.translate('MessageRecordingSaved'));
|
Dashboard.alert(Globalize.translate('MessageRecordingSaved'));
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -159,7 +159,7 @@
|
||||||
|
|
||||||
var id = getParameterByName('id');
|
var id = getParameterByName('id');
|
||||||
|
|
||||||
ApiClient.getLiveTvSeriesTimer(id).done(function (result) {
|
ApiClient.getLiveTvSeriesTimer(id).then(function (result) {
|
||||||
|
|
||||||
renderTimer(page, result);
|
renderTimer(page, result);
|
||||||
|
|
||||||
|
@ -170,7 +170,7 @@
|
||||||
userId: Dashboard.getCurrentUserId(),
|
userId: Dashboard.getCurrentUserId(),
|
||||||
seriesTimerId: id
|
seriesTimerId: id
|
||||||
|
|
||||||
}).done(function (recordingResult) {
|
}).then(function (recordingResult) {
|
||||||
|
|
||||||
renderRecordings(page, recordingResult);
|
renderRecordings(page, recordingResult);
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@
|
||||||
|
|
||||||
seriesTimerId: id
|
seriesTimerId: id
|
||||||
|
|
||||||
}).done(function (timerResult) {
|
}).then(function (timerResult) {
|
||||||
|
|
||||||
renderSchedule(page, timerResult);
|
renderSchedule(page, timerResult);
|
||||||
|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.cancelLiveTvSeriesTimer(id).done(function () {
|
ApiClient.cancelLiveTvSeriesTimer(id).then(function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('MessageSeriesCancelled'));
|
Dashboard.alert(Globalize.translate('MessageSeriesCancelled'));
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getLiveTvSeriesTimers(query).done(function (result) {
|
ApiClient.getLiveTvSeriesTimers(query).then(function (result) {
|
||||||
|
|
||||||
renderTimers(page, result.Items);
|
renderTimers(page, result.Items);
|
||||||
|
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
|
|
||||||
config.GuideDays = $('#selectGuideDays', form).val() || null;
|
config.GuideDays = $('#selectGuideDays', form).val() || null;
|
||||||
config.EnableMovieProviders = $('#chkMovies', form).checked();
|
config.EnableMovieProviders = $('#chkMovies', form).checked();
|
||||||
|
@ -34,7 +34,7 @@
|
||||||
config.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
config.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||||
config.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
config.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||||
|
|
||||||
ApiClient.updateNamedConfiguration("livetv", config).done(Dashboard.processServerConfigurationUpdateResult);
|
ApiClient.updateNamedConfiguration("livetv", config).then(Dashboard.processServerConfigurationUpdateResult);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Disable default form submission
|
// Disable default form submission
|
||||||
|
@ -72,7 +72,7 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
|
|
||||||
loadPage(page, config);
|
loadPage(page, config);
|
||||||
|
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.resetLiveTvTuner(id).done(function () {
|
ApiClient.resetLiveTvTuner(id).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@
|
||||||
|
|
||||||
renderTuners(page, tuners);
|
renderTuners(page, tuners);
|
||||||
|
|
||||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
|
|
||||||
renderDevices(page, config.TunerHosts);
|
renderDevices(page, config.TunerHosts);
|
||||||
renderProviders(page, config.ListingProviders);
|
renderProviders(page, config.ListingProviders);
|
||||||
|
@ -243,7 +243,7 @@
|
||||||
Id: id
|
Id: id
|
||||||
})
|
})
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
reload(page);
|
reload(page);
|
||||||
});
|
});
|
||||||
|
@ -255,7 +255,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getLiveTvInfo().done(function (liveTvInfo) {
|
ApiClient.getLiveTvInfo().then(function (liveTvInfo) {
|
||||||
|
|
||||||
loadPage(page, liveTvInfo);
|
loadPage(page, liveTvInfo);
|
||||||
|
|
||||||
|
@ -276,11 +276,11 @@
|
||||||
}),
|
}),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
reload(page);
|
reload(page);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('ErrorAddingTunerDevice')
|
message: Globalize.translate('ErrorAddingTunerDevice')
|
||||||
});
|
});
|
||||||
|
@ -345,7 +345,11 @@
|
||||||
Id: id
|
Id: id
|
||||||
})
|
})
|
||||||
|
|
||||||
}).always(function () {
|
}).then(function () {
|
||||||
|
|
||||||
|
reload(page);
|
||||||
|
|
||||||
|
}, function () {
|
||||||
|
|
||||||
reload(page);
|
reload(page);
|
||||||
});
|
});
|
||||||
|
|
|
@ -33,7 +33,7 @@
|
||||||
ImageTypeLimit: 1,
|
ImageTypeLimit: 1,
|
||||||
EnableImageTypes: "Primary"
|
EnableImageTypes: "Primary"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderItems(page, result.Items, 'activeProgramItems', 'play');
|
renderItems(page, result.Items, 'activeProgramItems', 'play');
|
||||||
LibraryBrowser.setLastRefreshed(page);
|
LibraryBrowser.setLastRefreshed(page);
|
||||||
|
@ -56,7 +56,7 @@
|
||||||
IsKids: false,
|
IsKids: false,
|
||||||
IsSeries: true
|
IsSeries: true
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderItems(page, result.Items, 'upcomingProgramItems');
|
renderItems(page, result.Items, 'upcomingProgramItems');
|
||||||
});
|
});
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
limit: getLimit(),
|
limit: getLimit(),
|
||||||
IsMovie: true
|
IsMovie: true
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderItems(page, result.Items, 'upcomingTvMovieItems', null, getPortraitShape());
|
renderItems(page, result.Items, 'upcomingTvMovieItems', null, getPortraitShape());
|
||||||
});
|
});
|
||||||
|
@ -82,7 +82,7 @@
|
||||||
limit: getLimit(),
|
limit: getLimit(),
|
||||||
IsSports: true
|
IsSports: true
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderItems(page, result.Items, 'upcomingSportsItems');
|
renderItems(page, result.Items, 'upcomingSportsItems');
|
||||||
});
|
});
|
||||||
|
@ -95,7 +95,7 @@
|
||||||
limit: getLimit(),
|
limit: getLimit(),
|
||||||
IsKids: true
|
IsKids: true
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
renderItems(page, result.Items, 'upcomingKidsItems');
|
renderItems(page, result.Items, 'upcomingKidsItems');
|
||||||
});
|
});
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||||
|
|
||||||
|
@ -72,12 +72,12 @@
|
||||||
|
|
||||||
var form = this;
|
var form = this;
|
||||||
|
|
||||||
ApiClient.getLiveTvTimer(currentItem.Id).done(function (item) {
|
ApiClient.getLiveTvTimer(currentItem.Id).then(function (item) {
|
||||||
|
|
||||||
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
item.PrePaddingSeconds = $('#txtPrePaddingMinutes', form).val() * 60;
|
||||||
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
item.PostPaddingSeconds = $('#txtPostPaddingMinutes', form).val() * 60;
|
||||||
|
|
||||||
ApiClient.updateLiveTvTimer(item).done(function () {
|
ApiClient.updateLiveTvTimer(item).then(function () {
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
Dashboard.alert(Globalize.translate('MessageRecordingSaved'));
|
Dashboard.alert(Globalize.translate('MessageRecordingSaved'));
|
||||||
});
|
});
|
||||||
|
@ -94,7 +94,7 @@
|
||||||
|
|
||||||
var id = getParameterByName('id');
|
var id = getParameterByName('id');
|
||||||
|
|
||||||
ApiClient.getLiveTvTimer(id).done(function (result) {
|
ApiClient.getLiveTvTimer(id).then(function (result) {
|
||||||
|
|
||||||
renderTimer(page, result);
|
renderTimer(page, result);
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.cancelLiveTvTimer(id).done(function () {
|
ApiClient.cancelLiveTvTimer(id).then(function () {
|
||||||
|
|
||||||
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
Dashboard.alert(Globalize.translate('MessageRecordingCancelled'));
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getLiveTvTimers().done(function (result) {
|
ApiClient.getLiveTvTimers().then(function (result) {
|
||||||
|
|
||||||
renderTimers(page, result.Items);
|
renderTimers(page, result.Items);
|
||||||
});
|
});
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
page.querySelector('.chkFavorite').checked = false;
|
page.querySelector('.chkFavorite').checked = false;
|
||||||
|
|
||||||
if (providerId) {
|
if (providerId) {
|
||||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
|
|
||||||
var info = config.TunerHosts.filter(function (i) {
|
var info = config.TunerHosts.filter(function (i) {
|
||||||
return i.Id == providerId;
|
return i.Id == providerId;
|
||||||
|
@ -45,12 +45,12 @@
|
||||||
data: JSON.stringify(info),
|
data: JSON.stringify(info),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
Dashboard.processServerConfigurationUpdateResult();
|
Dashboard.processServerConfigurationUpdateResult();
|
||||||
Dashboard.navigate('livetvstatus.html');
|
Dashboard.navigate('livetvstatus.html');
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('ErrorSavingTvProvider')
|
message: Globalize.translate('ErrorSavingTvProvider')
|
||||||
});
|
});
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
page.querySelector('.txtDevicePath').value = '';
|
page.querySelector('.txtDevicePath').value = '';
|
||||||
|
|
||||||
if (providerId) {
|
if (providerId) {
|
||||||
ApiClient.getNamedConfiguration("livetv").done(function (config) {
|
ApiClient.getNamedConfiguration("livetv").then(function (config) {
|
||||||
|
|
||||||
var info = config.TunerHosts.filter(function (i) {
|
var info = config.TunerHosts.filter(function (i) {
|
||||||
return i.Id == providerId;
|
return i.Id == providerId;
|
||||||
|
@ -37,12 +37,12 @@
|
||||||
data: JSON.stringify(info),
|
data: JSON.stringify(info),
|
||||||
contentType: "application/json"
|
contentType: "application/json"
|
||||||
|
|
||||||
}).done(function (result) {
|
}).then(function (result) {
|
||||||
|
|
||||||
Dashboard.processServerConfigurationUpdateResult();
|
Dashboard.processServerConfigurationUpdateResult();
|
||||||
Dashboard.navigate('livetvstatus.html');
|
Dashboard.navigate('livetvstatus.html');
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
Dashboard.alert({
|
Dashboard.alert({
|
||||||
message: Globalize.translate('ErrorSavingTvProvider')
|
message: Globalize.translate('ErrorSavingTvProvider')
|
||||||
|
|
|
@ -24,12 +24,12 @@
|
||||||
|
|
||||||
options.cameraUploadServers = AppSettings.cameraUploadServers();
|
options.cameraUploadServers = AppSettings.cameraUploadServers();
|
||||||
|
|
||||||
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).done(function () {
|
syncPromise = new MediaBrowser.MultiServerSync(ConnectionManager).sync(options).then(function () {
|
||||||
|
|
||||||
syncPromise = null;
|
syncPromise = null;
|
||||||
deferred.resolve();
|
deferred.resolve();
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
syncPromise = null;
|
syncPromise = null;
|
||||||
});
|
});
|
||||||
|
|
|
@ -21,9 +21,9 @@
|
||||||
|
|
||||||
var page = this;
|
var page = this;
|
||||||
|
|
||||||
LoginPage.getApiClient().done(function (apiClient) {
|
LoginPage.getApiClient().then(function (apiClient) {
|
||||||
|
|
||||||
apiClient.getPublicUsers().done(function (users) {
|
apiClient.getPublicUsers().then(function (users) {
|
||||||
|
|
||||||
var showManualForm = !users.length;
|
var showManualForm = !users.length;
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
|
|
||||||
apiClient.fetchJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
|
apiClient.getJSON(apiClient.getUrl('Branding/Configuration')).then(function (options) {
|
||||||
|
|
||||||
$('.disclaimer', page).html(options.LoginDisclaimer || '');
|
$('.disclaimer', page).html(options.LoginDisclaimer || '');
|
||||||
});
|
});
|
||||||
|
@ -93,7 +93,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
apiClient.authenticateUserByName(username, password).done(function (result) {
|
apiClient.authenticateUserByName(username, password).then(function (result) {
|
||||||
|
|
||||||
var user = result.User;
|
var user = result.User;
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@
|
||||||
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
Dashboard.onServerChanged(user.Id, result.AccessToken, apiClient);
|
||||||
Dashboard.navigate(newUrl);
|
Dashboard.navigate(newUrl);
|
||||||
|
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
|
|
||||||
$('#pw', page).val('');
|
$('#pw', page).val('');
|
||||||
$('#txtManualName', page).val('');
|
$('#txtManualName', page).val('');
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
|
|
||||||
var page = $(this).parents('.page');
|
var page = $(this).parents('.page');
|
||||||
|
|
||||||
LoginPage.getApiClient().done(function (apiClient) {
|
LoginPage.getApiClient().then(function (apiClient) {
|
||||||
LoginPage.authenticateUserByName(page, apiClient, $('#txtManualName', page).val(), $('#txtManualPassword', page).val());
|
LoginPage.authenticateUserByName(page, apiClient, $('#txtManualName', page).val(), $('#txtManualPassword', page).val());
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
|
|
||||||
var apiClient = ApiClient;
|
var apiClient = ApiClient;
|
||||||
|
|
||||||
apiClient.fetchJSON(apiClient.getUrl('System/Logs')).then(function (logs) {
|
apiClient.getJSON(apiClient.getUrl('System/Logs')).then(function (logs) {
|
||||||
|
|
||||||
var html = '';
|
var html = '';
|
||||||
|
|
||||||
|
|
|
@ -75,7 +75,7 @@
|
||||||
|
|
||||||
Dashboard.showModalLoadingMsg();
|
Dashboard.showModalLoadingMsg();
|
||||||
|
|
||||||
MediaController.getTargets().done(function (targets) {
|
MediaController.getTargets().then(function (targets) {
|
||||||
|
|
||||||
var menuItems = targets.map(function (t) {
|
var menuItems = targets.map(function (t) {
|
||||||
|
|
||||||
|
@ -207,7 +207,7 @@
|
||||||
|
|
||||||
var player = controller.getCurrentPlayer();
|
var player = controller.getCurrentPlayer();
|
||||||
|
|
||||||
player.getPlayerState().done(function (result) {
|
player.getPlayerState().then(function (result) {
|
||||||
|
|
||||||
var state = result;
|
var state = result;
|
||||||
|
|
||||||
|
@ -321,7 +321,7 @@
|
||||||
|
|
||||||
currentPairingId = targetInfo.id;
|
currentPairingId = targetInfo.id;
|
||||||
|
|
||||||
player.tryPair(targetInfo).done(function () {
|
player.tryPair(targetInfo).then(function () {
|
||||||
|
|
||||||
currentPlayer = player;
|
currentPlayer = player;
|
||||||
currentTargetInfo = targetInfo;
|
currentTargetInfo = targetInfo;
|
||||||
|
@ -340,7 +340,7 @@
|
||||||
|
|
||||||
name = normalizeName(name);
|
name = normalizeName(name);
|
||||||
|
|
||||||
self.getTargets().done(function (result) {
|
self.getTargets().then(function (result) {
|
||||||
|
|
||||||
var target = result.filter(function (p) {
|
var target = result.filter(function (p) {
|
||||||
return normalizeName(p.name) == name;
|
return normalizeName(p.name) == name;
|
||||||
|
@ -418,7 +418,7 @@
|
||||||
return p.getTargets();
|
return p.getTargets();
|
||||||
});
|
});
|
||||||
|
|
||||||
$.when.apply($, promises).done(function () {
|
$.when.apply($, promises).then(function () {
|
||||||
|
|
||||||
var targets = [];
|
var targets = [];
|
||||||
|
|
||||||
|
@ -461,7 +461,7 @@
|
||||||
|
|
||||||
self.playbackTimeLimitMs = null;
|
self.playbackTimeLimitMs = null;
|
||||||
|
|
||||||
RegistrationServices.validateFeature('playback').done(fn).fail(function () {
|
RegistrationServices.validateFeature('playback').then(fn, function () {
|
||||||
|
|
||||||
self.playbackTimeLimitMs = lockedTimeLimitMs;
|
self.playbackTimeLimitMs = lockedTimeLimitMs;
|
||||||
startAutoStopTimer();
|
startAutoStopTimer();
|
||||||
|
@ -801,7 +801,7 @@
|
||||||
var serverInfo = ApiClient.serverInfo();
|
var serverInfo = ApiClient.serverInfo();
|
||||||
|
|
||||||
if (serverInfo.Id) {
|
if (serverInfo.Id) {
|
||||||
LocalAssetManager.getLocalMediaSource(serverInfo.Id, itemId).done(function (localMediaSource) {
|
LocalAssetManager.getLocalMediaSource(serverInfo.Id, itemId).then(function (localMediaSource) {
|
||||||
// Use the local media source if a specific one wasn't requested, or the smae one was requested
|
// Use the local media source if a specific one wasn't requested, or the smae one was requested
|
||||||
if (localMediaSource && (!mediaSource || mediaSource.Id == localMediaSource.Id)) {
|
if (localMediaSource && (!mediaSource || mediaSource.Id == localMediaSource.Id)) {
|
||||||
|
|
||||||
|
@ -823,9 +823,9 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
function getPlaybackInfoWithoutLocalMediaSource(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId, deferred) {
|
function getPlaybackInfoWithoutLocalMediaSource(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId, deferred) {
|
||||||
self.getPlaybackInfoInternal(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).done(function (result) {
|
self.getPlaybackInfoInternal(itemId, deviceProfile, startPosition, mediaSource, audioStreamIndex, subtitleStreamIndex, liveStreamId).then(function (result) {
|
||||||
deferred.resolveWith(null, [result]);
|
deferred.resolveWith(null, [result]);
|
||||||
}).fail(function () {
|
}, function () {
|
||||||
deferred.reject();
|
deferred.reject();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -916,7 +916,7 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.fileExists(mediaSource.Path).done(function (exists) {
|
LocalAssetManager.fileExists(mediaSource.Path).then(function (exists) {
|
||||||
Logger.log('LocalAssetManager.fileExists: path: ' + mediaSource.Path + ' result: ' + exists);
|
Logger.log('LocalAssetManager.fileExists: path: ' + mediaSource.Path + ' result: ' + exists);
|
||||||
deferred.resolveWith(null, [exists]);
|
deferred.resolveWith(null, [exists]);
|
||||||
});
|
});
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
collectionTypeOptions: getCollectionTypeOptions(),
|
collectionTypeOptions: getCollectionTypeOptions(),
|
||||||
refresh: shouldRefreshLibraryAfterChanges(page)
|
refresh: shouldRefreshLibraryAfterChanges(page)
|
||||||
|
|
||||||
}).done(function (hasChanges) {
|
}).then(function (hasChanges) {
|
||||||
|
|
||||||
if (hasChanges) {
|
if (hasChanges) {
|
||||||
reloadLibrary(page);
|
reloadLibrary(page);
|
||||||
|
@ -35,7 +35,7 @@
|
||||||
refresh: shouldRefreshLibraryAfterChanges(page),
|
refresh: shouldRefreshLibraryAfterChanges(page),
|
||||||
library: virtualFolder
|
library: virtualFolder
|
||||||
|
|
||||||
}).done(function (hasChanges) {
|
}).then(function (hasChanges) {
|
||||||
|
|
||||||
if (hasChanges) {
|
if (hasChanges) {
|
||||||
reloadLibrary(page);
|
reloadLibrary(page);
|
||||||
|
@ -59,7 +59,7 @@
|
||||||
|
|
||||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||||
|
|
||||||
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).done(function () {
|
ApiClient.removeVirtualFolder(virtualFolder.Name, refreshAfterChange).then(function () {
|
||||||
reloadLibrary(page);
|
reloadLibrary(page);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -80,7 +80,7 @@
|
||||||
|
|
||||||
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
var refreshAfterChange = shouldRefreshLibraryAfterChanges(page);
|
||||||
|
|
||||||
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).done(function () {
|
ApiClient.renameVirtualFolder(virtualFolder.Name, newName, refreshAfterChange).then(function () {
|
||||||
reloadLibrary(page);
|
reloadLibrary(page);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,7 @@
|
||||||
|
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.getVirtualFolders().done(function (result) {
|
ApiClient.getVirtualFolders().then(function (result) {
|
||||||
reloadVirtualFolders(page, result);
|
reloadVirtualFolders(page, result);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -211,7 +211,7 @@
|
||||||
|
|
||||||
ImageEditor.show(virtualFolder.ItemId, {
|
ImageEditor.show(virtualFolder.ItemId, {
|
||||||
theme: 'a'
|
theme: 'a'
|
||||||
}).done(function (hasChanged) {
|
}).then(function (hasChanged) {
|
||||||
if (hasChanged) {
|
if (hasChanged) {
|
||||||
reloadLibrary(page);
|
reloadLibrary(page);
|
||||||
}
|
}
|
||||||
|
@ -441,7 +441,7 @@ var WizardLibraryPage = {
|
||||||
type: "POST",
|
type: "POST",
|
||||||
url: apiClient.getUrl('System/Configuration/MetadataPlugins/Autoset')
|
url: apiClient.getUrl('System/Configuration/MetadataPlugins/Autoset')
|
||||||
|
|
||||||
}).done(function () {
|
}).then(function () {
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
Dashboard.navigate('wizardsettings.html');
|
Dashboard.navigate('wizardsettings.html');
|
||||||
|
|
|
@ -955,7 +955,7 @@
|
||||||
|
|
||||||
requirejs(['videorenderer'], function () {
|
requirejs(['videorenderer'], function () {
|
||||||
|
|
||||||
self.createStreamInfo('Video', item, mediaSource, startPosition).done(function (streamInfo) {
|
self.createStreamInfo('Video', item, mediaSource, startPosition).then(function (streamInfo) {
|
||||||
|
|
||||||
// Huge hack alert. Safari doesn't seem to like if the segments aren't available right away when playback starts
|
// Huge hack alert. Safari doesn't seem to like if the segments aren't available right away when playback starts
|
||||||
// This will start the transcoding process before actually feeding the video url into the player
|
// This will start the transcoding process before actually feeding the video url into the player
|
||||||
|
@ -964,14 +964,15 @@
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
ApiClient.ajax({
|
ApiClient.ajax({
|
||||||
|
|
||||||
type: 'GET',
|
type: 'GET',
|
||||||
url: streamInfo.url.replace('master.m3u8', 'live.m3u8')
|
url: streamInfo.url.replace('master.m3u8', 'live.m3u8')
|
||||||
}).always(function () {
|
|
||||||
|
|
||||||
|
}).then(function () {
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
}).done(function () {
|
|
||||||
self.playVideoInternal(item, mediaSource, startPosition, streamInfo, callback);
|
self.playVideoInternal(item, mediaSource, startPosition, streamInfo, callback);
|
||||||
|
}, function () {
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -1135,7 +1136,7 @@
|
||||||
|
|
||||||
self.updateNowPlayingInfo(item);
|
self.updateNowPlayingInfo(item);
|
||||||
|
|
||||||
mediaRenderer.init().done(function () {
|
mediaRenderer.init().then(function () {
|
||||||
|
|
||||||
self.onBeforePlaybackStart(mediaRenderer, item, mediaSource);
|
self.onBeforePlaybackStart(mediaRenderer, item, mediaSource);
|
||||||
|
|
||||||
|
|
|
@ -668,7 +668,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
if (self.currentItem.MediaType == "Video") {
|
if (self.currentItem.MediaType == "Video") {
|
||||||
ApiClient.stopActiveEncodings(playSessionId).done(function () {
|
ApiClient.stopActiveEncodings(playSessionId).then(function () {
|
||||||
|
|
||||||
//self.startTimeTicksOffset = newPositionTicks;
|
//self.startTimeTicksOffset = newPositionTicks;
|
||||||
self.setSrcIntoRenderer(mediaRenderer, streamInfo, self.currentItem, self.currentMediaSource);
|
self.setSrcIntoRenderer(mediaRenderer, streamInfo, self.currentItem, self.currentMediaSource);
|
||||||
|
@ -862,7 +862,7 @@
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ApiClient.fetchJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/' + firstItem.Id + '/Intros')).then(function (intros) {
|
ApiClient.getJSON(ApiClient.getUrl('Users/' + user.Id + '/Items/' + firstItem.Id + '/Intros')).then(function (intros) {
|
||||||
|
|
||||||
items = intros.Items.concat(items);
|
items = intros.Items.concat(items);
|
||||||
self.playInternal(items[0], options.startPositionTicks, function () {
|
self.playInternal(items[0], options.startPositionTicks, function () {
|
||||||
|
@ -880,7 +880,7 @@
|
||||||
return MediaController.supportsDirectPlay(v);
|
return MediaController.supportsDirectPlay(v);
|
||||||
});
|
});
|
||||||
|
|
||||||
$.when.apply($, promises).done(function () {
|
$.when.apply($, promises).then(function () {
|
||||||
|
|
||||||
for (var i = 0, length = versions.length; i < length; i++) {
|
for (var i = 0, length = versions.length; i < length; i++) {
|
||||||
versions[i].enableDirectPlay = arguments[i] || false;
|
versions[i].enableDirectPlay = arguments[i] || false;
|
||||||
|
@ -1036,7 +1036,7 @@
|
||||||
|
|
||||||
require(['localassetmanager'], function () {
|
require(['localassetmanager'], function () {
|
||||||
|
|
||||||
LocalAssetManager.translateFilePath(resultInfo.url).done(function (path) {
|
LocalAssetManager.translateFilePath(resultInfo.url).then(function (path) {
|
||||||
|
|
||||||
resultInfo.url = path;
|
resultInfo.url = path;
|
||||||
Logger.log('LocalAssetManager.translateFilePath: path: ' + resultInfo.url + ' result: ' + path);
|
Logger.log('LocalAssetManager.translateFilePath: path: ' + resultInfo.url + ' result: ' + path);
|
||||||
|
@ -1087,7 +1087,8 @@
|
||||||
AppSettings.maxStreamingBitrate(bitrate);
|
AppSettings.maxStreamingBitrate(bitrate);
|
||||||
|
|
||||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||||
}).fail(function () {
|
|
||||||
|
}, function () {
|
||||||
|
|
||||||
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
playOnDeviceProfileCreated(self.getDeviceProfile(), item, startPosition, callback);
|
||||||
});
|
});
|
||||||
|
@ -1108,14 +1109,14 @@
|
||||||
|
|
||||||
if (validatePlaybackInfoResult(playbackInfoResult)) {
|
if (validatePlaybackInfoResult(playbackInfoResult)) {
|
||||||
|
|
||||||
getOptimalMediaSource(item.MediaType, playbackInfoResult.MediaSources).done(function (mediaSource) {
|
getOptimalMediaSource(item.MediaType, playbackInfoResult.MediaSources).then(function (mediaSource) {
|
||||||
if (mediaSource) {
|
if (mediaSource) {
|
||||||
|
|
||||||
if (mediaSource.RequiresOpening) {
|
if (mediaSource.RequiresOpening) {
|
||||||
|
|
||||||
MediaController.getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).done(function (openLiveStreamResult) {
|
MediaController.getLiveStream(item.Id, playbackInfoResult.PlaySessionId, deviceProfile, startPosition, mediaSource, null, null).then(function (openLiveStreamResult) {
|
||||||
|
|
||||||
MediaController.supportsDirectPlay(openLiveStreamResult.MediaSource).done(function (result) {
|
MediaController.supportsDirectPlay(openLiveStreamResult.MediaSource).then(function (result) {
|
||||||
|
|
||||||
openLiveStreamResult.MediaSource.enableDirectPlay = result;
|
openLiveStreamResult.MediaSource.enableDirectPlay = result;
|
||||||
callback(openLiveStreamResult.MediaSource);
|
callback(openLiveStreamResult.MediaSource);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue