Add more DCGI (to hopefully avoid listing all programs) - gophercgis - Collection of gopher CGI/DCGI for geomyidae
(HTM) hg clone https://bitbucket.org/iamleot/gophercgis
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) README
(DIR) LICENSE
---
(DIR) changeset 8fb40a09a419cc2c50c780dbadab1ce726ba42d0
(DIR) parent f31c02bc8db96d0de5e57d9cd16a87a21e240401
(HTM) Author: Leonardo Taccari <iamleot@gmail.com>
Date: Sat, 15 Sep 2018 17:13:10
Add more DCGI (to hopefully avoid listing all programs)
Diffstat:
raiplay/categoria.dcgi | 23 +++++++++++++++++++++++
raiplay/genere.dcgi | 23 +++++++++++++++++++++++
2 files changed, 46 insertions(+), 0 deletions(-)
---
diff -r f31c02bc8db9 -r 8fb40a09a419 raiplay/categoria.dcgi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/raiplay/categoria.dcgi Sat Sep 15 17:13:10 2018 +0200
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+GENERE_CGI="/cgi/raiplay/genere.dcgi"
+
+case "$2" in
+programmi | fiction | film | teatro | documentari | musica | cartonianimati )
+ url="https://www.raiplay.it/$2/?json"
+ ;;
+*)
+ exit 1
+ ;;
+esac
+
+/usr/pkg/bin/curl -Lgs "${url}" |
+/usr/pkg/bin/jq -r '
+ "t",
+ "t\(.name)",
+ "t",
+ ( .blocchi[] | .lanci[] |
+ "[1|\(.name | gsub("\\|"; "\\|"))|" +
+ "'"${GENERE_CGI}"'?\(.PathID | gsub("\\|"; "\\|"))|server|port]"
+ )
+' | grep -v -F '.json'
diff -r f31c02bc8db9 -r 8fb40a09a419 raiplay/genere.dcgi
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/raiplay/genere.dcgi Sat Sep 15 17:13:10 2018 +0200
@@ -0,0 +1,23 @@
+#!/bin/sh
+
+PROGRAMMA_CGI="/cgi/raiplay/programma.dcgi"
+
+case "$2" in
+http*)
+ url="$2"
+ ;;
+*)
+ url="http://www.rai.it$2"
+ ;;
+esac
+
+/usr/pkg/bin/curl -Lgs "${url}" |
+/usr/pkg/bin/jq -r '
+ "t",
+ "t\(.name)",
+ "t",
+ ( .blocchi[] | .lanci[] |
+ "[1|\(.name | gsub("\\|"; "\\|"))|" +
+ "'"${PROGRAMMA_CGI}"'?\(.PathID | gsub("\\|"; "\\|"))|server|port]"
+ )
+'