1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

remove more code related to camera roll

This commit is contained in:
dkanada 2019-01-21 18:05:15 +09:00
parent 08df4531e3
commit b5b928ec21
4 changed files with 3 additions and 73 deletions

View file

@ -1,8 +0,0 @@
define([], function() {
"use strict";
function CameraRoll() {}
return CameraRoll.prototype.getFiles = function() {
return Promise.resolve([])
}, new CameraRoll
});

View file

@ -1,57 +0,0 @@
define(["localassetmanager", "cameraRoll"], function(localAssetManager, cameraRoll) {
"use strict";
function getFilesToUpload(files, uploadHistory) {
return files.filter(function(file) {
if (!file) return !1;
var uploadId = getUploadId(file);
return 0 === uploadHistory.FilesUploaded.filter(function(u) {
return uploadId === u.Id
}).length
})
}
function getUploadId(file) {
return btoa(file.Id + "1")
}
function uploadNext(files, index, server, apiClient, resolve, reject) {
var length = files.length;
if (index >= length) return void resolve();
uploadFile(files[index], apiClient).then(function() {
uploadNext(files, index + 1, server, apiClient, resolve, reject)
}, function() {
uploadNext(files, index + 1, server, apiClient, resolve, reject)
})
}
function uploadFile(file, apiClient) {
return new Promise(function(resolve, reject) {
require(["fileupload"], function(FileUpload) {
var url = apiClient.getUrl("Devices/CameraUploads", {
DeviceId: apiClient.deviceId(),
Name: file.Name,
Album: "Camera Roll",
Id: getUploadId(file),
api_key: apiClient.accessToken()
});
console.log("Uploading file to " + url), (new FileUpload).upload(file, url).then(resolve, reject)
})
})
}
function ContentUploader() {}
return ContentUploader.prototype.uploadImages = function(connectionManager, server) {
return cameraRoll.getFiles().then(function(photos) {
if (!photos.length) return Promise.resolve();
var apiClient = connectionManager.getApiClient(server.Id);
return apiClient.getContentUploadHistory().then(function(uploadHistory) {
return photos = getFilesToUpload(photos, uploadHistory), console.log("Found " + photos.length + " files to upload"), new Promise(function(resolve, reject) {
uploadNext(photos, 0, server, apiClient, resolve, reject)
})
}, function() {
return Promise.resolve()
})
})
}, ContentUploader
});

View file

@ -12,11 +12,7 @@ define([], function() {
}
function uploadContent(connectionManager, server, options) {
return new Promise(function(resolve, reject) {
require(["contentuploader"], function(ContentUploader) {
(new ContentUploader).uploadImages(connectionManager, server).then(resolve, reject)
})
})
return new Promise().resolve();
}
function syncMedia(connectionManager, server, options) {

View file

@ -304,8 +304,8 @@ var Dashboard = {
var embyWebComponentsBowerPath = bowerPath + "/emby-webcomponents";
"android" === self.appMode
? (define("filesystem", ["cordova/filesystem"], returnFirstDependency), define("cameraRoll", ["cordova/cameraroll"], returnFirstDependency))
: (define("filesystem", [embyWebComponentsBowerPath + "/filesystem"], returnFirstDependency), define("cameraRoll", [apiClientBowerPath + "/cameraroll"], returnFirstDependency));
? define("filesystem", ["cordova/filesystem"], returnFirstDependency)
: define("filesystem", [embyWebComponentsBowerPath + "/filesystem"], returnFirstDependency);
window.IntersectionObserver && !browser.edge
? define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-intersectionobserver"], returnFirstDependency)
: define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-scroll"], returnFirstDependency);
@ -1133,7 +1133,6 @@ var Dashboard = {
? define("fileupload", ["cordova/fileupload"], returnFirstDependency)
: define("fileupload", [apiClientBowerPath + "/fileupload"], returnFirstDependency);
define("connectionmanager", [apiClientBowerPath + "/connectionmanager"]);
define("contentuploader", [apiClientBowerPath + "/sync/contentuploader"], returnFirstDependency);
define("serversync", [apiClientBowerPath + "/sync/serversync"], returnFirstDependency);
define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"], returnFirstDependency);
define("mediasync", [apiClientBowerPath + "/sync/mediasync"], returnFirstDependency);