mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2025-07-06 12:04:44 +02:00
Enhanced download series ui
- Move download button from menu to toolbar - Changed download confirmation message - Changed serie to series
This commit is contained in:
parent
84509ec1a8
commit
34dcdc89c3
3 changed files with 20 additions and 32 deletions
|
@ -13,6 +13,7 @@
|
||||||
</div>
|
</div>
|
||||||
<span class="material-icons px-2" @click="showSortModal = true">sort</span>
|
<span class="material-icons px-2" @click="showSortModal = true">sort</span>
|
||||||
</template>
|
</template>
|
||||||
|
<span v-if="seriesBookPage" class="material-icons px-2" @click="downloadSeries">download</span>
|
||||||
<span v-if="(page == 'library' && isBookLibrary) || seriesBookPage" class="material-icons px-2" @click="showMoreMenuDialog = true">more_vert</span>
|
<span v-if="(page == 'library' && isBookLibrary) || seriesBookPage" class="material-icons px-2" @click="showMoreMenuDialog = true">more_vert</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -95,11 +96,6 @@ export default {
|
||||||
text: this.$strings.LabelCollapseSeries,
|
text: this.$strings.LabelCollapseSeries,
|
||||||
value: 'collapse_subseries',
|
value: 'collapse_subseries',
|
||||||
icon: this.settings.collapseBookSeries ? 'check_box' : 'check_box_outline_blank'
|
icon: this.settings.collapseBookSeries ? 'check_box' : 'check_box_outline_blank'
|
||||||
},
|
|
||||||
{
|
|
||||||
text: this.$strings.LabelDownloadSerie,
|
|
||||||
value: 'download_serie',
|
|
||||||
icon: 'download'
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
} else {
|
} else {
|
||||||
|
@ -122,9 +118,6 @@ export default {
|
||||||
} else if (action === 'collapse_subseries') {
|
} else if (action === 'collapse_subseries') {
|
||||||
this.settings.collapseBookSeries = !this.settings.collapseBookSeries
|
this.settings.collapseBookSeries = !this.settings.collapseBookSeries
|
||||||
this.saveSettings()
|
this.saveSettings()
|
||||||
} else if (action === 'download_serie') {
|
|
||||||
console.log('Download Serie click')
|
|
||||||
this.$eventBus.$emit('download-serie-click')
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
updateOrder() {
|
updateOrder() {
|
||||||
|
@ -152,6 +145,10 @@ export default {
|
||||||
async changeView() {
|
async changeView() {
|
||||||
this.bookshelfListView = !this.bookshelfListView
|
this.bookshelfListView = !this.bookshelfListView
|
||||||
await this.$hapticsImpact()
|
await this.$hapticsImpact()
|
||||||
|
},
|
||||||
|
downloadSeries() {
|
||||||
|
console.log('Download Series click')
|
||||||
|
this.$eventBus.$emit('download-series-click')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
|
|
|
@ -28,8 +28,8 @@ export default {
|
||||||
mediaType: 'book',
|
mediaType: 'book',
|
||||||
booksPerFetch: 20,
|
booksPerFetch: 20,
|
||||||
books: 0,
|
books: 0,
|
||||||
numFiles: 0,
|
missingFiles: 0,
|
||||||
numAudioFiles: 0,
|
missingFilesSize: 0,
|
||||||
libraryIds: []
|
libraryIds: []
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -40,7 +40,7 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
async downloadSerieClick() {
|
async downloadSeriesClick() {
|
||||||
console.log('Download Series clicked')
|
console.log('Download Series clicked')
|
||||||
if (this.startingDownload) return
|
if (this.startingDownload) return
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ export default {
|
||||||
searchParams.set('filter', `series.${this.$encode(this.seriesId)}`)
|
searchParams.set('filter', `series.${this.$encode(this.seriesId)}`)
|
||||||
return searchParams.toString()
|
return searchParams.toString()
|
||||||
},
|
},
|
||||||
async fetchSerieEntities(page) {
|
async fetchSeriesEntities(page) {
|
||||||
const startIndex = page * this.booksPerFetch
|
const startIndex = page * this.booksPerFetch
|
||||||
|
|
||||||
this.currentSFQueryString = this.buildSearchParams()
|
this.currentSFQueryString = this.buildSearchParams()
|
||||||
|
@ -79,10 +79,9 @@ export default {
|
||||||
this.books = payload.total
|
this.books = payload.total
|
||||||
|
|
||||||
for (let i = 0; i < payload.results.length; i++) {
|
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}`))) {
|
if (!(await this.$db.getLocalLibraryItem(`local_${payload.results[i].id}`))) {
|
||||||
this.numFiles += payload.results[i].numFiles
|
this.missingFiles += payload.results[i].numFiles
|
||||||
this.numAudioFiles += payload.results[i].media.numAudioFiles
|
this.missingFilesSize += payload.results[i].size
|
||||||
this.libraryIds.push(payload.results[i].id)
|
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 page = 0
|
||||||
let fetchFinished = false
|
let fetchFinished = false
|
||||||
while (fetchFinished === false) {
|
while (fetchFinished === false) {
|
||||||
fetchFinished = await this.fetchSerieEntities(page)
|
fetchFinished = await this.fetchSeriesEntities(page)
|
||||||
page += 1
|
page += 1
|
||||||
}
|
}
|
||||||
if (fetchFinished !== true) {
|
if (fetchFinished !== true) {
|
||||||
console.error('failed to fetch serie books data')
|
console.error('failed to fetch series books data')
|
||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format message for dialog
|
// 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 startDownloadMessage = this.$getString('MessageSeriesDownloadConfirmIos', [this.libraryIds.length, this.missingFiles, this.$bytesPretty(this.missingFilesSize)])
|
||||||
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'}`
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (!this.isIos) {
|
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
|
// Show confirmation dialog and start downloading if user chooses so
|
||||||
const { value } = await Dialog.confirm({
|
const { value } = await Dialog.confirm({
|
||||||
|
@ -180,10 +170,10 @@ export default {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
mounted() {
|
||||||
this.$eventBus.$on('download-serie-click', this.downloadSerieClick)
|
this.$eventBus.$on('download-series-click', this.downloadSeriesClick)
|
||||||
},
|
},
|
||||||
beforeDestroy() {
|
beforeDestroy() {
|
||||||
this.$eventBus.$off('download-serie-click', this.downloadSerieClick)
|
this.$eventBus.$off('download-series-click', this.downloadSeriesClick)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -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.",
|
"LabelDisableVibrateOnResetHelp": "When the sleep timer gets reset your device will vibrate. Enable this setting to not vibrate when the sleep timer resets.",
|
||||||
"LabelDiscover": "Discover",
|
"LabelDiscover": "Discover",
|
||||||
"LabelDownload": "Download",
|
"LabelDownload": "Download",
|
||||||
"LabelDownloadSerie": "Download serie",
|
|
||||||
"LabelDownloadUsingCellular": "Download using Cellular",
|
"LabelDownloadUsingCellular": "Download using Cellular",
|
||||||
"LabelDownloaded": "Downloaded",
|
"LabelDownloaded": "Downloaded",
|
||||||
"LabelDuration": "Duration",
|
"LabelDuration": "Duration",
|
||||||
|
@ -288,6 +287,8 @@
|
||||||
"MessageNoUpdatesWereNecessary": "No updates were necessary",
|
"MessageNoUpdatesWereNecessary": "No updates were necessary",
|
||||||
"MessageNoUserPlaylists": "You have no playlists",
|
"MessageNoUserPlaylists": "You have no playlists",
|
||||||
"MessageReportBugsAndContribute": "Report bugs, request features, and contribute on",
|
"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",
|
"MessageSocketConnectedOverMeteredCellular": "Socket connected over metered cellular",
|
||||||
"MessageSocketConnectedOverMeteredWifi": "Socket connected over metered wifi",
|
"MessageSocketConnectedOverMeteredWifi": "Socket connected over metered wifi",
|
||||||
"MessageSocketConnectedOverUnmeteredCellular": "Socket connected over unmetered cellular",
|
"MessageSocketConnectedOverUnmeteredCellular": "Socket connected over unmetered cellular",
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue