Screenly OSE install notes

For: My Michelle – Sprint 7

install

Download OS here: https://github.com/screenly/screenly-ose/releases

Instructions to burn image here: https://www.raspberrypi.org/documentation/installation/installing-images/linux.md

the short of it is:

unzip -p 2018-05-04-Screenly_OSE_4GB.zip | dd of=/dev/sdc bs=4M status=progress conv=fsync

Install instructions here: https://www.screenly.io/ose/ Use Option 1.

run:

sudo raspi-config

to change hostname and many other things.

Wi-Fi

Use the Screenly UI. Nothing else seemed to work. Connect by instructions on the screen.

Which wireless network?

iwgetid

display rotation and offset

Edit /boot/config.txt.

# uncomment this if your display has a black border of unused pixels visible
# and your display can output without overscan
disable_overscan=1

# uncomment the following to adjust overscan. Use positive numbers if console
# goes off screen, and negative if there is too much border
overscan_left=-31
overscan_right=-31
overscan_top=-31
overscan_bottom=-31
...
# rotate display
display_hdmi_rotate=3

ssh and firewall

Enable ssh if you wish (like any other system.)

Ditto firewall.

ssl

See here https://support.screenly.io/hc/en-us/articles/212107306-Does-Screenly-OSE-support-SSL-

$ cd ~/screenly
$ git pull
$ ./bin/enable_ssl.sh

auth

(user name and password). See https://support.screenly.io/hc/en-us/articles/115004422954-How-do-I-enable-authentication-in-Screenly-OSE-

Edit /home/pi/.screenly/screenly.conf No quotes.

[auth]
password = some_password
user = some_user

Afterwards pkill -f serever.py to restart server.

turn monitor off

See: https://www.screenly.io/blog/2017/07/02/how-to-automatically-turn-off-and-on-your-monitor-from-your-raspberry-pi/

With our Samsung LH32DCE /usr/bin/vcgencmd display_power 0 in the pi user’s crontab worked.

Set the timezone to make this easy… dpkg-reconfigure tzdata

convert pdf to jpg

http://xmodulo.com/convert-pdf-files-to-jpg-format-on-linux.html and scroll down a bit.

gs -dNOPAUSE -sDEVICE=jpeg -dFirstPage=1 -dLastPage=1 -sOutputFile=output%d.jpg -dJPEGQ=100 -r127 -q intput.pdf -c quit

To get the -r number, divide the screen width in px by the pdf width in inches, 1080/8.5 in the case of a flyer, 1080/20.25 ~=54 in the case of a calendar.

Add -dTextAlphaBits=4 -dGraphicsAlphaBits=4 for anti-aliasing.

cloning screens

Clone script,sync.sh on clone:

#!/bin/bash
/usr/bin/rsync -az --delete pi@screenly-reception:screenly_assets/ screenly_assets
/usr/bin/rsync -az pi@screenly-reception:.screenly/screenly.db .screenly

crontab on clone:
# clone
*/5 * * * * /home/pi/sync.sh

.ssh/config on clone:

Host master_screen
    Port some_port

Modifications to viewer.py (on clone) to enable reconnecting to database:

--- viewer.py.orig	2018-10-24 14:34:22.076759685 -0400
+++ viewer.py	2018-10-24 14:33:24.427157304 -0400
@@ -155,6 +155,12 @@
         time_cur = datetime.utcnow()
         logging.debug('refresh: counter: (%s) deadline (%s) timecur (%s)', self.counter, self.deadline, time_cur)
         if self.get_db_mtime() > self.last_update_db_mtime:
+	    # testing: reload database
+	    global db_conn
+	    if db_conn != None:
+		db_conn.close()
+	    db_conn = db.conn(settings['database'])
+	    #
             logging.debug('updating playlist due to database modification')
             self.update_playlist()
         elif settings['shuffle_playlist'] and self.counter >= 5:
@@ -164,12 +170,15 @@
 
     def update_playlist(self):
         logging.debug('update_playlist')
-        self.last_update_db_mtime = self.get_db_mtime()
+	# mtime save was here
         (new_assets, new_deadline) = generate_asset_list()
-        if new_assets == self.assets and new_deadline == self.deadline:
+	# added check to db_mtime
+        if new_assets == self.assets and new_deadline == self.deadline and self.last_update_db_mtime == self.get_db_mtime():
             # If nothing changed, don't disturb the current play-through.
+	    self.last_update_db_mtime = self.get_db_mtime()
             return
 
+        self.last_update_db_mtime = self.get_db_mtime()
         self.assets, self.deadline = new_assets, new_deadline
         self.counter = 0
         # Try to keep the same position in the play list. E.g. if a new asset is added to the end of the list, we

validate-rsync on master screen:

#!/bin/bash
if [ "$SSH_ORIGINAL_COMMAND" == "rsync --server --sender -logDtprze.iLsfxC . screenly_assets/" -o "$SSH_ORIGINAL_COMMAND" == "rsync --server --sender -logDtprze.iLsfxC . .screenly/screenly.db" ]
then
  $SSH_ORIGINAL_COMMAND
else
  echo "failed `date` $SSH_ORIGINAL_COMMAND" >>/home/pi/soc
fi

.ssh/authorized_keys on master screen:

command="/home/pi/validate-rsync" ssh-rsa A...