summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDanielsLPecke <daniel.letsplay007@gmail.com>2016-11-11 12:41:56 +0100
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2016-11-14 14:47:30 +0100
commit1cd51d1f7c1ff7403f3d17be488a4eb6163bca95 (patch)
treeaed9a401c50ed5e2d7569b81bf5275b40541ddb0
parentd73088ad9910b66ad02d40b7217981c1a302809a (diff)
downloadimpressive-display-1cd51d1f7c1ff7403f3d17be488a4eb6163bca95.tar.gz
impressive-display-1cd51d1f7c1ff7403f3d17be488a4eb6163bca95.tar.bz2
impressive-display-1cd51d1f7c1ff7403f3d17be488a4eb6163bca95.zip
Add support for individually configuring multiple displays.
(cherry picked from commit ce0733ae746423db3ee4a1c6808737001d1bf2a1)
-rwxr-xr-xbin/impressive-display84
-rw-r--r--data/testpage1.pdfbin0 -> 12597 bytes
-rw-r--r--data/testpage2.pdfbin0 -> 11663 bytes
-rw-r--r--data/testpage3.pdfbin0 -> 13330 bytes
4 files changed, 41 insertions, 43 deletions
diff --git a/bin/impressive-display b/bin/impressive-display
index 77276ec..821318c 100755
--- a/bin/impressive-display
+++ b/bin/impressive-display
@@ -33,32 +33,17 @@
# texlive-extra-utils (for pdfnup)
# poppler-utils (for pdfinfo)
-VERSION="0.2.5"
-PDF_URL="http://localhost"
+VERSION="0.2.990"
-WITH_PULSEAUDIO="yes"
-HIDE_IDLE_POINTER="yes"
-
-
-# There can be master terminals and slave display.
-# All terminal not listed here are slave displays...
-PRIMARY_DISPLAYS="$(hostname -f)"
-
-# these terminals can have different startup URLs
-PDF_URL_PRIMARIES=""
-PDF_URL_SECONDARIES=""
-PDF_URL_PRIMARIES_CREDS=""
-PDF_URL_SECONDARIES_CREDS=""
+# Can be configured at "/etc/default/impressive-display"
+DEFAULT_PDF_URI="/usr/share/doc/impressive-display/examples/testpage1.pdf"
+DEFAULT_RESOLUTION="1920x1080"
+# Loggin credentials for websites..
+DEFAULT_PDF_URL_CREDS=""
-PDF_FILE_PRIMARIES=""
-PDF_FILE_SECONDARIES=""
-
-# enforce fixed resolution for displays
-# PRIMARIES_RESOLUTION="1920x1080"
-# SECONDARIES_RESOLUTION="1920x1080"
-PRIMARIES_RESOLUTION=
-SECONDARIES_RESOLUTION=
+# all displays that need to be changed
+declare -A DISPLAYS
# launch pulseaudio daemon if not already running
WITH_PULSEAUDIO="yes"
@@ -94,6 +79,7 @@ IMPRESSIVE_OPTIONS="--transition None"
# write some debugging output to stdout when downloading a remote PDF
DEBUG_DOWNLOADS=""
+# if files exists: source it to this file (The script will overide variables)
if [ -r $HOME/.impressive-display-secrets ] && [ ! -d $HOME/.impressive-display-secrets ]; then
. $HOME/.impressive-display-secrets
fi
@@ -147,26 +133,38 @@ if [ "x$HIDE_IDLE_POINTER" = "xyes" ]; then
fi
fi
-PDF_URL="$PDF_URL_SECONDARIES"
-PDF_URL_CREDS="$PDF_URL_SECONDARIES_CREDS"
-PDF_FILE="$PDF_FILE_SECONDARIES"
-RESOLUTION="$SECONDARIES_RESOLUTION"
-
# if FAKE_HOSTNAME is not empty, use that string for hostname
THIS_HOSTNAME=$(hostname -f)
if [ -n "$FAKE_HOSTNAME" ]; then
THIS_HOSTNAME="$FAKE_HOSTNAME"
fi
-for primary_display in $PRIMARY_DISPLAYS; do
- if [ "x$THIS_HOSTNAME" = "x$primary_display" ]; then
- PDF_URL="$PDF_URL_PRIMARIES"
- PDF_URL_CREDS="$PDF_URL_PRIMARIES_CREDS"
- PDF_FILE="$PDF_FILE_PRIMARIES"
- RESOLUTION="$PRIMARIES_RESOLUTION"
- break
+
+if `echo ${!DISPLAYS[@]} | grep -q "$THIS_HOSTNAME"`; then
+ $OUTPUT "INFO: $THIS_HOSTNAME has extra properties. loading it.."
+
+ if echo ${DISPLAYS[$THIS_HOSTNAME]} | grep -q "pdf_uri="; then
+ PDF_URI=`echo ${DISPLAYS[$THIS_HOSTNAME]} | sed -r -e 's/.*pdf_uri=([^|]*).*/\1/'`
+ else
+ PDF_URI="$DEFAULT_PDF_URI"
fi
-done
+
+ if echo ${DISPLAYS[$THIS_HOSTNAME]} | grep -q "res="; then
+ RESOLUTION=`echo ${DISPLAYS[$THIS_HOSTNAME]} | sed -r -e 's/.*res=([^|]*).*/\1/'`
+ else
+ RESOLUTION="$DEFAULT_RESOLUTION"
+ fi
+
+ if echo ${DISPLAYS[$THIS_HOSTNAME]} | grep -q "creds="; then
+ PDF_URL_CREDS=`echo ${DISPLAYS[$THIS_HOSTNAME]} | sed -r -e 's/.*creds=([^|]*).*/\1/'`
+ else
+ PDF_URL_CREDS="$DEFAULT_PDF_URL_CREDS"
+ fi
+else
+ PDF_URI="$DEFAULT_PDF_URI"
+ PDF_URL_CREDS="$DEFAULT_PDF_URL_CREDS"
+ RESOLUTION="$DEFAULT_RESOLUTION"
+fi
if [ -n "${RESOLUTION}" ]; then
if which xrandr 1>/dev/null; then
@@ -341,7 +339,7 @@ function download_pdffile {
if [ -n "$PDF_URL_CREDS" ]; then
creds="-u $PDF_URL_CREDS"
fi
- curl $creds "$PDF_URL" 1> "$pdffile_downloaded" 2>/dev/null
+ curl $creds "$PDF_URI" 1> "$pdffile_downloaded" 2>/dev/null
if pdfinfo "$pdffile_downloaded" 1>/dev/null 2>/dev/null; then
@@ -380,19 +378,19 @@ function download_loop {
if is_rush_hour 1>/dev/null && [ "x$RUSH_HOURS_DOWNLOAD_INTERVAL" != "x0" ]; then
sleep $RUSH_HOURS_DOWNLOAD_INTERVAL
if [ -n "$DEBUG_DOWNLOADS" ]; then
- $OUTPUT "INFO: RUSH HOUR download, URL: $PDF_URL"
+ $OUTPUT "INFO: RUSH HOUR download, URL: $PDF_URI"
fi
download_pdffile
elif is_sleep_hour 1>/dev/null && [ "x$SLEEP_HOURS_DOWNLOAD_INTERVAL" != "x0" ]; then
sleep $SLEEP_HOURS_DOWNLOAD_INTERVAL
if [ -n "$DEBUG_DOWNLOADS" ]; then
- $OUTPUT "INFO: SLEEP HOUR download, URL: $PDF_URL"
+ $OUTPUT "INFO: SLEEP HOUR download, URL: $PDF_URI"
fi
download_pdffile
elif (! is_rush_hour 1>/dev/null ) && (! is_sleep_hour 1>/dev/null) && [ "x$DOWNLOAD_INTERVAL" != "x0" ]; then
sleep $DOWNLOAD_INTERVAL
if [ -n "$DEBUG_DOWNLOADS" ]; then
- $OUTPUT "INFO: NORMAL HOUR download, URL: $PDF_URL"
+ $OUTPUT "INFO: NORMAL HOUR download, URL: $PDF_URI"
fi
download_pdffile
else
@@ -453,9 +451,9 @@ function create_lock {
$OUTPUT "INFO: IMPRESSIVE Display (version $VERSION)"
$OUTPUT "INFO: HOSTNAME set to: $THIS_HOSTNAME"
-if [ -n "$PDF_URL" ]; then
+if [ -n "$PDF_URI" ]; then
- $OUTPUT "INFO: PDF_URL is configured. Using PDF file from given URL: $PDF_URL"
+ $OUTPUT "INFO: PDF_URI is configured. Using PDF file from given URL: $PDF_URI"
create_lock
download_loop
@@ -467,7 +465,7 @@ elif [ -n "$PDF_FILE" ]; then
else
- $OUTPUT "ERROR: Neither PDF_FILE nor PDF_URL has been configured. Doing nothing."
+ $OUTPUT "ERROR: PDF_URI hasn't been configured. Doing nothing."
exit 0
fi
diff --git a/data/testpage1.pdf b/data/testpage1.pdf
new file mode 100644
index 0000000..151874c
--- /dev/null
+++ b/data/testpage1.pdf
Binary files differ
diff --git a/data/testpage2.pdf b/data/testpage2.pdf
new file mode 100644
index 0000000..659c24f
--- /dev/null
+++ b/data/testpage2.pdf
Binary files differ
diff --git a/data/testpage3.pdf b/data/testpage3.pdf
new file mode 100644
index 0000000..b8550cb
--- /dev/null
+++ b/data/testpage3.pdf
Binary files differ