mirror of
https://github.com/jellyfin/jellyfin-web.git
synced 2024-11-18 03:18:19 -07:00
55 lines
1.6 KiB
JavaScript
55 lines
1.6 KiB
JavaScript
|
(function (globalScope) {
|
|||
|
|
|||
|
function contentUploader(connectionManager) {
|
|||
|
|
|||
|
self.uploadImages = function (server) {
|
|||
|
|
|||
|
var deferred = DeferredBuilder.Deferred();
|
|||
|
|
|||
|
var apiClient = self.getApiClient(server.Id);
|
|||
|
|
|||
|
apiClient.getDevicesOptions().done(function (devicesOptions) {
|
|||
|
|
|||
|
if (!devicesOptions.EnabledCameraUploadDevices || devicesOptions.EnabledCameraUploadDevices.indexOf(apiClient.deviceId()) == -1) {
|
|||
|
Logger.log("Camera upload is not enabled for this device.");
|
|||
|
deferred.reject();
|
|||
|
}
|
|||
|
else {
|
|||
|
uploadImagesInternal(server, apiClient, deferred);
|
|||
|
}
|
|||
|
|
|||
|
}).fail(function () {
|
|||
|
deferred.reject();
|
|||
|
});
|
|||
|
|
|||
|
return deferred.promise();
|
|||
|
};
|
|||
|
|
|||
|
function uploadImagesInternal(server, apiClient, deferred) {
|
|||
|
|
|||
|
apiClient.getContentUploadHistory().done(function (result) {
|
|||
|
|
|||
|
uploadImagesWithHistory(server, result, apiClient, deferred);
|
|||
|
|
|||
|
}).fail(function () {
|
|||
|
deferred.reject();
|
|||
|
});
|
|||
|
}
|
|||
|
|
|||
|
function uploadImagesWithHistory(server, uploadHistory, apiClient, deferred) {
|
|||
|
|
|||
|
require(['localassetmanager'], function () {
|
|||
|
|
|||
|
// TODO: Mimic java version of ContentUploader.UploadImagesInternal
|
|||
|
deferred.resolve();
|
|||
|
});
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
if (!globalScope.MediaBrowser) {
|
|||
|
globalScope.MediaBrowser = {};
|
|||
|
}
|
|||
|
|
|||
|
globalScope.MediaBrowser.ContentUploader = contentUploader;
|
|||
|
|
|||
|
})(this);
|