diff options
author | Britney Fransen <brfransen@gmail.com> | 2013-10-16 20:41:16 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2013-10-16 20:41:16 (GMT) |
commit | 4fb36a904c3818185105d2fe09adc512c46285c7 (patch) | |
tree | 56c1deb162824e4695133a955a6022e90282dd79 /abs/core/linhes-scripts | |
parent | 2648e999d277eac5c3d331a3609bcc73fafbea71 (diff) | |
parent | 36f4b0be52fddbd5f491da90475e69c25bf6903f (diff) | |
download | linhes_pkgbuild-4fb36a904c3818185105d2fe09adc512c46285c7.zip linhes_pkgbuild-4fb36a904c3818185105d2fe09adc512c46285c7.tar.gz linhes_pkgbuild-4fb36a904c3818185105d2fe09adc512c46285c7.tar.bz2 |
Merge branch 'testing'
Diffstat (limited to 'abs/core/linhes-scripts')
-rw-r--r-- | abs/core/linhes-scripts/PKGBUILD | 44 | ||||
-rw-r--r-- | abs/core/linhes-scripts/acl_fix_fstab.py | 64 | ||||
-rw-r--r-- | abs/core/linhes-scripts/find_orphans.py | 238 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/get_airplay_key | 6 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/idle.sh | 147 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/importfiles.sh | 18 | ||||
-rw-r--r-- | abs/core/linhes-scripts/linhes-scripts.install | 7 | ||||
-rw-r--r-- | abs/core/linhes-scripts/linhes_update.sh | 74 | ||||
-rw-r--r-- | abs/core/linhes-scripts/linhes_update2.sh | 52 | ||||
-rw-r--r-- | abs/core/linhes-scripts/linhes_update3.sh | 28 | ||||
-rw-r--r-- | abs/core/linhes-scripts/myth2mkv | 433 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/myth2mp3 | 96 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/mythwelcome-config.py | 27 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/mythwelcome-set-alarm.sh | 23 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/mythwelcome-test-wakeup.sh | 16 | ||||
-rwxr-xr-x | abs/core/linhes-scripts/ripD_eject.sh | 125 | ||||
-rw-r--r-- | abs/core/linhes-scripts/stop_xss.sh | 12 | ||||
-rw-r--r-- | abs/core/linhes-scripts/xwin_find.sh | 72 |
18 files changed, 6 insertions, 1476 deletions
diff --git a/abs/core/linhes-scripts/PKGBUILD b/abs/core/linhes-scripts/PKGBUILD index c325101..c5849c0 100644 --- a/abs/core/linhes-scripts/PKGBUILD +++ b/abs/core/linhes-scripts/PKGBUILD @@ -3,12 +3,12 @@ pkgname=linhes-scripts pkgver=7 -pkgrel=50 +pkgrel=57 pkgdesc="Various scripts that help to make LinHES, LinHES." arch=('i686' 'x86_64') license=('GPL2') depends=('xosd' 'cpulimit' 'screen' 'mencoder' 'tablet-encode' 'mplayer' - 'normalize' 'handbrake-cli' 'mkvtoolnix' 'perl' 'perl-shell') + 'handbrake-cli' 'mkvtoolnix' 'perl' 'perl-shell') url="http://linhes.org/" install="linhes-scripts.install" source=( @@ -17,24 +17,15 @@ shootscreens.sh mplayer-resumer-vdpau.pl run-pause-mythcommflag shootscreens-mythtv.sh -importfiles.sh -myth2mp3 mplayer-resumer.pl -mythwelcome-test-wakeup.sh pause-mythcommflag.sh myth2x264 770-wrapper.sh -mythwelcome-set-alarm.sh -mythwelcome-config.py pause_mythcommflag limit-mythcommflag.sh vdpau-detector -idle.sh screenshooter.sh run-limit-mythcommflag -linhes_update.sh -linhes_update2.sh -linhes_update3.sh update_schema_021_to_022.sh upgrade_linhes.sh remove_php_mythvideo.sh @@ -44,23 +35,16 @@ myth2fuze dct700-cc.sh qip7100-cc.sh dtheme.sh -xwin_find.sh upgrade_screen_rc upgrade_linhes_script.sh -find_orphans.py -acl_fix_fstab.py -stop_xss.sh -myth2mkv LinHES-osd -ripD_eject.sh -get_airplay_key ) -build() { +package() { cd ${srcdir} install -d ${pkgdir}/usr/LH/bin install -d ${pkgdir}/usr/LH/etc - install -D -m755 myth2* *.sh *.pl *.py vdpau* run-* pause_* LinHES* get_airplay_key ${pkgdir}/usr/LH/bin/ + install -D -m755 myth2* *.sh *.pl vdpau* run-* pause_* LinHES* ${pkgdir}/usr/LH/bin/ install -D -m755 upgrade_screen_rc ${pkgdir}/usr/LH/etc/ mkdir -p ${pkgdir}/etc/sv/pause-mythcommflag/supervise cp run-pause-mythcommflag ${pkgdir}/etc/sv/pause-mythcommflag/run @@ -68,7 +52,7 @@ build() { cp run-limit-mythcommflag ${pkgdir}/etc/sv/limit-mythcommflag/run mkdir -p ${pkgdir}/etc/logrotate.d/ # cp pause_mythcommflag ${pkgdir}/etc/logrotate.d/ - install -m644 -D pause_mythcommflag $startdir/pkg/etc/logrotate.d/pause_mythcommflag + install -m644 -D pause_mythcommflag ${pkgdir}/etc/logrotate.d/pause_mythcommflag } md5sums=('47a66238d95259d75c9c5cbcbb6da19f' @@ -76,24 +60,15 @@ md5sums=('47a66238d95259d75c9c5cbcbb6da19f' '9ae2cd7a0c42d57ad8b5f515d7d60196' '1274bad3fb7296f00acd2d44804bad14' '47225fa9b6c953d56f6ede84d921a300' - '6b6e7d34a4bda6d608d150039adefd07' - '4a1fda884dcd7d65fb2690fbdbd92a83' '18263972b6326e140bbef0bb7dfa2da9' - '410795ef9039e4c6c0484e706ecfd567' 'ad98d51e79f83df7c03f828dbeaea7f4' '3b1c44a0818b35b6939c3cb2b723ce9e' 'd2b475821f902c5e081e7da43a35e6ac' - '95c092f67036a361ef7a57436f44332e' - '92950f0ffb1faf1ed64c6be2b8fbc3f6' '3b776bbff68906ddc2f62b7e0dde3fe4' 'a57641fb63d7bb6d92a438f1ea779a57' '3d0adf26280cde55a0c47188fff34826' - 'c3ada01d3a739abe3f920b02d4ea3f6e' 'b2c3dd48a4abb976eda2d5fbf22a173a' 'b527b01d119d3bc33b8fa69bdf1082bb' - '9d077c24d102fa02e4f417d639d8b00a' - '98979920c30bb48c02d00f6943e9e50e' - '460861e6d0cf999629b734912eea0acf' '65629302a4d2c3adf88cdf0ebc10d493' 'ab469714d77f3a29c7dda715e5ab98e0' '87b0dc855181f98516acb18a7d551601' @@ -103,13 +78,6 @@ md5sums=('47a66238d95259d75c9c5cbcbb6da19f' 'df727c98350a64e2171c950bbefc9c5d' '7b890e7044db38e8d439f67e398af206' '35693f50939d5827aeabfce8c5dce589' - 'a94fe6d980f4b810f2e2ae5352084b39' '974c137d3fcb85942ba8945a1bc815fe' 'f454faeabfa153b10389a9a3bfd51c4a' - '34fc1f58ad1eabf4eff4979d420760c0' - 'cc9cdabcdfc969c2829b58c0e513488c' - '54a478660d0f8150fe10112a9ecf2740' - '503df99218373dfc75e7e7f5e449a44e' - 'b608044c9e7530a400d8f5b88fdfe6e6' - 'e2e24dd59d5d576cc33feafb329fa302' - '33fbebbd546672cedd3c5e7350ab414e') + 'b608044c9e7530a400d8f5b88fdfe6e6') diff --git a/abs/core/linhes-scripts/acl_fix_fstab.py b/abs/core/linhes-scripts/acl_fix_fstab.py deleted file mode 100644 index 187cab1..0000000 --- a/abs/core/linhes-scripts/acl_fix_fstab.py +++ /dev/null @@ -1,64 +0,0 @@ -#!/usr/bin/python2 -import os -import sys -import subprocess as sub - -def should_add_acl(mount_point,fs_map): - acl_fs_list=["ext3","ext4"] - rc = False - for i in fs_map: - if i[0] == mount_point: - if i[1] in acl_fs_list: - rc = True - - return rc - - -cmd="cp -f /etc/fstab /etc/fstab.backup.pre_acl" -os.system(cmd) -f = open('/etc/fstab', 'r') -fstab=f.readlines() -f.close() - -p = sub.Popen(['/sbin/fsck','-N' ],stdout=sub.PIPE,stderr=sub.PIPE) -output, errors = p.communicate() -output = output.split("\n") -fs_map=[] -for i in output: - if i.startswith("["): - split_line=i.split() - #find mount_p and remove the last char - mount_p = split_line[3][:-1] - fstype = split_line[4].split(".")[1] - append_tuple=(mount_p,fstype) - fs_map.append(append_tuple) - - - -mp=['/' , '/myth', '/data'] -newfstab=[] -for line in fstab: - new_line=line - split_line=line.split() - try: - if split_line[1] in mp and should_add_acl(split_line[1],fs_map): - #print split_line[3] - if "acl" in split_line[3]: - pass - else: - print "Adding ACL" - new_acl=split_line[3]+",acl" - split_line[3]=new_acl - new_line='\t'.join(split_line) - except: - pass - newfstab.append(new_line) - - -f = open('/etc/fstab', 'w') -for i in newfstab: - f.write(i) - f.write("\n") - -f.close() - diff --git a/abs/core/linhes-scripts/find_orphans.py b/abs/core/linhes-scripts/find_orphans.py deleted file mode 100644 index cdc03d4..0000000 --- a/abs/core/linhes-scripts/find_orphans.py +++ /dev/null @@ -1,238 +0,0 @@ -#!/usr/bin/env python2 - -from MythTV import MythDB, MythBE, Recorded, MythError -from socket import timeout - -import os -import sys - -def human_size(s): - s = float(s) - o = 0 - while s > 1000: - s /= 1000 - o += 1 - return str(round(s,1))+('B ','KB','MB','GB')[o] - -class File( str ): - def __new__(self, host, group, path, name, size): - return str.__new__(self, name) - def __init__(self, host, group, path, name, size): - self.host = host - self.group = group - self.path = path - self.size = int(size) - def pprint(self): - name = u'%s: %s' % (self.host, os.path.join(self.path, self)) - print u' {0:<90}{1:>8}'.format(name, human_size(self.size)) - def delete(self): - be = MythBE(self.host, db=DB) - be.deleteFile(self, self.group) - -class MyRecorded( Recorded ): - _table = 'recorded' - def pprint(self): - name = u'{0.hostname}: {0.title}'.format(self) - if self.subtitle: - name += u' - '+self.subtitle - print u' {0:<70}{1:>28}'.format(name,self.basename) - -def printrecs(title, recs): - print title - for rec in sorted(recs, key=lambda x: x.title): - rec.pprint() - print u'{0:>88}{1:>12}'.format('Count:',len(recs)) - -def printfiles(title, files): - print title - for f in sorted(files, key=lambda x: x.path): - f.pprint() - size = sum([f.size for f in files]) - print u'{0:>88}{1:>12}'.format('Total:',human_size(size)) - -def populate(host=None): - unfiltered = [] - kwargs = {'livetv':True} - if host: - with DB as c: - c.execute("""SELECT count(1) FROM settings - WHERE hostname=%s AND value=%s""", - (host, 'BackendServerIP')) - if c.fetchone()[0] == 0: - raise Exception('Invalid hostname specified on command line.') - hosts = [host] - kwargs['hostname'] = host - else: - with DB as c: - c.execute("""SELECT hostname FROM settings - WHERE value='BackendServerIP'""") - hosts = [r[0] for r in c.fetchall()] - for host in hosts: - for sg in DB.getStorageGroup(): - if sg.groupname in ('Videos','Banners','Coverart',\ - 'Fanart','Screenshots','Trailers'): - continue - try: - dirs,files,sizes = BE.getSGList(host, sg.groupname, sg.dirname) - for f,s in zip(files,sizes): - newfile = File(host, sg.groupname, sg.dirname, f, s) - if newfile not in unfiltered: - unfiltered.append(newfile) - except: - pass - - recs = list(DB.searchRecorded(**kwargs)) - - zerorecs = [] - orphvids = [] - for rec in list(recs): - if rec.basename in unfiltered: - recs.remove(rec) - i = unfiltered.index(rec.basename) - f = unfiltered.pop(i) - if f.size < 1024: - zerorecs.append(rec) - name = rec.basename.rsplit('.',1)[0] - for f in list(unfiltered): - if name in f: - unfiltered.remove(f) - for f in list(unfiltered): - if not (f.endswith('.mpg') or f.endswith('.nuv')): - continue - orphvids.append(f) - unfiltered.remove(f) - - orphimgs = [] - for f in list(unfiltered): - if not f.endswith('.png'): - continue - orphimgs.append(f) - unfiltered.remove(f) - - dbbackup = [] - for f in list(unfiltered): - if 'sql' not in f: - continue - dbbackup.append(f) - unfiltered.remove(f) - - return (recs, zerorecs, orphvids, orphimgs, dbbackup, unfiltered) - -def delete_recs(recs): - printrecs('The following recordings will be deleted', recs) - print 'Are you sure you want to continue?' - try: - res = raw_input('> ') - while True: - if res == 'yes': - for rec in recs: - rec.delete(True, True) - break - elif res == 'no': - break - else: - res = raw_input("'yes' or 'no' > ") - except MythError: - name = u'{0.hostname}: {0.title}'.format(rec) - if rec.subtitle: - name += ' - '+rec.subtitle - print "Warning: Failed to delete '" + name + "'" - except KeyboardInterrupt: - pass - except EOFError: - sys.exit(0) - -def delete_files(files): - printfiles('The following files will be deleted', files) - print 'Are you sure you want to continue?' - try: - res = raw_input('> ') - while True: - if res == 'yes': - for f in files: - f.delete() - break - elif res == 'no': - break - else: - res = raw_input("'yes' or 'no' > ") - except KeyboardInterrupt: - pass - except EOFError: - sys.exit(0) - -def main(host=None): - while True: - recs, zerorecs, orphvids, orphimgs, dbbackup, unfiltered = populate(host) - - if len(recs): - printrecs("Recordings with missing files", recs) - if len(zerorecs): - printrecs("Zero byte recordings", zerorecs) - if len(orphvids): - printfiles("Orphaned video files", orphvids) - if len(orphimgs): - printfiles("Orphaned snapshots", orphimgs) - if len(dbbackup): - printfiles("Database backups", dbbackup) - if len(unfiltered): - printfiles("Other files", unfiltered) - if not printOnly: - opts = [] - if len(recs): - opts.append(['Delete orphaned recording entries', delete_recs, recs]) - if len(zerorecs): - opts.append(['Delete zero byte recordings', delete_recs, zerorecs]) - if len(orphvids): - opts.append(['Delete orphaned video files', delete_files, orphvids]) - if len(orphimgs): - opts.append(['Delete orphaned snapshots', delete_files, orphimgs]) - if len(unfiltered): - opts.append(['Delete other files', delete_files, unfiltered]) - opts.append(['Refresh list', None, None]) - print 'Please select from the following' - for i, opt in enumerate(opts): - print ' {0}. {1}'.format(i+1, opt[0]) - - try: - inner = True - res = raw_input('> ') - while inner: - try: - res = int(res) - except: - res = raw_input('input number. ctrl-c to exit > ') - continue - if (res <= 0) or (res > len(opts)): - res = raw_input('input number within range > ') - continue - break - opt = opts[res-1] - if opt[1] is None: - continue - else: - opt[1](opt[2]) - - except KeyboardInterrupt: - break - except EOFError: - sys.exit(0) - else: - sys.exit(0) -DB = MythDB() -BE = MythBE(db=DB) -DB.searchRecorded.handler = MyRecorded -DB.searchRecorded.dbclass = MyRecorded - -if __name__ == '__main__': - global printOnly - if "--printonly" in sys.argv : - printOnly=True - else: - printOnly=False - - - if len(sys.argv) == 2 and sys.argv[1] != "--printonly": - main(sys.argv[1]) - else: - main() diff --git a/abs/core/linhes-scripts/get_airplay_key b/abs/core/linhes-scripts/get_airplay_key deleted file mode 100755 index 89a40dd..0000000 --- a/abs/core/linhes-scripts/get_airplay_key +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/bash - -. /usr/MythVantage/bin/install_functions.sh -curl https://raw.github.com/juhovh/shairplay/master/airport.key > $MYTHHOME/.mythtv/RAOPKey.rsa -chmod 755 $MYTHHOME/.mythtv/RAOPKey.rsa -chown mythtv:mythtv $MYTHHOME/.mythtv/RAOPKey.rsa
\ No newline at end of file diff --git a/abs/core/linhes-scripts/idle.sh b/abs/core/linhes-scripts/idle.sh deleted file mode 100755 index 4f6174c..0000000 --- a/abs/core/linhes-scripts/idle.sh +++ /dev/null @@ -1,147 +0,0 @@ -#!/bin/bash - -usage () { - echo "Usage: $0 [-h] [-s] [-t <minutes_needed>] [-l] [-w] [-m] [-r] [-v]" - echo - echo "-h - Print this help/usage message and quit" - echo "-s - Run silently (default is verbose)" - echo "-t - Minutes of idle time needed (default is 20)" - echo "-l - Check for user logins (default: false - do not check)" - echo "-w - Check for open windows (default: false - do not check)" - echo "-m - Include mythshutdown daily wake, locked, & about to start wake in system busy" - echo " (default: daily wake, locked & about to start wake is system idle)" - echo "-r - Check if mythfrontends are running (default: false - do not check)" - echo "-v - Be more verbose for debugging" - echo - echo "Silent mode is recommended for use in cron jobs or scripts." - exit $1 -} - -msg () { # A status reporting function - [ "$VERBOSE" -ne 0 ] && echo "$*" -} - -mysql_cmd () { - /usr/bin/mysql -u root mythconverg -sBe "$*" -} - -# Command line argument handling -VERBOSE=1 -LOGINS=0 -WINDOWS=0 -DAILY=0 -RUNNING=0 -TIME_BEFORE=20 -TIME_AFTER=5 # Only adjustable by editing here - -while getopts "hslwmrt:v" OPT ; do - case $OPT in - h) usage 0 ;; - s) VERBOSE=0 ;; - t) TIME_BEFORE=$OPTARG ;; - l) LOGINS=1 ;; - w) WINDOWS=1 ;; - m) DAILY=1 ;; - r) RUNNING=1 ;; - v) VERBOSE=2 ;; - *) usage 1 ;; - esac -done -# Check for extra cruft on the command line... -shift $(($OPTIND - 1)) -[ -n "$*" ] && usage 1 - -msg "Checking what MythTV is doing now or plans to within $TIME_BEFORE minutes..." -msg - -/usr/bin/mythshutdown --status -BUSY="$?" -msg "mythshutdown returned $BUSY" -if [ "$DAILY" -eq 0 ] ; then - msg " including daily wake, locked, and about to start wake as system idle" - # Ignore daily wake, locked and about to start wake flag values - BUSY=$(($BUSY & 0x2F)) - msg " mythshutdown returned $BUSY" -fi - -SCHEMALOCK=$(mysql_cmd "select count(*) from schemalock") -msg "schemalock $SCHEMALOCK" - -JOBS=$(mysql_cmd "select count(*) from jobqueue where status = 4") -msg "running jobs $JOBS" - -INUSE=$(mysql_cmd "select count(*) from inuseprograms") -msg "inuse programs $INUSE" - -UPCOMING=$(timeout 3 misc_upcoming_recordings.pl --plain_text --text_format "%rs " --heading "" --minutes $TIME_BEFORE --recordings -1 | wc -w) -msg "planned recordings $UPCOMING" -if [ "$VERBOSE" -ge 2 ] ; then - msg - timeout 3 /usr/LH/bin/misc_upcoming_recordings.pl --plain_text --minutes $TIME_BEFORE --recordings -1 -fi - -# Check all host's mythfrontends if they are running and playing -HOSTNAMES=$(mysql_cmd "select hostname from settings where value = 'FrontendIdleTimeout'") -FERUNNING=0 -PLAYING=0 -for HOST in $HOSTNAMES -do - if [ "$VERBOSE" -ge 2 ]; then - msg "Checking $HOST's mythfrontend status..." - fi -ncOUTPUT=$(timeout 2 nc $HOST 6546 << EOF -query location -quit -EOF -) - if [ "$RUNNING" -ge 1 ] ; then - if [[ "$ncOUTPUT" == *"# "* ]]; then - FERUNNING=$(( $FERUNNING + 1 )) - msg "$HOST's mythfrontend is running $FERUNNING" - else - msg "$HOST's mythfrontend is NOT running $FERUNNING" - fi - fi - if [[ "$ncOUTPUT" == *"# Playback "* ]]; then - PLAYING=$(( $PLAYING + 1 )) - msg "$HOST is playing a recording or video $PLAYING" - else - msg "$HOST is NOT playing a recording or video $PLAYING" - fi -done - -# Check for users logged in -if [ "$LOGINS" -ge 1 ] ; then - USERS=`/usr/bin/last | /bin/grep "still logged in" | awk '{ print $1 }'` - if [ -n "$USERS" ] ; then - LOGINS=1 - msg "The following user(s) are still logged in:" - msg "${USERS}" - else - LOGINS=0 - msg "No users are logged in $LOGINS" - fi -fi - -# Check for open windows -FOUNDWINDOWS=0 -if [ "$WINDOWS" -ge 1 ] ; then - /usr/LH/bin/xwin_find.sh -q '.*(mythtv@|xterm|Firefox|Namoroka|Opera|Chromium).*' - FOUNDWINDOWS="$?" - FOUNDWINDOWS=$(($FOUNDWINDOWS == 0)) - if [ "$FOUNDWINDOWS" -eq 0 ] ; then - msg "no application windows open $FOUNDWINDOWS" - else - msg "one or more application windows open $FOUNDWINDOWS" - fi -fi - -activities=$(($BUSY + $SCHEMALOCK + $JOBS + $INUSE + $UPCOMING + $FERUNNING + $PLAYING + $LOGINS + $FOUNDWINDOWS)) -msg -if [ "$activities" -eq 0 ] ; then - msg "System is idle" - exit 0 -else - msg "System is busy" - exit 1 -fi diff --git a/abs/core/linhes-scripts/importfiles.sh b/abs/core/linhes-scripts/importfiles.sh deleted file mode 100755 index 84f1ab5..0000000 --- a/abs/core/linhes-scripts/importfiles.sh +++ /dev/null @@ -1,18 +0,0 @@ -#!/bin/bash -export FONT="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" - -DVD_or_CD=`cat /proc/mounts |grep iso9660|awk '{print $2}'|tail -1` -if [ "$DVD_or_CD" != "" ]; then - echo "Copying files from $DVD_or_CD to /myth/video." > /tmp/screens - echo "This could take several minutes, depending on the" >> /tmp/screens - echo "speed and size of your optical media." >> /tmp/screens - cat /tmp/screens | osd_cat --font=$FONT --shadow=3 --pos=middle --align=centre --color=yellow --delay=0 & - /bin/cp -R $DVD_or_CD/* /myth/video/ - killall osd_cat - echo "Copied videos from $DVD_or_CD to /myth/video" > /tmp/screens - cat /tmp/screens | osd_cat --font=$FONT --shadow=3 --pos=middle --align=centre --color=yellow --delay=2 & -else - echo "No optical media found. If you just inserted" > /tmp/screens - echo "your media, please wait a moment and try again." >> /tmp/screens - cat /tmp/screens | osd_cat --font=$FONT --shadow=3 --pos=middle --align=centre --color=yellow --delay=5 & -fi diff --git a/abs/core/linhes-scripts/linhes-scripts.install b/abs/core/linhes-scripts/linhes-scripts.install index d4c9e59..f554bd0 100644 --- a/abs/core/linhes-scripts/linhes-scripts.install +++ b/abs/core/linhes-scripts/linhes-scripts.install @@ -2,13 +2,6 @@ post_upgrade() { . /etc/profile /usr/LH/bin/remove_php_mythvideo.sh - if [ "`vercmp $2 7-24`" -lt 0 ] - then - echo "Applying ACL fix and remounting /" - /usr/LH/bin/acl_fix_fstab.py - mount -o remount / - fi - } # 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 deleted file mode 100644 index e5dd2ad..0000000 --- a/abs/core/linhes-scripts/linhes_update.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -#---------------------------------------------------------------------------- -. /etc/osd_cat.cfg || { - color=yellow - outline=2 - outlinecolour=black - shadow=0 - shadowcolour=black - font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" -} -#---------------------------------------------------------------------------- -dsply () { - if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml - then - killall -9 osd_cat - echo -e "\nUpdates available!\nExit and re-enter Service Menu\n to install the updates." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - echo -e "\nUpdates available!\nExit and re-enter Service Menu\n to install the updates." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - exit - else - killall -9 osd_cat - echo -e "Checking for updates..." | osd_cat --pos=middle --align=center --delay=300 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - echo -e "Checking for updates..." | osd_cat --pos=middle --align=center --delay=300 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - fi -} -chck () { - sudo pacman -Sy - sudo pacman -Qu > /tmp/to_be_upgraded - if [[ ! -s /tmp/to_be_upgraded ]] - then - killall -9 osd_cat - echo -e "\nNo updates available." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - echo -e "\nNo updates available." | osd_cat --pos=middle --align=center --delay=5 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - else - 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 - echo " <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp - echo " <text>Updates Available</text>" >> /tmp/linhes.xml.tmp - echo " <action>MENU update2.xml</action>" >> /tmp/linhes.xml.tmp - 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/themes/defaultmenu/linhes.xml - - echo "<mythmenu name=\"LinHES\">" > /tmp/update3.xml.tmp - if grep kernel26 /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded - then - echo "" >> /tmp/update3.xml.tmp - echo " <button>" >> /tmp/update3.xml.tmp - echo " <type>UPGRADE</type>" >> /tmp/update3.xml.tmp - echo " <text>REBOOT REQUIRED</text>" >> /tmp/update3.xml.tmp - echo " <action>NONE</action>" >> /tmp/update3.xml.tmp - echo " </button>" >> /tmp/update3.xml.tmp - fi - - while read line; do - echo "" >> /tmp/update3.xml.tmp - echo " <button>" >> /tmp/update3.xml.tmp - echo " <type>UPGRADE</type>" >> /tmp/update3.xml.tmp - echo " <text>$line</text>" >> /tmp/update3.xml.tmp - echo " <action>NONE</action>" >> /tmp/update3.xml.tmp - echo " </button>" >> /tmp/update3.xml.tmp - done < "/tmp/to_be_upgraded" - echo "</mythmenu>" >> /tmp/update3.xml.tmp - mv /tmp/update3.xml.tmp /usr/share/mythtv/themes/defaultmenu/update3.xml - dsply - fi - } -dsply -chck diff --git a/abs/core/linhes-scripts/linhes_update2.sh b/abs/core/linhes-scripts/linhes_update2.sh deleted file mode 100644 index d6984ed..0000000 --- a/abs/core/linhes-scripts/linhes_update2.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash - -#---------------------------------------------------------------------------- -. /etc/osd_cat.cfg || { - color=yellow - outline=2 - outlinecolour=black - shadow=0 - shadowcolour=black - font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" -} -#---------------------------------------------------------------------------- - -if [[ "$1" = "install" ]] -then - killall -9 osd_cat - echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - echo -e "Updating..." | osd_cat --pos=middle --align=center --delay=300000 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - sudo pacman -Suf --noconfirm && sudo killall -9 osd_cat - killall -9 osd_cat - echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - echo -e "\nUpdates complete." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - if grep kernel26 /tmp/to_be_upgraded || grep nvidia /tmp/to_be_upgraded - then - echo -e "\n\nUpdates require a reboot." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - echo -e "\n\nUpdates require a reboot." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - fi -else - killall -9 osd_cat - echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - echo -e "\nUpdates canceled." | osd_cat --pos=middle --align=center --delay=3 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & -fi - -rm -fr /tmp/to_be_upgraded - -if grep -q Updates\ Available /usr/share/mythtv/themes/defaultmenu/linhes.xml -then - 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 - echo " <type>UPGRADE</type>" >> /tmp/linhes.xml.tmp - echo " <text>Update LinHES</text>" >> /tmp/linhes.xml.tmp - echo " <action>MENU update.xml</action>" >> /tmp/linhes.xml.tmp - 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/themes/defaultmenu/linhes.xml -fi diff --git a/abs/core/linhes-scripts/linhes_update3.sh b/abs/core/linhes-scripts/linhes_update3.sh deleted file mode 100644 index 72641db..0000000 --- a/abs/core/linhes-scripts/linhes_update3.sh +++ /dev/null @@ -1,28 +0,0 @@ -#!/bin/bash -#---------------------------------------------------------------------------- -. /etc/osd_cat.cfg || { - color=yellow - outline=2 - outlinecolour=black - shadow=0 - shadowcolour=black - font="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" -} -#---------------------------------------------------------------------------- - -sudo killall osd_cat -cat /tmp/to_be_upgraded | sed 's/ /\n/g' | sed '/^$/d' | grep - > /tmp/to_be_upgraded2 -COUNT=$(wc -l /tmp/to_be_upgraded2 | awk '{print $1}') -if [ $COUNT -lt 20 ] - then - cat /tmp/to_be_upgraded2 | osd_cat --lines=20 --pos=top --align=center --delay=12 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & - else - cat /tmp/to_be_upgraded2 | osd_cat --lines=20 --pos=top --align=center --delay=1 --wait --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font & -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 --pos=middle --align=center --delay=10 --color=$color --outline=$outline --outlinecolour=$outlinecolour --shadow=$shadow --shadowcolour=$shadowcolour --font=$font -else - exit -fi diff --git a/abs/core/linhes-scripts/myth2mkv b/abs/core/linhes-scripts/myth2mkv deleted file mode 100644 index aedccff..0000000 --- a/abs/core/linhes-scripts/myth2mkv +++ /dev/null @@ -1,433 +0,0 @@ -#!/bin/bash -# -# Convert video to AVC-1 / h264 -# -# version 0.25-004 -# -# Prerequisites: -# - mythtv >= 0.25 -# - handbrake-cli -# - mplayer -# - mkvtoolnix -# -# Arguments -# $1 must be the directory/file of the recording -# $2 must be chanid -# $3 must be starttime -# $4 must be title -# $5 must be subtitle -# $6 must be jobid -# $7 must be quality of encode -# -# As a MythTV user job: -# myth2mkv "%DIR%/%FILE%" "%CHANID%" "%STARTTIME%" "%TITLE%" "%SUBTITLE%" "%JOBID%" HQ|MQ|LQ - -######################## -# # -# Adjustable variables # -# # -######################## - -OUTDIR=/myth/video -LOGPATH=/var/log/mythtv -LOGFILE=${LOGPATH}/myth2mkv-$$.log - -# TMPDIR is for large transient files -TMPDIR=/myth/tmp - -# x264 tuning: -# Tune x264 based on content. Valid options for TUNING are: -# film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency -# Separate multiple options with a comma. DEFAULT: none -TUNING="" - -# Custom cropping. Useful if you have a 4:3 image in a HD frame or if -# HandBrake's autocrop smarts fail you. -# Crop 240 pixels off the left and right for 4:3 image in 1920x1080 frame -# Crop 160 pixels off the left and right for 4:3 image in 1280x720 frame -# <T:B:L:R> -# i.e. 0:0:240:240 -# Default: In HQ: CROP="0:0:0:0" (no cropping). -# IN MQ and LQ: autocrop. -CROP="" - -# Force custom output resolution. -# Default: Keep same resolution as input file (less any cropping). -WIDTH="" -HEIGHT="" - -# Force use/non-use of deinterlacing filter. Y|N|G (Yes, No, Guess) -# Default: G - Guess based on source resolution. -# If the source video width is 1920, 1440, 852, 704, 640 or 528 pixels -# "G" will deinterlace the video. Change to "Y" to force use of deinterlacing -# filter or to "N" to NOT use deinterlace filter no matter the resolution. -DEINT="G" - -############################ -# # -# End adjustable variables # -# # -############################ - -if [[ -e $HOME/.mythtv/mysql.txt ]] ; then - . $HOME/.mythtv/mysql.txt -else - DBHostName=${DBHostName:-"localhost"} - DBUserName=${DBUserName:-"mythtv"} - DBPassword=${DBPassword:-"mythtv"} - DBName=${DBName:-"mythconverg"} -fi - -if [[ ! -d ${TMPDIR} ]] ; then - mkdir -p ${TMPDIR} -fi - -if [[ ! -d ${OUTDIR} ]] ; then - mkdir -p ${OUTDIR} -fi - -#------FUNCTIONS--------------- -update_comment() -# Arg_1 = COMMENT -{ -if [ ${NO_JOBID} -eq 0 ]; then - SQL_CMD="update jobqueue set comment=\"${1}\" where id=\"${JOBID}\";" - `${MYSQLCMD} "${SQL_CMD}"` -fi -} - -check_background_progress() -# check handbrake progress in background -{ -while [ `tail -2 ${STATUSFILE} | grep -c "^HandBrake has exited"` = 0 ] -do - sleep 10 - check_myth_jobcmds - pass=`tail -1 ${STATUSFILE} | egrep -o -e 'task [0-9]' | tail -1 | sed 's/task\ //g'` - prog_percent=`tail -1 ${STATUSFILE} | egrep -o -e '[0-9]*\.[0-9]. %' | tail -1 | sed 's/\ %//g'` - current_FPS=`tail -1 ${STATUSFILE} | egrep -o -e 'avg [0-9.]*\.[0-9]* fps' | tail -1 | sed -e 's/avg\ //g' -e 's/\ fps//g'` - current_ETA=`tail -1 ${STATUSFILE} | egrep -o -e 'ETA [0-9.][0-9.]h[0-9.][0-9.]m[0-9.][0-9.]s' | tail -1` - if [ -n "$prog_percent" ]; then - echo "Pass ${pass}, ${prog_percent}% @ ${current_FPS} fps. ${current_ETA}" - update_comment "Pass ${pass} of 2, ${prog_percent}% @ ${current_FPS} fps. ${current_ETA}" - fi - sleep 10 -done -} - -check_myth_jobcmds() -# check the myth database for stop pause or resume commands -{ -if [[ ${NO_JOBID} -eq 0 ]] ; then - CURRENT_CMD=`${MYSQLCMD} "select cmds from jobqueue where id = \"${JOBID}\";"` - case "${CURRENT_CMD}" in - # JOB_RUN - 0) ;; - # JOB_PAUSE - 1) `${MYSQLCMD} "update jobqueue set status=\"6\" where id=\"${JOBID}\";"` - kill -s STOP ${handbrake_pid} ;; - # JOB_RESUME - 2) `${MYSQLCMD} "update jobqueue set status=\"4\" where id=\"${JOBID}\";"` - `${MYSQLCMD} "update jobqueue set cmds=\"0\" where id=\"${JOBID}\";"` - kill -s CONT ${handbrake_pid} ;; - # JOB_STOP - 4) `${MYSQLCMD} "update jobqueue set status=\"5\" where id=\"${JOBID}\";"` - `${MYSQLCMD} "update jobqueue set cmds=\"0\" where id=\"${JOBID}\";"` - kill -9 ${handbrake_pid} ${command_pid} - clean_up_files - echo "Encode Cancelled" >> ${LOGFILE} - `${MYSQLCMD} "update jobqueue set status=\"320\" where id=\"${JOBID}\";"` - exit ;; - esac -fi -} - -get_info_for_hb() { -# Collect some info about source file - -/usr/bin/mplayer -nolirc -identify -frames 0 "${HBINPUTFILE}" \ - 2>/dev/null 1>"${IDFILE}" - -VIDEOW=$( grep ID_VIDEO_WIDTH= "${IDFILE}" | awk -F= '{ print $NF }' ) -FPS=$( grep ID_VIDEO_FPS= "${IDFILE}" | awk -F= '{ print $NF }' ) - -# HandBrake does not like a framerate of 29.970, so let's drop the 0 -if [[ ${FPS} = "29.970" ]] ; then - FPS="29.97" -fi - -# HandBrake does not like a framerate of 59.940, so let's drop the 0 -if [[ ${FPS} = "59.940" ]] ; then - FPS="59.94" -fi - -# A rough guestimation that if the video width is 1920, 1440, 852, 704, 640 or -# 528 pixels it is probably interlaced. -if [[ ${DEINT} = Y ]] ; then - DEINT="-d slow" -else - if [[ ${DEINT} = N ]] ; then - DEINT="" - else - if [[ ${VIDEOW} = 1920 || ${VIDEOW} = 1440 || ${VIDEOW} = 852 || \ - ${VIDEOW} = 704 || ${VIDEOW} = 640 || ${VIDEOW} = 528 ]] ; then - DEINT="-d slow" - else - DEINT="" - fi - fi -fi - -if [[ -n ${DEINT} ]] ; then - if [[ ${QUALITY} = LQ ]] ; then - DEINT="-d fast" - fi -fi - -if [[ -n ${TUNING} ]] ; then - TUNING="--x264-tune ${TUNING}" -fi - -if [[ -n ${CROP} ]] ; then - CROP="--crop ${CROP}" -fi - -if [[ -n ${WIDTH} ]] ; then - WIDTH="-w ${WIDTH} -X ${WIDTH}" -fi - -if [[ -n ${HEIGHT} ]] ; then - HEIGHT="-l ${HEIGHT} -Y ${HEIGHT}" -fi - -if [[ ${QUALITY} = HQ ]] ; then - if [[ -n ${CROP} ]] ; then - CROP="--crop ${CROP}" - else - CROP="--crop 0:0:0:0 --strict-anamorphic" - fi - HB_OPTS="-o ${TMPFILE} -f mkv -m -e x264 ${TUNING} -x b-adapt=2:rc-lookahead=50 -b 5000 -2 -T ${WIDTH} ${HEIGHT} -r ${FPS} --cfr ${CROP} ${DEINT} -a 1 -E copy -s 1" -else - if [[ ${CROP} = "--crop 0:0:0:0" ]] ; then - CROP="${CROP} --strict-anamorphic" - fi - if [[ ${QUALITY} = LQ ]] ; then - HB_OPTS="-o ${TMPFILE} -f mkv -m -e x264 ${TUNING} -b 1250 ${WIDTH} ${HEIGHT} -r ${FPS} --pfr ${CROP} ${DEINT} -a 1 -E lame -B 128 -Q 8 -6 stereo -s 1" - else - # Fallback to "MQ" - HB_OPTS="-o ${TMPFILE} -f mkv -m -e x264 ${TUNING} -b 2500 -2 -T ${WIDTH} ${HEIGHT} -r ${FPS} --pfr ${CROP} ${DEINT} -a 1 -E lame -B 256 -Q 3 -6 stereo -s 1" - fi -fi -} - -get_handbrake_pid() -{ -process_name="" -i1=1 -while [ "${process_name}" != "found" ]; do - handbrake_pid=`expr ${handbrake_pid} + 1` - i1=`expr ${i1} + 1` - if [ "`ps ${handbrake_pid} | grep HandBrakeCLI | sed 's_.*\(HandBrakeCLI\).*_\1_'`" = "HandBrakeCLI" ]; then - process_name="found" - fi - if [ ${i1} -gt 20 ]; then - break - fi -done -} - -tag_file() { -DATE=`date` - -# Create a tag file here -echo "<?xml version='1.0' encoding='ISO-8859-1'?>" > "${TAG_FILE}" -echo "" >> "${TAG_FILE}" -echo "<!DOCTYPE Tags SYSTEM 'matroskatags.dtd'>" >> "${TAG_FILE}" -echo "" >> "${TAG_FILE}" -echo "<Tags>" >> "${TAG_FILE}" -echo " <Tag>" >> "${TAG_FILE}" -echo " <Simple>" >> "${TAG_FILE}" -echo " <Name>TITLE</Name>" >> "${TAG_FILE}" -echo " <String>${TITLE}</String>" >> "${TAG_FILE}" -echo " <Simple>" >> "${TAG_FILE}" -echo " <Name>SUBTITLE</Name>" >> "${TAG_FILE}" -echo " <String>${SUBTITLE}</String>" >> "${TAG_FILE}" -echo " <Simple>" >> "${TAG_FILE}" -echo " <Name>SUMMARY</Name>" >> "${TAG_FILE}" -echo " <String>${DESCR}</String>" >> "${TAG_FILE}" -echo " </Simple>" >> "${TAG_FILE}" -echo " <Simple>" >> "${TAG_FILE}" -echo " <Name>DATE_RELEASED</Name>" >> "${TAG_FILE}" -echo " <String>${OAD}</String>" >> "${TAG_FILE}" -echo " </Simple>" >> "${TAG_FILE}" -echo " </Simple>" >> "${TAG_FILE}" -echo " </Simple>" >> "${TAG_FILE}" -echo " <Simple>" >> "${TAG_FILE}" -echo " <Name>ENCODER</Name>" >> "${TAG_FILE}" -echo " <String>HandBrakeCLI ${HBCLIVER}</String>" >> "${TAG_FILE}" -echo " </Simple>" >> "${TAG_FILE}" -echo " <Simple>" >> "${TAG_FILE}" -echo " <Name>DATE_TAGGED</Name>" >> "${TAG_FILE}" -echo " <String>${DATE}</String>" >> "${TAG_FILE}" -echo " </Simple>" >> "${TAG_FILE}" -echo " </Tag>" >> "${TAG_FILE}" -echo "</Tags>" >> "${TAG_FILE}" - -# Add tag info into MKV file -echo "Adding tag info to ${TITLE} - ${SUBTITLE} ..." >> ${LOGFILE} - -/usr/bin/mkvpropedit -r ${LOGFILE} -t all:"${TAG_FILE}" "${TMPFILE}" -} - -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 ${STATUSFILE} 2> /dev/null -unlink ${IDFILE} 2> /dev/null -unlink ${HB_RETURN_CODE} 2> /dev/null -unlink ${TAG_FILE} 2> /dev/null -} - -#-------MAIN SCRIPT------------ - -# create temp filename so multiple instances won't conflict -TMPNAME=toX264-$$ -TMPFILE=${TMPDIR}/${TMPNAME}.mkv -TMPCUTFILE=${TMPDIR}/${TMPNAME}.mpg -HBINPUTFILE="${1}" -TITLE="${4}" -SUBTITLE="${5}" -JOBID="${6}" -QUALITY="${7}" -BASE=`basename ${HBINPUTFILE}` -HBCLIVER=`pacman -Q | grep handbrake-cli | awk '{ print $NF }' | awk -F"-" '{ print $1 }'` -STATUSFILE=/tmp/${TMPNAME}-status.log -HB_RETURN_CODE=/tmp/${TMPNAME}-hb_return_code -IDFILE=/tmp/${TMPNAME}-id.txt -TAG_FILE=/tmp/${TMPNAME}.xml -MYSQLCMD="mysql -B --skip-column-names -u ${DBUserName} -p${DBPassword} -h ${DBHostName} -D ${DBName} -e" -OAD=`${MYSQLCMD} "select originalairdate from recorded where basename LIKE '${BASE}';"` -DESCR=`${MYSQLCMD} "select description from recorded where basename LIKE '${BASE}';" | sed 's/\&/and/g'` -USER=`whoami` - -# check if %JOBID% is passed from command line -if [ -z ${JOBID} ]; then - NO_JOBID=1 -else - NO_JOBID=0 -fi - -# log file location -CDate="`date`" -echo "" >> ${LOGFILE} -echo $CDate >> ${LOGFILE} -echo "File to encode: ${HBINPUTFILE}" >> ${LOGFILE} -echo " --> Name: ${TITLE} - ${SUBTITLE}" >> ${LOGFILE} -echo " --> Temporary Files: ${TMPNAME}.*" >> ${LOGFILE} -echo "" >> ${LOGFILE} - -get_info_for_hb -ERROR=$? - -if [[ ${ERROR} != 0 ]] ; then - echo "Error parsing source file information!" >> ${LOGFILE} - cat ${IDFILE} >> ${LOGFILE} - clean_up_files - exit 1 -fi - -# start timer -beforetime="$(date +%s)" - -check_myth_jobcmds - -# If there is a cutlist, use it: -if [[ -n `mythutil --getcutlist --chanid "${2}" --starttime "${3}" | grep \ - Cutlist: | awk -F": " '{ print $NF }'` ]] ; then - echo "Applying cutlist for ${TITLE} - ${SUBTITLE} ..." >> ${LOGFILE} - mythtranscode --chanid "${2}" --starttime "${3}" -m --honorcutlist \ - -q --loglevel info --logpath "${LOGPATH}" -o "${TMPCUTFILE}" - mythtrans_pid=$! - ERROR=$? - HBINPUTFILE=${TMPCUTFILE} -fi - -if [[ ${ERROR} != 0 ]] ; then - echo "MythTranscode error!" >> ${LOGFILE} - echo "Check ${LOGPATH}/mythtranscode.date.${mythtrans_pid}.log for mythtranscode error" >> ${LOGFILE} - clean_up_files - exit 1 -fi - -# run handbrake in background to do conversion -echo "Encoding ${TITLE} - ${SUBTITLE} ..." >> ${LOGFILE} - -( /usr/bin/nice -n19 nohup /usr/bin/HandBrakeCLI -i ${HBINPUTFILE} ${HB_OPTS} \ - > ${STATUSFILE} 2>&1 ; echo $? > ${HB_RETURN_CODE} ) & -handbrake_pid=$! -command_pid=${handbrake_pid} -get_handbrake_pid - -check_background_progress - -if [[ `cat ${HB_RETURN_CODE}` != 0 ]] ; then - echo "HandBrakeCLI error!" >> ${LOGFILE} - cat ${STATUSFILE} >> ${LOGFILE} - clean_up_files - exit 1 -fi - -tag_file -ERROR=$? - -if [[ ${ERROR} != 0 ]] ; then - echo "Error creating tag file!" >> ${LOGFILE} - cat ${TAG_FILE} >> ${LOGFILE} - clean_up_files - exit 1 -fi - -# make output filename unique and do not clobber an existing file -# Build a final file name -FILE=$( echo "${TITLE,,} ${OAD} ${SUBTITLE,,}" | tr -d [:punct:] | tr [:blank:] "_" | tr -s "_" ) -OUTPUTFILE="${OUTDIR}/${FILE}.mkv" -i=1 -while [ -e "${OUTPUTFILE}" ] -do - OUTPUTFILE="${OUTDIR}/${FILE}-${i}.mkv" - i=`expr $i + 1` -done - -# move temp file to output location -chown -v "${USER}" "${TMPFILE}" >> ${LOGFILE} -mv -v "${TMPFILE}" "$OUTPUTFILE" >> ${LOGFILE} -ERROR=$? - -if [[ ${ERROR} != 0 ]] ; then - echo "Error moving ${TMPFILE} to ${OUTPUTFILE} !" >> ${LOGFILE} - clean_up_files - exit 1 -fi - -# stop timer -aftertime="$(date +%s)" -seconds="$(expr ${aftertime} - ${beforetime})" - -if [ ${ERROR} -eq 0 ]; then - 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} - `${MYSQLCMD} "update jobqueue set status = \"272\" where id = \"${JOBID}\";"` - update_comment "Encode Successful. Encoding Time: ${hours} hour\(s\) ${minutes} minute\(s\) ${seconds} second\(s\)" -else - echo "ERROR: ${ERROR}" >> ${LOGFILE} -fi - -# Clean up -clean_up_files diff --git a/abs/core/linhes-scripts/myth2mp3 b/abs/core/linhes-scripts/myth2mp3 deleted file mode 100755 index 69d5d3f..0000000 --- a/abs/core/linhes-scripts/myth2mp3 +++ /dev/null @@ -1,96 +0,0 @@ -#!/bin/sh -# convert recordings to as mp3 audio only -# version 1.1.3 - -# usage: -# first parameter must be %DIR%/%FILE% of the recording -# second parameter must be the desired base name of the output -# third parameter must be %CHANID% if you set USECUTLIST=Y -# fourth parameter must be %STARTTIME% if you set USECUTLIST=Y -# In the mythtv setup screen invoke this script like this: -# MYTHTV User Job Command: -# /usr/LH/bin/myth2mp3 "%DIR%/%FILE%" "%TITLE% - %SUBTITLE%" "%CHANID%" "%STARTTIME%" - -# options: -BITRATE=256k #ie. 128k, 160k, 192k, 224k, 256k -USECUTLIST=Y #Y or N - -# where the converted audio is stored -OUT_DIR=/myth/music - -# create temp filename so multiple instances won't conflict -TMPNAME=toMP3-$$ -TMPFILE=/myth/tmp/$TMPNAME -TMPCUTFILE=/myth/tmp/$TMPNAME.mpg -FFINPUTFILE=$1 -TITLE=`echo $2 | sed 's/\//_/g'` - -# log file location -LOGFILE=/var/log/mythtv/myth2mp3.log -CDate="`date`" -echo "" >> $LOGFILE -echo $CDate >> $LOGFILE -echo "File to encode: $1 Name: $TITLE" >> $LOGFILE - -# start timer -beforetime="$(date +%s)" - -# check if using cutlist -if [ $USECUTLIST = Y ];then - MYTHCOMMFRAMES=`mythutil --getcutlist --chanid "$3" --starttime "$4" | grep 'Cutlist:' | cut -d \ -f 2` - if [ -n "$MYTHCOMMFRAMES" ]; then - echo "Extracting Cutlist..." >> $LOGFILE - /usr/bin/nice -n19 /usr/bin/mythtranscode --chanid "$3" --starttime "$4" --outfile "$TMPCUTFILE" --mpeg2 --honorcutlist - FFINPUTFILE=$TMPCUTFILE - fi -fi - -# run ffmpeg to do conversion to wav -echo "Encoding to intermediate wav..." >> $LOGFILE -/usr/bin/nice -n19 /usr/bin/ffmpeg -i "$FFINPUTFILE" -vn -acodec pcm_s16le -ar 44100 -ac 2 "$TMPFILE.wav" -ERROR=$? - -# Normalize the intermediate wav -echo "Normalizing intermediate wav..." >> $LOGFILE -/usr/bin/nice -n19 /usr/bin/normalize -q "$TMPFILE.wav" -ERROR=$? - -FFINPUTFILE=$TMPFILE.wav - -# Final encode of normalized wav to mp3 -echo "Encoding normalized wav to mp3..." >> $LOGFILE -/usr/bin/nice -n19 /usr/bin/ffmpeg -i "$FFINPUTFILE" -vn -acodec libmp3lame -ab $BITRATE -ar 44100 -ac 2 "$TMPFILE.mp3" -ERROR=$? - -# make output filename unique -OUTPUTFILE=$OUT_DIR/$TITLE.mp3 -i=1 -while [ -e "$OUTPUTFILE" ] -do - OUTPUTFILE=$OUT_DIR/$TITLE-$i.mp3 - i=`expr $i + 1` -done - -# move temp file to output location -chown mythtv "$TMPFILE.mp3" && mv "$TMPFILE.mp3" "$OUTPUTFILE" - -# stop timer -aftertime="$(date +%s)" -seconds="$(expr $aftertime - $beforetime)" - -if [ $ERROR -eq 0 ]; then - echo "File Encoded Sucessfully: $OUTPUTFILE" >> $LOGFILE - hours=$((seconds / 3600)) - seconds=$((seconds % 3600)) - minutes=$((seconds / 60)) - seconds=$((seconds % 60)) - echo "Encoding Time: $hours hour(s) $minutes minute(s) $seconds second(s)" >> $LOGFILE -else - echo "ERROR: $ERROR" >> $LOGFILE -fi - -# clean up left over files -unlink $TMPFILE.mp3 2> /dev/null -unlink $TMPFILE.wav 2> /dev/null -unlink $TMPCUTFILE 2> /dev/null -unlink $TMPCUTFILE.map 2> /dev/null diff --git a/abs/core/linhes-scripts/mythwelcome-config.py b/abs/core/linhes-scripts/mythwelcome-config.py deleted file mode 100755 index 5ab24b0..0000000 --- a/abs/core/linhes-scripts/mythwelcome-config.py +++ /dev/null @@ -1,27 +0,0 @@ -#!/usr/bin/env python2 - -# 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/LH/bin/idle.sh -s -m -r' diff --git a/abs/core/linhes-scripts/mythwelcome-set-alarm.sh b/abs/core/linhes-scripts/mythwelcome-set-alarm.sh deleted file mode 100755 index 990adf7..0000000 --- a/abs/core/linhes-scripts/mythwelcome-set-alarm.sh +++ /dev/null @@ -1,23 +0,0 @@ -#!/bin/sh -#$1 is the first argument to the script. It is the time in seconds since 1970 -#This is defined in mythwelcome with the time_t argument - -# Configure mythwelcome --setup page: -# Command to Set Wakeup Time: sudo sh -c "/usr/LH/bin/mythwelcome-set-alarm.sh $time" -# Wakeup Time Format: time_t -# nvram-wakeup Restart Command: Leave this blank -# Command to reboot: sudo /sbin/reboot -# Command to shutdown: sudo /sbin/poweroff -# Command to run Xterm: xterm -# Command to start the Frontend: /usr/bin/mythfrontend -l /var/log/mythtv/mythfrontend.log - -# Configure mythtv-setup Shutdown/Wakeup Options page: -# Idletimeout (secs): any value greater that 0 -# 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 - -echo 0 > /sys/class/rtc/rtc0/wakealarm #this clears your alarm -echo $1 > /sys/class/rtc/rtc0/wakealarm #this writes your alarm -cat /proc/driver/rtc > /var/log/wake_alarm diff --git a/abs/core/linhes-scripts/mythwelcome-test-wakeup.sh b/abs/core/linhes-scripts/mythwelcome-test-wakeup.sh deleted file mode 100755 index 4aadf6d..0000000 --- a/abs/core/linhes-scripts/mythwelcome-test-wakeup.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/sh - -sudo sh -c "echo 0 > /sys/class/rtc/rtc0/wakealarm" #this clears your alarm -sudo sh -c "echo `date '+%s' -d '+ 4 minutes'` > /sys/class/rtc/rtc0/wakealarm" #this writes your alarm -cat /proc/driver/rtc -cat /proc/driver/rtc > /var/log/wake_alarm -echo "Your computer is set to start up in 4 minutes using ACPI." -echo -n "Do you want to shutdown the computer now? (y/n): " -read -n 1 shutdown -if [ "$shutdown" == "y" ]; then - echo -e "\nShutting down now..." - sudo shutdown -t 5 -h now -else - echo -e "\nTo shutdown execute the following:" - echo " sudo shutdown -t 5 -h now" -fi diff --git a/abs/core/linhes-scripts/ripD_eject.sh b/abs/core/linhes-scripts/ripD_eject.sh deleted file mode 100755 index 99947a8..0000000 --- a/abs/core/linhes-scripts/ripD_eject.sh +++ /dev/null @@ -1,125 +0,0 @@ -#!/bin/bash -# /usr/LH/bin/ripD_eject.sh -# A DVD rip and eject script. -######################################################################## -DEV='/dev/sr0' # DVD device -MPNT='media/cdrom' # Mount Point -Ddir='/myth/video' # DVD output dir List -Bsnd='/usr/share/sounds/init.wav' # Begin sound file -Esnd='/usr/share/sounds/complete.wav' # End sound file -DATE=$(date +%Y%m%d_%H%M) # current date/time -LOG='/var/log/mythtv/ripD.log' # name of Log file. -TRACK=$(lsdvd | grep -i longest | awk '{print $3}') #Finds longest track -FILE=$TITLE -#----------------------------------------------------------------------- -FONT="-adobe-helvetica-bold-*-*-*-34-*-*-*-*-*-*-*" -OPTS="-f $FONT -s 2 -p bottom -A left -i 50 -l 4" -#----------------------------------------------------------------------- -[ -r /etc/rip.cfg ] && . /etc/rip.cfg -#----------------------------------------------------------------------- -LOCK=/tmp/.ripLock.$$ -[ "$DISPLAY" == "" ] && export DISPLAY=:0 -######################################################################## -function osd { # $1=text, $2=color, $3=delay - cmd="osd_cat $OPTS" - [ -n "$2" ] && cmd="$cmd --color=$2" - [ -n "$3" ] && cmd="$cmd -d $3" - killall osd_cat - echo -e "$1" | $cmd -} >& /dev/null -function osd_loop() { - FN=$1 ; shift -# TXT="$MAX to $dir" - TXT="$MAX to $dir/$FILE" - N=0 - while [ -f "$LOCK" ]; do - #osd "\nbacking up DVD: '$@'\n$TXT" gray 60 - osd "\nbacking up DVD: '$TITLE'\n$TXT" gray 60 - N=$(($N+1)) - [ -d "$FN" ] && SIZE=$(du -sh $FN | awk '{print $1}') -# TXT="$SIZE of $MAX @ $N min. elapsed" - TXT="$N min. elapsed" - done -} -######################################################################## -LinHES-osd "\nDetecting DVD" gray20 5 & -echo "`date` detected DVD" >> $LOG -rm -f /tmp/.ripLock.* -#======================================================================= -for dir in $Ddir ; do - if [ -d $dir -a -w $dir ]; then - break - fi -done -#----------------------------------------------------------------------- -if [ ! -d "$dir" ]; then - echo "no $dir" >> $LOG - osd "\ndirectory: $dir\nnot found!" red 10 & - eject ; eject - exit 0 -fi -if [ ! -w "$dir" ]; then - echo "$dir not writable" >> $LOG - osd "\ndirectory: $Cdir\nnot writable!" red 10 & - eject ; eject - exit 0 -fi -#----------------------------------------------------------------------- -mount $DEV >& /dev/null -dev=$(readlink $DEV) -df=$(df -h /dev/$dev | grep /dev/$dev) -MAX=$(echo $df | while read d v r ; do echo $v ; done) -echo " backup $MAX to $dir" >> $LOG -#======================================================================= -# first make sure DMA is on: -sudo hdparm -d1 -u1 $DEV >& /dev/null -# attempt to get the DVD information: -TITLE=$(dvdbackup -i /dev/sr0 -I | grep information | awk '{ s = ""; for (i = 8; i <= NF; i++) s = s $i " "; print s }' | tr -d '"' | sed 's/ /_/g' | sed 's/_$//g') -if [ "$TITLE" == "DVD_VIDEO" -o "$TITLE" == "" \ - -o "$TITLE" == " " -o "$TITLE" == "[ ].*" ]; then - # if not a good title, - TITLE="dvdbackup_$DATE" -fi -echo " $TITLE" >> $LOG -if [ $1 = m ] -then - COMMAND="dvdbackup -M -i $DEV -o $dir -n $TITLE" - elif [ $1 = h ] - then -# COMMAND="mencoder dvd://$TRACK -alang en -oac mp3lame -lameopts br=320:cbr -ovc lavc -lavcopts vcodec=mpeg4:vhq -vf scale -zoom -xy 720 -o $dir/$TITLE.avi" - COMMAND="HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "High\ Profile" --main-feature" - FILE=$TITLE.mp4 - elif [ $1 = n ] - then -# COMMAND="mencoder dvd://$TRACK -alang en -oac mp3lame -lameopts br=160:cbr -ovc lavc -lavcopts vcodec=mpeg4:vhq -vf scale -zoom -xy 512 -o $dir/$TITLE.avi" - COMMAND="HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "Normal" --main-feature" - FILE=$TITLE.mp4 - elif [ $1 = l ] - then -# COMMAND="mencoder dvd://$TRACK -alang en -oac mp3lame -lameopts br=96:cbr -ovc lavc -lavcopts vcodec=mpeg4:vhq -vf scale -zoom -xy 320 -o $dir/$TITLE.avi" - COMMAND="HandBrakeCLI -i $DEV -o $dir/$TITLE.mp4 --preset "Classic" --main-feature" - FILE=$TITLE.mp4 - elif [ $1 = i ] - then - COMMAND="dd if=$DEV of=$dir/$TITLE.iso bs=2048" - FILE=$TITLE.iso -fi -{ # for the redir below: - # Begin: - touch $LOCK - osd_loop "$dir/$TITLE" "$TITLE" & - dvdbackup -i $DEV -I - sleep 1 ; aplay $Bsnd - $COMMAND - # Finish: - rm -f $LOCK - osd "\nfinish DVD: '$TITLE'\ninto $dir/$FILE" gray20 5 & - sleep 1 ; aplay $Esnd - # Eject the media: - sudo eject ; sudo eject -} > $dir/.$TITLE.log 2>&1 -echo " `du -sh $dir/$FILE`" >> $LOG -echo " `date` finished DVD" >> $LOG -exit 0 -######################################################################## -# End diff --git a/abs/core/linhes-scripts/stop_xss.sh b/abs/core/linhes-scripts/stop_xss.sh deleted file mode 100644 index 4bb9d1a..0000000 --- a/abs/core/linhes-scripts/stop_xss.sh +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/sh - -while [ 1=1 ]; -do - - if [ "$(pidof chromium)" -o "$(pidof huludesktop)" -o "$(pidof xbmc.bin)" ] - then - xscreensaver-command -deactivate - fi - sleep 60 - -done diff --git a/abs/core/linhes-scripts/xwin_find.sh b/abs/core/linhes-scripts/xwin_find.sh deleted file mode 100644 index 35309dd..0000000 --- a/abs/core/linhes-scripts/xwin_find.sh +++ /dev/null @@ -1,72 +0,0 @@ -#!/bin/sh -# -# xwin_find [-v|-q] [timeout] window_name_regex -# -# Look for a window of the windows full name given by a awk regular -# expression, and print the windows xwindow ID. -# -# If a timeout is given (in seconds)continue to look for the windows ID -# for this amount of time before returning. (EG default a single search) -# -# If no such window is found output nothing, just exit -# -# OPTIONS -# -v verbose, print the full matching xwininfo line on stderr -# -q do not print windows ID on stdout -# -#### -# Anthony Thyssen September 2005 -# -PROGNAME=`type $0 | awk '{print $3}'` # search for executable on path -PROGDIR=`dirname $PROGNAME` # extract directory of program -PROGNAME=`basename $PROGNAME` # base name of program -Usage() { - echo >&2 "$PROGNAME:" "$@" - sed >&2 -n '/^###/q; s/^#$/# /; 3s/^#/# Usage:/; 3,$s/^# //p;' \ - "$PROGDIR/$PROGNAME" - exit 10; -} - -timeout=0 - -while [ $# -gt 0 ]; do - case "$1" in - [0-9]*) timeout=`date +%s` - timeout=`expr $timeout + $1 + 1` || Usage - ;; - -q) QUIET=true ;; # don't print the final window ID, just status - -v) VERBOSE=true ;; # output the full xwininfo line on stderr - - --) shift; break ;; # end of user options - -*) Usage "Unknown option \"$1\"" ;; - *) break ;; # end of user options - esac - shift # next option -done - -[ $# -lt 1 ] && Usage "Missing window search regex" -[ $# -gt 1 ] && Usage "Too many arguments." - - -find_win() { - # nice added to let it give way to starting processes - if [ "$VERBOSE" ]; then - line=`nice xwininfo -root -tree | awk '/"'"$1"'":/ {print; exit}'` - echo >&2 $line # VERBOSE - xwininfo output - echo "$line" | sed 's/ .*//' - else - nice xwininfo -root -tree | awk '/"'"$1"'":/ {print $1; exit}' - fi -} - -while :; do - id=`find_win "$1"` - if [ "$id" ]; then - [ -z "$QUIET" ] && echo $id # the window ID found - exit 0; - fi - [ `date +%s` -ge $timeout ] && break -done - -exit 1 # window was not found - |