feat: rework Discover
All checks were successful
repod / xml (push) Successful in 20s
repod / php (push) Successful in 58s
repod / nodejs (push) Successful in 2m1s

This commit is contained in:
Michel Roux 2024-01-10 17:50:06 +01:00
parent 11865916a7
commit 70f1d3b69f
10 changed files with 174 additions and 70 deletions

View File

@ -17,6 +17,7 @@ return [
['name' => 'episodes#list', 'url' => '/episodes/list', 'verb' => 'GET'],
['name' => 'podcast#index', 'url' => '/podcast', 'verb' => 'GET'],
['name' => 'search#index', 'url' => '/search', 'verb' => 'GET'],
['name' => 'toplist#index', 'url' => '/toplist', 'verb' => 'GET'],
['name' => 'toplist#hot', 'url' => '/toplist/hot', 'verb' => 'GET'],
['name' => 'toplist#new', 'url' => '/toplist/new', 'verb' => 'GET'],
],
];

View File

@ -1,9 +1,13 @@
OC.L10N.register(
"repod",
{
"RePod" : "RePod",
"🔊 Browse, manage and listen to podcasts" : "🔊 Parcourir, gérer et écouter vos podcasts",
"# Features\n- 🔍 Browse and subscribe huge collection of podcasts\n- 🔊 Listen to episodes directly in Nextcloud\n- 🌐 Sync your activity with [AntennaPod](https://antennapod.org/)\n\n# Requirements\nYou need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!" : "# Fonctionnalités\n- 🔍 Parcourir et s'abonner à une grande collections de podcasts\n- 🔊 Écouter vos épisodes directement sur Nextcloud\n- 🌐 Synchroniser son activité avec [AntennaPod](https://antennapod.org/)\n\n# Pré-requis\nVous devez avoir [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installé pour utiliser cette application !",
"Add a RSS link" : "Ajouter un lien RSS",
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
"Suggests by fyyd" : "Suggestions via fyyd",
"Hot podcasts" : "Tendances",
"New podcasts" : "Nouveautés",
"Could not fetch tops" : "Impossible de récupérer les tops",
"Subscribe" : "S'abonner",
"Error while adding the feed" : "Erreur lors de l'ajout du flux",
@ -12,6 +16,7 @@ OC.L10N.register(
"Could not fetch episodes" : "Impossible de récuprer les épisodes",
"Download" : "Télécharger",
"Delete" : "Supprimer",
"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",
"Could not fetch subscriptions" : "Impossible de récupérer les flux",

View File

@ -1,7 +1,11 @@
{ "translations": {
"RePod" : "RePod",
"🔊 Browse, manage and listen to podcasts" : "🔊 Parcourir, gérer et écouter vos podcasts",
"# Features\n- 🔍 Browse and subscribe huge collection of podcasts\n- 🔊 Listen to episodes directly in Nextcloud\n- 🌐 Sync your activity with [AntennaPod](https://antennapod.org/)\n\n# Requirements\nYou need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installed to use this app!" : "# Fonctionnalités\n- 🔍 Parcourir et s'abonner à une grande collections de podcasts\n- 🔊 Écouter vos épisodes directement sur Nextcloud\n- 🌐 Synchroniser son activité avec [AntennaPod](https://antennapod.org/)\n\n# Pré-requis\nVous devez avoir [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) installé pour utiliser cette application !",
"Add a RSS link" : "Ajouter un lien RSS",
"Could not fetch search results" : "Impossible de récupérer les resultats de la recherche",
"Suggests by fyyd" : "Suggestions via fyyd",
"Hot podcasts" : "Tendances",
"New podcasts" : "Nouveautés",
"Could not fetch tops" : "Impossible de récupérer les tops",
"Subscribe" : "S'abonner",
"Error while adding the feed" : "Erreur lors de l'ajout du flux",
@ -10,6 +14,7 @@
"Could not fetch episodes" : "Impossible de récuprer les épisodes",
"Download" : "Télécharger",
"Delete" : "Supprimer",
"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",
"Could not fetch subscriptions" : "Impossible de récupérer les flux",

View File

@ -23,7 +23,15 @@ class ToplistController extends Controller
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index(): JSONResponse {
public function hot(): JSONResponse {
return new JSONResponse($this->fyydService->hot());
}
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function new(): JSONResponse {
return new JSONResponse($this->fyydService->latest());
}
}

View File

@ -55,7 +55,33 @@ class FyydService implements IProvider
/**
* @return PodcastData[]
*/
public function hot(int $count = 10): array {
public function latest(): array {
$podcasts = [];
$podcastClient = $this->clientService->newClient();
$podcastResponse = $podcastClient->get(self::BASE_URL.'podcast/latest');
$podcastJson = (array) json_decode((string) $podcastResponse->getBody(), true, flags: JSON_THROW_ON_ERROR);
if (array_key_exists('data', $podcastJson) && is_array($podcastJson['data'])) {
/** @var string[] $feed */
foreach ($podcastJson['data'] as $feed) {
$podcasts[] = new PodcastData(
$feed['title'],
$feed['author'],
$feed['xmlURL'],
$feed['description'],
$feed['imgURL'],
strtotime($feed['lastpub'])
);
}
}
return $podcasts;
}
/**
* @return PodcastData[]
*/
public function hot(): array {
$podcasts = [];
$language = 'en';
$userLang = $this->userService->getLangCode();
@ -75,7 +101,6 @@ class FyydService implements IProvider
$podcastResponse = $podcastClient->get(self::BASE_URL.'feature/podcast/hot', [
'query' => [
'count' => $count,
'language' => $language,
],
]);

View File

@ -1,5 +1,5 @@
<template>
<ul>
<ul class="bar">
<NcAppNavigationNewItem :name="t('repod', 'Add a RSS link')"
@new-item="addSubscription">
<template #icon>
@ -26,3 +26,9 @@ export default {
},
}
</script>
<style scoped>
.bar {
margin-top: 1rem;
}
</style>

View File

@ -1,17 +1,29 @@
<template>
<div>
<Loading v-if="loading" />
<ul v-if="!loading" class="tops">
<li v-for="top in tops" :key="top.link">
<div>
<h2>{{ t('repod', 'Hot podcasts') }}</h2>
<Loading v-if="tops.hot.loading" />
<ul v-if="!tops.hot.loading">
<li v-for="top in tops.hot.items" :key="top.link">
<TopItem :author="top.author"
:image-url="top.imageUrl"
:link="top.link"
:title="top.title" />
</li>
</ul>
<p v-if="!loading" class="caption">
{{ t('repod', 'Suggests by fyyd') }}
</p>
</div>
<div>
<h2>{{ t('repod', 'New podcasts') }}</h2>
<Loading v-if="tops.new.loading" />
<ul v-if="!tops.new.loading">
<li v-for="top in tops.new.items" :key="top.link">
<TopItem :author="top.author"
:image-url="top.imageUrl"
:link="top.link"
:title="top.title" />
</li>
</ul>
</div>
</div>
</template>
@ -30,44 +42,54 @@ export default {
},
data() {
return {
tops: [],
tops: {
hot: {
items: [],
loading: true,
},
new: {
items: [],
loading: true,
},
},
}
},
async mounted() {
this.loadList('hot')
this.loadList('new')
},
methods: {
async loadList(type) {
try {
this.loading = true
const toplist = await axios.get(generateUrl('/apps/repod/toplist'))
this.tops = toplist.data
this.tops[type].loading = true
const toplist = await axios.get(generateUrl(`/apps/repod/toplist/${type}`))
this.tops[type].items = toplist.data
} catch (e) {
console.error(e)
showError(t('repod', 'Could not fetch tops'))
} finally {
this.loading = false
this.tops[type].loading = false
}
},
},
}
</script>
<style scoped>
div {
margin: 2rem 0;
h2 {
margin: 1rem 0;
}
li {
flex-basis: 15%;
}
p {
font-size: small;
margin: .5rem;
text-align: right;
flex-basis: 35%;
flex-shrink: 0;
}
ul {
display: flex;
flex-wrap: wrap;
gap: 2rem 5%;
justify-content: center;
gap: 2rem;
overflow-x: auto;
overflow-y: hidden;
padding: .5rem;
}
</style>

View File

@ -1,7 +1,6 @@
<template>
<NcAppContent class="main">
<NcTextField class="search"
:label="t('repod', 'Find a podcast')"
<NcTextField :label="t('repod', 'Find a podcast')"
:value.sync="search">
<Magnify :size="20" />
</NcTextField>
@ -39,10 +38,5 @@ export default {
<style scoped>
.main {
padding: 15px 51px;
overflow: hidden;
}
.search {
margin-bottom: 1rem;
}
</style>

View File

@ -8,23 +8,50 @@ msgid ""
msgstr ""
"Project-Id-Version: Nextcloud 3.14159\n"
"Report-Msgid-Bugs-To: translations\\@example.com\n"
"POT-Creation-Date: 2024-01-10 08:48+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
msgid "RePod"
msgstr "RePod"
msgid "🔊 Browse, manage and listen to podcasts"
msgstr "🔊 Parcourir, gérer et écouter vos podcasts"
msgid ""
"# Features\n"
"- 🔍 Browse and subscribe huge collection of podcasts\n"
"- 🔊 Listen to episodes directly in Nextcloud\n"
"- 🌐 Sync your activity with [AntennaPod](https://antennapod.org/)\n"
"\n"
"# Requirements\n"
"You need to have [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) "
"installed to use this app!"
msgstr ""
"# Fonctionnalités\n"
"- 🔍 Parcourir et s'abonner à une grande collections de podcasts\n"
"- 🔊 Écouter vos épisodes directement sur Nextcloud\n"
"- 🌐 Synchroniser son activité avec [AntennaPod](https://antennapod.org/)\n"
"\n"
"# Pré-requis\n"
"Vous devez avoir [GPodderSync](https://apps.nextcloud.com/apps/gpoddersync) "
"installé pour utiliser cette application !"
msgid "Add a RSS link"
msgstr "Ajouter un lien RSS"
msgid "Could not fetch search results"
msgstr "Impossible de récupérer les resultats de la recherche"
msgid "Suggests by fyyd"
msgstr "Suggestions via fyyd"
msgid "Hot podcasts"
msgstr "Tendances"
msgid "New podcasts"
msgstr "Nouveautés"
msgid "Could not fetch tops"
msgstr "Impossible de récupérer les tops"
@ -50,6 +77,9 @@ msgstr "Télécharger"
msgid "Delete"
msgstr "Supprimer"
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"

View File

@ -8,7 +8,7 @@ msgid ""
msgstr ""
"Project-Id-Version: Nextcloud 3.14159\n"
"Report-Msgid-Bugs-To: translations\\@example.com\n"
"POT-Creation-Date: 2024-01-10 14:22+0000\n"
"POT-Creation-Date: 2024-01-10 16:47+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@ -46,65 +46,73 @@ msgid "Could not fetch search results"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:3
msgid "Suggests by fyyd"
msgid "Hot podcasts"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:4
msgid "Could not fetch tops"
msgid "New podcasts"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:5
msgid "Subscribe"
msgid "Could not fetch tops"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:6
msgid "Error while adding the feed"
msgid "Subscribe"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:7
msgid "Play"
msgid "Error while adding the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:8
msgid "Stop"
msgid "Play"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:9
msgid "Could not fetch episodes"
msgid "Stop"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:10
msgid "Download"
msgid "Could not fetch episodes"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:11
msgid "Delete"
msgid "Download"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:12
msgid "Error while removing the feed"
msgid "Delete"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:13
msgid "Add a podcast"
msgid "Are you sure you want to delete this subscription?"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:14
msgid "Could not fetch subscriptions"
msgid "Error while removing the feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:15
msgid "Find a podcast"
msgid "Add a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:16
msgid "Error loading feed"
msgid "Could not fetch subscriptions"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:17
msgid "Missing required app"
msgid "Find a podcast"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:18
msgid "Error loading feed"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:19
msgid "Missing required app"
msgstr ""
#: /app/specialVueFakeDummyForL10nScript.js:20
msgid "Install GPodder Sync"
msgstr ""