jellyfin-web/dashboard-ui/apiclient/sync/mediasync.js
Luke Pulverenti 59d8a3a853 update docs
2015-09-14 08:50:37 -04:00

76 lines
1.7 KiB
JavaScript

(function (globalScope) {
function mediaSync() {
var self = this;
self.sync = function (apiClient) {
var deferred = DeferredBuilder.Deferred();
reportOfflineActions(apiClient).done(function () {
// Do the first data sync
syncData(apiClient, false).done(function () {
// Download new content
getNewMedia(apiClient).done(function () {
// Do the second data sync
syncData(apiClient, false).done(function () {
deferred.resolve();
}).fail(getOnFail(deferred));
}).fail(getOnFail(deferred));
}).fail(getOnFail(deferred));
}).fail(getOnFail(deferred));
return deferred.promise();
};
function reportOfflineActions(apiClient) {
var deferred = DeferredBuilder.Deferred();
deferred.resolve();
return deferred.promise();
}
function syncData(apiClient, syncUserItemAccess) {
var deferred = DeferredBuilder.Deferred();
deferred.resolve();
return deferred.promise();
}
function getNewMedia(apiClient) {
var deferred = DeferredBuilder.Deferred();
deferred.resolve();
return deferred.promise();
}
function getOnFail(deferred) {
return function () {
deferred.reject();
};
}
}
if (!globalScope.MediaBrowser) {
globalScope.MediaBrowser = {};
}
globalScope.MediaBrowser.MediaSync = mediaSync;
})(this);