summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2011-09-02 15:43:40 (GMT)
committer Jaromil <jaromil@dyne.org>2011-09-02 15:43:40 (GMT)
commit9df16fed9bee4eba2ac9f334ebe359ad5cd094b6 (patch)
treed300a8e03eeab0af436315670d70eb011bec6721
parentff904c7f22c05a84245e21838d988e68b205e481 (diff)
fixes for loop and fluidity
tested on 3ch HDMI for Semiconductor's installation Heliocentric
-rw-r--r--scripts/S88hdsync13
-rwxr-xr-xscripts/listen-sync.sh24
-rwxr-xr-xscripts/offer-sync.sh26
-rw-r--r--scripts/utils-sync.sh7
4 files changed, 49 insertions, 21 deletions
diff --git a/scripts/S88hdsync b/scripts/S88hdsync
index d49a575..9cec935 100644
--- a/scripts/S88hdsync
+++ b/scripts/S88hdsync
@@ -81,8 +81,17 @@ echo "UPNP port detected listening on $UPNPPORT" >> /tmp/hdsync.log
# wait that the usb is mounted
sleep 10
-# will get ready for play button
-prepare_play >> /tmp/hdsync.log
+# turn off screensaver
+config_tool -c DMA_ENABLE_SCREENSAVER='0'
+config_tool -c DMA_SCREENSAVER='0'
+
+# kill all services hogging our resources
+killall dmaosd
+killall pandora_ep
+killall apache2
+killall smbtree
+
+
if [ "$HDSYNC_CHANNEL" = "1" ]; then
echo "Offering sync" >> /tmp/hdsync.log
diff --git a/scripts/listen-sync.sh b/scripts/listen-sync.sh
index 41c132d..fbe5aba 100755
--- a/scripts/listen-sync.sh
+++ b/scripts/listen-sync.sh
@@ -39,11 +39,26 @@ touch /tmp/hdsync.reply
# loop continuously
while [ true ]; do
- sleep 3
- # check that the video is not already playing
+ sync
+
+ sleep 10
+
+ # check the state of the video
state=`$AV -s localhost -p $UPNPPORT get 2>&1| awk '/^TInfo:/ {print $2}'`
- if [ "$state" == "PAUSED_PLAYBACK" ]; then
+
+ if [ "$state" == "NO_MEDIA_PRESENT" ]; then
+
+ # will get ready for sync
+ prepare_play >> /tmp/hdsync.log
+
+ elif [ "$state" == "STOPPED" ]; then
+
+ # will get ready for sync again
+ prepare_play >> /tmp/hdsync.log
+
+ elif [ "$state" == "PAUSED_PLAYBACK" ]; then
+ # will sync start
rm -f /tmp/hdsync.reply
touch /tmp/hdsync.reply
@@ -80,11 +95,10 @@ while [ true ]; do
fi
# "press play on tape"
- echo "$SYNC -s localhost -p $UPNPPORT start"
$SYNC -s localhost -p $UPNPPORT start
echo "sync playback started on `date +%T`"
- sleep 3
+
fi
done
diff --git a/scripts/offer-sync.sh b/scripts/offer-sync.sh
index 2eb59b2..e3a06a8 100755
--- a/scripts/offer-sync.sh
+++ b/scripts/offer-sync.sh
@@ -38,11 +38,26 @@ touch /tmp/hdsync.reply
# loop continuously
while [ true ]; do
- sleep 3
- # check that the video is not already playing
+ sync
+
+ sleep 10
+
+ # check the state of the video
state=`$AV -s localhost -p $UPNPPORT get 2>&1| awk '/^TInfo:/ {print $2}'`
- if [ "$state" == "PAUSED_PLAYBACK" ]; then
+
+ if [ "$state" == "NO_MEDIA_PRESENT" ]; then
+
+ # will get ready for sync
+ prepare_play >> /tmp/hdsync.log
+
+ elif [ "$state" == "STOPPED" ]; then
+
+ # will get ready for sync again
+ prepare_play >> /tmp/hdsync.log
+
+ elif [ "$state" == "PAUSED_PLAYBACK" ]; then
+ # will sync start
rm -f /tmp/hdsync.reply
touch /tmp/hdsync.reply
@@ -78,8 +93,6 @@ while [ true ]; do
sync
sleep 10
-
-
# sync start!
$BC $bcast 3336 s
@@ -88,10 +101,9 @@ while [ true ]; do
fi
# "press play on tape"
- echo "$SYNC -s localhost -p $UPNPPORT start"
$SYNC -s localhost -p $UPNPPORT start
echo "sync playback started on `date +%T`"
- sleep 3
+
fi
done \ No newline at end of file
diff --git a/scripts/utils-sync.sh b/scripts/utils-sync.sh
index fb3c8a8..9d6dc4f 100644
--- a/scripts/utils-sync.sh
+++ b/scripts/utils-sync.sh
@@ -63,13 +63,6 @@ get_bins() {
}
prepare_play() {
- # turn off screensaver
- config_tool -c DMA_ENABLE_SCREENSAVER='0'
- config_tool -c DMA_SCREENSAVER='0'
-
- # kill dmaosd!
- killall dmaosd
-
file=`ls $USBROOT/video`
$SYNC -s localhost -p $UPNPPORT prepare "$USBROOT/video/$file"