mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
update sync process
This commit is contained in:
parent
cc428aac1d
commit
504384e83d
109 changed files with 553 additions and 289 deletions
12
dashboard-ui/cordova/ios/tabbar.js
vendored
12
dashboard-ui/cordova/ios/tabbar.js
vendored
|
@ -11,8 +11,8 @@
|
|||
}
|
||||
|
||||
switch (name) {
|
||||
case 'Featured':
|
||||
Dashboard.navigate('index.html');
|
||||
case 'Favorites':
|
||||
Dashboard.navigate('favorites.html');
|
||||
break;
|
||||
case 'Library':
|
||||
Dashboard.navigate('index.html');
|
||||
|
@ -68,8 +68,8 @@
|
|||
*/
|
||||
|
||||
var items = [
|
||||
{ name: 'Featured', label: Globalize.translate('ButtonForYou'), image: 'tabButton:Featured', options: {} },
|
||||
{ name: 'Library', label: Globalize.translate('ButtonLibrary'), image: 'tabbar/tab-library.png', options: {} },
|
||||
{ name: 'Favorites', label: Globalize.translate('ButtonFavorites'), image: 'tabButton:Favorites', options: {} },
|
||||
{ name: 'Search', label: Globalize.translate('ButtonSearch'), image: 'tabButton:Search', options: {} },
|
||||
{ name: 'NowPlaying', label: Globalize.translate('ButtonNowPlaying'), image: 'tabbar/tab-nowplaying.png', options: {} },
|
||||
{ name: 'Sync', label: Globalize.translate('ButtonSync'), image: 'tabbar/tab-sync.png', options: {} },
|
||||
|
@ -113,11 +113,11 @@
|
|||
|
||||
Events.on(ConnectionManager, 'localusersignedin', showTabs);
|
||||
Events.on(ConnectionManager, 'localusersignedout', hideTabs);
|
||||
Events.on(ConnectionManager, 'playbackstart', onPlaybackStop);
|
||||
Events.on(ConnectionManager, 'playbackstop', onPlaybackStart);
|
||||
Events.on(MediaController, 'playbackstart', onPlaybackStop);
|
||||
Events.on(MediaController, 'playbackstop', onPlaybackStart);
|
||||
});
|
||||
|
||||
pageClassOn('pageshowready', "page", function () {
|
||||
pageClassOn('pageshow', "page", function () {
|
||||
|
||||
var page = this;
|
||||
|
||||
|
|
50
dashboard-ui/cordova/localassetmanager.js
vendored
50
dashboard-ui/cordova/localassetmanager.js
vendored
|
@ -459,10 +459,20 @@
|
|||
return filename;
|
||||
}
|
||||
|
||||
function downloadFile(url, localPath) {
|
||||
function downloadFile(url, localPath, enableBackground) {
|
||||
|
||||
if (!enableBackground) {
|
||||
return downloadWithFileTransfer(url, localPath);
|
||||
}
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
if (localStorage.getItem('sync-' + url) == '1') {
|
||||
Logger.log('file was downloaded previously');
|
||||
deferred.resolveWith(null, [localPath]);
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
Logger.log('downloading: ' + url + ' to ' + localPath);
|
||||
|
||||
getFileSystem().done(function (fileSystem) {
|
||||
|
@ -478,10 +488,8 @@
|
|||
var downloadPromise = download.startAsync().then(function () {
|
||||
|
||||
// on success
|
||||
var localUrl = localPath;
|
||||
|
||||
Logger.log('Downloaded local url: ' + localUrl);
|
||||
deferred.resolveWith(null, [localUrl]);
|
||||
Logger.log('Downloaded local url: ' + localPath);
|
||||
localStorage.setItem('sync-' + url, '1');
|
||||
|
||||
}, function () {
|
||||
|
||||
|
@ -495,6 +503,34 @@
|
|||
//Logger.log('download progress: ' + value);
|
||||
|
||||
});
|
||||
|
||||
// true indicates that it's queued
|
||||
deferred.resolveWith(null, [localPath, true]);
|
||||
});
|
||||
|
||||
}).fail(getOnFail(deferred));;
|
||||
|
||||
}).fail(getOnFail(deferred));
|
||||
|
||||
return deferred.promise();
|
||||
}
|
||||
|
||||
function downloadWithFileTransfer(url, localPath) {
|
||||
|
||||
var deferred = DeferredBuilder.Deferred();
|
||||
|
||||
Logger.log('downloading: ' + url + ' to ' + localPath);
|
||||
|
||||
getFileSystem().done(function (fileSystem) {
|
||||
|
||||
createDirectory(getParentDirectoryPath(localPath)).done(function () {
|
||||
|
||||
var path = fileSystem.root.toURL() + "/emby/cache/" + key;
|
||||
|
||||
var ft = new FileTransfer();
|
||||
ft.download(url, path, function (entry) {
|
||||
|
||||
deferred.resolveWith(null, [localPath]);
|
||||
});
|
||||
|
||||
}).fail(getOnFail(deferred));;
|
||||
|
@ -552,10 +588,6 @@
|
|||
return deferred.promise();
|
||||
}
|
||||
|
||||
function getParentDirectoryPath(path) {
|
||||
return path.substring(0, path.lastIndexOf('/'));;
|
||||
}
|
||||
|
||||
function downloadSubtitles(url, localItem, subtitleStream) {
|
||||
|
||||
var path = item.LocalPath;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue