Permalink
Browse files

initial commit of ploop

a simple app.bin for wdlxtv to play a file in loop without any interface
  • Loading branch information...
0 parents commit 2dded0cf3ef89ab022917f1d4cb8202c5054dbcf @jaromil committed Apr 29, 2011
Showing with 161 additions and 0 deletions.
  1. +5 −0 AUTHORS
  2. +74 −0 scripts/S88ploop
  3. +82 −0 scripts/assemble-app-bin.sh
5 AUTHORS
@@ -0,0 +1,5 @@
+
+The author of PLoop is Denis Roio <jaromil@nimk.nl>
+
+This software is packaged to run on B-rad's WDLXTV firmware and
+benefits by the research and development of the wdlxtv.com community.
74 scripts/S88ploop
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# Copyright (C) 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# wait the boot to complete
+
+APPROOT=/apps/ploop
+
+if [ "$1" = "stop" ]; then
+ UPNPPORT="`lsof -a -i4 -sTCP:LISTEN -c DMARender -F n | awk -v FS=':' '/^n/ {print $2}'`"
+ $APPROOT/bin/avremote -p $UPNPPORT stop
+ umount /apps/ploop
+ exit 0
+fi
+
+# wait until boot is completed
+sleep 15
+
+touch /tmp/ploop.log
+# USBROOT=`mount | awk '/.tmp.mnt/ { print $3}'`
+USBROOT=`cat /tmp/appsRoot | grep ploop | sed 's/ploop//`
+echo "PLoop app running on USB $USBROOT" >> /tmp/ploop.log
+date >> /tmp/ploop.log
+echo "args: $@" >> /tmp/ploop.log
+
+# if there is a custom osd, we have to wait longer
+ls $USBROOT/ | grep 'osd.bin$'
+if [ $? = 0 ]; then
+ sleep 15
+fi
+
+# find out the UPNP port listening on localhost
+UPNPPORT="`lsof -a -i4 -sTCP:LISTEN -c DMARender -F n | awk -v FS=':' '/^n/ {print $2}'`"
+
+export USBROOT
+export APPROOT
+export UPNPPORT
+
+# wait that the usb is mounted
+sleep 10
+
+# kill dmaosd!
+killall dmaosd
+
+# will get ready for play
+file=`ls $USBROOT/video`
+$APPROOT/bin/avremote -s 127.0.0.1 -p $UPNPPORT load "$USBROOT/video/$file" \
+ >> /tmp/ploop.log
+
+$APPROOT/bin/avremote -s 127.0.0.1 -p $UPNPPORT mode REPEAT_ONE \
+ >> /tmp/ploop.log
+
+$APPROOT/bin/avremote -s 127.0.0.1 -p $UPNPPORT play >> /tmp/ploop.log
+
+# done! this will loop one file indefinitely
+
+# if you need to customize stuff (playlist etc.) you can edit this
+# source and refer to avremote documentation on
+# http://nimk.nl/avremote or ask for help on the WDLXTV forum on
+# http://forum.wdlxtv.com
+
82 scripts/assemble-app-bin.sh
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# This file was part of WDTV Tools (http://wdtvtools.sourceforge.net/).
+# Copyright (C) 2009 Elmar Weber <wdtv@elmarweber.org>
+#
+# adaptation to ploop by Denis Roio <jaromil@dyne.org>
+#
+# 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
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+
+# assembly script for application images
+
+appname=ploop
+
+if [ -z $1 ]; then
+ # no argument, create fresh
+
+ imagefile=./$appname.app.bin
+ loopdir=./$appname.app.loop
+
+# create and fill in appdir
+ appdir=$appname.app
+
+ sudo rm -rf $appdir $imagefile $loopdir
+
+ mkdir -p $appdir
+ mkdir -p $appdir/bin
+ mkdir -p $appdir/etc/init.d
+
+ cp -v src/avremote $appdir/bin &&
+ cp -v scripts/S88ploop $appdir/etc/init.d &&
+ chmod a+x $appdir/etc/init.d/S88ploop &&
+ cp -v README AUTHORS $appdir &&
+
+ sudo chown -R root:root $appdir
+
+ dd if=/dev/zero of=$imagefile bs=1K count=256 &&
+ /sbin/mkfs.ext3 -F $imagefile &&
+ /sbin/tune2fs -c 0 -i 0 $imagefile &&
+ mkdir -p $loopdir &&
+ sudo mount -o loop $imagefile $loopdir &&
+ cp -a $appdir/* $loopdir/ &&
+ sudo rm -rf $loopdir/lost+found &&
+ sudo chown root:root -R $loopdir &&
+ sleep 1 &&
+ sudo umount $loopdir &&
+ sudo rm -rf $loopdir $appdir &&
+ sudo /sbin/fsck.ext3 $imagefile
+
+else
+ # has argument, update existing
+ appname=$1
+ loopdir=/tmp/`basename $appname`.loop
+
+ if ! [ -r $appname ]; then
+ echo "error: $appname doesn't exist"
+ exit 1
+ fi
+ mkdir -p $loopdir
+ sudo mount -o loop $appname $loopdir
+ sudo cp -v scripts/S88ploop $loopdir/etc/init.d &&
+ sudo chmod a+x $loopdir/etc/init.d/S88ploop &&
+ sudo cp -v README AUTHORS $loopdir &&
+
+ sudo chown -R root:root $loopdir
+
+ sudo umount $loopdir
+ sudo sync
+ sudo rm -r $loopdir
+
+fi

0 comments on commit 2dded0c

Please sign in to comment.