diff --git a/appinfo/routes.php b/appinfo/routes.php index 34ef9b2..a7fd5fc 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -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'], ], ]; diff --git a/l10n/fr.js b/l10n/fr.js index 5a84812..4271eaf 100644 --- a/l10n/fr.js +++ b/l10n/fr.js @@ -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", diff --git a/l10n/fr.json b/l10n/fr.json index 8274593..24ed3ad 100644 --- a/l10n/fr.json +++ b/l10n/fr.json @@ -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", diff --git a/lib/Controller/ToplistController.php b/lib/Controller/ToplistController.php index 325abe8..161cb6b 100644 --- a/lib/Controller/ToplistController.php +++ b/lib/Controller/ToplistController.php @@ -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()); + } } diff --git a/lib/Service/FyydService.php b/lib/Service/FyydService.php index 97857ba..0a2c1e1 100644 --- a/lib/Service/FyydService.php +++ b/lib/Service/FyydService.php @@ -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, ], ]); diff --git a/src/components/Discover/AddRss.vue b/src/components/Discover/AddRss.vue index 8de881f..8bacc45 100644 --- a/src/components/Discover/AddRss.vue +++ b/src/components/Discover/AddRss.vue @@ -1,5 +1,5 @@