summaryrefslogtreecommitdiffstats
path: root/abs/extra/mythappletrailers/gen_trailer_menu.sh
blob: fabf0e0be4bf1552ff0d08585be7eb2d861f440a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#!/bin/bash
cp /home/mythtv/appletrailer.xml /tmp
sed -n -e 's/.*<action>\(.*\)<\/action>.*/\1/p' /tmp/appletrailer.xml > /tmp/a.log
awk < /tmp/a.log '{ print $NF }' > /tmp/b.log
sort -R /tmp/b.log > /tmp/c.log
echo "<mythmenu name=\"TRAILERS\">" > /tmp/appletrailer.2.xml
echo "    <button>" >> /tmp/appletrailer.2.xml
echo "        <type>VIDEO_BROWSER</type>" >> /tmp/appletrailer.2.xml
echo "        <text>Play Random Trailer</text>" >> /tmp/appletrailer.2.xml
echo "        <action>EXEC loading.sh &amp; mplayer-wrapper.pl -fs -zoom -user-agent "QuickTime/7.6.2" -cache 16000 \$(sort -R /home/mythtv/apple_all_trailers | tail -1)</action>" >> /tmp/appletrailer.2.xml
echo "    </button>" >> /tmp/appletrailer.2.xml
echo "" >> /tmp/appletrailer.2.xml

grep -v mythmenu /tmp/appletrailer.xml >> /tmp/appletrailer.2.xml

echo "    <button>" >> /tmp/appletrailer.2.xml
echo "        <type>VIDEO_BROWSER</type>" >> /tmp/appletrailer.2.xml
echo "        <text>Play All Trailers</text>" >> /tmp/appletrailer.2.xml
echo "        <action>EXEC play_trailer.sh /home/mythtv/apple_all_trailers</action>" >> /tmp/appletrailer.2.xml
echo "        </button>" >> /tmp/appletrailer.2.xml
echo "" >> /tmp/appletrailer.2.xml
echo "    <button>" >> /tmp/appletrailer.2.xml
echo "        <type>VIDEO_BROWSER</type>" >> /tmp/appletrailer.2.xml
echo "        <text>Shuffle All Trailers</text>" >> /tmp/appletrailer.2.xml
echo "        <action>EXEC play_trailer.sh /home/mythtv/apple_shuffle_trailers</action>" >> /tmp/appletrailer.2.xml
echo "    </button>" >> /tmp/appletrailer.2.xml
echo "</mythmenu>" >> /tmp/appletrailer.2.xml
echo "" >> /tmp/appletrailer.2.xml
mv /tmp/b.log /home/mythtv/apple_all_trailers
mv /tmp/c.log /home/mythtv/apple_shuffle_trailers
mv /tmp/appletrailer.2.xml /home/mythtv/appletrailer.xml