Difference between revisions of "Kiosk display on a Mac Powerbook"

From dftwiki3
Jump to: navigation, search
(Account)
(Watch script)
 
(9 intermediate revisions by the same user not shown)
Line 14: Line 14:
 
The idea is to have the Powerbook download a Quicktime movie from a server when a new version of it has been created, and automatically run it in a loop, full screen.
 
The idea is to have the Powerbook download a Quicktime movie from a server when a new version of it has been created, and automatically run it in a loop, full screen.
  
The mac used for displaying the endless loop is an old '''Powerbook PowerPC G4''' running Mac OS X 10.5.8 that was collecting dust.  It is connected to an external display.
+
The mac used for displaying the endless loop is an old '''Powerbook PowerPC G4''' running Mac OS X 10.5.8 that was collecting dust.  It is connected to an external display, and connected to the LAN via its wifi port.  Either a wifi or cabled connection is essential for the Powerbook to automatically detect when a new version of the movie it's playing exists, so that it can download it.
  
 
The original '''.mov''' movie that is to be displayed is located a server, at a given '''URL''', and the Powerbook will check regularly (in our case every 10 minutes) to see if that file has been recently updated.  If it has been, the Powerbook uses '''wget''' (downloaded from [http://www.macupdate.com/app/mac/33951/wget here]) to download the movie, and the Powerbook is restarted (automatically) so that Quicktime can restart with the new movie.
 
The original '''.mov''' movie that is to be displayed is located a server, at a given '''URL''', and the Powerbook will check regularly (in our case every 10 minutes) to see if that file has been recently updated.  If it has been, the Powerbook uses '''wget''' (downloaded from [http://www.macupdate.com/app/mac/33951/wget here]) to download the movie, and the Powerbook is restarted (automatically) so that Quicktime can restart with the new movie.
Line 22: Line 22:
  
 
=Setup=
 
=Setup=
* Create a Quicktime compatible movie of your presentation (for example, see this [http://minute.maine121.org/2012/10/12/episode-282-export-keynote-as-quicktime/ quick tutorial] on how to export a Keynote presentation as a Quicktime movie).    Make sure you set the full-screen and loop options (if available) ON when export the file to Quicktime format.
+
==The movie==
* Install [http://www.macupdate.com/app/mac/33951/wget wget] on the Powerbook.
+
* Create a Quicktime compatible movie of your presentation (for example, see this [http://minute.maine121.org/2012/10/12/episode-282-export-keynote-as-quicktime/ quick tutorial] on how to export a Keynote presentation as a Quicktime movie).    Make sure you set the full-screen and loop options (if available) ON when exporting the file to Quicktime format.
* Using Systems Preferences, go to the '''Users ''' menu and set '''newaccount'''  to '''automatic login'''
+
==Non-standard software==
 +
* Install [http://www.macupdate.com/app/mac/33951/wget wget] on the Powerbook.  It is not part of the standard Mac OSX distribution.
 +
==Automatic Login, and Automatic Opening of the Movie==
 +
* Using Systems Preferences, go to the '''Users ''' menu and set '''newaccount'''  to '''automatic login'''.  This will make sure the laptop will automatically login the ''newaccount'' account when it is booted up or restarted.
 
* Load the first copy of the movie to play at startup  in the '''Desktop''' folder, and call it '''DisplayCase.mov'''.  This is also the name of the original movie file on the server.
 
* Load the first copy of the movie to play at startup  in the '''Desktop''' folder, and call it '''DisplayCase.mov'''.  This is also the name of the original movie file on the server.
* In the '''Users''' pane of the Systems Preference app, with '''newaccount''' selected, click on '''Login Items''' and put the movie '''DisplayCase.mov''' in the window. Leave the '''Hide''' box unchecked.
+
* In the '''Users''' pane of the Systems Preference app, with '''newaccount''' selected, click on '''Login Items''' and put the movie '''DisplayCase.mov''' in the window. Leave the '''Hide''' box unchecked. This will indicate that the movie should be opened as soon as the user ''newaccount'' is logged in.
 +
* Connect the external display to the video connector.  In the '''Systems Preference''' select '''Display''' and set the display mode to ''mirror''.  This way the movie will play on both the laptop and the external display.
 +
* In the '''Systems Preference''' select the '''Desktop and Screen Saver''' option,  and make sure the screen saver is set to '''never''' come on.
 +
* In the '''Systems Preference''' select the '''Energy Saver''' option, and make sure the computer is set to '''never''' sleep, and for the display to '''never''' sleep as well.
 +
 
 +
==Watch script==
 +
You need to create a program that will constantly check to see if the movie on the remote server has been updated.  If a new version  has been found, the script will automatically download it, and will logout and log back in, in effect restarting the environment for User ''newaccount''.  Because the movie is in the list of applications to start automatically when the user logs in, this will force Quicktime to stop and restart with the new movie.
 +
 
 +
;'''Note''':
 +
: Users familiar with ''Applescript'' will find alternative solutions to the one presented here.  Having started using Unix more than 20 years ago, I have found  '''bash''' scripts simpler to develop than Applescript code.
 +
 
 +
<br />
 +
Here are the steps you need to take:
 
* Create a '''bin''' directory in the '''newaccount''' directory.   
 
* Create a '''bin''' directory in the '''newaccount''' directory.   
 
* Create the script '''updateMovie.sh''' in the newly created bin directory, and initialize it with this code:
 
* Create the script '''updateMovie.sh''' in the newly created bin directory, and initialize it with this code:
Line 65: Line 80:
 
</pre></code>
 
</pre></code>
 
<br />
 
<br />
Then it's time to create a [http://en.wikipedia.org/wiki/Cron '''cron'''] job that will run this script every 10 minutes.  Run the command:
+
 
 +
* Make the script executable by opening up the '''Terminal''' window and typing these commands:
 +
 
 +
  cd
 +
  chmod a+x ~/bin/updateMovie.sh
 +
 
 +
 
 +
Then it's time to create a [http://en.wikipedia.org/wiki/Cron '''cron'''] job that will run this script every 10 minutes.  
 +
 
 +
* In the same '''Terminal''' window run the following command:
  
 
     crontab -e
 
     crontab -e
  
in the '''Terminal''' window.
+
 
Add the following contents to the crontab list:
+
 
 +
* Add the following contents to the crontab list:
  
 
  */10 * * * * /Users/newaccount/bin/updateMovie.sh
 
  */10 * * * * /Users/newaccount/bin/updateMovie.sh
  
and exit the default editor.   
+
:and exit the default editor.
 +
 
 +
;'''Note:'''
 +
:If you want to the default editor to be emacs, simply set the '''EDITOR''' shell variable before issuing the ''crontab'' command:
 +
 
 +
 +
export EDITOR=/usr/bin/emacs
 +
   
  
<tanbox>
 
'''Note:''' If you want to the default editor to be emacs, simply set the '''EDITOR''' shell variable before issuing the ''crontab'' command:<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;<tt><font size="+1">export EDITOR=/usr/bin/emacs</font></tt><br /><br />
 
</tanbox>
 
 
<br />
 
<br />
 +
 +
=Testing=
 
You can now restart the PowerBook and the kiosk should start working, loading the movie full-screen, in a loop.  Whenever you change the original movie on the server, the kiosk should update its copy within 10 minutes and restart, showing the new movie.
 
You can now restart the PowerBook and the kiosk should start working, loading the movie full-screen, in a loop.  Whenever you change the original movie on the server, the kiosk should update its copy within 10 minutes and restart, showing the new movie.
 +
 
<br />
 
<br />
 
<br />
 
<br />

Latest revision as of 08:34, 11 April 2013

--D. Thiebaut 10:37, 10 April 2013 (EDT)




This tutorial is a simple series of step to create a kiosk on a PowerBook mac. The Kiosk displays a Quicktime movie in a loop, in full-screen mode. The movie can be updated remotely, and the kiosk automatically reloads the movie (with a 1-minute down-time, approximately).



Introduction

The idea is to have the Powerbook download a Quicktime movie from a server when a new version of it has been created, and automatically run it in a loop, full screen.

The mac used for displaying the endless loop is an old Powerbook PowerPC G4 running Mac OS X 10.5.8 that was collecting dust. It is connected to an external display, and connected to the LAN via its wifi port. Either a wifi or cabled connection is essential for the Powerbook to automatically detect when a new version of the movie it's playing exists, so that it can download it.

The original .mov movie that is to be displayed is located a server, at a given URL, and the Powerbook will check regularly (in our case every 10 minutes) to see if that file has been recently updated. If it has been, the Powerbook uses wget (downloaded from here) to download the movie, and the Powerbook is restarted (automatically) so that Quicktime can restart with the new movie.

User Account

The account under which everything runs on the Powerbook is "newccount", which has no password, and admin privileges.

Setup

The movie

  • Create a Quicktime compatible movie of your presentation (for example, see this quick tutorial on how to export a Keynote presentation as a Quicktime movie). Make sure you set the full-screen and loop options (if available) ON when exporting the file to Quicktime format.

Non-standard software

  • Install wget on the Powerbook. It is not part of the standard Mac OSX distribution.

Automatic Login, and Automatic Opening of the Movie

  • Using Systems Preferences, go to the Users menu and set newaccount to automatic login. This will make sure the laptop will automatically login the newaccount account when it is booted up or restarted.
  • Load the first copy of the movie to play at startup in the Desktop folder, and call it DisplayCase.mov. This is also the name of the original movie file on the server.
  • In the Users pane of the Systems Preference app, with newaccount selected, click on Login Items and put the movie DisplayCase.mov in the window. Leave the Hide box unchecked. This will indicate that the movie should be opened as soon as the user newaccount is logged in.
  • Connect the external display to the video connector. In the Systems Preference select Display and set the display mode to mirror. This way the movie will play on both the laptop and the external display.
  • In the Systems Preference select the Desktop and Screen Saver option, and make sure the screen saver is set to never come on.
  • In the Systems Preference select the Energy Saver option, and make sure the computer is set to never sleep, and for the display to never sleep as well.

Watch script

You need to create a program that will constantly check to see if the movie on the remote server has been updated. If a new version has been found, the script will automatically download it, and will logout and log back in, in effect restarting the environment for User newaccount. Because the movie is in the list of applications to start automatically when the user logs in, this will force Quicktime to stop and restart with the new movie.

Note
Users familiar with Applescript will find alternative solutions to the one presented here. Having started using Unix more than 20 years ago, I have found bash scripts simpler to develop than Applescript code.


Here are the steps you need to take:

  • Create a bin directory in the newaccount directory.
  • Create the script updateMovie.sh in the newly created bin directory, and initialize it with this code:
#! /bin/bash
# updateMovie.sh
# D. Thiebaut
# This script  will download movie from given url if it is more recent
# than local copy.  If download is performed, the laptop is restarted
# so as to force Quicktime to stop and restart.  The movie will automatically
# be played at login because it is in the "logins" list for the current account.
# 

movie="DisplayCase.mov"
url="http://xxx.yyy.zzz/${movie}"  # <== enter the URL of your movie here
wget="/usr/local/bin/wget"

cd ~/Desktop

# get creation time of local copy of movie
currentTimeStamp=`stat -f "%m%t%Sm" $movie`

# attempt to get newer version of movie from server
$wget -q -N $url

# get creation time of same movie file
newTimeStamp=`stat -f "%m%t%Sm" $movie`

# if creation times are different, a new version has been downloaded
# so we need to restart the system.

if [ "$currentTimeStamp" != "$newTimeStamp" ]; then
    # restarting the Finder will restart the user newaccount...
    osascript -e 'tell application "Finder" to restart'
fi



  • Make the script executable by opening up the Terminal window and typing these commands:
 cd
 chmod a+x ~/bin/updateMovie.sh


Then it's time to create a cron job that will run this script every 10 minutes.

  • In the same Terminal window run the following command:
   crontab -e


  • Add the following contents to the crontab list:
*/10 * * * * /Users/newaccount/bin/updateMovie.sh
and exit the default editor.
Note:
If you want to the default editor to be emacs, simply set the EDITOR shell variable before issuing the crontab command:


export EDITOR=/usr/bin/emacs


Testing

You can now restart the PowerBook and the kiosk should start working, loading the movie full-screen, in a loop. Whenever you change the original movie on the server, the kiosk should update its copy within 10 minutes and restart, showing the new movie.