diff options
| author | Quentin Aristote <quentin@aristote.fr> | 2022-11-27 16:28:24 +0100 |
|---|---|---|
| committer | Quentin Aristote <quentin@aristote.fr> | 2022-11-27 16:28:24 +0100 |
| commit | efa28a3baa12cac85f4cfc8665f1cf8762b9d7ee (patch) | |
| tree | 58859c63c8f8006039cedae681752a94a4e46f64 /config/services | |
| parent | 0c0affb59873dd265719a7293dfde6f76495c612 (diff) | |
services: web: rss: add fip bridge
Diffstat (limited to 'config/services')
| -rw-r--r-- | config/services/web/rss/FipAlbumsBridge.php | 41 | ||||
| -rw-r--r-- | config/services/web/rss/default.nix | 5 |
2 files changed, 44 insertions, 2 deletions
diff --git a/config/services/web/rss/FipAlbumsBridge.php b/config/services/web/rss/FipAlbumsBridge.php new file mode 100644 index 0000000..dfc3930 --- /dev/null +++ b/config/services/web/rss/FipAlbumsBridge.php @@ -0,0 +1,41 @@ +<?php + +class FipAlbumsBridge extends XPathAbstract { + const NAME = 'Fip Albums Bridge'; + const URI = 'https://www.radiofrance.fr/fip/albums/'; + const DESCRIPTION = 'Albums promoted by Fip.'; + const MAINTAINER = 'Quentin Aristote'; + const CACHE_TIMEOUT = 86400; // 6h + + const PARAMETERS = [ + '' => [ + 'category' => [ + 'name' => 'Category', + 'type' => 'text', + 'description' => 'See examples for available options.', + 'exampleValue' => 'can be empty, "selections" or "album-jazz-de-la-semaine"' + ] + ] + ]; + + const XPATH_EXPRESSION_ITEM = '//div[@class="Card Basic list squaredVisual"]'; + const XPATH_EXPRESSION_ITEM_TITLE = './/a/@title'; + const XPATH_EXPRESSION_ITEM_CONTENT = './div[1]'; + const XPATH_EXPRESSION_ITEM_URI = './/a/@href'; + const XPATH_EXPRESSION_ITEM_AUTHOR = './/div[@class="CardDetails fullWidth"]/div[2]'; + const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/time/@datetime'; + const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img/@src'; + const XPATH_EXPRESSION_ITEM_CATEGORIES = './/div[@class="CardDetails fullWidth"]/div[3]'; + + public function getSourceUrl() { + return self::URI . $this->getInput('category'); + } + + public function getIcon() { + return 'https://www.radiofrance.fr/dist/favicons/fip/favicon.png'; + } + + protected function formatItemTimestamp($value) { + return strtotime('today +' . $value); + } +} diff --git a/config/services/web/rss/default.nix b/config/services/web/rss/default.nix index 2c5d515..18a6763 100644 --- a/config/services/web/rss/default.nix +++ b/config/services/web/rss/default.nix @@ -2,13 +2,14 @@ let cfg = config.services.rss-bridge; - debug = false; + debug = true; rss-bridge = pkgs.rss-bridge.overrideAttrs (oldAttrs: oldAttrs // { installPhase = oldAttrs.installPhase + '' pushd $out/bridges ln -sf ${./ParisJazzClubBridge.php} ParisJazzClubBridge.php ln -sf ${./MaisonDeLaRadioBridge.php} MaisonDeLaRadioBridge.php + ln -sf ${./FipAlbumsBridge.php} FipAlbumsBridge.php ln -sf ${./WhatsOnMubiBridge.php} WhatsOnMubiBridge.php popd '' + lib.optionalString debug '' @@ -18,7 +19,7 @@ let in { services.rss-bridge = { enable = true; - whitelist = [ "ParisJazzClub" "MaisonDeLaRadio" "WhatsOnMubi" ]; + whitelist = [ "ParisJazzClub" "MaisonDeLaRadio" "FipAlbumsBridge" "WhatsOnMubi" ]; virtualHost = "rss"; }; |
