summaryrefslogtreecommitdiffstats
path: root/abs/extra/mythappletrailers
diff options
context:
space:
mode:
Diffstat (limited to 'abs/extra/mythappletrailers')
-rw-r--r--abs/extra/mythappletrailers/PKGBUILD49
-rw-r--r--abs/extra/mythappletrailers/apple_all_trailers (renamed from abs/extra/mythappletrailers/all_trailers)0
-rw-r--r--abs/extra/mythappletrailers/apple_shuffle_trailers (renamed from abs/extra/mythappletrailers/shuffle_trailers)0
-rw-r--r--abs/extra/mythappletrailers/fix_aple_url.sh3
-rw-r--r--abs/extra/mythappletrailers/gen_trailer_menu.sh39
-rwxr-xr-xabs/extra/mythappletrailers/loading.sh12
-rwxr-xr-xabs/extra/mythappletrailers/myth_trailers_grabber80
-rw-r--r--abs/extra/mythappletrailers/mythappletrailers.install2
-rw-r--r--abs/extra/mythappletrailers/play_trailer.sh6
-rwxr-xr-xabs/extra/mythappletrailers/trailers2
10 files changed, 93 insertions, 100 deletions
diff --git a/abs/extra/mythappletrailers/PKGBUILD b/abs/extra/mythappletrailers/PKGBUILD
index 140c8b7..89ea17f 100644
--- a/abs/extra/mythappletrailers/PKGBUILD
+++ b/abs/extra/mythappletrailers/PKGBUILD
@@ -3,54 +3,49 @@
pkgname=mythappletrailers
pkgver=0.04.3
-pkgrel=46
+pkgrel=47
pkgdesc="Unofficial Add-on for MythTV to get Apple.com Movie Trailers."
-arch=('i686' 'x86_64')
+arch=('x86_64')
license=('GPL2')
url="http://www.mythtv.org/wiki/index.php/Myth_Apple_Trailers"
depends=('php' 'mythtv' 'mplayer-wrapper')
install=mythappletrailers.install
source=('myth_trailers_grabber' 'appletrailer.xml'\
- 'trailers' 'loading.sh' 'fix_aple_url.sh'\
+ 'trailers' 'loading.sh'\
'play_trailer.sh' 'gen_trailer_menu.sh'\
- 'all_trailers' 'shuffle_trailers'\
+ 'apple_all_trailers' 'apple_shuffle_trailers'\
'appletrailers_is.conf')
#. /usr/MythVantage/bin/install_functions.sh
-build() {
+package() {
MYTHHOME="/home/mythtv"
- mkdir -p $startdir/pkg/usr/bin
- mkdir -p $startdir/pkg/etc/cron.daily
- mkdir -p $startdir/pkg/$MYTHHOME
- mkdir -p $startdir/pkg/usr/share/mythtv/
- cp appletrailer.xml $startdir/pkg/$MYTHHOME/appletrailer.xml
- chown 1000:1000 $startdir/pkg/$MYTHHOME/appletrailer.xml
+ mkdir -p $pkgdir/usr/bin
+ mkdir -p $pkgdir/etc/cron.daily
+ mkdir -p $pkgdir/$MYTHHOME
+ mkdir -p $pkgdir/usr/share/mythtv/
+ cp appletrailer.xml $pkgdir/$MYTHHOME/appletrailer.xml
+ chown 1000:1000 $pkgdir/$MYTHHOME/appletrailer.xml
chmod 755 trailers
chmod 755 myth_trailers_grabber
chmod 755 loading.sh
- cp myth_trailers_grabber $startdir/pkg/usr/bin/
- cp loading.sh $startdir/pkg/usr/bin/
- cp trailers $startdir/pkg/etc/cron.daily/
- install -m755 $srcdir/fix_aple_url.sh $pkgdir/usr/bin
+ cp myth_trailers_grabber $pkgdir/usr/bin/
+ cp loading.sh $pkgdir/usr/bin/
+ cp trailers $pkgdir/etc/cron.daily/
install -m755 $srcdir/play_trailer.sh $pkgdir/usr/bin
install -m755 $srcdir/gen_trailer_menu.sh $pkgdir/usr/bin
- install -m644 $srcdir/all_trailers $pkgdir/home/mythtv
- install -m644 $srcdir/shuffle_trailers $pkgdir/home/mythtv
- chown 1000:1000 $startdir/pkg/$MYTHHOME/*_trailers
+ install -m644 $srcdir/apple_all_trailers $pkgdir/home/mythtv
+ install -m644 $srcdir/apple_shuffle_trailers $pkgdir/home/mythtv
+ chown 1000:1000 $pkgdir/$MYTHHOME/*_trailers
#add in file for gen_is.xml
install -D -m0744 ${srcdir}/appletrailers_is.conf ${pkgdir}/etc/gen_is_xml.d/appletrailers_is.conf
}
-
-
-
-md5sums=('336e68953d0e1e8a0c7a4990f8d43a2b'
+md5sums=('c70339830f6d538035b715ee779a4f2f'
'be0d071981e5536f24aaf67545a96cc5'
- 'a508f2de763f5bec5b4549885c062c8a'
- 'f072ec9c3d78b107e25039758fd5b378'
- 'a2349f844e47fd95a672739177ca44ff'
- '14f153c1efa7ae4e192d87010cbf9f7c'
- '3e9d8014a0e76e2cf8057291d20c9291'
+ '1c5a2730628e696606357ad5378a134c'
+ 'f4a7f6d13ccb61e16934529ad5b7e69a'
+ 'dfaf2c692c0913f489f479a8fa61a243'
+ '5b3d9551d363bfbd6c3529984b317940'
'7af1e58dfab2772dbb6f339481ae8d5d'
'd26681921482cbf334b43f700adf0d29'
'341eb4f98b70b51b9420f58051c8df6a')
diff --git a/abs/extra/mythappletrailers/all_trailers b/abs/extra/mythappletrailers/apple_all_trailers
index 186c49c..186c49c 100644
--- a/abs/extra/mythappletrailers/all_trailers
+++ b/abs/extra/mythappletrailers/apple_all_trailers
diff --git a/abs/extra/mythappletrailers/shuffle_trailers b/abs/extra/mythappletrailers/apple_shuffle_trailers
index f2d3a5e..f2d3a5e 100644
--- a/abs/extra/mythappletrailers/shuffle_trailers
+++ b/abs/extra/mythappletrailers/apple_shuffle_trailers
diff --git a/abs/extra/mythappletrailers/fix_aple_url.sh b/abs/extra/mythappletrailers/fix_aple_url.sh
deleted file mode 100644
index a08be65..0000000
--- a/abs/extra/mythappletrailers/fix_aple_url.sh
+++ /dev/null
@@ -1,3 +0,0 @@
-#!/bin/sh
-cat /home/mythtv/appletrailer.xml | sed -e 's|http:/\/\movies.apple|http:\/\/apple|g' > /tmp/appletrailer.xml
-mv /tmp/appletrailer.xml /home/mythtv
diff --git a/abs/extra/mythappletrailers/gen_trailer_menu.sh b/abs/extra/mythappletrailers/gen_trailer_menu.sh
index 43b2fae..fabf0e0 100644
--- a/abs/extra/mythappletrailers/gen_trailer_menu.sh
+++ b/abs/extra/mythappletrailers/gen_trailer_menu.sh
@@ -4,26 +4,29 @@ sed -n -e 's/.*<action>\(.*\)<\/action>.*/\1/p' /tmp/appletrailer.xml > /tmp/a.l
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 All Trailers</text>" >> /tmp/appletrailer.2.xml
-echo " <action>EXEC /usr/bin/play_trailer.sh /home/mythtv/all_trailers</action>" >> /tmp/appletrailer.2.xml
-echo " </button>" >> /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
-echo " <button>" >> /tmp/appletrailer.2.xml
-echo " <type>VIDEO_BROWSER</type>" >> /tmp/appletrailer.2.xml
-echo " <text>Shuffle Play Trailers</text>" >> /tmp/appletrailer.2.xml
-echo " <action>EXEC /usr/bin/play_trailer.sh /home/mythtv/shuffle_trailers</action>" >> /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>Play Random Trailer</text>" >> /tmp/appletrailer.2.xml
-echo " <action>EXEC loading.sh &amp;&amp; mplayer -fs -zoom -really-quiet -user-agent "QuickTime/7.6.2" -cache 16000 \$(sort -R /home/mythtv/all_trailers | tail -1)</action>" >> /tmp/appletrailer.2.xml
-echo " </button>" >> /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
-
-grep -v TRAILERS /tmp/appletrailer.xml >> /tmp/appletrailer.2.xml
-mv /tmp/b.log /home/mythtv/all_trailers
-mv /tmp/c.log /home/mythtv/shuffle_trailers
+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
+
diff --git a/abs/extra/mythappletrailers/loading.sh b/abs/extra/mythappletrailers/loading.sh
index 55321fa..8b191e1 100755
--- a/abs/extra/mythappletrailers/loading.sh
+++ b/abs/extra/mythappletrailers/loading.sh
@@ -1,5 +1,4 @@
#!/bin/bash
-msg_client.py --timeout 10 --msg "Loading . . . "
#. /etc/osd_cat.cfg || {
# color=yellow
@@ -11,3 +10,14 @@ msg_client.py --timeout 10 --msg "Loading . . . "
#}
#echo -e "Loading . . . " | osd_cat --pos=middle --align=center --delay=10 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font
+
+msg_client.py --timeout 10 --msg "Loading Trailer..." --tag "trailers" &
+sleep 2
+cacheFill=0
+while [[ cacheFill -eq 0 ]]
+do
+ cacheFill=$(tail -n 1 /tmp/.mplayer-status | grep -ci "Cache fill")
+done
+#sleep 1
+msg_client.py --clear --tag "trailers"
+msg_client.py --kill
diff --git a/abs/extra/mythappletrailers/myth_trailers_grabber b/abs/extra/mythappletrailers/myth_trailers_grabber
index ae32e75..074c879 100755
--- a/abs/extra/mythappletrailers/myth_trailers_grabber
+++ b/abs/extra/mythappletrailers/myth_trailers_grabber
@@ -1,25 +1,25 @@
<?php
/**
* Copyright (C) 2007 Ben Leto <undertoe@chemlab.org>
- *
+ *
* Description: Apple Trailer Grabber for mythtv
- *
+ *
* Version 0.4.3
- *
+ *
* Apple Trailer Grabber 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 2 of the License, or
* (at your option) any later version.
- *
+ *
* Apple Trailer Grabber 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, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
+ *
* Usage: read the INSTALL file
* Setup as a cron script to run as frequently as you want
*
@@ -30,8 +30,8 @@
// CONFIGURATION
// command to use when streaming content from the internet - cache 50% before displaying and use 32MB of memory
-$STREAMING_EXEC_CMD = 'loading.sh &amp;&amp; mplayer-wrapper.pl -fs -zoom -really-quiet -user-agent "QuickTime/7.6.2" -cache 16000';
-$APPLE_FEED = 'http://www.apple.com/trailers/home/xml/current.xml';
+$STREAMING_EXEC_CMD = 'loading.sh &amp; mplayer-wrapper.pl -fs -zoom -user-agent "QuickTime/7.6.2" -cache 16000';
+$APPLE_FEED = 'https://trailers.apple.com/trailers/home/xml/current.xml';
/************************************************************************/
// Shouldn't Need To modify anything beyond here
@@ -43,58 +43,54 @@ define("XMLFEED", $APPLE_FEED);
init_main();
-// Function: returns null | init_main ()
+// Function: returns null | init_main ()
// Description: Outputs Apple Trailer XML feed to watchable movie urls in MythTV menu XML format
function init_main()
{
print "<mythmenu name=\"TRAILERS\">\n";
-
+
if(valid_url(XMLFEED)){
-
- // Gather Array of Current Movie Trailers
+ //Gather Array of Current Movie Trailers
//XML Data
$xml_data = url_to_string(XMLFEED);
//Creating Instance of the Class
$xmlObj = new XmlToArray($xml_data);
$arrayData = $xmlObj->createArray();
-
+
foreach($arrayData['records']['movieinfo'] as $Row){
-
+
$MovieTitle = $Row['info'][0]['title'];
$MovieLink = $Row['preview'][0]['large'];
+ $MovieLink = preg_replace("/http:\/\//i", "https://", $MovieLink); //change http:// to https://
$VideoPlayCMD = PLAYERCMD . ' ' . $MovieLink;
-
+
if(!valid_url($MovieLink)){
$MovieTitle = $MovieTitle . '*VIDEO ERROR*';
- $VideoPlayCMD = '';
+ $VideoPlayCMD = '';
}
-
+
print "\t<button>\n";
print "\t\t<type>VIDEO_BROWSER</type>\n";
$MovieTitle = preg_replace('/ & /', ' &amp; ', $MovieTitle);
print "\t\t<text>$MovieTitle</text>\n";
print "\t\t<action>EXEC $VideoPlayCMD</action>\n";
- print "\t</button>\n\n";
-
+ print "\t</button>\n\n";
+
}
}else{
print "\t<button>\n";
print "\t\t<type>VIDEO_BROWSER</type>\n";
print "\t\t<text>Error Grabbing XML Feed</text>\n";
print "\t\t<action></action>\n";
- print "\t</button>\n\n";
+ print "\t</button>\n\n";
}
-
print "</mythmenu>\n";
-
-
-
}
-// Function: returns boolean | valid_url ( var | url to check)
-// Description: Checks to see if a url is a valid page
+// Function: returns boolean | valid_url ( var | url to check)
+// Description: Checks to see if a url is a valid page
function valid_url($str)
{
if(@fopen($str, "r")) {
@@ -104,36 +100,32 @@ function valid_url($str)
}
}
-// Function: returns string | all elements of XML ( var | url to feed)
+// Function: returns string | all elements of XML ( var | url to feed)
// Description: Converts each element in an XML feed to single line string
-// Notes: must have 'allow_url_fopen = On' in php.ini
+// Notes: must have 'allow_url_fopen = On' in php.ini
function url_to_string($url){
$lines = file($url);
foreach ($lines as $line) {
$lineR = trim($line);
}
- $lineR = eregi_replace("<" . "large" . "[^>]*>", "<large>", $lineR); //hack for apple goofy xml
+ $lineR = preg_replace("/<" . "large" . "[^>]*>/i", "<large>", $lineR); //hack for apple goofy xml
return $lineR;
}
-// Class: returns (~) x array | elements of XML ( var | XML in string)
+// Class: returns (~) x array | elements of XML ( var | XML in string)
// Description: Converts each element in an XML feed to an Array
class XmlToArray
{
-
var $xml='';
-
/**
* Default Constructor
* @param $xml = xml data
* @return none
*/
-
function XmlToArray($xml)
{
- $this->xml = $xml;
+ $this->xml = $xml;
}
-
/**
* _struct_to_array($values, &$i)
*
@@ -145,34 +137,34 @@ class XmlToArray
* @param int $i this is the current location in the array
* @return Array
*/
-
+
function _struct_to_array($values, &$i)
{
$child = array();
if (isset($values[$i]['value'])) array_push($child, $values[$i]['value']);
-
+
while ($i++ < count($values)) {
switch ($values[$i]['type']) {
case 'cdata':
array_push($child, $values[$i]['value']);
break;
-
+
case 'complete':
$name = $values[$i]['tag'];
if(!empty($name)){
$child[$name]= ($values[$i]['value'])?($values[$i]['value']):'';
- if(isset($values[$i]['attributes'])) {
+ if(isset($values[$i]['attributes'])) {
$child[$name] = $values[$i]['attributes'];
}
- }
+ }
break;
-
+
case 'open':
$name = $values[$i]['tag'];
$size = isset($child[$name]) ? sizeof($child[$name]) : 0;
$child[$name][$size] = $this->_struct_to_array($values, $i);
break;
-
+
case 'close':
return $child;
break;
@@ -180,7 +172,7 @@ class XmlToArray
}
return $child;
}//_struct_to_array
-
+
/**
* createArray($data)
*
@@ -207,8 +199,6 @@ class XmlToArray
$array[$name] = $this->_struct_to_array($values, $i);
return $array;
}
-
-
}
?>
diff --git a/abs/extra/mythappletrailers/mythappletrailers.install b/abs/extra/mythappletrailers/mythappletrailers.install
index 602b96a..b8e3b97 100644
--- a/abs/extra/mythappletrailers/mythappletrailers.install
+++ b/abs/extra/mythappletrailers/mythappletrailers.install
@@ -9,7 +9,7 @@ post_upgrade() {
/usr/LH/bin/gen_is_xml.py
if [ -e /usr/share/mythtv/themes/defaultmenu/appletrailer.xml ]
then
- exit
+ exit
else
ln -s /$MYTHHOME/appletrailer.xml /usr/share/mythtv/themes/defaultmenu/appletrailer.xml
fi
diff --git a/abs/extra/mythappletrailers/play_trailer.sh b/abs/extra/mythappletrailers/play_trailer.sh
index b584bd1..7ea6e9d 100644
--- a/abs/extra/mythappletrailers/play_trailer.sh
+++ b/abs/extra/mythappletrailers/play_trailer.sh
@@ -1,8 +1,6 @@
#!/bin/bash
for TRAILER in $(cat $1)
do
- /usr/bin/loading.sh
- mplayer -fs -zoom -really-quiet -user-agent "QuickTime/7.6.2" -cache 16000 $TRAILER
+ loading.sh &
+ mplayer-wrapper.pl -fs -zoom -user-agent "QuickTime/7.6.2" -cache 16000 $TRAILER
done
-
-
diff --git a/abs/extra/mythappletrailers/trailers b/abs/extra/mythappletrailers/trailers
index 9611439..fb03498 100755
--- a/abs/extra/mythappletrailers/trailers
+++ b/abs/extra/mythappletrailers/trailers
@@ -1,2 +1,2 @@
#!/bin/sh
-su mythtv -c '/usr/bin/php -q /usr/bin/myth_trailers_grabber > /home/mythtv/appletrailer.xml && /usr/bin/fix_aple_url.sh && /usr/bin/gen_trailer_menu.sh' 2>/dev/null
+su mythtv -c '/usr/bin/php -q /usr/bin/myth_trailers_grabber > /home/mythtv/appletrailer.xml && /usr/bin/gen_trailer_menu.sh' 2>/dev/null