diff --git a/components/home/BookshelfToolbar.vue b/components/home/BookshelfToolbar.vue
index 59c971fe..ff3cbef7 100644
--- a/components/home/BookshelfToolbar.vue
+++ b/components/home/BookshelfToolbar.vue
@@ -13,6 +13,7 @@
sort
+ download
more_vert
@@ -95,11 +96,6 @@ export default {
text: this.$strings.LabelCollapseSeries,
value: 'collapse_subseries',
icon: this.settings.collapseBookSeries ? 'check_box' : 'check_box_outline_blank'
- },
- {
- text: this.$strings.LabelDownloadSerie,
- value: 'download_serie',
- icon: 'download'
}
]
} else {
@@ -122,9 +118,6 @@ export default {
} else if (action === 'collapse_subseries') {
this.settings.collapseBookSeries = !this.settings.collapseBookSeries
this.saveSettings()
- } else if (action === 'download_serie') {
- console.log('Download Serie click')
- this.$eventBus.$emit('download-serie-click')
}
},
updateOrder() {
@@ -152,6 +145,10 @@ export default {
async changeView() {
this.bookshelfListView = !this.bookshelfListView
await this.$hapticsImpact()
+ },
+ downloadSeries() {
+ console.log('Download Series click')
+ this.$eventBus.$emit('download-series-click')
}
},
mounted() {
diff --git a/pages/bookshelf/series/_id.vue b/pages/bookshelf/series/_id.vue
index 7e7edd8b..b188afe0 100644
--- a/pages/bookshelf/series/_id.vue
+++ b/pages/bookshelf/series/_id.vue
@@ -28,8 +28,8 @@ export default {
mediaType: 'book',
booksPerFetch: 20,
books: 0,
- numFiles: 0,
- numAudioFiles: 0,
+ missingFiles: 0,
+ missingFilesSize: 0,
libraryIds: []
}
},
@@ -40,7 +40,7 @@ export default {
}
},
methods: {
- async downloadSerieClick() {
+ async downloadSeriesClick() {
console.log('Download Series clicked')
if (this.startingDownload) return
@@ -60,7 +60,7 @@ export default {
searchParams.set('filter', `series.${this.$encode(this.seriesId)}`)
return searchParams.toString()
},
- async fetchSerieEntities(page) {
+ async fetchSeriesEntities(page) {
const startIndex = page * this.booksPerFetch
this.currentSFQueryString = this.buildSearchParams()
@@ -79,10 +79,9 @@ export default {
this.books = payload.total
for (let i = 0; i < payload.results.length; i++) {
- console.log(payload.results[i].numFiles)
if (!(await this.$db.getLocalLibraryItem(`local_${payload.results[i].id}`))) {
- this.numFiles += payload.results[i].numFiles
- this.numAudioFiles += payload.results[i].media.numAudioFiles
+ this.missingFiles += payload.results[i].numFiles
+ this.missingFilesSize += payload.results[i].size
this.libraryIds.push(payload.results[i].id)
}
}
@@ -124,32 +123,23 @@ export default {
}
}
- // Fetch serie data from server
+ // Fetch series data from server
let page = 0
let fetchFinished = false
while (fetchFinished === false) {
- fetchFinished = await this.fetchSerieEntities(page)
+ fetchFinished = await this.fetchSeriesEntities(page)
page += 1
}
if (fetchFinished !== true) {
- console.error('failed to fetch serie books data')
+ console.error('failed to fetch series books data')
return null
}
// Format message for dialog
- let startDownloadMessage = `Serie "${this.series.name}" has ${this.books} book${this.books == 1 ? '' : 's'}. Download missing ${this.libraryIds.length} book${this.libraryIds.length == 1 ? '' : 's'} with ${this.numFiles} file${this.numFiles == 1 ? '' : 's'}`
- let numEbookFiles = this.numFiles - this.numAudioFiles
- if (!this.isIos && numEbookFiles > 0) {
- if (this.numAudioFiles > 0) {
- startDownloadMessage = `Serie "${this.series.name}" has ${this.books} book${this.books == 1 ? '' : 's'}. Download missing ${this.libraryIds.length} book${this.libraryIds.length == 1 ? '' : 's'} with ${this.numAudioFiles} audio file${this.numAudioFiles == 1 ? '' : 's'} and ${numEbookFiles} ebook file${this.numEbookFiles == 1 ? '' : 's'}`
- } else {
- startDownloadMessage = `Serie "${this.series.name}" has ${this.books} book${this.books == 1 ? '' : 's'}. Download missing ${this.libraryIds.length} book${this.libraryIds.length == 1 ? '' : 's'} with ${this.numFiles} ebook file${this.numFiles == 1 ? '' : 's'}`
- }
- }
+ let startDownloadMessage = this.$getString('MessageSeriesDownloadConfirmIos', [this.libraryIds.length, this.missingFiles, this.$bytesPretty(this.missingFilesSize)])
if (!this.isIos) {
- startDownloadMessage += ` to folder ${localFolder.name}`
+ startDownloadMessage = this.$getString('MessageSeriesDownloadConfirm', [this.libraryIds.length, this.missingFiles, this.$bytesPretty(this.missingFilesSize), localFolder.name])
}
- startDownloadMessage += `?`
// Show confirmation dialog and start downloading if user chooses so
const { value } = await Dialog.confirm({
@@ -180,10 +170,10 @@ export default {
}
},
mounted() {
- this.$eventBus.$on('download-serie-click', this.downloadSerieClick)
+ this.$eventBus.$on('download-series-click', this.downloadSeriesClick)
},
beforeDestroy() {
- this.$eventBus.$off('download-serie-click', this.downloadSerieClick)
+ this.$eventBus.$off('download-series-click', this.downloadSeriesClick)
}
}
diff --git a/strings/en-us.json b/strings/en-us.json
index c865bf4f..2d89987e 100644
--- a/strings/en-us.json
+++ b/strings/en-us.json
@@ -123,7 +123,6 @@
"LabelDisableVibrateOnResetHelp": "When the sleep timer gets reset your device will vibrate. Enable this setting to not vibrate when the sleep timer resets.",
"LabelDiscover": "Discover",
"LabelDownload": "Download",
- "LabelDownloadSerie": "Download serie",
"LabelDownloadUsingCellular": "Download using Cellular",
"LabelDownloaded": "Downloaded",
"LabelDuration": "Duration",
@@ -288,6 +287,8 @@
"MessageNoUpdatesWereNecessary": "No updates were necessary",
"MessageNoUserPlaylists": "You have no playlists",
"MessageReportBugsAndContribute": "Report bugs, request features, and contribute on",
+ "MessageSeriesDownloadConfirm": "Download missing {0} book(s) with {1} file(s), totaling {2} to folder {3}?",
+ "MessageSeriesDownloadConfirmIos": "Download missing {0} book(s) with {1} file(s), totaling {2}?",
"MessageSocketConnectedOverMeteredCellular": "Socket connected over metered cellular",
"MessageSocketConnectedOverMeteredWifi": "Socket connected over metered wifi",
"MessageSocketConnectedOverUnmeteredCellular": "Socket connected over unmetered cellular",