From 94fe26b46f3b4a29ed564a6286b2fb75dd1ffc2a Mon Sep 17 00:00:00 2001
From: Cecil <knoppmyth@gmail.com>
Date: Sun, 10 Jun 2012 16:39:50 -0700
Subject: dolphin-emu:Added a more robust scanner.

---
 abs/extra/community/dolphin-emu/PKGBUILD            |  4 ++--
 abs/extra/community/dolphin-emu/dolphin-emu_scan.sh | 18 +++++++++++++++---
 2 files changed, 17 insertions(+), 5 deletions(-)

diff --git a/abs/extra/community/dolphin-emu/PKGBUILD b/abs/extra/community/dolphin-emu/PKGBUILD
index a75a929..2c4d3b6 100644
--- a/abs/extra/community/dolphin-emu/PKGBUILD
+++ b/abs/extra/community/dolphin-emu/PKGBUILD
@@ -5,7 +5,7 @@
 
 pkgname=dolphin-emu
 pkgver=3.0
-pkgrel=10
+pkgrel=11
 epoch=1
 pkgdesc="A GameCube and Wii emulator (stable git branch)"
 arch=('i686' 'x86_64')
@@ -84,4 +84,4 @@ md5sums=('feed4580c2e6bfbc7f6c67dad861daae'
          'd15c51f547b4bd47e510faac40bcc9d6'
          'ab7a9b9cfe03db65c881134c0f02bda0'
          '1d03499e0abab56285bc97176d311bf1'
-         '4d2304318e82fd9115810b7a13fa5ad0')
+         'af44dd20626ce26d0a07dadc37c20233')
diff --git a/abs/extra/community/dolphin-emu/dolphin-emu_scan.sh b/abs/extra/community/dolphin-emu/dolphin-emu_scan.sh
index 615cac8..804553e 100644
--- a/abs/extra/community/dolphin-emu/dolphin-emu_scan.sh
+++ b/abs/extra/community/dolphin-emu/dolphin-emu_scan.sh
@@ -12,14 +12,24 @@
 EXTNS=('[eE][lL][fF]' '[dD][oO][lL]' '[gG][cC][mM]' '[iI][sS][oO]' '[cC][iI][sS][oO]' '[gG][cC][zZ]' '[wW][aA][dD]')
 DIR=/myth/games/dolphin-emu/roms
 rm -fr /tmp/dolphin*
-echo -e "Scanning for games and creating menu." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+echo -e "Scanning for games." | osd_cat --pos=middle --align=center --delay=2 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
 for EXT in ${EXTNS[@]}
 do
 	if [ -d "$DIR" ]; then
 	cd $DIR
-	ls *.$EXT >> /tmp/dolphin-emu.games
+	ls *.$EXT >> /tmp/dolphin-emu.games 
 	fi
 done
+sleep 3
+if [ -s /tmp/dolphin-emu.games ]; then
+	echo -e "Creating menu." | osd_cat --pos=middle --align=center --delay=2 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+	sleep 3
+else
+	echo -e "No games detected. Ensure you have your files in $DIR." | osd_cat --pos=middle --align=center --delay=4 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+	sleep 5
+	exit 0
+fi
+
 echo "<mythmenu name=\"DOLPHIN\">" > /tmp/dolphin-emu_games.xml
 
 while read line
@@ -27,8 +37,10 @@ do
 	echo "  <button>" >> /tmp/dolphin-emu_games.xml
 	echo "    <type>MENU_DOLPHIN</type>" >> /tmp/dolphin-emu_games.xml
 	echo "    <text>$(echo "$line"  | sed 's/.\{4\}$//')</text>" >> /tmp/dolphin-emu_games.xml
-	echo "    <action>EXEC /usr/bin/dolphin-emu -b -e $DIR/"$line"</action>" >> /tmp/dolphin-emu_games.xml
+	echo "    <action>EXEC /usr/bin/dolphin-emu -b -e $DIR/$(echo "$line" | sed "s/'/\\\\'/g" | sed 's/ /\\ /g')</action>" >> /tmp/dolphin-emu_games.xml
 	echo "  </button>" >> /tmp/dolphin-emu_games.xml
 done < /tmp/dolphin-emu.games
 echo "</mythmenu>" >> /tmp/dolphin-emu_games.xml
 sudo mv /tmp/dolphin-emu_games.xml /usr/share/mythtv/themes/defaultmenu/
+echo -e "Menu created." | osd_cat --pos=middle --align=center --delay=2 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font &
+sleep 2
-- 
cgit v0.12