Add themoviedb support for bay.parazy.de - annna - Annna the nice friendly bot. HTML git clone git://bitreich.org/annna/ git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/annna/ DIR Log DIR Files DIR Refs DIR Tags DIR README --- DIR commit 07add18a679ee42ddfb270c6d98e37647a186225 DIR parent 02a180aeae1e6ef0a928d4182012d7ee708bf7e6 HTML Author: Annna Robert-Houdin <annna@bitreich.org> Date: Thu, 19 Aug 2021 20:29:46 +0200 Add themoviedb support for bay.parazy.de Diffstat: M annna-message-common | 7 +++++++ A themoviedb2gopherbay | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+), 0 deletions(-) --- DIR diff --git a/annna-message-common b/annna-message-common @@ -95,6 +95,13 @@ case "${text}" in nuris="gopher://bay.parazy.de:666/1/q.dcgi?${movietitle}" fi ;; + *themoviedb.org/movie/*) + movietitle="$(themoviedb2gopherbay "${uri}" | sed 's, ,+,g')" + if [ -n "${movietitle}" ]; + then + nuris="gopher://bay.parazy.de:666/1/q.dcgi?${movietitle}" + fi + ;; *lichess.org/????????|*lichess.org/????????/|*lichess.org/????????/black|*lichess.org/????????/white) nuris="$(printf "%s\n" "${uri}" \ | sed 's,https://lichess.org\(/[^ ]*\)$,\1,; s,^/\([^/]*\)/black$,/black/\1,; s,/white,,; s,\(.*\),https://lichess1.org/game/export/gif\1.gif,;')" DIR diff --git a/themoviedb2gopherbay b/themoviedb2gopherbay @@ -0,0 +1,18 @@ +#!/bin/sh + +if [ $# -lt 1 ]; +then + printf "usage: %s themoviedburi\n" "$(basename "$0")" >&2 + exit 1 +fi + +imdburi="$1" +title="$(curl -s "${imdburi}" \ + | xml2tsv 2>/dev/null \ + | grep property=og:title \ + | sed 's,.*content=\([^\t]*\).*,\1,')" + +[ -z "${title}" ] && exit 1 + +printf "%s\n" "${title}" +