From 1aff2551703e97bf7fd05b255d46b40e16ba392e Mon Sep 17 00:00:00 2001 From: advplyr Date: Sat, 4 Sep 2021 14:17:26 -0500 Subject: [PATCH] Adding download tab and download manager, ffmpeg in worker thread --- client/components/modals/EditModal.vue | 43 +++- .../components/modals/edit-tabs/Download.vue | 154 +++++++++++++ client/components/ui/Btn.vue | 5 +- client/layouts/default.vue | 42 ++++ client/package.json | 2 +- client/pages/audiobook/_id/index.vue | 6 +- client/plugins/toast.js | 1 - client/store/downloads.js | 36 +++ index.js | 1 + package.json | 2 +- server/ApiController.js | 33 ++- server/Db.js | 5 +- server/DownloadManager.js | 212 ++++++++++++++++++ server/Scanner.js | 2 +- server/Server.js | 7 +- server/StreamManager.js | 2 +- server/{ => objects}/AudioFile.js | 0 server/{ => objects}/AudioTrack.js | 2 +- server/{ => objects}/Audiobook.js | 6 +- server/{ => objects}/AudiobookFile.js | 0 server/{ => objects}/Book.js | 5 +- server/objects/Download.js | 107 +++++++++ server/{ => objects}/Stream.js | 30 +-- server/{ => objects}/User.js | 0 server/utils/audioFileScanner.js | 2 - server/utils/downloadWorker.js | 68 ++++++ server/utils/ffmpegHelpers.js | 37 +++ server/utils/fileUtils.js | 7 + 28 files changed, 757 insertions(+), 60 deletions(-) create mode 100644 client/components/modals/edit-tabs/Download.vue create mode 100644 client/store/downloads.js create mode 100644 server/DownloadManager.js rename server/{ => objects}/AudioFile.js (100%) rename server/{ => objects}/AudioTrack.js (98%) rename server/{ => objects}/Audiobook.js (98%) rename server/{ => objects}/AudiobookFile.js (100%) rename server/{ => objects}/Book.js (98%) create mode 100644 server/objects/Download.js rename server/{ => objects}/Stream.js (91%) rename server/{ => objects}/User.js (100%) create mode 100644 server/utils/downloadWorker.js create mode 100644 server/utils/ffmpegHelpers.js diff --git a/client/components/modals/EditModal.vue b/client/components/modals/EditModal.vue index 441d115a..0079f457 100644 --- a/client/components/modals/EditModal.vue +++ b/client/components/modals/EditModal.vue @@ -6,10 +6,9 @@
-
Details
-
Cover
-
Match
-
Tracks
+
@@ -26,7 +25,34 @@ export default { selectedTab: 'details', processing: false, audiobook: null, - fetchOnShow: false + fetchOnShow: false, + tabs: [ + { + id: 'details', + title: 'Details', + component: 'modals-edit-tabs-details' + }, + { + id: 'cover', + title: 'Cover', + component: 'modals-edit-tabs-cover' + }, + { + id: 'match', + title: 'Match', + component: 'modals-edit-tabs-match' + }, + { + id: 'tracks', + title: 'Tracks', + component: 'modals-edit-tabs-tracks' + }, + { + id: 'download', + title: 'Download', + component: 'modals-edit-tabs-download' + } + ] } }, watch: { @@ -54,11 +80,8 @@ export default { } }, tabName() { - if (this.selectedTab === 'details') return 'modals-edit-tabs-details' - else if (this.selectedTab === 'cover') return 'modals-edit-tabs-cover' - else if (this.selectedTab === 'match') return 'modals-edit-tabs-match' - else if (this.selectedTab === 'tracks') return 'modals-edit-tabs-tracks' - return '' + var _tab = this.tabs.find((t) => t.id === this.selectedTab) + return _tab ? _tab.component : '' }, selectedAudiobook() { return this.$store.state.selectedAudiobook || {} diff --git a/client/components/modals/edit-tabs/Download.vue b/client/components/modals/edit-tabs/Download.vue new file mode 100644 index 00000000..50c0346a --- /dev/null +++ b/client/components/modals/edit-tabs/Download.vue @@ -0,0 +1,154 @@ + + + \ No newline at end of file diff --git a/client/components/ui/Btn.vue b/client/components/ui/Btn.vue index 501b13f7..734e0d76 100644 --- a/client/components/ui/Btn.vue +++ b/client/components/ui/Btn.vue @@ -1,5 +1,5 @@