diff options
| author | quentin@aristote.fr <quentin@aristote.fr> | 2024-09-09 19:20:36 +0200 |
|---|---|---|
| committer | quentin@aristote.fr <quentin@aristote.fr> | 2024-09-09 19:20:36 +0200 |
| commit | ee27492a0c6ce33d8d28a2bc13ec090bd57ca153 (patch) | |
| tree | ff769d61f1ac476724fafdfd65314656a97ebce6 | |
| parent | 4440d096e573579cdd489cb0e76f9567ee6b22e6 (diff) | |
rss: remove deprecated bridges
| -rw-r--r-- | config/services/web/rss/ParisCineInfoBridge.php | 98 | ||||
| -rw-r--r-- | config/services/web/rss/ParisJazzClubBridge.php | 40 | ||||
| -rw-r--r-- | config/services/web/rss/default.nix | 13 |
3 files changed, 6 insertions, 145 deletions
diff --git a/config/services/web/rss/ParisCineInfoBridge.php b/config/services/web/rss/ParisCineInfoBridge.php deleted file mode 100644 index 5e418b4..0000000 --- a/config/services/web/rss/ParisCineInfoBridge.php +++ /dev/null @@ -1,98 +0,0 @@ -<?php - -class ParisCineInfoBridge extends BridgeAbstract { - const NAME = 'Paris-ciné.info Bridge'; - const URI = 'https://paris-cine.info/'; - const DESCRIPTION = 'Movies playing in Paris'; - const MAINTAINER = 'Quentin Aristote'; - const CACHE_TIMEOUT = 86400; // 24h - - const PARAMETERS = [ - 'Filters' => [ - // TODO add an option for choosing the reviewer - 'card' => [ - 'name' => 'Card', - 'type' => 'text', - 'title' => 'Fidelity / subscription card.', - 'exampleValue' => 'ugc', - 'defaultValue' => 'all' - ], - 'dayid' => [ - 'name' => 'Day of the week', - 'type' => 'text', - 'title' => 'Comma-separated list of integers (0 means everyday, 1 means Sunday, etc.)/', - 'exampleValue' => '1,3,6', - 'defaultValue' => '0' - ], - 'time' => [ - 'name' => 'Time of day', - 'type' => 'text', - 'title' => 'Morning (8AM-12AM), Afternoon (12AM-18PM), Evening (18PM-12PM).', - 'exampleValue' => 'soir', - 'defaultValue' => 'all' - ], - 'addr' => [ - 'name' => 'Location', - 'type' => 'text', - 'title' => 'Comma-separated list of districts or cities.', - 'exampleValue' => '13e,Châtillon', - 'defaultValue' => 'Paris' - ], - 'cine' => [ - 'name' => 'Theater', - 'type' => 'text', - 'title' => 'ID of a movie theater.', - 'exampleValue' => 'C0150', - ], - 'format' => [ - 'name' => 'Format', - 'type' => 'text', - 'title' => 'Movie format.', - 'exampleValue' => '3D' - ] - ] - ]; - - public function getSourceUrl() { - $query = ''; - foreach(self::PARAMETERS['Filters'] as $param => $val) { - $value = $this->getInput($param); - if ($value != '') { - $query = $query . 'sel' . $param . '=' . $value . '&'; - } - } - $selday = ['week', 'dimanche', 'lundi', 'mardi', 'mercredi', 'jeudi', 'vendredi', 'samedi'][$this->getInput('dayid')]; - return self::URI . 'get_pcimovies.php?' . $query . 'selday=' . $selday; - } - - private function fetchData() { - return json_decode(getSimpleHTMLDOMCached($this->getSourceUrl()))->data; - } - - public function getIcon() { - return 'https://paris-cine.info/resources/img/favicon-16x16.png'; - } - - public function collectData() { - $data = $this->fetchData(); - foreach($data as $film) { - $item = [ - 'uri' => str_replace('\\/', '/', $film->sc_url), - 'title' => $film->title, - 'timestamp' => str_replace('/', '-', $film->released), - 'author' => $film->dir, - 'content' => ( - $film->year . ' - ' . - 'with ' . str_replace(',', ', ', $film->actors) . ' - ' . - $film->duration . ' - ' . - 'SC: ' . $film->sc_rating . '/10 - ' . - 'IMDB: ' . $film->imdbr . '/10' . ' ' - ), - 'enclosures' => [ $film->poster_url ], - 'categories' => explode(',', $film->genre), - 'id' => $film->id - ]; - $this->items[] = $item; - } - } -} diff --git a/config/services/web/rss/ParisJazzClubBridge.php b/config/services/web/rss/ParisJazzClubBridge.php deleted file mode 100644 index e55ecce..0000000 --- a/config/services/web/rss/ParisJazzClubBridge.php +++ /dev/null @@ -1,40 +0,0 @@ -<?php - -class ParisJazzClubBridge extends XPathAbstract { - const NAME = 'Paris Jazz Club Bridge'; - const URI = 'https://www.parisjazzclub.net/en/agenda-free/'; - const DESCRIPTION = 'Free concerts for the Paris Jazz Club subscribers.'; - const MAINTAINER = 'Quentin Aristote'; - const CACHE_TIMEOUT = 3600; // 1h - - const FEED_SOURCE_URL = 'https://www.parisjazzclub.net/en/agenda-free/'; - const XPATH_EXPRESSION_ITEM = '//div[@class="col-12 mb-5 concerts-items"]'; - const XPATH_EXPRESSION_ITEM_TITLE = './/h3'; - const XPATH_EXPRESSION_ITEM_CONTENT = '.'; - const XPATH_EXPRESSION_ITEM_URI = './/a/@href'; - const XPATH_EXPRESSION_ITEM_AUTHOR = './/i[@class="fa fa-fw fa-street-view text-ocre"]/..'; - const XPATH_EXPRESSION_ITEM_TIMESTAMP = './/i[@class="fa fa-fw fa-calendar text-ocre"]/..'; - const XPATH_EXPRESSION_ITEM_ENCLOSURES = './/img[@class="img"]/@src'; - const XPATH_EXPRESSION_ITEM_CATEGORIES = './/i[@class="fa fa-fw fa-music text-ocre"]/..'; - - public function getIcon() { - return 'https://www.parisjazzclub.net/favicon/favicon.ico'; - } - - protected function formatItemTimestamp($value) { - $date = str_replace("/", "-", substr($value, -10)); - return strtotime($date); - } - - protected function formatItemContent($value) { - $text = preg_replace("/\s{2}\s+/", "\n", $value); - $lines = array_map("trim", explode("\n", $text)); - $time = $lines[0]; - $title = $lines[1]; - $club = $lines[2]; - $location = $lines[3]; - $category = $lines[4]; - $date = $lines[5]; - return $title . "," . $category . " -" . $club . "," . $location . " -" . $date . ", " . $time; - } -} diff --git a/config/services/web/rss/default.nix b/config/services/web/rss/default.nix index 2c2ff54..18d2a57 100644 --- a/config/services/web/rss/default.nix +++ b/config/services/web/rss/default.nix @@ -1,6 +1,9 @@ -{ config, lib, pkgs, ... }: - -let cfg = config.services.rss-bridge; +{ + config, + lib, + ... +}: let + cfg = config.services.rss-bridge; in { services.rss-bridge = { enable = true; @@ -12,10 +15,6 @@ in { } ## Concerts { - name = "ParisJazzClub"; - source = ./ParisJazzClubBridge.php; - } - { name = "MaisonDeLaRadio"; source = ./MaisonDeLaRadioBridge.php; } |
