feat: filtering options for each podcast section (close #50)
All checks were successful
repod / xml (push) Successful in 32s
repod / php (push) Successful in 1m7s
repod / nodejs (push) Successful in 2m36s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-01-29 23:33:05 +01:00
parent 99fa123640
commit ac4161a18a
10 changed files with 184 additions and 48 deletions

View File

@ -19,12 +19,17 @@ OC.L10N.register(
"Play" : "Lecture", "Play" : "Lecture",
"Stop" : "Arrêter", "Stop" : "Arrêter",
"Could not fetch episodes" : "Impossible de récuprer les épisodes", "Could not fetch episodes" : "Impossible de récuprer les épisodes",
"Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", "Export subscriptions" : "Exporter les abonnements",
"Error while removing the feed" : "Erreur lors de la suppression du flux", "Filtering episodes" : "Filtrage des épisodes",
"Playback speed" : "Vitesse de lecture", "Show all" : "Montrer tout",
"Listened" : "Écoutés",
"Listening" : "En cours",
"Unlistened" : "Non lus",
"Import subscriptions" : "Importer les abonnements", "Import subscriptions" : "Importer les abonnements",
"Import OPML file" : "Importer un fichier OPML", "Import OPML file" : "Importer un fichier OPML",
"Export subscriptions" : "Exporter les abonnements", "Playback speed" : "Vitesse de lecture",
"Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?",
"Error while removing the feed" : "Erreur lors de la suppression du flux",
"Add a podcast" : "Ajouter un podcast", "Add a podcast" : "Ajouter un podcast",
"Could not fetch subscriptions" : "Impossible de récupérer les flux", "Could not fetch subscriptions" : "Impossible de récupérer les flux",
"Find a podcast" : "Chercher un podcast", "Find a podcast" : "Chercher un podcast",

View File

@ -17,12 +17,17 @@
"Play" : "Lecture", "Play" : "Lecture",
"Stop" : "Arrêter", "Stop" : "Arrêter",
"Could not fetch episodes" : "Impossible de récuprer les épisodes", "Could not fetch episodes" : "Impossible de récuprer les épisodes",
"Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", "Export subscriptions" : "Exporter les abonnements",
"Error while removing the feed" : "Erreur lors de la suppression du flux", "Filtering episodes" : "Filtrage des épisodes",
"Playback speed" : "Vitesse de lecture", "Show all" : "Montrer tout",
"Listened" : "Écoutés",
"Listening" : "En cours",
"Unlistened" : "Non lus",
"Import subscriptions" : "Importer les abonnements", "Import subscriptions" : "Importer les abonnements",
"Import OPML file" : "Importer un fichier OPML", "Import OPML file" : "Importer un fichier OPML",
"Export subscriptions" : "Exporter les abonnements", "Playback speed" : "Vitesse de lecture",
"Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?",
"Error while removing the feed" : "Erreur lors de la suppression du flux",
"Add a podcast" : "Ajouter un podcast", "Add a podcast" : "Ajouter un podcast",
"Could not fetch subscriptions" : "Impossible de récupérer les flux", "Could not fetch subscriptions" : "Impossible de récupérer les flux",
"Find a podcast" : "Chercher un podcast", "Find a podcast" : "Chercher un podcast",

View File

@ -2,7 +2,7 @@
<div> <div>
<Loading v-if="loading" /> <Loading v-if="loading" />
<ul v-if="!loading"> <ul v-if="!loading">
<NcListItem v-for="episode in episodes" <NcListItem v-for="episode in filteredEpisodes"
:key="episode.guid" :key="episode.guid"
:active="isCurrentEpisode(episode)" :active="isCurrentEpisode(episode)"
:class="hasEnded(episode) ? 'ended': ''" :class="hasEnded(episode) ? 'ended': ''"
@ -20,7 +20,7 @@
{{ episode.duration }} {{ episode.duration }}
</template> </template>
<template #indicator> <template #indicator>
<NcProgressBar v-if="episode.action && episode.action.action === 'PLAY'" <NcProgressBar v-if="isListening(episode)"
class="progress" class="progress"
:value="episode.action.position * 100 / episode.action.total" /> :value="episode.action.position * 100 / episode.action.total" />
</template> </template>
@ -88,6 +88,26 @@ export default {
currentEpisode() { currentEpisode() {
return this.$store.state.player.episode return this.$store.state.player.episode
}, },
filters() {
return this.$store.state.settings.filters
},
filteredEpisodes() {
return this.episodes.filter((episode) => {
if (!this.filters.listened && this.hasEnded(episode)) {
return false
}
if (!this.filters.listening && this.isListening(episode)) {
return false
}
if (!this.filters.unlistened && !this.hasEnded(episode) && !this.isListening(episode)) {
return false
}
return true
})
},
url() { url() {
return decodeUrl(this.$route.params.url) return decodeUrl(this.$route.params.url)
}, },
@ -116,6 +136,9 @@ export default {
isCurrentEpisode(episode) { isCurrentEpisode(episode) {
return this.currentEpisode && this.currentEpisode.url === episode.url return this.currentEpisode && this.currentEpisode.url === episode.url
}, },
isListening(episode) {
return episode.action && episode.action.action === 'PLAY' && !this.hasEnded(episode)
},
load(episode) { load(episode) {
this.$store.dispatch('player/load', episode) this.$store.dispatch('player/load', episode)
}, },

View File

@ -15,7 +15,7 @@
<VolumeMute v-if="player.volume === 0" <VolumeMute v-if="player.volume === 0"
class="pointer" class="pointer"
:size="30" :size="30"
@click="unmute" /> @click="$store.dispatch('player/volume', volumeMuted)" />
<input max="1" <input max="1"
min="0" min="0"
step="0.1" step="0.1"
@ -54,9 +54,6 @@ export default {
this.volumeMuted = this.player.volume this.volumeMuted = this.player.volume
this.$store.dispatch('player/volume', 0) this.$store.dispatch('player/volume', 0)
}, },
unmute() {
this.$store.dispatch('player/volume', this.volumeMuted)
},
}, },
} }
</script> </script>

