diff options
author | James Meyer <james.meyer@operamail.com> | 2010-08-30 22:24:02 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2010-08-30 22:24:02 (GMT) |
commit | c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc (patch) | |
tree | f4e4f7a91e1d9d90033fd99d89e5e26a2c144528 /abs/core/linhes-scripts | |
parent | 0e7b327a1ae444233f1308a95420f70540ad74a3 (diff) | |
download | linhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.zip linhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.tar.gz linhes_pkgbuild-c4bd4457b5d640e1c8f5afbca7cd54c53691e5fc.tar.bz2 |
RSYNC CORE:
resync core-testing -> core
Signed-off-by: James Meyer <james.meyer@operamail.com>
Diffstat (limited to 'abs/core/linhes-scripts')
22 files changed, 1166 insertions, 61 deletions
diff --git a/abs/core/linhes-scripts/770-wrapper.sh b/abs/core/linhes-scripts/770-wrapper.sh index 65573f4..3095541 100755 --- a/abs/core/linhes-scripts/770-wrapper.sh +++ b/abs/core/linhes-scripts/770-wrapper.sh @@ -26,7 +26,7 @@ fi # Transcode the file -perl /usr/local/bin/770-encode.pl -q -p mplayer $VIDEODIR/$FILENAME $DIROUT/$TITLE-$STARTTIME.avi +perl /usr/bin/tablet-encode -q -p mplayer $VIDEODIR/$FILENAME $DIROUT/$TITLE-$STARTTIME.avi chmod 664 $DIROUT/$TITLE-$STARTTIME.avi diff --git a/abs/core/linhes-scripts/PKGBUILD b/abs/core/linhes-scripts/PKGBUILD index 4b3244f..d4bdc50 100644 --- a/abs/core/linhes-scripts/PKGBUILD +++ b/abs/core/linhes-scripts/PKGBUILD @@ -3,12 +3,13 @@ pkgname=linhes-scripts pkgver=1 -pkgrel=35 +pkgrel=77 pkgdesc="Various scripts that help to make LinHES, LinHES." arch=('i686' 'x86_64') license=('GPL2') depends=('xosd' 'cpulimit') url="http://linhes.org/" +install="linhes-scripts.install" source=( myth2xvid shootscreens.sh @@ -23,6 +24,7 @@ pause-mythcommflag.sh myth2x264 770-wrapper.sh mythwelcome-set-alarm.sh +mythwelcome-config.py pause_mythcommflag limit-mythcommflag.sh vdpau-detector @@ -32,12 +34,21 @@ run-limit-mythcommflag linhes_update.sh linhes_update2.sh linhes_update3.sh +install_hulu.sh +update_schema_021_to_022.sh +upgrade_linhes.sh +remove_php_mythvideo.sh +removecommercials.sh +system-cleanup.sh +myth2fuze +dct700-cc.sh +qip7100-cc.sh ) build() { cd $startdir/src mkdir -p $startdir/pkg/usr/LH/bin - install -D -m755 myt* 770* idle.sh imp* shoo* *commflag*sh mplayer* vdpau* screen* linhes_* $startdir/pkg/usr/LH/bin + install -D -m755 myt* 770* *.sh imp* shoo* *commflag*sh mplayer* vdpau* screen* linhes_* install_hulu.sh $startdir/pkg/usr/LH/bin mkdir -p $startdir/pkg/etc/sv/pause-mythcommflag/supervise cp run-pause-mythcommflag $startdir/pkg/etc/sv/pause-mythcommflag/run mkdir -p $startdir/pkg/etc/sv/limit-mythcommflag/supervise @@ -45,3 +56,36 @@ build() { mkdir -p $startdir/pkg/etc/logrotate.d/ cp pause_mythcommflag $startdir/pkg/etc/logrotate.d/ } + +md5sums=('f56985b2d602e11dc1e10d3e7848b2a5' + '9a2181cdc0bc9cc8b42101f19620def8' + '9ae2cd7a0c42d57ad8b5f515d7d60196' + '1274bad3fb7296f00acd2d44804bad14' + '47225fa9b6c953d56f6ede84d921a300' + '6b6e7d34a4bda6d608d150039adefd07' + '3fe554dbbf7d09e1f9925032ba888bf5' + '18263972b6326e140bbef0bb7dfa2da9' + '410795ef9039e4c6c0484e706ecfd567' + '0750d7c65109d12aa536f312a38410d1' + 'ac2a4a6b4100f4d7bfb9ecd9356c8c6e' + 'd2b475821f902c5e081e7da43a35e6ac' + '95c092f67036a361ef7a57436f44332e' + 'a87e7394bfb3fcc5c2419a2f9ae9b9aa' + '3b776bbff68906ddc2f62b7e0dde3fe4' + '15f3143d2b1369da431e4268029aba40' + '3d0adf26280cde55a0c47188fff34826' + '93aaa2940e33ec9ebb305b839ac46a3e' + '27a8b3680f3c631a582064fd26ab8746' + 'b527b01d119d3bc33b8fa69bdf1082bb' + 'c537c44156d8404016cc4b405b092d45' + '4e66f302a77f1a857476e7f289d0c157' + 'be324dba44ae96676973a74421944853' + 'ccca6bdbbd86b203a3eecdbbe363e701' + '65629302a4d2c3adf88cdf0ebc10d493' + '2734054f08c4c885bb9070dce239d4c3' + '87b0dc855181f98516acb18a7d551601' + '25c1baeb97a49656456ae33f7e7a9f06' + '2fb25aef03ffd1282414d8cca3df7056' + 'd2a29444ab9036fb385bbf044daf1ff5' + 'df727c98350a64e2171c950bbefc9c5d' + '7b890e7044db38e8d439f67e398af206') diff --git a/abs/core/linhes-scripts/dct700-cc.sh b/abs/core/linhes-scripts/dct700-cc.sh new file mode 100644 index 0000000..c8d8cf6 --- /dev/null +++ b/abs/core/linhes-scripts/dct700-cc.sh @@ -0,0 +1,27 @@ +#!/bin/bash +#Script to control DCT 700/2524 on emitter #1 of CommandIR +irsend set_transmitters 1 +REMOTE_NAME=DCT700 +cmd="$1" +irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME menu +sleep 1 +irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME exit +sleep 1 + +case $cmd in + [0-9]*) + for digit in $(echo $1 | sed -e 's/./& /g'); do + irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME $digit + sleep .2 + # If things work OK with sleep 1, try this for faster channel changes: + # sleep 0.3 + done + irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME ok +sleep .3 + irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME exit + ;; + + *) + irsend SEND_ONCE $REMOTE_NAME $cmd + ;; +esac diff --git a/abs/core/linhes-scripts/install_hulu.sh b/abs/core/linhes-scripts/install_hulu.sh new file mode 100644 index 0000000..9b06b2e --- /dev/null +++ b/abs/core/linhes-scripts/install_hulu.sh @@ -0,0 +1,70 @@ +#!/bin/bash +#install_hulu.sh +if [ -e /tmp/huludesktop_i386.deb ] +then +cd /tmp +deb2targz huludesktop_i386.deb +tar -xzvf huludesktop_i386.tar.gz -C / +else +echo "Cannot find huludesktop_i386.deb." +echo "Please download it from http://www.hulu.com/labs/hulu-desktop-linux" +echo "Then copy (or move) it to /tmp" +exit +fi +if grep -q Hulu /usr/share/mythtv/themes/defaultmenu/is.xml +then +echo "Hulu Desktop exist in Online Streams!" +else + mv /usr/share/mythtv/themes/defaultmenu/is.xml /tmp + grep -v -e /mythmenu /tmp/is.xml > /tmp/is.xml.tmp + echo "<!--#Hulu-->" >> /tmp/is.xml.tmp + echo " <button>" >> /tmp/is.xml.tmp + echo " <type>STREAM</type>" >> /tmp/is.xml.tmp + echo " <text>Hulu Desktop</text>" >> /tmp/is.xml.tmp + echo " <action>EXEC huludesktop</action>" >> /tmp/is.xml.tmp + echo " </button>" >> /tmp/is.xml.tmp + echo "<!--#Hulu-->" >> /tmp/is.xml.tmp + echo "" >> /tmp/is.xml.tmp + echo "</mythmenu>" >> /tmp/is.xml.tmp + mv /tmp/is.xml.tmp /usr/share/mythtv/themes/defaultmenu/is.xml +echo "Hulu Desktop has been added to Online Streams!" +fi +if [ -e /home/mythtv/.huludesktop ] +then +echo "Found existing Hulu configuration file." +else +cat >> /home/mythtv/.huludesktop << EOF +[display] +fullscreen = TRUE +width = 1024 +height = 576 +pos_x = 201 +pos_y = 179 + +[remote] +lirc_device = /dev/lircd +lirc_remote_identifier = mceusb +lirc_release_suffix = _UP +lirc_repeat_threshold = 10 +button_name_up = Up +button_name_down = Down +button_name_left = Left +button_name_right = Right +button_name_select = OK +button_name_menu = Home + +[flash] +flash_location = /usr/lib/mozilla/plugins/libflashplayer.so + +[screensaver] +suspend_script = /usr/bin/xscreensaver-command -deactivate +resume_script = /usr/bin/xscreensaver-command -activate + +[version] +latest = (null) +eula_version = 0 +EOF +chown mythtv.mythtv /home/mythtv/.huludesktop +fi +echo "Integration of Hulu Desktop is now complete!" +echo "Thanks for using LinHES!" diff --git a/abs/core/linhes-scripts/limit-mythcommflag.sh b/abs/core/linhes-scripts/limit-mythcommflag.sh index 8ca61c7..5cd81bb 100755 --- a/abs/core/linhes-scripts/limit-mythcommflag.sh +++ b/abs/core/linhes-scripts/limit-mythcommflag.sh @@ -1,6 +1,7 @@ #!/bin/bash -# limit-mythcommflag.sh v0.1 05/17/09 -# Utility to automatically limit mythcommflag if CPU usage is above a certain level. +# limit-mythcommflag.sh v0.2 03/2/10 +# Utility to automatically limit mythcommflag if CPU system load is above a certain level +# and if backend usage is above a certain level # Uses cpulimit from http://cpulimit.sourceforge.net/ # Free for any use. # Installation: @@ -8,47 +9,83 @@ # chmod +x /usr/LH/bin/limit-mythcommflag.sh # Usage: Executed from runit limit-mythcommflag at boot -# Threshold for when mythcommflag will be paused -CPUTHRESHOLD=43 - -# Limit mythcommflag to percentage -LIMITCPU=20 - -# Log file to write (use /dev/null for no log) -#LOG=/var/log/mythtv/limit-mythcommflag.log -LOG=/dev/null - +#-----OPTIONS______ # Number of seconds to wait between checking for mythcommflag process SLEEP=5 +# Backend and Frontend thresholds above which mythcommflag is stopped +BETHRESHOLD=30 +FETHRESHOLD=55 -#sleep $SLEEP +# FUNCTIONS +limit_cpu() +# Arg_1 = LimitedRangeNum; Arg_2 = CPULimitPercent; Arg_3 = Commflag PID +{ +if [ $ALREADYLIMITED -ne $1 ] ; then + if [ $cpulimit_pid -ne 0 ]; then + kill $cpulimit_pid + fi + cpulimit -p $3 -l $2 & + cpulimit_pid=$! + ALREADYLIMITED=$1 +fi +} -touch $LOG +stop_limit() +{ +if [ $ALREADYLIMITED -ne 0 ]; then + if [ $cpulimit_pid -ne 0 ]; then + kill $cpulimit_pid + cpulimit_pid=0 + fi + ALREADYLIMITED=0 +fi +} ALREADYLIMITED=0 +STOPPED=0 +cpulimit_pid=0 while true; do PROCCOMMFLAG=`pidof mythcommflag` - if [ -n "${PROCCOMMFLAG}" ] - then - FRONTENDCPU=`top -bn1u mythtv | grep mythfrontend | awk '{ print $9 }'` - if [ "$FRONTENDCPU" -ge "$CPUTHRESHOLD" ] - then - echo "$(date) FE CPU $FRONTENDCPU% is greater than $CPUTHRESHOLD%, LIMIT Commflagging" # >> $LOG - if [ $ALREADYLIMITED -eq 0 ]; then - cpulimit -e mythcommflag -l $LIMITCPU & - cpulimit_pid=$! - ALREADYLIMITED=1 + if [ -n "${PROCCOMMFLAG}" ]; then + BACKENDCPU=`top -bn1u mythtv | grep -m 1 mythbackend | awk '{ print $9 }'` + FRONTENDCPU=`top -bn1u mythtv | grep -m 1 mythfrontend | awk '{ print $9 }'` + if [ "$FRONTENDCPU" = "" ]; then + FRONTENDCPU=0 + fi + if [ "$BACKENDCPU" -ge "$BETHRESHOLD" ]; then + if [ "$FRONTENDCPU" -ge $FETHRESHOLD ]; then + if [ $STOPPED -eq 0 ]; then + kill -s STOP $PROCCOMMFLAG + STOPPED=1 + fi + else + if [ $STOPPED -eq 1 ]; then + kill -s CONT $PROCCOMMFLAG + STOPPED=0 + fi + stop_limit fi else - echo "$(date) FE CPU $FRONTENDCPU% is less than $CPUTHRESHOLD%, UNLIMIT Commflagging" #>> $LOG - if [ $ALREADYLIMITED -eq 1 ]; then - kill $cpulimit_pid - ALREADYLIMITED=0 + if [ $STOPPED -eq 1 ]; then + kill -s CONT $PROCCOMMFLAG + STOPPED=0 fi + case $FRONTENDCPU in + [0-9]|[0-3][0-9] ) + stop_limit;; + [4-5][0-9] ) + limit_cpu "1" "70" $PROCCOMMFLAG;; + [6-7][0-9] ) + limit_cpu "2" "50" $PROCCOMMFLAG;; + [8-9][0-9] ) + limit_cpu "3" "20" $PROCCOMMFLAG;; + [1][0-9][0-9] ) + limit_cpu "4" "10" $PROCCOMMFLAG;; + esac fi # else -# echo "No COMMFLAG Process Active" >> $LOG +# echo "No COMMFLAG Process Active" fi sleep $SLEEP done diff --git a/abs/core/linhes-scripts/linhes-scripts.install b/abs/core/linhes-scripts/linhes-scripts.install new file mode 100644 index 0000000..f554bd0 --- /dev/null +++ b/abs/core/linhes-scripts/linhes-scripts.install @@ -0,0 +1,7 @@ + +post_upgrade() { + . /etc/profile + /usr/LH/bin/remove_php_mythvideo.sh +} + +# vim:set ts=2 sw=2 et: diff --git a/abs/core/linhes-scripts/linhes_update.sh b/abs/core/linhes-scripts/linhes_update.sh index 3b455e0..39d2817 100644 --- a/abs/core/linhes-scripts/linhes_update.sh +++ b/abs/core/linhes-scripts/linhes_update.sh @@ -1,26 +1,27 @@ #!/bin/bash dsply () { - if grep -q Updates\ Available /usr/share/mythtv/linhes.xml + if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml then - killall osd_cat + killall -9 osd_cat echo -e "Updates available!\n Exit and reenter Service Menu\n to perform updates." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 10 -A centre exit else + killall -9 osd_cat echo -e "Checking for updates." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 300 -A centre & fi } chck () { sudo pacman -Sy - sudo pacman -Qu > /tmp/check_update - sudo grep Target /tmp/check_update > /tmp/to_be_upgraded + sudo pacman -Qu > /tmp/to_be_upgraded +# sudo grep Target /tmp/check_update > /tmp/to_be_upgraded if grep -q no\ upgrades\ found /tmp/check_update then - killall osd_cat + killall -9 osd_cat echo -e "No updates available\n at this time." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 5 -A centre else - mv /usr/share/mythtv/linhes.xml /tmp/linhes.xml.tmp - sed -e '/\#Check/,/\#Check/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/linhes.xml - mv /usr/share/mythtv/linhes.xml /tmp + mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp + sed -e '/\#Check/,/\#Check/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/themes/defaultmenu/linhes.xml + mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp grep -v -e /mythmenu /tmp/linhes.xml > /tmp/linhes.xml.tmp echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp echo " <button>" >> /tmp/linhes.xml.tmp @@ -30,7 +31,7 @@ chck () { echo " </button>" >> /tmp/linhes.xml.tmp echo "<!--#UpdatesAvailable-->" >> /tmp/linhes.xml.tmp echo "</mythmenu>" >> /tmp/linhes.xml.tmp - mv /tmp/linhes.xml.tmp /usr/share/mythtv/linhes.xml + mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml dsply fi } diff --git a/abs/core/linhes-scripts/linhes_update2.sh b/abs/core/linhes-scripts/linhes_update2.sh index 20f32b9..80945eb 100644 --- a/abs/core/linhes-scripts/linhes_update2.sh +++ b/abs/core/linhes-scripts/linhes_update2.sh @@ -1,14 +1,16 @@ #!/bin/bash +killall -9 osd_cat echo -e "Performing updates." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 300000 -A centre & -sudo pacman -Syuf --noconfirm && sudo killall -9 osd_cat -if grep -q Check\ for\ updates /usr/share/mythtv/linhes.xml +sudo pacman -Suf --noconfirm && sudo killall -9 osd_cat +if grep -q Check\ for\ updates /usr/share/mythtv/themes/defaultmenu/linhes.xml then rm -fr /tmp/to_be_upgraded +killall -9 osd_cat echo -e "Update complete." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 5 -A centre else -mv /usr/share/mythtv/linhes.xml /tmp/linhes.xml.tmp -sed -e '/\#UpdatesAv/,/\#UpdatesAv/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/linhes.xml -mv /usr/share/mythtv/linhes.xml /tmp +mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp/linhes.xml.tmp +sed -e '/\#UpdatesAv/,/\#UpdatesAv/d' < /tmp/linhes.xml.tmp > /usr/share/mythtv/themes/defaultmenu/linhes.xml +mv /usr/share/mythtv/themes/defaultmenu/linhes.xml /tmp grep -v -e /mythmenu /tmp/linhes.xml > /tmp/linhes.xml.tmp echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp echo " <button>" >> /tmp/linhes.xml.tmp @@ -19,7 +21,8 @@ echo " </button>" >> /tmp/linhes.xml.tmp echo "<!--#Check for updates-->" >> /tmp/linhes.xml.tmp echo "" >> /tmp/linhes.xml.tmp echo "</mythmenu>" >> /tmp/linhes.xml.tmp -mv /tmp/linhes.xml.tmp /usr/share/mythtv/linhes.xml +mv /tmp/linhes.xml.tmp /usr/share/mythtv/themes/defaultmenu/linhes.xml rm -fr /tmp/to_be_upgraded +killall -9 osd_cat echo -e "Update complete." | osd_cat -p middle -s 5 -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 5 -A centre fi diff --git a/abs/core/linhes-scripts/linhes_update3.sh b/abs/core/linhes-scripts/linhes_update3.sh index 56e8612..5dc0b4d 100644 --- a/abs/core/linhes-scripts/linhes_update3.sh +++ b/abs/core/linhes-scripts/linhes_update3.sh @@ -8,3 +8,10 @@ if [ $COUNT -lt 20 ] else cat /tmp/to_be_upgraded2 | osd_cat -p top -f"-adobe-courier-bold-*-*-*-34-*-*-*-*-*" -d 1 -A centre -l 20 -w fi +if grep kernel26 /tmp/to_be_upgraded2 +then + killall -9 osd_cat + echo -e "Please note:\The kernel will be upgraded.\nThis will require a reboot.\nPlease do so when no jobs are running." | osd_cat -p middle -s 5 -f"-adobe-courier-bould-*-*-*-34-*-*-*-*-*" -d 10 -A centre +else + exit +fi diff --git a/abs/core/linhes-scripts/myth2fuze b/abs/core/linhes-scripts/myth2fuze new file mode 100755 index 0000000..9e8fc3c --- /dev/null +++ b/abs/core/linhes-scripts/myth2fuze @@ -0,0 +1,318 @@ +#!/bin/bash +# convert recording to avi compatable with San Disk Sansa Fuze +# Based on and/or inspired by myth2xvid, the video4fuze project: +# http://code.google.com/p/video4fuze +# and the fuzemux project: +# http://code.google.com/p/fuzemux +# +# version 0.2 +# +# usage: +# first parameter must be %DIR%/%FILE% of the recording +# second parameter must be the %TITLE% for the output filename +# third parameter must be the %SUBTITLE% for the output filename +# fourth parameter must be %CHANID% if you set USECUTLIST=Y +# fifth parameter must be %STARTTIME% for USECUTLIST=Y and output filename +# sixth parameter must be %JOBID% for the User Job status to be updated +# in MythTV +# In the mythtv setup screen invoke this script like this: +# MYTHTV User Job Command: +# /usr/LH/bin/myth2fuze "%DIR%/%FILE%" "%TITLE%" "%SUBTITLE%" "%CHANID%" "%STARTTIME%" "%JOBID%" + +# options: +USECUTLIST=Y # Y or N + +# check prerequesites +for APP in {fuzemux,mencoder,ffmpeg,mythcommflag,mythtranscode,mysql}; do + /usr/bin/which ${APP} &>/dev/null + ERROR=$? + if [ $ERROR -ne 0 ]; then + echo "${APP} not found in your PATH! Aborting! ERROR: ${ERROR}" >> ${LOGFILE} + update_status 304 + update_comment "${APP} not found in your PATH! Aborting! Exit status: ${ERROR}" + exit 1 + fi +done + +# where the converted video is stored +OUT_DIR=/myth/video/fuze + +# Ensure output directory exists +if [ ! -d ${OUT_DIR} ] ; then + mkdir -p -m777 ${OUT_DIR} +fi + +# database settings +BACKEND_HOSTNAME=${BACKEND_HOSTNAME:-"localhost"} +DBUSERNAME=${DBUSERNAME:-"mythtv"} +DBPASSWORD=${DBPASSWORD:-"mythtv"} +SQLCMD="mysql -u ${DBUSERNAME} --password=${DBPASSWORD} -h ${BACKEND_HOSTNAME} mythconverg -e" + +# create temp filename so multiple instances won't conflict +TMPNAME=toFUZE-$$ +TMPDIR=/myth/tmp +TMPFILE=${TMPDIR}/${TMPNAME}.avi +TMPCUTFILE=${TMPDIR}/${TMPNAME}.mpg +MENINPUTFILE=${1} +TWOPASSFILE=/tmp/${TMPNAME}-2pass.log +STATUSFILE=/tmp/${TMPNAME}-status.log +MENCODER_RETURN_CODE=/tmp/${TMPNAME}-mencoder_return_code +MENCODER_RETURN_CODE_2=/tmp/${TMPNAME}-mencoder_return_code_2 + +# Ensure temp directory exists +if [ ! -d ${TMPDIR} ] ; then + mkdir -p -m777 ${TMPDIR} +fi + +#------FUNCTIONS--------------- +update_comment() +# Arg_1 = COMMENT +{ +if [ ${NO_JOBID} = 0 ]; then + `${SQLCMD} "update jobqueue set comment=\"${1}\" where id=\"${JOBID}\";"` +fi +} + +update_status() +# Arg_1 = status code +{ +if [ ${NO_JOBID} = 0 ]; then + `${SQLCMD} "update jobqueue set status=\"${1}\" where id=\"${JOBID}\";"` +fi +} + +check_background_progress() +# check mencoder progress in background +# Arg_1 = PROGRESS CALCULATION +{ +while [ `tail -1 ${STATUSFILE} | grep -cE "^Audio stream:|^Video stream:"` = 0 ] +do + sleep 10 + check_myth_jobcmds + current_status=`tail -1 ${STATUSFILE} | grep "([ 0-9]\{1,\}%)"` + prog_percent=`echo ${current_status} | sed 's_.*(\([ 0-9][ 0-9]\)%).*_\1_'` + current_FPS=`echo ${current_status} | sed 's_.*\([ 0-9][ 0-9].[ 0-9][ 0-9]\)fps.*_\1_'` + if [ -n ${prog_percent} ]; then + prog_percent=`expr ${prog_percent} / ${1}` + echo "${prog_percent}% Completed @ ${current_FPS} fps" + update_comment "${prog_percent}% Completed @ ${current_FPS} fps" + fi + sleep 10 +done +} + +check_myth_jobcmds() +# check the myth database for stop pause or resume commands +{ +if [ ${NO_JOBID} = 0 ]; then + CURRENT_CMD=`${SQLCMD} "select cmds from jobqueue where id=\"${JOBID}\";" | sed '/[0-9]/!d'` + case ${CURRENT_CMD} in + # JOB_RUN + 0) ;; + # JOB_PAUSE + 1) update_status 6 + kill -s STOP ${mencoder_pid} ;; + # JOB_RESUME + 2) update_status 4 + `${SQLCMD} "update jobqueue set cmds=\"0\" where id=\"${JOBID}\";"` + kill -s CONT ${mencoder_pid} ;; + # JOB_STOP + 4) update_status 5 + `${SQLCMD} "update jobqueue set cmds=\"0\" where id=\"${JOBID}\";"` + kill -9 ${mencoder_pid} ${command_pid} + clean_up_files + echo "Encode Cancelled" >> ${LOGFILE} + update_status 320 + exit ;; + esac +fi +} + +get_mencoder_pid() +{ +process_name="" +i1=1 +while [ "$process_name" != "found" ]; do + if [ "`ps ${mencoder_pid} | grep mencoder | sed 's_.*\(mencoder\).*_\1_'`" = "mencoder" ]; then + process_name="found" + else + mencoder_pid=`expr ${mencoder_pid} + 1` + fi + i1=`expr $i1 + 1` + if [ $i1 -gt 20 ]; then + break + fi +done +} + +run_fuzemux() +# Remux avi to fuze compatable avi +{ +/usr/bin/nice -n19 /usr/bin/fuzemux ${TMPFILE} ${OUTPUTFILE} >> ${LOGFILE} || return 1 +} + +create_thumbnail() +# Create a thumbnail image for the fuze +{ +/usr/bin/nice -n19 /usr/bin/ffmpeg -y -v -1 -i ${OUTPUTFILE} -t 1 -ss 3 \ +-s 224x176 -f image2 ${OUTPUTFILE%.*}.thm >> ${LOGFILE} +} + +clean_up_files() +# clean up left over files +{ +unlink ${TMPFILE} 2> /dev/null +unlink ${TMPCUTFILE} 2> /dev/null +unlink ${TMPCUTFILE}.map 2> /dev/null +unlink ${TWOPASSFILE} 2> /dev/null +unlink ${TWOPASSFILE}.tmp 2> /dev/null +unlink ${STATUSFILE} 2> /dev/null +unlink ${MENCODER_RETURN_CODE} 2> /dev/null +unlink ${MENCODER_RETURN_CODE_2} 2> /dev/null +} + +#-------MAIN SCRIPT------------ + +# check if %JOBID% is passed from command line +JOBID=${6} +if [ -z ${JOBID} ]; then + NO_JOBID=1 +else + NO_JOBID=0 +fi + +# log file location +LOGFILE=/var/log/mythtv/myth2fuze.log +CDate="`date`" +echo "" >> ${LOGFILE} +echo ${CDate} >> ${LOGFILE} +echo "File to encode: ${MENINPUTFILE} Name: ${2} - ${3}" >> ${LOGFILE} + +# start timer +beforetime="$(date +%s)" + +check_myth_jobcmds + +# check if using cutlist +if [ ${USECUTLIST} = Y ]; then + MYTHCOMMFRAMES=$( mythcommflag --getcutlist -f ${MENINPUTFILE} | grep 'Cutlist:' | cut -d \ -f 2 ) + if [ -n "$MYTHCOMMFRAMES" ]; then + echo "Extracting Cutlist..." >> ${LOGFILE} + update_comment "Extracting Cutlist" + /usr/bin/nice -n19 /usr/bin/mythtranscode --chanid ${4} --starttime ${5} --outfile ${TMPCUTFILE} --mpeg2 --honorcutlist + MENINPUTFILE=${TMPCUTFILE} + fi +fi + +# run mencoder in background to do 1st pass conversion +echo "Encoding 1st Pass for the Fuze..." >> ${LOGFILE} +( /usr/bin/nice -n19 /usr/bin/mencoder ${MENINPUTFILE} -passlogfile \ +${TWOPASSFILE} -ffourcc DX50 -ofps 20 \ +-vf pp=li,expand=:::::224/176,scale=224:176,harddup -ovc lavc \ +-lavcopts vcodec=mpeg4:vbitrate=683:vmax_b_frames=0:keyint=15:turbo:vpass=1 \ +-nosound -o /dev/null > ${STATUSFILE} 2>&1 ; echo $? > \ +${MENCODER_RETURN_CODE} ) & +mencoder_pid=$! +command_pid=${mencoder_pid} +get_mencoder_pid + +check_background_progress "2" + +if [ `cat ${MENCODER_RETURN_CODE}` -ne 0 ]; then + echo "Mencoder pass #1 exited with error ${MENCODER_RETURN_CODE}. Encoding failed!" + update_status 304 + update_comment "ERROR: Mencoder pass #1 exited with error ${MENCODER_RETURN_CODE}" + clean_up_files + exit 1 +fi + +# run mencoder in background to do 2nd pass conversion +echo "Encoding 2nd Pass for the Fuze..." >> ${LOGFILE} +( /usr/bin/nice -n19 /usr/bin/mencoder ${MENINPUTFILE} -passlogfile \ +${TWOPASSFILE} -ffourcc DX50 -ofps 20 \ +-vf pp=li,expand=:::::224/176,scale=224:176,harddup -ovc lavc \ +-lavcopts vcodec=mpeg4:vbitrate=683:vmax_b_frames=0:keyint=15:vpass=2 \ +-srate 44100 -af resample=44100:0:1,format=s16le -oac mp3lame \ +-lameopts cbr:br=128 -o ${TMPFILE} > ${STATUSFILE} 2>&1 ; echo $? \ +> ${MENCODER_RETURN_CODE_2} ) & +mencoder_pid=$! +command_pid=${mencoder_pid} +get_mencoder_pid + +check_background_progress "2 + 50" + +if [ `cat ${MENCODER_RETURN_CODE_2}` -ne 0 ]; then + echo "Mencoder pass #1 exited with error ${MENCODER_RETURN_CODE}. Encoding failed!" + update_status 304 + update_comment "ERROR: Mencoder pass #1 exited with error ${MENCODER_RETURN_CODE_2}" + clean_up_files + exit 1 +fi + +# make output filename unique, remove punctuation and "special" characters, +# replace spaces with underscores and force lowercase names +OAD=$( echo ${5} | cut -b 1-8 ) +FILENAME=$( echo "${2} ${OAD} ${3}" | tr -d '[:punct:]' \ + | tr -s '[:blank:]' '[_]' | tr '[:upper:]' '[:lower:]' )_fuze.avi + +OUTPUTFILE=${OUT_DIR}/${FILENAME} +ERROR=$? + +if [ ${ERROR} -ne 0 ]; then + echo "Setting output file name exited with error ${ERROR}" >> ${LOGFILE} + update_status 304 + update_comment "ERROR: Setting output file name exited with error ${ERROR} Job failed!" + clean_up_files + exit 1 +fi + +run_fuzemux +ERROR=$? + +if [ ${ERROR} -ne 0 ]; then + echo "Fuzemux exited with error ${ERROR}" >> ${LOGFILE} + update_status 304 + update_comment "ERROR: Fuzemux exited with error ${ERROR} Job Failed!" + clean_up_files + exit 1 +fi + +# ensure mythtv owns the final avi +chown mythtv ${OUTPUTFILE} +ERROR=$? + +if [ ${ERROR} -ne 0 ]; then + echo "Changing ownership of avi to mythtv exited with error ${ERROR}" + update_status 304 + update_comment "ERROR: Changing ownership of avi to mythtv exited with error ${ERROR} Job failed!" + clean_up_files + exit 1 +fi + +create_thumbnail + +# ensure mythtv owns the thumbnail +chown mythtv ${OUTPUTFILE%.*}.thm +ERROR=$? + +if [ ${ERROR} -ne 0 ]; then + echo "Changing ownership of thumbnail to mythtv exited with error ${ERROR}" + update_status 304 + update_comment "ERROR: Changing ownership of thumbnail to mythtv exited with error ${ERROR} Job failed!" + clean_up_files + exit 1 +fi + +# stop timer +aftertime="$(date +%s)" +seconds="$(expr $aftertime - $beforetime)" + echo "File Encoded Successfully: ${OUTPUTFILE}" >> ${LOGFILE} + hours=$((seconds / 3600)) + seconds=$((seconds % 3600)) + minutes=$((seconds / 60)) + seconds=$((seconds % 60)) + echo "Encoding took $hours hour(s) $minutes minute(s) $seconds second(s) @ $current_FPS fps." >> ${LOGFILE} + update_status 272 + update_comment "Encode Successful. Encoding Time: $hours hour(s) $minutes minute(s) $seconds second(s)" + +clean_up_files diff --git a/abs/core/linhes-scripts/mythwelcome-config.py b/abs/core/linhes-scripts/mythwelcome-config.py new file mode 100755 index 0000000..c7bf10b --- /dev/null +++ b/abs/core/linhes-scripts/mythwelcome-config.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +# This script will configure the myth db to allow MythWelcome to wake and shutdown the system. + +from socket import gethostname +from MythTV import MythDB +mythdb = MythDB() +localhostname = gethostname() + +# mythwelcome --setup +mythdb.settings[localhostname].MythShutdownNvramCmd = u'sudo sh -c \"/usr/LH/bin/mythwelcome-set-alarm.sh $time\"' +mythdb.settings[localhostname].MythShutdownWakeupTimeFmt = u'time_t' +mythdb.settings[localhostname].MythShutdownNvramRestartCmd = u'' +mythdb.settings[localhostname].MythShutdownReboot = u'sudo /sbin/reboot' +mythdb.settings[localhostname].MythShutdownPowerOff = u'sudo /sbin/poweroff' +mythdb.settings[localhostname].MythShutdownXTermCmd = u'xterm' +mythdb.settings[localhostname].MythWelcomeStartFECmd = u'/usr/LH/bin/mythfrontend-start' + + +# mythtv-setup Shutdown/Wakeup options +if mythdb.settings[localhostname].idleTimeoutSecs == u'0': + mythdb.settings[localhostname].idleTimeoutSecs = u'40' + +mythdb.settings.NULL.WakeupTimeFormat = u'yyyy-MM-ddThh:mm:ss' +mythdb.settings.NULL.SetWakeuptimeCommand = u'/usr/bin/mythshutdown --setwakeup $time' +mythdb.settings.NULL.ServerHaltCommand = u'/usr/bin/mythshutdown --shutdown' +mythdb.settings.NULL.preSDWUCheckCommand = u'/usr/bin/mythshutdown --check' diff --git a/abs/core/linhes-scripts/mythwelcome-set-alarm.sh b/abs/core/linhes-scripts/mythwelcome-set-alarm.sh index 6dbd39e..990adf7 100755 --- a/abs/core/linhes-scripts/mythwelcome-set-alarm.sh +++ b/abs/core/linhes-scripts/mythwelcome-set-alarm.sh @@ -13,7 +13,7 @@ # Configure mythtv-setup Shutdown/Wakeup Options page: # Idletimeout (secs): any value greater that 0 -# Wakeup time format: yyyy-MM-dd:hh:mm +# Wakeup time format: yyyy-MM-ddThh:mm:ss # Set wakeup time command: /usr/bin/mythshutdown --setwakeup $time # Server Halt command: /usr/bin/mythshutdown --shutdown # Pre shutdown check command: /usr/bin/mythshutdown --check diff --git a/abs/core/linhes-scripts/qip7100-cc.sh b/abs/core/linhes-scripts/qip7100-cc.sh new file mode 100755 index 0000000..029e25c --- /dev/null +++ b/abs/core/linhes-scripts/qip7100-cc.sh @@ -0,0 +1,25 @@ +#!/bin/bash +#Script to control DCT 700/2524 on emitter #1 of CommandIR +irsend set_transmitters 2 +sleep .5 +#REMOTE_NAME=DCT2524 +REMOTE_NAME=Motorola_QIP6200-2 +cmd="$1" + +case $cmd in + [0-9]*) + for digit in $(echo $1 | sed -e 's/./& /g'); do + irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME $digit + sleep .4 + # If things work OK with sleep 1, try this for faster channel changes: + sleep 0.3 + done + irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME ok +sleep .3 + irsend -d /dev/lircd SEND_ONCE $REMOTE_NAME exit + ;; + + *) + irsend SEND_ONCE $REMOTE_NAME $cmd + ;; +esac diff --git a/abs/core/linhes-scripts/remove_php_mythvideo.sh b/abs/core/linhes-scripts/remove_php_mythvideo.sh new file mode 100644 index 0000000..d9d53a0 --- /dev/null +++ b/abs/core/linhes-scripts/remove_php_mythvideo.sh @@ -0,0 +1,13 @@ +#!/bin/bash +. /etc/systemconfig + +if [ $SystemType != Frontend_only ] && [ $SystemType != Slave_backend ] ; then + +mysql mythconverg <<EOF +delete from videotypes where extension='php'; +insert into videotypes(extension,f_ignore) values('php','1'); +EOF + +else + exit 0 +fi diff --git a/abs/core/linhes-scripts/removecommercials.sh b/abs/core/linhes-scripts/removecommercials.sh new file mode 100755 index 0000000..70e2e52 --- /dev/null +++ b/abs/core/linhes-scripts/removecommercials.sh @@ -0,0 +1,213 @@ +#!/bin/sh +# remove commercials from recordings using the user generated cutlist or +# optionally using the mythcommflag generated cutlist. +# version 0.2 3/24/2010 + +# usage: +# first parameter must be %DIR% of the recording +# second parameter must be %FILE% of the recording +# third parameter must be %CHANID% +# fourth parameter must be %STARTTIME% +# fifth parameter must be %JOBID% for the User Job status to be updated in MythTV +# in the mythtv setup screen invoke this script like this: +# MYTHTV User Job Command: +# /usr/LH/bin/removecommercials.sh "%DIR%" "%FILE%" "%CHANID%" "%STARTTIME%" "%JOBID%" + +#-------OPTIONS---------------- +# If no cutlist is found USE_MYTHCOMMFLAG_CUTLIST=YES will use mythcommflag +# to generate a cutlist. +# WARNING: Using this option could result in part of the recording being cut if +# mythcommflag incorrectly flagged the commercial. +USE_MYTHCOMMFLAG_CUTLIST=NO + +# Auguments passed from command line +VIDEODIR=$1 +FILENAME=$2 +CHANID=$3 +STARTTIME=$4 +JOBID=$5 + +# database settings +BACKEND_HOSTNAME=${BACKEND_HOSTNAME:-"localhost"} +DBUSERNAME=${DBUSERNAME:-"mythtv"} +DBPASSWORD=${DBPASSWORD:-"mythtv"} +SQLCMD="mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -e" + +LOG="/var/log/mythtv/removecommercials.log" + +#------FUNCTIONS--------------- +update_comment() +# Arg_1 = COMMENT +{ +if [ $NO_JOBID = 0 ]; then + `$SQLCMD "update jobqueue set comment=\"$1\" where id=\"$JOBID\";"` +fi +} + +update_status() +# Arg_1 = status code +{ +if [ $NO_JOBID = 0 ]; then + `$SQLCMD "update jobqueue set status=\"$1\" where id=\"$JOBID\";"` +fi +} + +check_myth_jobcmds() +# check the myth database for stop pause or resume commands +{ +if [ $NO_JOBID = 0 ]; then + CURRENT_CMD=`$SQLCMD "select cmds from jobqueue where id=\"$JOBID\";" | sed '/[0-9]/!d'` + case "$CURRENT_CMD" in + # JOB_RUN + 0) ;; + # JOB_PAUSE + 1) update_status 6 + kill -s STOP $TPID ;; + # JOB_RESUME + 2) update_status 4 + `$SQLCMD "update jobqueue set cmds=\"0\" where id=\"$JOBID\";"` + kill -s CONT $TPID ;; + # JOB_STOP + 4) update_status 5 + `$SQLCMD "update jobqueue set cmds=\"0\" where id=\"$JOBID\";"` + kill -9 $TPID + clean_up_files + echo "Cancelled" + update_status 320 + exit ;; + esac +fi +} + +check_background_progress() +#check progress in background +{ +while [ `tail -1 $STATUSFILE | grep -c "Done"` = 0 ] +do + sleep 5 + check_myth_jobcmds + current_status=`tail -1 $STATUSFILE` + if [ `expr match "$current_status" '.*\complete'` -ne 0 ]; then + prog_percent=`echo "$current_status" | awk '{print $3}'` + if [ -n "$prog_percent" ]; then + echo "Removing Commercials - $prog_percent Completed" + update_comment "Removing Commercials - $prog_percent Completed" + fi + fi +done +} + +get_pid() +{ +process_name="" +i1=1 +while [ "$process_name" != "found" ]; do + if [ "`ps $TPID | grep mythtranscode | sed 's_.*\(mythtranscode\).*_\1_'`" = "mythtranscode" ]; then + process_name="found" + else + TPID=`expr $TPID + 1` + fi + i1=`expr $i1 + 1` + if [ $i1 -gt 20 ]; then + break + fi +done +} + +clean_up_files() +# clean up left over files +{ +unlink $TMPFILE 2> /dev/null +unlink $TMPFILE.map 2> /dev/null +unlink $STATUSFILE 2> /dev/null +unlink $VIDEODIR/$FILENAME.tmp 2> /dev/null +} + +#-------MAIN SCRIPT------------ +# check if %JOBID% is passed from command line +JOBID=$5 +if [ -z "$JOBID" ]; then + NO_JOBID=1 +else + NO_JOBID=0 +fi +# check if file is a .mpg +if [ `expr match "$FILENAME" '.*\.mpg'` -ne 0 ]; then + MPEG="--mpeg2" +else + MPEG="" +fi + +# create temp filename so multiple instances won't conflict +TMPNAME=rmvCOMMS-$$ +TMPFILE=$VIDEODIR/$FILENAME-$$ +STATUSFILE=/myth/tmp/$TMPNAME-status.log + +touch $STATUSFILE + +update_status 4 + +check_myth_jobcmds + +# check for cutlist +MYTHCOMMFRAMES=`mythcommflag --getcutlist -f $VIDEODIR/$FILENAME | grep 'Cutlist:' | cut -d \ -f 2` + +if [ $USE_MYTHCOMMFLAG_CUTLIST=YES ] && [ -z "$MYTHCOMMFRAMES" ]; then + echo "Generating cutlist..." + update_comment "Generating cutlist..." + /usr/bin/nice -n19 /usr/bin/mythcommflag --gencutlist -f $VIDEODIR/$FILENAME + MYTHCOMMFRAMES=`mythcommflag --getcutlist -f $VIDEODIR/$FILENAME | grep 'Cutlist:' | cut -d \ -f 2` +fi + +if [ -n "$MYTHCOMMFRAMES" ]; then + echo "Removing Commercials..." + update_comment "Removing Commercials..." + ( /usr/bin/nice -n19 /usr/bin/mythtranscode -c $CHANID -s $STARTTIME -o $TMPFILE $MPEG --honorcutlist --showprogress > $STATUSFILE 2>&1 ; echo "Done" >> $STATUSFILE ) & + TPID=$! + get_pid + check_background_progress + ERROR=$? + if [ $ERROR -ne 0 ]; then + echo "Transcoding failed for ${FILENAME} with error $ERROR" + exit $ERROR + fi + + check_myth_jobcmds + # move temp file to output location + echo "Moving file..." + update_comment "Moving file..." + if [ `$SQLCMD "select data from settings where value='SaveTranscoding';" | sed '/[0-9]/!d'` = 1 ]; then + echo "DB is set to save transcoding" + mv $VIDEODIR/$FILENAME $VIDEODIR/$FILENAME.old + fi + mv $TMPFILE $VIDEODIR/$FILENAME + + # file has changed, rebuild index + echo "Rebuilding index..." + update_comment "Rebuilding index..." + mythcommflag -c $CHANID -s $STARTTIME --rebuild + ERROR=$? + if [ $ERROR -ne 0 ]; then + echo "Rebuilding seek list failed for ${FILENAME} with error $ERROR" + exit $ERROR + fi + + # remove old cutlist + echo "Removing old cutlist..." + update_comment "Removing old cutlist..." + mythcommflag -c $CHANID -s $STARTTIME --clearcutlist + ERROR=$? + if [ $ERROR -eq 0 ]; then + # Fix the database entry for the file + `$SQLCMD UPDATE recorded SET cutlist = 0, filesize = $(ls -l $VIDEODIR/$FILENAME | awk '{print $5}') WHERE basename = '$FILENAME';` > /dev/null + else + echo "Clearing cutlist failed for ${FILENAME} with error $ERROR" + exit $ERROR + fi + clean_up_files + echo "Commercials Removed" + update_status 272 + update_comment "Sucessfully Completed." +else + echo "No cutlist found." +fi diff --git a/abs/core/linhes-scripts/screenshooter.sh b/abs/core/linhes-scripts/screenshooter.sh index 94ea6fd..3bacac1 100755 --- a/abs/core/linhes-scripts/screenshooter.sh +++ b/abs/core/linhes-scripts/screenshooter.sh @@ -135,7 +135,7 @@ if [ "$EXTENSION_CHECK" == "1" ]; then # if [ "$VERBOSE" == "1" ]; then # echo "Importing $VIDEO_FILENAME in to database." # fi - # mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "insert into videometadata (intid, title, director, plot, rating, inetref, year, userrating, length, showlevel, filename, coverfile, childid, browse, playcommand, category) values (' ', '$VIDEO_FILENAME', 'Unknown', 'Unknown', 'NR', '00000000', 1895, 0.0, 0, 1, '$VIDEO_PATHNAME', 'No Cover', -1, 1, ' ', 0);" + # mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -sNBe "insert into videometadata (intid, title, director, plot, rating, inetref, year, userrating, length, showlevel, filename, coverfile, childid, browse, playcommand, category) values (' ', '$VIDEO_FILENAME', 'Unknown', 'Unknown', 'NR', '00000000', 1895, 0.0, 0, 1, '$VIDEO_PATHNAME', '', -1, 1, ' ', 0);" fi fi fi @@ -145,7 +145,7 @@ if [ "$CLOBBER" -eq 0 ]; then SQL_CMD="select coverfile from videometadata where filename=\"$VIDEO_PATHNAME\";" CURRENT_COVERFILE=`mysql -u $DBUSERNAME --password=$DBPASSWORD -h $BACKEND_HOSTNAME mythconverg -B -e "$SQL_CMD" | tail -1` - if [[ "$CURRENT_COVERFILE" != "" ]] && [[ "$CURRENT_COVERFILE" != "No Cover" ]]; then + if [[ "$CURRENT_COVERFILE" != "" ]] && [[ "$CURRENT_COVERFILE" != "" ]]; then # there's already a cover file for this video if [ "$VERBOSE" == "1" ]; then echo "$VIDEO_FILENAME has cover file, skipping." diff --git a/abs/core/linhes-scripts/shootscreens-mythtv.sh b/abs/core/linhes-scripts/shootscreens-mythtv.sh index db01147..111b980 100755 --- a/abs/core/linhes-scripts/shootscreens-mythtv.sh +++ b/abs/core/linhes-scripts/shootscreens-mythtv.sh @@ -1,11 +1,19 @@ #! /bin/bash -# available sizes: 34, 25, 24, 20, 18, 17, 14, 12, 11, 10 -export FONT="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" + +. /etc/osd_cat.cfg || { + color=yellow + outline=2 + outlinecolour=black + shadow=0 + shadowcolour=black + font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" +} + echo "This could take several minutes," > /tmp/screens echo "depending on your hardware and the" >> /tmp/screens echo "number and type of videos you have." >> /tmp/screens echo "It will only work on videos scanned" >> /tmp/screens echo "with Video Manager." >> /tmp/screens -cat /tmp/screens | osd_cat --font=$FONT --shadow=3 --pos=middle --align=centre --offset=200 --color=yellow --delay=0 & +cat /tmp/screens | osd_cat --pos=middle --align=center --delay=0 --offset=200 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & shootscreens.sh 1 /bin/rm -f /tmp/screens
\ No newline at end of file diff --git a/abs/core/linhes-scripts/shootscreens.sh b/abs/core/linhes-scripts/shootscreens.sh index 7b1260c..bb45252 100755 --- a/abs/core/linhes-scripts/shootscreens.sh +++ b/abs/core/linhes-scripts/shootscreens.sh @@ -10,6 +10,14 @@ if [ "$1" == "1" ]; then OSD=1 + . /etc/osd_cat.cfg || { + color=yellow + outline=2 + outlinecolour=black + shadow=0 + shadowcolour=black + font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" + } else OSD=0 fi @@ -23,15 +31,14 @@ fi increment=$(expr 100 / $vidcount) for vid in `mysql -u root mythconverg -B -e "select filename from videometadata where coverfile=\"No Cover\";" | grep -v -e "^filename$"` do - if [ $OSD == 1 ]; then - osd_cat --barmode=percentage --percentage=$percentage --pos=middle --align=center --color=white --text="Generating Video Thumbnails..." --font=$FONT --shadow=3 --color=yellow --delay=0 & - percentage=$(expr $percentage + $increment) - fi - - screenshooter.sh -v $vid + if [ $OSD == 1 ]; then + osd_cat --barmode=percentage --percentage=$percentage --pos=middle --align=center --text="Generating Video Thumbnails..." --delay=0 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & + percentage=$(expr $percentage + $increment) + fi + screenshooter.sh -v $vid done if [ $OSD == 1 ]; then - killall -9 osd_cat - osd_cat --barmode=percentage --percentage=100 --pos=middle --align=center --color=white --text="Video Thumbnails Generated!" --font=$FONT --shadow=3 --color=yellow --delay=3 & + killall -9 osd_cat + osd_cat --barmode=percentage --percentage=100 --pos=middle --align=center --text="Video Thumbnails Generated!" --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & fi }
\ No newline at end of file diff --git a/abs/core/linhes-scripts/system-cleanup.sh b/abs/core/linhes-scripts/system-cleanup.sh new file mode 100755 index 0000000..59a4ebb --- /dev/null +++ b/abs/core/linhes-scripts/system-cleanup.sh @@ -0,0 +1,47 @@ +#!/bin/bash + +# This script cleans up some SVN stuff that the build process leaves +# in /usr/share/mythtv, along with ownership and file permsisions on the +# themes and the mythstream stuff. There are bunch of files which are +# left executable for no good reason, although I can think of several +# potentially bad reasons for it. + +find /usr/share/mythtv -name .svn -print0 | xargs -0 rm -rf +find /usr/share/mythtv -name CVS -print0 | xargs -0 rm -rf + +THEMES=/usr/share/mythtv/themes + +chown -R root:root $THEMES +chmod -R +r $THEMES +find $THEMES -type f -print0 | xargs -0 chmod a-x + + +chown -R mythtv:users /myth +chown -R root:root /myth/backup/ +chown -R root:root /etc/sv + +chown -R http:users /data/srv/httpd/ + +# None of thes files should be executable. +for ext in gif png jpg xml htm html php ; do + find / -type f -name "*.$ext" -print0 | xargs -0 chmod a-x +done + +# These files should be owned by root and not writable to anybody else + +#chown root:root /usr/share/mythtv/*.xml /usr/share/mythtv/*.ttf +chown root:root /usr/share/mythtv/*.ttf + +chown -R root:root \ + /usr/share/mythtv/i18n \ + /usr/share/mythtv/mytharchive \ + /usr/share/mythtv/mythflix \ + /usr/share/mythtv/mythnews \ + /usr/share/mythtv/mythvideo \ + /usr/share/mythtv/mythweather \ + /usr/LH + + + +# Report any remaining orphans... +find / /myth -xdev \( -nouser -o -nogroup \) -ls diff --git a/abs/core/linhes-scripts/update_schema_021_to_022.sh b/abs/core/linhes-scripts/update_schema_021_to_022.sh new file mode 100644 index 0000000..4157fb4 --- /dev/null +++ b/abs/core/linhes-scripts/update_schema_021_to_022.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +mysql mythconverg <<EOF +update gameplayers set commandline = '/usr/bin/sdlmame -rp /myth/games/xmame/roms %s' where commandline = '/usr/game/mame -rp /myth/games/xmame/roms %s'; +update settings set data = '/myth/video_stuff/coverart' where value = 'VideoArtworkDir'; +update settings set data = '/myth/video_stuff/fanart' where value = 'mythvideo.fanartDir'; +update settings set data = '/myth/video_stuff/screenshots' where value = 'mythvideo.screenshotDir'; +update settings set data = '/myth/video_stuff/banners' where value = 'mythvideo.bannerDir'; +update settings set data = '/myth/video_stuff/trailers' where value = 'mythvideo.TrailersDir'; +update settings set data = '1' where value = 'mythvideo.TrailersRandomEnabled'; +update settings set data = '1' where value = 'mythvideo.EnableAlternatePlayer'; +update settings set data = '/myth/video_stuff/screenshots' where value = 'ScreenShotPath'; +update settings set data = '/myth/games/screenshots' where value = 'mythgame.screenshotdir'; +update settings set data = '/myth/games/fanart' where value = 'mythgame.fanartdir'; +update settings set data = '/myth/games/boxart' where value = 'mythgame.boxartdir'; +update settings set data = '3' where value = 'OverrideExitMenu'; +update settings set data = 'sudo sv start mythbackend' where value = 'BackendStartCommand'; +update settings set data = 'sudo sv stop mythbackend' where value = 'BackendStopCommand'; +update settings set data = '/usr/share/mythtv/mythvideo/scripts/tmdb.pl -M' where value = 'MovieListCommandLine'; +update settings set data = replace(data, 'imdb.pl', 'tmdb.pl'); +EOF diff --git a/abs/core/linhes-scripts/upgrade_linhes.sh b/abs/core/linhes-scripts/upgrade_linhes.sh new file mode 100755 index 0000000..91a46e6 --- /dev/null +++ b/abs/core/linhes-scripts/upgrade_linhes.sh @@ -0,0 +1,136 @@ +#!/bin/bash +#Script to facilitate easy upgrade to latest LinHES. +clear +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi +function pause(){ + read -p "$*" +} +echo "The script will guide you thru the process of upgrading to the latest LinHES." +pause 'Press <ENTER> to continue...' +echo +echo "Sync'n with the repos..." +echo +pacman -Sy &>/dev/null +pacman -Qu > /tmp/linhes_upgrade +if [ ! -s /tmp/linhes_upgrade ] +then + echo "No upgrades found. This could mean the repository is busy." + echo "Or your system is already up to date." + echo "If you have not upgrade, please try again later." + echo "Starting the backend." + sv start mythbackend &>/dev/null + exit 1 +fi +if grep -E "Master|Stand" /etc/systemconfig &>/dev/null + then + echo "Stopping the backend." + sv stop mythbackend &>/dev/null +fi +if pacman -Qs mythvodka &>/dev/null + then + echo "Removing MythVodka if installed as it is no longer compatible with MythTV." + echo + pacman -R mythvodka &>/dev/null +fi +echo +echo "Backing up Online Streams listings." +echo +cp /usr/share/mythtv/is.xml /usr/share/mythtv/is.xml.021 +echo "Removing mythcontrol and mythphone if installed." +echo +if pacman -Qs mythcontrols &>/dev/null + then + pacman -R mythcontrols &>/dev/null +fi +if pacman -Qs mythphone &>/dev/null + then + pacman -R mythphone &>/dev/null +fi +if grep -q kernel26 /tmp/linhes_upgrade +then + echo "Upgrading the kernel." + echo + if pacman -Qs v4l-dvb &>/dev/null + then + pacman -Sf --noconfirm kernel26 &>/dev/null && pacman -Sf --noconfirm v4l-dvb + else + pacman -S kernel26 --noconfirm &>/dev/null + fi +fi +if grep -q v4l-dvb /tmp/linhes_upgrade +then + pacman -Sf --noconfirm v4l-dvb &>/dev/null +fi +echo "Checking for VDPAU packages and upgrading if needed." +echo +if pacman -Qs vdpinfo-71xx &>/dev/null + then + pacman -Rd vdpinfo-71xx &>/dev/null +fi +if pacman -Qs vdpinfo-96xx &>/dev/null + then + pacman -Rd vdpinfo-96xx &>/dev/null +fi +if pacman -Qs vdpinfo &>/dev/null + then + pacman -Rd vdpinfo &>/dev/null && pacman -S --noconfirm nvidia &>/dev/null && pacman -S --noconfirm vdpauinfo &>/dev/null +fi +echo "Performing complete system upgrade." +echo "This may take some time depending on your connection speed." +echo "Server bandwidth utilization will also have an affect." +echo "Please be patient." +echo +pacman -Suf --noconfirm &>/dev/null +echo "Restoring Online Streams listings." +echo +cp /usr/share/mythtv/is.xml.021 /usr/share/mythtv/is.xml +if grep -E "Master|Stand" /etc/systemconfig &>/dev/null + then + echo "Starting the backend. This will automatically update the schema." + sv start mythbackend &>/dev/null + echo "I'll launch an xterm so you watch output backend log." + echo "Once the schema updates are complete, switch back to this xterm." + echo -e "\033[1mWhen you see \"Upgrading to MythTV schema version 1254\"\033[0m" + echo "You can switch back to this xterm." + echo -e "\033[1mNote:After pressing <ENTER>, I'll be asleep for 30 secs...\033[0m" + echo -e "\033[1mThis will give the schema time to upgrade.\033[0m" + pause 'Press <ENTER> to continue...' + xterm -fn *18* -e tail -f /var/log/mythtv/mythbackend.log & + #Sleeping for 30 seconds to give the schema time to upgrade.... + sleep 30 + read -p "Press <ENTER> to continue once the schema upgrade is complete." + echo + echo -e "\033[1mNow, the frontend will launch to update the schema for any plugins.\033[0m" + echo -e "\033[1mOnce the this is done, please exit the frontend.\033[0m" + pause 'Press <ENTER> to continue...' + xterm -e mythfrontend + echo + echo "Performing LinHES specific schema updates." + echo + /usr/LH/bin/update_schema_021_to_022.sh + cat /data/database/dvd_transcode_r6.sql | mysql -u root mythconverg + /usr/LH/bin/mythwelcome-config.py +fi +echo "All done!" +echo -e "\033[5mThanks for choosing LinHES!\033[0m" +if grep -q kernel26 /tmp/linhes_upgrade +then + echo "The kernel was upgraded, we need to reboot." + pause "Press <ENTER> to reboot." + reboot +else + if grep -q v4l-dvb /tmp/linhes_upgrade + then + echo "The V4L\DVB modules were upgraded." + pause "Press <ENTER> to reboot." + reboot + else + echo "Launching mythfrontend once again!" + echo "Enjoy the latest version!" + sleep 5 + mythfrontend +fi +fi diff --git a/abs/core/linhes-scripts/upgrade_to_0.22.sh b/abs/core/linhes-scripts/upgrade_to_0.22.sh new file mode 100644 index 0000000..8536a05 --- /dev/null +++ b/abs/core/linhes-scripts/upgrade_to_0.22.sh @@ -0,0 +1,94 @@ +#!/bin/bash +#Script to facilitate easy upgrade to MythTV 0.22 in LinHES. +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root" 1>&2 + exit 1 +fi +function pause(){ + read -p "$*" +} +clear +echo "The script will guide you thru the process of upgrading LinHES to MythTV 0.22." +pause 'Press <ENTER> to continue...' +if grep -E "Master|Stand" /etc/systemconfig &>/dev/null + then + echo "Stopping the backend." + sv stop mythbackend &>/dev/null +fi +echo "Sync'n with the repos..." +pacman -Sy &>/dev/null +echo "Removing MythVodka if installed as it is no longer compatible with MythTV." +if pacman -Qs mythvodka &>/dev/null + then + pacman -R mythvodka &>/dev/null +fi +echo "Backing up Online Streams listings." +cp /usr/share/mythtv/is.xml /usr/share/mythtv/is.xml.021 +echo "Removing mythcontrol, mythphone and mythsmolt if installed." +if pacman -Qs mythcontrols &>/dev/null + then + pacman -R mythcontrols &>/dev/null +fi +if pacman -Qs mythphone &>/dev/null + then + pacman -R mythphone &>/dev/null +fi +if pacman -Qs mythsmolt &>/dev/null + then + pacman -R mythsmolt &>/dev/null +fi +echo "Upgrading the kernel." +if pacman -Qs v4l-dvb &>/dev/null + then + pacman -Sf --noconfirm kernel26 &>/dev/null && pacman -Sf --noconfirm v4l-dvb + else + pacman -S kernel26 --noconfirm &>/dev/null +fi +echo "Checking for VDPAU packages and upgrading if needed." +if pacman -Qs vdpinfo-71xx &>/dev/null + then + pacman -Rd vdpinfo-71xx &>/dev/null +fi +if pacman -Qs vdpinfo-96xx &>/dev/null + then + pacman -Rd vdpinfo-96xx &>/dev/null +fi +if pacman -Qs vdpinfo &>/dev/null + then + pacman -Rd vdpinfo &>/dev/null && pacman -S --noconfirm nvidia &>/dev/null && pacman -S --noconfirm vdpauinfo &>/dev/null +fi +echo "Performing complete system upgrade." +echo "This may take some time depending on your connection speed." +echo "Server bandwidth utilization will also have an affect." +echo "Please be patient." +pacman -Su --noconfirm &>/dev/null +echo "Restoring Online Streams listings." +cp /usr/share/mythtv/is.xml.021 /usr/share/mythtv/is.xml +clear +if grep -E "Master|Stand" /etc/systemconfig &>/dev/null + then + echo "Starting the backend. This will automatically update the schema." + sv start mythbackend &>/dev/null + echo "I'll launch an xterm so you watch output backend log." + echo "Once the schema updates are complete, switch back to this xterm." + echo -e "\033[1mWhen you see \"Upgrading to MythTV schema version 1244\"\033[0m" + echo "You can switch back to this xterm." + echo -e "\033[1mNote:After pressing <ENTER>, I'll be asleep for 30 secs...\033[0m" + echo -e "\033[1mThis will give the schema time to upgrade.\033[0m" + pause 'Press <ENTER> to continue...' + xterm -fn *18* -e tail -f /var/log/mythtv/mythbackend.log & + #Sleeping for 30 seconds to give the schema time to upgrade.... + sleep 30 + read -p "Press <ENTER> to continue once the schema upgrade is complete." + echo -e "\033[1mNow, the frontend will launch to update the schema for any plugins.\033[0m" + echo -e "\033[1mOnce the this is done, please exit the frontend.\033[0m" + pause 'Press <ENTER> to continue...' + xterm -e mythfrontend + echo "Performing LinHES specific schema updates." + /usr/LH/bin/update_schema_021_to_022.sh + cat /data/database/dvd_transcode_r6.sql | mysql -u root mythconverg +fi +echo "All done!" +echo -e "\033[5mThanks for choosing LinHES!\033[0m" +pause "Press <ENTER> to reboot." +reboot |