mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 19:38:20 -07:00
76 lines
1.7 KiB
JavaScript
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); |