mirror of
https://github.com/advplyr/audiobookshelf-app.git
synced 2026-08-30 23:27:17 +02:00
Merge pull request #1522 from 4ch1m/sort_podcasts_by_filename
sort podcasts by filename; display filename in table row
This commit is contained in:
@@ -119,6 +119,10 @@ export default {
|
|||||||
{
|
{
|
||||||
text: this.$strings.LabelEpisode,
|
text: this.$strings.LabelEpisode,
|
||||||
value: 'episode'
|
value: 'episode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$strings.LabelFilename,
|
||||||
|
value: 'audioFile.metadata.filename'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,6 +17,11 @@
|
|||||||
|
|
||||||
<p class="text-sm text-fg episode-subtitle mt-1.5 mb-0.5" v-html="subtitle" />
|
<p class="text-sm text-fg episode-subtitle mt-1.5 mb-0.5" v-html="subtitle" />
|
||||||
|
|
||||||
|
<p v-if="sortKey === 'audioFile.metadata.filename'" class="text-xs text-fg-muted truncate mt-2 mb-0.5">
|
||||||
|
<span class="font-semibold">{{ $getString('LabelFilename') }}</span
|
||||||
|
>: <span class="font-light">{{ episode.audioFile.metadata.filename }}</span>
|
||||||
|
</p>
|
||||||
|
|
||||||
<div v-if="episodeNumber || season || episodeType" class="flex py-2 items-center -mx-0.5">
|
<div v-if="episodeNumber || season || episodeType" class="flex py-2 items-center -mx-0.5">
|
||||||
<div v-if="episodeNumber" class="px-2 pt-px pb-0.5 mx-0.5 bg-primary bg-opacity-50 rounded-full text-xs font-light text-fg">Episode #{{ episodeNumber }}</div>
|
<div v-if="episodeNumber" class="px-2 pt-px pb-0.5 mx-0.5 bg-primary bg-opacity-50 rounded-full text-xs font-light text-fg">Episode #{{ episodeNumber }}</div>
|
||||||
<div v-if="season" class="px-2 pt-px pb-0.5 mx-0.5 bg-primary bg-opacity-50 rounded-full text-xs font-light text-fg">Season #{{ season }}</div>
|
<div v-if="season" class="px-2 pt-px pb-0.5 mx-0.5 bg-primary bg-opacity-50 rounded-full text-xs font-light text-fg">Season #{{ season }}</div>
|
||||||
@@ -72,7 +77,8 @@ export default {
|
|||||||
type: Object,
|
type: Object,
|
||||||
default: () => {}
|
default: () => {}
|
||||||
},
|
},
|
||||||
isLocal: Boolean
|
isLocal: Boolean,
|
||||||
|
sortKey: String
|
||||||
},
|
},
|
||||||
mixins: [cellularPermissionHelpers],
|
mixins: [cellularPermissionHelpers],
|
||||||
data() {
|
data() {
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<template v-for="episode in episodesSorted">
|
<template v-for="episode in episodesSorted">
|
||||||
<tables-podcast-episode-row :episode="episode" :local-episode="localEpisodeMap[episode.id]" :library-item-id="libraryItemId" :local-library-item-id="localLibraryItemId" :is-local="isLocal" :key="episode.id" @addToPlaylist="addEpisodeToPlaylist" />
|
<tables-podcast-episode-row :episode="episode" :local-episode="localEpisodeMap[episode.id]" :library-item-id="libraryItemId" :local-library-item-id="localLibraryItemId" :is-local="isLocal" :sort-key="sortKey" :key="episode.id" @addToPlaylist="addEpisodeToPlaylist" />
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<!-- Huhhh?
|
<!-- Huhhh?
|
||||||
@@ -133,6 +133,10 @@ export default {
|
|||||||
{
|
{
|
||||||
text: this.$strings.LabelEpisode,
|
text: this.$strings.LabelEpisode,
|
||||||
value: 'episode'
|
value: 'episode'
|
||||||
|
},
|
||||||
|
{
|
||||||
|
text: this.$strings.LabelFilename,
|
||||||
|
value: 'audioFile.metadata.filename'
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
@@ -181,8 +185,17 @@ export default {
|
|||||||
},
|
},
|
||||||
episodesSorted() {
|
episodesSorted() {
|
||||||
return this.episodesFiltered.sort((a, b) => {
|
return this.episodesFiltered.sort((a, b) => {
|
||||||
let aValue = a[this.sortKey]
|
let aValue
|
||||||
let bValue = b[this.sortKey]
|
let bValue
|
||||||
|
|
||||||
|
if (this.sortKey.includes('.')) {
|
||||||
|
const getNestedValue = (ob, s) => s.split('.').reduce((o, k) => o?.[k], ob)
|
||||||
|
aValue = getNestedValue(a, this.sortKey)
|
||||||
|
bValue = getNestedValue(b, this.sortKey)
|
||||||
|
} else {
|
||||||
|
aValue = a[this.sortKey]
|
||||||
|
bValue = b[this.sortKey]
|
||||||
|
}
|
||||||
|
|
||||||
// Sort episodes with no pub date as the oldest
|
// Sort episodes with no pub date as the oldest
|
||||||
if (this.sortKey === 'publishedAt') {
|
if (this.sortKey === 'publishedAt') {
|
||||||
|
|||||||
Reference in New Issue
Block a user