feat: Sleep timer (fix #119)
All checks were successful
repod / xml (push) Successful in 1m25s
repod / php (push) Successful in 1m0s
repod / nodejs (push) Successful in 1m16s
repod / release (push) Has been skipped

This commit is contained in:
Michel Roux 2024-11-09 19:42:17 +01:00
parent 8cb58fe388
commit e9166ff307
11 changed files with 198 additions and 26 deletions

View File

@ -36,6 +36,10 @@ OC.L10N.register(
"Import subscriptions" : "Importiere Abonnements", "Import subscriptions" : "Importiere Abonnements",
"Import OPML file" : "Importiere OPML-Datei", "Import OPML file" : "Importiere OPML-Datei",
"Rate RePod ❤️" : "Bewerte RePod ❤️", "Rate RePod ❤️" : "Bewerte RePod ❤️",
"Sleep timer" : "Einschlaftimer",
"Minutes" : "Minuten",
"_%n min_::_%n mins_" : ["%n min","%n mins"],
"_%n sec_::_%n secs_" : ["%s sec","%n secs"],
"Playback speed" : "Wiedergabegeschwindigkeit", "Playback speed" : "Wiedergabegeschwindigkeit",
"Favorite" : "Favorit", "Favorite" : "Favorit",
"Are you sure you want to delete this subscription?" : "Bist Du sicher, dass Du das Abonnement löschen möchtest?", "Are you sure you want to delete this subscription?" : "Bist Du sicher, dass Du das Abonnement löschen möchtest?",

View File

@ -34,6 +34,10 @@
"Import subscriptions" : "Importiere Abonnements", "Import subscriptions" : "Importiere Abonnements",
"Import OPML file" : "Importiere OPML-Datei", "Import OPML file" : "Importiere OPML-Datei",
"Rate RePod ❤️" : "Bewerte RePod ❤️", "Rate RePod ❤️" : "Bewerte RePod ❤️",
"Sleep timer" : "Einschlaftimer",
"Minutes" : "Minuten",
"_%n min_::_%n mins_" : ["%n min","%n mins"],
"_%n sec_::_%n secs_" : ["%s sec","%n secs"],
"Playback speed" : "Wiedergabegeschwindigkeit", "Playback speed" : "Wiedergabegeschwindigkeit",
"Favorite" : "Favorit", "Favorite" : "Favorit",
"Are you sure you want to delete this subscription?" : "Bist Du sicher, dass Du das Abonnement löschen möchtest?", "Are you sure you want to delete this subscription?" : "Bist Du sicher, dass Du das Abonnement löschen möchtest?",

View File

@ -36,6 +36,10 @@ OC.L10N.register(
"Import subscriptions" : "Importer les abonnements", "Import subscriptions" : "Importer les abonnements",
"Import OPML file" : "Importer un fichier OPML", "Import OPML file" : "Importer un fichier OPML",
"Rate RePod ❤️" : "Donnez votre avis ❤️", "Rate RePod ❤️" : "Donnez votre avis ❤️",
"Sleep timer" : "Minuteur",
"Minutes" : "Minutes",
"_%n min_::_%n mins_" : ["%n min","%n mins"],
"_%n sec_::_%n secs_" : ["%s sec","%n secs"],
"Playback speed" : "Vitesse de lecture", "Playback speed" : "Vitesse de lecture",
"Favorite" : "Favori", "Favorite" : "Favori",
"Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", "Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?",

View File

@ -34,6 +34,10 @@
"Import subscriptions" : "Importer les abonnements", "Import subscriptions" : "Importer les abonnements",
"Import OPML file" : "Importer un fichier OPML", "Import OPML file" : "Importer un fichier OPML",
"Rate RePod ❤️" : "Donnez votre avis ❤️", "Rate RePod ❤️" : "Donnez votre avis ❤️",
"Sleep timer" : "Minuteur",
"Minutes" : "Minutes",
"_%n min_::_%n mins_" : ["%n min","%n mins"],
"_%n sec_::_%n secs_" : ["%s sec","%n secs"],
"Playback speed" : "Vitesse de lecture", "Playback speed" : "Vitesse de lecture",
"Favorite" : "Favori", "Favorite" : "Favori",
"Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?", "Are you sure you want to delete this subscription?" : "Êtes-vous sûr de vouloir supprimer ce flux ?",

View File

@ -1,6 +1,5 @@
<template> <template>
<NcAppNavigationItem <NcAppNavigationItem
:allow-collapse="true"
menu-placement="top" menu-placement="top"
:name="t('repod', 'Filtering episodes')"> :name="t('repod', 'Filtering episodes')">
<template #actions> <template #actions>

View File

@ -1,6 +1,7 @@
<template> <template>
<NcAppNavigationSettings> <NcAppNavigationSettings>
<Filters /> <Filters />
<Sleep />
<Speed /> <Speed />
<Import /> <Import />
<Export /> <Export />
@ -14,6 +15,7 @@ import Filters from './Filters.vue'
import Import from './Import.vue' import Import from './Import.vue'
import { NcAppNavigationSettings } from '@nextcloud/vue' import { NcAppNavigationSettings } from '@nextcloud/vue'
import Rate from './Rate.vue' import Rate from './Rate.vue'
import Sleep from './Sleep.vue'
import Speed from './Speed.vue' import Speed from './Speed.vue'
export default { export default {
@ -24,6 +26,7 @@ export default {
Import, Import,
NcAppNavigationSettings, NcAppNavigationSettings,
Rate, Rate,
Sleep,
Speed, Speed,
}, },
} }

View File

@ -0,0 +1,103 @@
<template>
<NcAppNavigationItem menu-placement="top" :name="t('repod', 'Sleep timer')">
<template #actions>
<NcActionInput
v-if="!sleep"
v-model="input"
:label="t('repod', 'Minutes')"
:label-outside="false"
type="number"
@submit="setTimer">
<template #icon>
<ClockVue :size="20" />
</template>
</NcActionInput>
</template>
<template #extra>
<div v-if="sleep" class="extra">
{{ label }}
<BellCancel class="pointer" :size="20" @click="stopTimer" />
</div>
</template>
<template #icon>
<BellSleepIcon v-if="sleep" :size="20" />
<BellSleepOutlineIcon v-if="!sleep" :size="20" />
</template>
</NcAppNavigationItem>
</template>
<script lang="ts">
import { NcActionInput, NcAppNavigationItem } from '@nextcloud/vue'
import { n, t } from '@nextcloud/l10n'
import BellCancel from 'vue-material-design-icons/BellCancel.vue'
import BellSleepIcon from 'vue-material-design-icons/BellSleep.vue'
import BellSleepOutlineIcon from 'vue-material-design-icons/BellSleepOutline.vue'
import ClockVue from 'vue-material-design-icons/Clock.vue'
import { mapActions } from 'pinia'
import { usePlayer } from '../../store/player.ts'
export default {
name: 'Sleep',
components: {
BellCancel,
BellSleepIcon,
BellSleepOutlineIcon,
ClockVue,
NcActionInput,
NcAppNavigationItem,
},
data: () => ({
input: 10,
sleep: null as NodeJS.Timeout | null,
timer: 0,
}),
computed: {
label() {
if (this.timer > 60) {
return this.n(
'repod',
'%n min',
'%n mins',
Math.round(this.timer / 60),
)
} else {
return this.n('repod', '%n sec', '%n secs', this.timer)
}
},
},
methods: {
...mapActions(usePlayer, ['stop']),
n,
t,
setTimer() {
this.timer = this.input * 60
this.sleep = setInterval(() => {
if (this.timer > 0) {
this.timer--
} else if (this.sleep) {
this.stopTimer()
this.stop()
}
}, 1000)
},
stopTimer() {
if (this.sleep) {
clearTimeout(this.sleep)
this.sleep = null
}
},
},
}
</script>
<style scoped>
.extra {
align-items: center;
display: flex;
gap: 0.5rem;
}
.pointer {
cursor: pointer;
}
</style>

View File

@ -71,12 +71,10 @@ export default {
required: true, required: true,
}, },
}, },
data() { data: () => ({
return { failed: false,
failed: false, loading: true,
loading: true, }),
}
},
computed: { computed: {
...mapState(useSubscriptions, ['getSubByUrl', 'subs']), ...mapState(useSubscriptions, ['getSubByUrl', 'subs']),
feed() { feed() {

View File

@ -145,6 +145,22 @@ msgstr "Importiere OPML-Datei"
msgid "Rate RePod ❤️" msgid "Rate RePod ❤️"
msgstr "Bewerte RePod ❤️" msgstr "Bewerte RePod ❤️"
msgid "Sleep timer"
msgstr "Einschlaftimer"
msgid "Minutes"
msgstr "Minuten"
msgid "%n min"
msgid_plural "%n mins"
msgstr[0] "%n min"
msgstr[1] "%n mins"
msgid "%n sec"
msgid_plural "%n secs"
msgstr[0] "%s sec"
msgstr[1] "%n secs"
msgid "Playback speed" msgid "Playback speed"
msgstr "Wiedergabegeschwindigkeit" msgstr "Wiedergabegeschwindigkeit"

View File

@ -149,6 +149,22 @@ msgstr "Importer un fichier OPML"
msgid "Rate RePod ❤️" msgid "Rate RePod ❤️"
msgstr "Donnez votre avis ❤️" msgstr "Donnez votre avis ❤️"
msgid "Sleep timer"
msgstr "Minuteur"
msgid "Minutes"
msgstr "Minutes"
msgid "%n min"
msgid_plural "%n mins"
msgstr[0] "%n min"
msgstr[1] "%n mins"
msgid "%n sec"
msgid_plural "%n secs"
msgstr[0] "%s sec"
msgstr[1] "%n secs"
msgid "Playback speed" msgid "Playback speed"
msgstr "Vitesse de lecture" msgstr "Vitesse de lecture"

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-11-08 23:27+0000\n" "POT-Creation-Date: 2024-11-09 18:34+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"
@ -16,6 +16,7 @@ msgstr ""
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n" "Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n" "Content-Transfer-Encoding: 8bit\n"
"Plural-Forms: nplurals=INTEGER; plural=EXPRESSION;\n"
#: /app/lib/Controller/OpmlController.php:46 #: /app/lib/Controller/OpmlController.php:46
msgid "RePod Subscriptions" msgid "RePod Subscriptions"
@ -189,56 +190,76 @@ msgid "Rate RePod ❤️"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:46 #: /app/specialVueFakeDummyForL10nScript.js:46
msgid "Playback speed" msgid "Sleep timer"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:47 #: /app/specialVueFakeDummyForL10nScript.js:47
#: /app/specialVueFakeDummyForL10nScript.js:48 msgid "Minutes"
#: /app/specialVueFakeDummyForL10nScript.js:49
msgid "Favorite"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:48
msgid "%n min"
msgid_plural "%n mins"
msgstr[0] ""
msgstr[1] ""
#: /app/specialVueFakeDummyForL10nScript.js:49
msgid "%n sec"
msgid_plural "%n secs"
msgstr[0] ""
msgstr[1] ""
#: /app/specialVueFakeDummyForL10nScript.js:50 #: /app/specialVueFakeDummyForL10nScript.js:50
msgid "Are you sure you want to delete this subscription?" msgid "Playback speed"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:51 #: /app/specialVueFakeDummyForL10nScript.js:51
msgid "Error while removing the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:52 #: /app/specialVueFakeDummyForL10nScript.js:52
msgid "You can only have 10 favorites"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:53 #: /app/specialVueFakeDummyForL10nScript.js:53
msgid "Add a podcast" msgid "Favorite"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:54 #: /app/specialVueFakeDummyForL10nScript.js:54
msgid "Could not fetch subscriptions" msgid "Are you sure you want to delete this subscription?"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:55 #: /app/specialVueFakeDummyForL10nScript.js:55
msgid "Find a podcast" msgid "Error while removing the feed"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:56 #: /app/specialVueFakeDummyForL10nScript.js:56
msgid "Error loading feed" msgid "You can only have 10 favorites"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:57 #: /app/specialVueFakeDummyForL10nScript.js:57
msgid "Missing required app" msgid "Add a podcast"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:58 #: /app/specialVueFakeDummyForL10nScript.js:58
msgid "Install GPodder Sync" msgid "Could not fetch subscriptions"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:59 #: /app/specialVueFakeDummyForL10nScript.js:59
msgid "Pin some subscriptions to see their latest updates" msgid "Find a podcast"
msgstr "" msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:60 #: /app/specialVueFakeDummyForL10nScript.js:60
msgid "Error loading feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:61
msgid "Missing required app"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:62
msgid "Install GPodder Sync"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:63
msgid "Pin some subscriptions to see their latest updates"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:64
msgid "No favorites" msgid "No favorites"
msgstr "" msgstr ""