Format the output as .gph and initial working version (still very WIP though) - 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 f31c02bc8db96d0de5e57d9cd16a87a21e240401
 (DIR) parent 08b792ba7fd60b30614c323b5f22df70efe9746d
 (HTM) Author: Leonardo Taccari <iamleot@gmail.com>
       Date:   Fri, 14 Sep 2018 01:39:06 
       
       Format the output as .gph and initial working version (still very WIP though)
       
       Diffstat:
        raiplay/elenco-programmi.dcgi |   7 ++++++-
        raiplay/programma.dcgi        |  37 +++++++++++++++++++++++--------------
        2 files changed, 29 insertions(+), 15 deletions(-)
       ---
       diff -r 08b792ba7fd6 -r f31c02bc8db9 raiplay/elenco-programmi.dcgi
       --- a/raiplay/elenco-programmi.dcgi     Fri Sep 14 01:03:54 2018 +0200
       +++ b/raiplay/elenco-programmi.dcgi     Fri Sep 14 01:39:06 2018 +0200
       @@ -1,5 +1,7 @@
        #!/bin/sh
        
       +PROGRAMMA_CGI="/cgi/raiplay/programma.dcgi"
       +
        url="https://www.raiplay.it/dl/RaiTV/RaiPlayMobile/Prod/Config/programmiAZ-elenco.json"
        
        /usr/pkg/bin/curl -gs "${url}" |
       @@ -27,6 +29,9 @@
                       desc = desc " - " tipology
               }
        
       -       printf("%s - %s\n", desc, pathid)
       +       gsub("\\|", "\\|", desc)
       +       gsub("\\|", "\\|", pathid)
       +
       +       printf("[1|%s|'"${PROGRAMMA_CGI}"'?%s|server|port]\n", desc, pathid)
        }
        '
       diff -r 08b792ba7fd6 -r f31c02bc8db9 raiplay/programma.dcgi
       --- a/raiplay/programma.dcgi    Fri Sep 14 01:03:54 2018 +0200
       +++ b/raiplay/programma.dcgi    Fri Sep 14 01:39:06 2018 +0200
       @@ -1,20 +1,29 @@
        #!/bin/sh
        
       -url=$2
       +PROGRAMMA_CGI="/cgi/raiplay/programma.dcgi"
        
       -#/usr/pkg/bin/curl -gs "${url}" |
       +case "$2" in
       +http*)
       +       url="$2"
       +       ;;
       +*)
       +       url="http://www.rai.it$2"
       +       ;;
       +esac
       +
       +/usr/pkg/bin/curl -Lgs "${url}" |
        /usr/pkg/bin/jq -r '
       -       .Name,
       -       .channel?,
       -       ( .items[]? |
       -               .name,
       -               .pathID
       -       ),
       -       ( .Blocks[]? |
       -               .Name,
       -               ( .Sets[] |
       -                       .Name,
       -                       .url
       -               )
       +"t\(.Name) \(.channel?)",
       +( .items[]? |
       +       "[h|\(.name | gsub("\\|"; "\\|"))|" +
       +           "URL:http://www.rai.it\(.pathID | gsub("\\|"; "\\|"))|server|port]"
       +),
       +( .Blocks[]? |
       +       "t",
       +       "t\(.Name)",
       +       ( .Sets[] |
       +               "[1|\(.Name | gsub("\\|"; "\\|"))|" +
       +                   "'"${PROGRAMMA_CGI}"'?\(.url | gsub("\\|"; "\\|"))|server|port]"
               )
       +)
        '