View File

@ -0,0 +1,51 @@
<template>
<NcAppNavigationItem :allow-collapse="true" :name="t('repod', 'Filtering episodes')">
<template #icon>
<FilterIcon v-if="all" :size="20" />
<FilterSettings v-if="!all" :size="20" />
</template>
<template #actions>
<NcActionCheckbox :checked="all"
:disabled="all"
@update:checked="(checked) => $store.commit('settings/filters', { listened: checked, listening: checked, unlistened: checked })">
{{ t('repod', 'Show all') }}
</NcActionCheckbox>
<NcActionCheckbox :checked="filters.listened"
@update:checked="(checked) => $store.commit('settings/filters', { listened: checked })">
{{ t('repod', 'Listened') }}
</NcActionCheckbox>
<NcActionCheckbox :checked="filters.listening"
@update:checked="(checked) => $store.commit('settings/filters', { listening: checked })">
{{ t('repod', 'Listening') }}
</NcActionCheckbox>
<NcActionCheckbox :checked="filters.unlistened"
@update:checked="(checked) => $store.commit('settings/filters', { unlistened: checked })">
{{ t('repod', 'Unlistened') }}
</NcActionCheckbox>
</template>
</NcAppNavigationItem>
</template>
<script>
import { NcActionCheckbox, NcAppNavigationItem } from '@nextcloud/vue'
import FilterIcon from 'vue-material-design-icons/Filter.vue'
import FilterSettings from 'vue-material-design-icons/FilterSettings.vue'
export default {
name: 'Filters',
components: {
FilterIcon,
FilterSettings,
NcAppNavigationItem,
NcActionCheckbox,
},
computed: {
all() {
return this.filters.listened && this.filters.listening && this.filters.unlistened
},
filters() {
return this.$store.state.settings.filters
},
},
}
</script>

View File

