[mythtv-users] mythtv apple trailers updated to v0.4.2.2

Jay Foster jayf0ster at sbcglobal.net
Tue Jun 30 15:10:17 UTC 2009


> > I installed this on Mythbuntu 8.10 0.21-fixes. 
> One thing you might add to
> > the installation notes is to install the cURL
> packages.  I had to do this
> > before the grabber script would run.  I like the
> download option, since I
> > only have a slow DSL connection which doesn't support
> streaming.
> >
> > There is an Apple Movie Trailers thing in Mythbuntu
> under the online
> > streams section.  I gather that this Apple
> Trailers is not related.  The
> > one that came with Mythbuntu has more trailers,
> organized by categories,
> > and displays a synopsis for each trailer.  It is
> also streaming only and
> > low resolution, so I really like the download option
> and 'HD' options.  Is
> > it possible to add a movie trailer synopsis for each
> one?
> >
> > One thing I noticed is that while the grabber script
> is running and the
> > appletrailer.xml file is being re-created, the
> appletrailer.xml file is
> > not parseable.  If the grabber runs to completion
> while no one is using
> > Myth frontend (either in the wee hours or you have a
> very fast internet
> > connection) this is transparent.  Would it be
> better to have the grabber
> > script re-create the xml file in a temporary file and
> then copy it over
> > the appletrailer.xml file when complete?
> 
> Hey, I will try and have a look at these additions, not
> sure how adding
> the synopsis would work. Currently I have my trailers
> viewable in
> MythVideo so I guess you would need to insert the data from
> the apple
> website into the mythtv database.
> 
> Creating a temporary working file for the appletrailer.xml
> should be
> straight forward so will attempt that first.
> 
> Cheers
> 
> Dave K.
I added my own wrapper script that calls the grabber script.  I use this from the command line and from the cron job.  It manages the temporary file part outside of the grabber script.  It also validates the resulting XML file generated by the grabber script, because if the grabber script fails for some reason the XML file is left syntactically incorrect, which might cause MythTV frontend problems when trying to parse it.

#!/bin/sh
LOGPATH=$HOME/log
LOGFILE=$LOGPATH/appletrailer.log

update_trailers()
{
	echo "Starting Apple Movie Trailers update at " `date`
	/usr/bin/php -q $HOME/bin/myth_trailers_grabber > $HOME/appletrailer.tmp
	RC=$?
	if [ $RC -eq 0 ]; then
		xmllint --noout $HOME/appletrailer.tmp
		RC=$?
		if [ $RC -eq 0 ]; then
			NUMTRAILERS_PREV=`grep '<button' $HOME/appletrailer.xml | wc -l`
			NUMTRAILERS_NEW=`grep '<button' $HOME/appletrailer.tmp | wc -l`
			mv $HOME/appletrailer.tmp $HOME/appletrailer.xml
			echo "Update successful."
			echo "  Had $NUMTRAILERS_PREV trailers."
			echo "  Have $NUMTRAILERS_NEW trailers."
			# TODO: Look in the grabber script.  If using download, 
			#       check download directory.  If exists, count the
			#       number of files there and report them.
		else
			echo "xmllint failed: $RC"
		fi
	else
		echo "myth_trailers_grabber failed: $RC"
	fi
	echo "Completed Apple Movie Trailers update at " `date`
}

update_trailers >> $LOGFILE 2>&1


Is there a way to make the XML file contain entries for all of the trailer files in the download directory instead of just the last 20 trailers downloaded?

Jay



More information about the mythtv-users mailing list