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:
parent
08df4531e3
commit
b5b928ec21
4 changed files with 3 additions and 73 deletions
|
@ -1,8 +0,0 @@
|
||||||
define([], function() {
|
|
||||||
"use strict";
|
|
||||||
|
|
||||||
function CameraRoll() {}
|
|
||||||
return CameraRoll.prototype.getFiles = function() {
|
|
||||||
return Promise.resolve([])
|
|
||||||
}, new CameraRoll
|
|
||||||
});
|
|
|
@ -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
|
|
||||||
});
|
|
|
@ -12,11 +12,7 @@ define([], function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function uploadContent(connectionManager, server, options) {
|
function uploadContent(connectionManager, server, options) {
|
||||||
return new Promise(function(resolve, reject) {
|
return new Promise().resolve();
|
||||||
require(["contentuploader"], function(ContentUploader) {
|
|
||||||
(new ContentUploader).uploadImages(connectionManager, server).then(resolve, reject)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function syncMedia(connectionManager, server, options) {
|
function syncMedia(connectionManager, server, options) {
|
||||||
|
|
|
@ -304,8 +304,8 @@ var Dashboard = {
|
||||||
var embyWebComponentsBowerPath = bowerPath + "/emby-webcomponents";
|
var embyWebComponentsBowerPath = bowerPath + "/emby-webcomponents";
|
||||||
|
|
||||||
"android" === self.appMode
|
"android" === self.appMode
|
||||||
? (define("filesystem", ["cordova/filesystem"], returnFirstDependency), define("cameraRoll", ["cordova/cameraroll"], returnFirstDependency))
|
? define("filesystem", ["cordova/filesystem"], returnFirstDependency)
|
||||||
: (define("filesystem", [embyWebComponentsBowerPath + "/filesystem"], returnFirstDependency), define("cameraRoll", [apiClientBowerPath + "/cameraroll"], returnFirstDependency));
|
: define("filesystem", [embyWebComponentsBowerPath + "/filesystem"], returnFirstDependency);
|
||||||
window.IntersectionObserver && !browser.edge
|
window.IntersectionObserver && !browser.edge
|
||||||
? define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-intersectionobserver"], returnFirstDependency)
|
? define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-intersectionobserver"], returnFirstDependency)
|
||||||
: define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-scroll"], returnFirstDependency);
|
: define("lazyLoader", [embyWebComponentsBowerPath + "/lazyloader/lazyloader-scroll"], returnFirstDependency);
|
||||||
|
@ -1133,7 +1133,6 @@ var Dashboard = {
|
||||||
? define("fileupload", ["cordova/fileupload"], returnFirstDependency)
|
? define("fileupload", ["cordova/fileupload"], returnFirstDependency)
|
||||||
: define("fileupload", [apiClientBowerPath + "/fileupload"], returnFirstDependency);
|
: define("fileupload", [apiClientBowerPath + "/fileupload"], returnFirstDependency);
|
||||||
define("connectionmanager", [apiClientBowerPath + "/connectionmanager"]);
|
define("connectionmanager", [apiClientBowerPath + "/connectionmanager"]);
|
||||||
define("contentuploader", [apiClientBowerPath + "/sync/contentuploader"], returnFirstDependency);
|
|
||||||
define("serversync", [apiClientBowerPath + "/sync/serversync"], returnFirstDependency);
|
define("serversync", [apiClientBowerPath + "/sync/serversync"], returnFirstDependency);
|
||||||
define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"], returnFirstDependency);
|
define("multiserversync", [apiClientBowerPath + "/sync/multiserversync"], returnFirstDependency);
|
||||||
define("mediasync", [apiClientBowerPath + "/sync/mediasync"], returnFirstDependency);
|
define("mediasync", [apiClientBowerPath + "/sync/mediasync"], returnFirstDependency);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue