[mythtv-users] MythTV Player 1.1.5 available to all on Google Play Store

dennis deg at outlook.com
Thu Apr 16 03:15:38 UTC 2015


On the topic of the streaming directory never getting cleaned up.

I put together a little shell script that I run from cron on a daily 
basis.  It looks for streams that are over 1 day old and delete the 
files out of the streaming directory.   It also removes the entry from 
the livestream table.  This assumes the SQL parameters are set in the 
/etc/mythtv/config.xml file.  This is a quick hack workaround until it 
gets officially fixed in the backend.   Run at your own risk ( but it 
works for me).  Just thought I would share.

The app is working well with my 0.28 server,  now that I figured out 
what player to use with what files.  VLC or the internal player won't 
play my mp4 encoded files streamed with the app, but 'ES Media Player' 
does.

Nice work on the app!






-------------- next part --------------
# Set seconds to save streams
# 86400 = 1 day

SAVE_SECONDS=86400

# Set SQL information 
CONFIG=/etc/mythtv/config.xml
SQLUSER=`grep "<UserName>" $CONFIG | cut -f2 -d">" | cut -f1 -d"<"` 
SQLPASS=`grep "<Password>" $CONFIG | cut -f2 -d">" | cut -f1 -d"<"`
DB=`grep "<DatabaseName>" $CONFIG | cut -f2 -d">" | cut -f1 -d"<"`
 
# Query for records where lastmodified is older than SAVE_SECONDS
QUERY="select id, outdir, outbase
from livestream WHERE 
UNIX_TIMESTAMP(CONVERT_TZ(lastmodified,'UTC',@@session.time_zone)) < UNIX_TIMESTAMP(now()) - $SAVE_SECONDS ;"

# Run query and remove files matching each entry
mysql -N -B -u$SQLUSER -p$SQLPASS -e "$QUERY" $DB | while read id outdir outbase
do
	echo "Cleaning up id=$id, outdir=$outdir, outbase=$outbase"
	cmd="rm -f $outdir/$outbase*"
	$cmd
	#remove record from database
	ACTION="delete from livestream where id=$id;"
	mysql -N -B -u$SQLUSER -p$SQLPASS -e "$ACTION" $DB 
done





More information about the mythtv-users mailing list