diff options
-rwxr-xr-x | bin/impressive-display | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/bin/impressive-display b/bin/impressive-display index 9b8c7ae..1f989c3 100755 --- a/bin/impressive-display +++ b/bin/impressive-display @@ -37,6 +37,8 @@ VERSION="0.3.3" +# List of supported extensions taken from impressive +# We add .txt, which is a file list (denoted by an @ prefix in impressive) SUPPORTED_FILES=(pdf jpg jpeg png tif bmp ppm avi) if type -p mplayer 1>/dev/null; then SUPPORTED_FILES+=(mov mp4 mkv webm ogv mpg mpeg ts flv txt) @@ -159,6 +161,7 @@ else RESOLUTION="$DEFAULT_RESOLUTION" fi +# Verify that URI is of a supprted form function uri_is_supported { check_uri=${1%%\?*} @@ -170,6 +173,7 @@ function uri_is_supported { fi } +# Verify primary URL; bail out if it is unsupported uri_is_supported "$PDF_URI" || exit -1 if [ -n "${RESOLUTION}" ]; then @@ -324,18 +328,24 @@ function is_sleep_hour { } +# Download a file (any file, not only PDF, actually) function download_pdffile { + # Params: full download URL; and indicator wif we are loading + # primary file or subsequent list entries local pdf_uri_orig=$1 local recursing=${2:-no} + # Split/strip query string filename, uncompressed filename, and extension local pdf_uri=${pdf_uri_orig%%\?*} local pdf_filename=$(basename "$pdf_uri") local pdf_stripped=${pdf_filename%.gz} local pdf_extension=${pdf_stripped##*.} + # Full paths for new file, and previous version currently displayed local pdffile_downloaded="$workdir/downloaded/$pdf_stripped" local pdffile_target="$workdir/display/$pdf_stripped" + # Do actual download using curl DOWNLOADED_FILE="$workdir/downloaded/$pdf_filename" if [ -f "$workdir/secrets/default.secret" ]; then NETRCFILE=" --netrc-file $workdir/secrets/default.secret" @@ -343,7 +353,6 @@ function download_pdffile { if [ -f "$workdir/secrets/$THIS_HOSTNAME.secret" ]; then NETRCFILE=" --netrc-file $workdir/secrets/${THIS_HOSTNAME}.secret" fi - if [ "x$LOG_TO_SYSLOG" = "xyes" ]; then if ! curl $NETRCFILE "$pdf_uri_orig" 1> "$DOWNLOADED_FILE" 2>/dev/null; then $OUTPUT "The curl tool failed in retrieving PDF file. Run this tool interactively to debug problems." |