summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJaromil <jaromil@dyne.org>2011-08-19 11:23:38 (GMT)
committer Jaromil <jaromil@dyne.org>2011-08-19 11:23:38 (GMT)
commitff904c7f22c05a84245e21838d988e68b205e481 (patch)
tree8f4709f7fcef1680fc57b9e58422f9e83eb288d6
parentf521699506584b5d55922d92daa5bc7a32314d9c (diff)
fixed sync playback loop
still plays only once, to be fixed the loop
-rw-r--r--.gitignore7
-rw-r--r--scripts/S88hdsync3
-rwxr-xr-xscripts/listen-sync.sh19
-rwxr-xr-xscripts/offer-sync.sh21
-rw-r--r--scripts/utils-sync.sh7
5 files changed, 41 insertions, 16 deletions
diff --git a/.gitignore b/.gitignore
index e16dd9f..a1c296b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -21,7 +21,6 @@ depcomp
install-sh
missing
stamp-h1
-wdhdsync-loop
-wdhdsync.app
-wdhdsync.app.bin
-wdlxtv_optware.app.bin
+hdsync-loop
+hdsync.app
+hdsync.app.bin
diff --git a/scripts/S88hdsync b/scripts/S88hdsync
index 61764eb..d49a575 100644
--- a/scripts/S88hdsync
+++ b/scripts/S88hdsync
@@ -75,6 +75,7 @@ fi
UPNPPORT="`lsof -a -i4 -sTCP:LISTEN -c DMARender -F n | awk -v FS=':' '/^n/ {print $2}'`"
export UPNPPORT
+echo "UPNP port detected listening on $UPNPPORT" >> /tmp/hdsync.log
# this exports UPNPPORT if a UPNP daemon is found listening
# wait that the usb is mounted
@@ -84,7 +85,9 @@ sleep 10
prepare_play >> /tmp/hdsync.log
if [ "$HDSYNC_CHANNEL" = "1" ]; then
+ echo "Offering sync" >> /tmp/hdsync.log
$APPROOT/bin/offer-sync.sh >> /tmp/hdsync.log
else
+ echo "Listening for sync offers" >> /tmp/hdsync.log
$APPROOT/bin/listen-sync.sh >> /tmp/hdsync.log
fi
diff --git a/scripts/listen-sync.sh b/scripts/listen-sync.sh
index 5be33a0..41c132d 100755
--- a/scripts/listen-sync.sh
+++ b/scripts/listen-sync.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2010 Denis Roio <jaromil@nimk.nl>
+# Copyright (C) 2010-2011 Denis Roio <jaromil@nimk.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -28,12 +28,23 @@ touch /tmp/hdsync.reply
echo $answer >> /tmp/hdsync.reply
done) &
+# # check that the video is prepared
+# while [ true ]; do
+# sleep 3
+# lsof | grep 'mnt.*video' > /dev/null
+# if [ $? == 0 ]; then # a video is loaded
+# break
+# fi
+# done
+
# loop continuously
while [ true ]; do
sleep 3
- lsof | grep video > /dev/null
- if [ $? == 1 ]; then
+ # check that the video is not already playing
+ state=`$AV -s localhost -p $UPNPPORT get 2>&1| awk '/^TInfo:/ {print $2}'`
+ if [ "$state" == "PAUSED_PLAYBACK" ]; then
+
rm -f /tmp/hdsync.reply
touch /tmp/hdsync.reply
@@ -69,9 +80,11 @@ 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 6f1d0ec..2eb59b2 100755
--- a/scripts/offer-sync.sh
+++ b/scripts/offer-sync.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2010 Denis Roio <jaromil@nimk.nl>
+# Copyright (C) 2010-2011 Denis Roio <jaromil@nimk.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -27,11 +27,22 @@ touch /tmp/hdsync.reply
echo $answer >> /tmp/hdsync.reply
done) &
+# # check that the video is prepared
+# while [ true ]; do
+# sleep 3
+# lsof | grep 'mnt.*video' > /dev/null
+# if [ $? == 0 ]; then # a video is loaded
+# break
+# fi
+# done
+
# loop continuously
while [ true ]; do
- sleep 5
- lsof | grep video > /dev/null
- if [ $? == 1 ]; then # no video is running
+ sleep 3
+
+ # check that the video is not already playing
+ state=`$AV -s localhost -p $UPNPPORT get 2>&1| awk '/^TInfo:/ {print $2}'`
+ if [ "$state" == "PAUSED_PLAYBACK" ]; then
rm -f /tmp/hdsync.reply
touch /tmp/hdsync.reply
@@ -77,8 +88,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 \ No newline at end of file
diff --git a/scripts/utils-sync.sh b/scripts/utils-sync.sh
index b393cb9..fb3c8a8 100644
--- a/scripts/utils-sync.sh
+++ b/scripts/utils-sync.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# Copyright (C) 2010 Denis Roio <jaromil@nimk.nl>
+# Copyright (C) 2010-2011 Denis Roio <jaromil@nimk.nl>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -59,7 +59,7 @@ get_bins() {
echo "$NC"
echo "$AV"
echo "$SYNC"
- export BC NC AV
+ export BC NC AV SYNC
}
prepare_play() {
@@ -76,8 +76,5 @@ prepare_play() {
# hdsync prepare makes: load, play and pause
sync
- # $AV -p $UPNPPORT pause
- # sync
-
echo "ready to play on `date +%T`"
}