@ -19,6 +19,7 @@
</template> </template>
<template #footer> <template #footer>
<NcAppNavigationSettings> <NcAppNavigationSettings>
<Filters />
<Speed /> <Speed />
<Import /> <Import />
<Export /> <Export />
@ -31,6 +32,7 @@
import { NcAppContentList, NcAppNavigationNew, NcAppNavigationSettings } from '@nextcloud/vue' import { NcAppContentList, NcAppNavigationNew, NcAppNavigationSettings } from '@nextcloud/vue'
import AppNavigation from '../Atoms/AppNavigation.vue' import AppNavigation from '../Atoms/AppNavigation.vue'
import Export from '../Settings/Export.vue' import Export from '../Settings/Export.vue'
import Filters from '../Settings/Filters.vue'
import Import from '../Settings/Import.vue' import Import from '../Settings/Import.vue'
import Item from './Item.vue' import Item from './Item.vue'
import Loading from '../Atoms/Loading.vue' import Loading from '../Atoms/Loading.vue'
@ -43,6 +45,7 @@ export default {
components: { components: {
AppNavigation, AppNavigation,
Export, Export,
Filters,
Import, Import,
Item, Item,
Loading, Loading,

View File

@ -1,6 +1,7 @@
import Vuex, { Store } from 'vuex' import Vuex, { Store } from 'vuex'
import Vue from 'vue' import Vue from 'vue'
import { player } from './player.js' import { player } from './player.js'
import { settings } from './settings.js'
import { subscriptions } from './subscriptions.js' import { subscriptions } from './subscriptions.js'
Vue.use(Vuex) Vue.use(Vuex)
@ -8,6 +9,7 @@ Vue.use(Vuex)
const store = new Store({ const store = new Store({
modules: { modules: {
player, player,
settings,
subscriptions, subscriptions,
}, },
}) })

15
src/store/settings.js Normal file
View File

@ -0,0 +1,15 @@
export const settings = {
namespaced: true,
state: {
filters: {
listened: true,
listening: true,
unlistened: true,
},
},
mutations: {
filters: (state, filters) => {
state.filters = { ...state.filters, ...filters }
},
},
}

View File

@ -86,14 +86,23 @@ msgstr "Arrêter"
msgid "Could not fetch episodes" msgid "Could not fetch episodes"
msgstr "Impossible de récuprer les épisodes" msgstr "Impossible de récuprer les épisodes"
msgid "Are you sure you want to delete this subscription?" msgid "Export subscriptions"
msgstr "Êtes-vous sûr de vouloir supprimer ce flux ?" msgstr "Exporter les abonnements"
msgid "Error while removing the feed" msgid "Filtering episodes"
msgstr "Erreur lors de la suppression du flux" msgstr "Filtrage des épisodes"
msgid "Playback speed" msgid "Show all"
msgstr "Vitesse de lecture" msgstr "Montrer tout"
msgid "Listened"
msgstr "Écoutés"
msgid "Listening"
msgstr "En cours"
msgid "Unlistened"
msgstr "Non lus"
msgid "Import subscriptions" msgid "Import subscriptions"
msgstr "Importer les abonnements" msgstr "Importer les abonnements"
@ -101,8 +110,14 @@ msgstr "Importer les abonnements"
msgid "Import OPML file" msgid "Import OPML file"
msgstr "Importer un fichier OPML" msgstr "Importer un fichier OPML"
msgid "Export subscriptions" msgid "Playback speed"
msgstr "Exporter les abonnements" msgstr "Vitesse de lecture"
msgid "Are you sure you want to delete this subscription?"
msgstr "Êtes-vous sûr de vouloir supprimer ce flux ?"
msgid "Error while removing the feed"
msgstr "Erreur lors de la suppression du flux"
msgid "Add a podcast" msgid "Add a podcast"
msgstr "Ajouter un podcast" msgstr "Ajouter un podcast"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: Nextcloud 3.14159\n" "Project-Id-Version: Nextcloud 3.14159\n"
"Report-Msgid-Bugs-To: translations\\@example.com\n" "Report-Msgid-Bugs-To: translations\\@example.com\n"
"POT-Creation-Date: 2024-01-21 11:14+0000\n" "POT-Creation-Date: 2024-01-29 22:30+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -100,49 +100,69 @@ msgid "Could not fetch episodes"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:14 #: /app/specialVueFakeDummyForL10nScript.js:14
msgid "Are you sure you want to delete this subscription?"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:15
msgid "Error while removing the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:16
msgid "Playback speed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:17
msgid "Import subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:18
msgid "Import OPML file"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:19
msgid "Export subscriptions" msgid "Export subscriptions"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:15
msgid "Filtering episodes"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:16
msgid "Show all"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:17
msgid "Listened"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:18
msgid "Listening"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:19
msgid "Unlistened"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:20 #: /app/specialVueFakeDummyForL10nScript.js:20
msgid "Add a podcast" msgid "Import subscriptions"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:21 #: /app/specialVueFakeDummyForL10nScript.js:21
msgid "Could not fetch subscriptions" msgid "Import OPML file"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:22 #: /app/specialVueFakeDummyForL10nScript.js:22
msgid "Find a podcast" msgid "Playback speed"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:23 #: /app/specialVueFakeDummyForL10nScript.js:23
msgid "Error loading feed" msgid "Are you sure you want to delete this subscription?"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:24 #: /app/specialVueFakeDummyForL10nScript.js:24
msgid "Missing required app" msgid "Error while removing the feed"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:25 #: /app/specialVueFakeDummyForL10nScript.js:25
msgid "Add a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:26
msgid "Could not fetch subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:27
msgid "Find a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:28
msgid "Error loading feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:29
msgid "Missing required app"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:30
msgid "Install GPodder Sync" msgid "Install GPodder Sync"
msgstr "" msgstr ""