diff options
author | Britney Fransen <brfransen@gmail.com> | 2015-02-19 18:16:16 (GMT) |
---|---|---|
committer | Britney Fransen <brfransen@gmail.com> | 2015-02-19 18:16:16 (GMT) |
commit | 8de064f6e96f960cdbfe6868d9957a4613f704df (patch) | |
tree | 4e73a420991733450d013529c0fee60e0365297a /abs/core/LinHES-system | |
parent | 0374b16f1e15ba1819b62bd5a6e0076ac7b243d0 (diff) | |
parent | 6fde8cd5e74f0840e01988e743464fe91c0a28f8 (diff) | |
download | linhes_pkgbuild-8de064f6e96f960cdbfe6868d9957a4613f704df.zip linhes_pkgbuild-8de064f6e96f960cdbfe6868d9957a4613f704df.tar.gz linhes_pkgbuild-8de064f6e96f960cdbfe6868d9957a4613f704df.tar.bz2 |
Merge branch 'testing'
Diffstat (limited to 'abs/core/LinHES-system')
-rwxr-xr-x | abs/core/LinHES-system/LinHES-session | 18 | ||||
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 30 | ||||
-rwxr-xr-x | abs/core/LinHES-system/cacheclean | 4 | ||||
-rwxr-xr-x | abs/core/LinHES-system/checkXFSfrag.sh | 22 | ||||
-rwxr-xr-x | abs/core/LinHES-system/etc_care.cron | 16 | ||||
-rwxr-xr-x | abs/core/LinHES-system/fstrim.cron | 4 | ||||
-rw-r--r-- | abs/core/LinHES-system/gen_game_xml.py | 6 | ||||
-rw-r--r-- | abs/core/LinHES-system/gen_lib_xml.py | 6 | ||||
-rw-r--r-- | abs/core/LinHES-system/lh_system_backup_job | 36 | ||||
-rwxr-xr-x | abs/core/LinHES-system/myth_mtc.cron | 50 | ||||
-rwxr-xr-x | abs/core/LinHES-system/myth_mtc.py | 35 | ||||
-rwxr-xr-x | abs/core/LinHES-system/mythvidexport.py | 100 | ||||
-rwxr-xr-x | abs/core/LinHES-system/xfs_defrag.cron | 2 |
13 files changed, 199 insertions, 130 deletions
diff --git a/abs/core/LinHES-system/LinHES-session b/abs/core/LinHES-system/LinHES-session index ae702cf..4563078 100755 --- a/abs/core/LinHES-system/LinHES-session +++ b/abs/core/LinHES-system/LinHES-session @@ -67,20 +67,6 @@ function keylaunch(){ } -function start_x11vnc(){ - if [ x$xvncenable = "x1" ] - then - if [ -e /etc/x11vnc.cfg ] - then - . /etc/x11vnc.cfg - x11vnc $x11vnc_options - else - x11vnc -forever -rfbport 5902 --passwd $xvncpassword - fi - fi -} - - function fluxbox_settings(){ if [ ! -e $HOME/.fluxbox ] then @@ -365,9 +351,6 @@ function run_myth(){ mv gdb.txt gdb.txt.mythfrontend sleep 5 else - killall -9 irexec - /usr/bin/irexec -d - if [ ! x$STARTUP_STYLE = xlegacy ] then run_wmctrl & @@ -421,7 +404,6 @@ $WM & pid=$! mouse_move keylaunch -start_x11vnc & unclutter load_nvidia_settings run_tilda diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index ad23218..d6b4bac 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system -pkgver=8.2 -pkgrel=3 +pkgver=8.3 +pkgrel=9 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -28,7 +28,7 @@ binfiles="LinHES-start optimize_mythdb.py myth_mtc.py mythwelcome-config.py mythwelcome-set-alarm.sh mythwelcome-test-wakeup.sh" source=(LinHES-session LinHES-profile.sh $binfiles - alsa-base cacheclean.cron myth_mtc.cron xfs_defrag.cron + alsa-base cacheclean.cron fstrim.cron myth_mtc.cron xfs_defrag.cron etc_care.cron readme_is_xml readme_light add_storage.readme system-sudo.rules msg.cfg) @@ -62,6 +62,8 @@ package() { #install -m755 -D $srcdir/smolt.cron $pkgdir/etc/cron.weekly/smolt.cron install -m755 -D $srcdir/cacheclean.cron $pkgdir/etc/cron.weekly/cacheclean install -m755 -D $srcdir/xfs_defrag.cron $pkgdir/etc/cron.weekly/xfs_defrag + install -m755 -D $srcdir/fstrim.cron $pkgdir/etc/cron.weekly/fstrim + install -m755 -D $srcdir/etc_care.cron $pkgdir/etc/cron.weekly/etc_care install -m755 -D $srcdir/myth_mtc.cron $pkgdir/etc/cron.hourly/myth_mtc #sudo rules @@ -75,11 +77,11 @@ package() { } -md5sums=('a10cb96850951ae835c46f41f92463b2' +md5sums=('8415c4b2587a8a1e6a312484c1edafcb' 'de32a1c50101265dd7f6ca5037f7a26a' '301884fb60521627fffd1160b2cf5181' '76b2637cac0452b3acdbeeb4e8a5474b' - '0149e77a12d30f1050dd3990f6f1f123' + 'd02ddadeb2181f90954e435842cd7f0a' 'dc3eef2a624754e16805d72bbe488b67' '617af86b901538817ebdcaf646248dc5' '542e670e78d117657f93141e9689f54d' @@ -91,22 +93,22 @@ md5sums=('a10cb96850951ae835c46f41f92463b2' '33fbebbd546672cedd3c5e7350ab414e' 'c773d8caacba8fbd4968e8afe5137bc6' '3edef50a49a47694bf8add39cc160add' - 'b376c30f95892b8682fad84f81685f75' + '8336874ee9e527f9799c3dec9fb770b5' 'bc69a520add58ede9b060c73e67ace13' '74e17d6f7453c52d56fecaed5c3f6ad5' '47e093e8cfe4b5b96602358e1f540832' '63bbc62240f46a9997eaae4a84b09b76' '2c005d95312018bef80092136f80f254' - '6519d209e151cdc39ae7e1091d189c3e' + 'c8db6a83ecc089ea37ab7fcb0f7a01cf' 'ca63946920ba33de1f15abda83e74e40' '84c0ea62550b0bf9d84ab48eddc08276' '3e60b17892e5b8214d47dcfddf5215a4' '57ec994cc3964a10c00580e89ebcae35' - '7ba5e774bfebc3ec2469c9fe9a76e2ce' + '1da933fd2f4436c1ecaf3d6d0c7c0d68' '0c3509b48f11af0dc1bf989721fe9ca7' - 'ac61cc460d9e97ba1f5ef69e92cdfbe5' + '9249313ae171abd5405f60625020da63' 'f3502bb7c665750da0ecdf6918f7c838' - 'b7febd04f64fe21e8cfbb888219b0b31' + 'fd3b08fc13b273f0ee3a5de775d63eb6' '06a628469051237943b7c874f2e29b8a' '8fe86aa9109a285aedce3c8658952bbb' '3300ea8b02e4fb8bd3409df348de6e16' @@ -117,7 +119,7 @@ md5sums=('a10cb96850951ae835c46f41f92463b2' 'bacc813b48bafcc6fe906e5969930501' '8e02efe1ad0df9a179075147eebb05b9' '8b0298f70f97cc1dc2a58b9a73c64bd3' - '911b0fbc8d9178dac1a193346c9decaf' + '716710e0db42147b079c9ec1c7080efa' '34fc1f58ad1eabf4eff4979d420760c0' '69ecfe682f1b61c2c4c95d890b9f523c' 'a94fe6d980f4b810f2e2ae5352084b39' @@ -131,8 +133,10 @@ md5sums=('a10cb96850951ae835c46f41f92463b2' '410795ef9039e4c6c0484e706ecfd567' 'eb879fee9603a05d5420d4ce8ed9e450' '02c810c2f47b7c4495fdacaf54189473' - 'fae4162988de9525ba3f9341e17f9c52' - '474d5c6883fcfffae4f199aceb3b1356' + '1aac1872bf9569ea58ceb2f6f766a654' + 'dc48a53d4e5fe27b218657ccc318d07f' + '4d7164800122243be6513b29c8fc498e' + 'd14fdc38878c70011754317b0f2ea59e' '36bdfa8d877cea20ca3870faf08e08d5' '59d0602bac7e06f11abba1894acc8bb0' 'b12bbf3e028f51b08acef2799a5708bc' diff --git a/abs/core/LinHES-system/cacheclean b/abs/core/LinHES-system/cacheclean index cfc8d58..24032c9 100755 --- a/abs/core/LinHES-system/cacheclean +++ b/abs/core/LinHES-system/cacheclean @@ -1,5 +1,5 @@ #!/usr/bin/env python2 -"""cacheclean - a simple python script to clean up the /data/var/cache/pacman/pkg directory. +"""cacheclean - a simple python script to clean up the /data/storage/disk0/pacman/pkg directory. More versatile than 'pacman -Sc' in that you can select how many old versions to keep. Usage: cacheclean {-p} {-v} <# of copies to keep> @@ -78,7 +78,7 @@ except getopt.GetoptError as msg: sys.exit(1) # change to the pkg directory & get a sorted list of its contents -os.chdir('/data/var/cache/pacman/pkg') +os.chdir('/data/storage/disk0/pacman/pkg') pkg_fns = os.listdir('.') pkg_fns.sort() diff --git a/abs/core/LinHES-system/checkXFSfrag.sh b/abs/core/LinHES-system/checkXFSfrag.sh index 99b833c..74b73c4 100755 --- a/abs/core/LinHES-system/checkXFSfrag.sh +++ b/abs/core/LinHES-system/checkXFSfrag.sh @@ -28,24 +28,32 @@ # DO NOT ALTER HEADER FROM THIS LINE UP. # e='/bin/echo -e' # Use the echo command, not built-in. -xfsfsr=/usr/sbin/xfs_fsr # Set variable with the path to xfs_fsr. -xfsdb=/usr/sbin/xfs_db # Set variable with the path to xfs_db. +xfsfsr=/usr/bin/xfs_fsr # Set variable with the path to xfs_fsr. +xfsdb=/usr/bin/xfs_db # Set variable with the path to xfs_db. pctmax=15 # Set maxiumum frag percent needed for defrag. # This is zero here for testing purposes only # a higher number should be used in production. array=`df -T|grep xfs|cut -f 1 --delim=" "` # Array of all XFS file systems. for i in ${array[@]}; do - percentage=`$xfsdb -c frag -r ${i}|cut -f 7 --delim=" "` - percent2=`$e $percentage|cut -f 1 --delim=.` - if [ "$percent2" -gt "$pctmax" ] + #check that the device is SATA and skip defrag on SSDs + device=`echo ${i} | cut -f 3 --delim="/" | sed 's/[0-9]//g'` + isSATA=`cat /sys/block/${device}/queue/rotational` + if [[ $isSATA -eq 1 ]] then - $e "${i} is $percentage fragmented. Running defragment on ${i}." + percentage=`$xfsdb -c frag -r ${i}|cut -f 7 --delim=" "` + percent2=`$e $percentage|cut -f 1 --delim=.` + if [ "$percent2" -gt "$pctmax" ] + then + $e "${i} is $percentage% fragmented. Running defragment on ${i}." # Only uncomment one of the following two lines. #$xfsfsr -v ${i} # Uncomment for verbose defrag. $xfsfsr ${i} # Uncomment for quiet defrag. + else + $e "${i} is $percent2% fragmented and is below the fragmentation threshold of $pctmax%. Skipping." + fi else - $e "${i}\t$percent2 is not above fragmentation threshold of $pctmax." + echo "${i} is an SSD. Skipping." fi done exit 0 diff --git a/abs/core/LinHES-system/etc_care.cron b/abs/core/LinHES-system/etc_care.cron new file mode 100755 index 0000000..97e0283 --- /dev/null +++ b/abs/core/LinHES-system/etc_care.cron @@ -0,0 +1,16 @@ +#!/bin/bash +MYTH_RUN_STATUS=1 +. /etc/profile + +KeepBackups=4 + +for f in "/etc/lircd.conf" "/etc/lircrc" "/etc/wol-lircrc" "/etc/remote.run" "/etc/asound.conf" +do + NumBackups=`ls -d $f-* | wc -l` + if [[ $NumBackups -gt $KeepBackups ]] + then + echo "Deleting old $f-* files..." + numdel=$(($NumBackups-$KeepBackups)) + rm -rf `ls -t $f-* | tail -$numdel` + fi +done diff --git a/abs/core/LinHES-system/fstrim.cron b/abs/core/LinHES-system/fstrim.cron new file mode 100755 index 0000000..ad0b4aa --- /dev/null +++ b/abs/core/LinHES-system/fstrim.cron @@ -0,0 +1,4 @@ +#!/bin/bash +#. /etc/profile +/usr/bin/fstrim -av | /usr/bin/logger -t fstrim + diff --git a/abs/core/LinHES-system/gen_game_xml.py b/abs/core/LinHES-system/gen_game_xml.py index e5d9afe..611bed5 100644 --- a/abs/core/LinHES-system/gen_game_xml.py +++ b/abs/core/LinHES-system/gen_game_xml.py @@ -24,6 +24,7 @@ class Gen_lib_xml: def read_snippets(self): xml_snippets="" + lines=[] try: os.chdir(self.snippit_dir) except: @@ -35,12 +36,13 @@ class Gen_lib_xml: try: print " gen_game_xml: reading in %s" %conf_file f=open(conf_file,'r') - lines=f.readlines() + line=f.readlines() f.close() except: print " gen_game_xml: Couldn't open %s for reading" %conf_file print " Exiting" sys.exit(0) + lines.extend(line) if len(file_list) == 0: print " gen_game_xml: no conf files found" @@ -114,4 +116,4 @@ def main(): write_xml(new_xml,filename) if __name__ == "__main__": - main()
\ No newline at end of file + main() diff --git a/abs/core/LinHES-system/gen_lib_xml.py b/abs/core/LinHES-system/gen_lib_xml.py index 320a84d..1cc4516 100644 --- a/abs/core/LinHES-system/gen_lib_xml.py +++ b/abs/core/LinHES-system/gen_lib_xml.py @@ -24,6 +24,7 @@ class Gen_lib_xml: def read_snippets(self): xml_snippets="" + lines=[] try: os.chdir(self.snippit_dir) except: @@ -35,12 +36,13 @@ class Gen_lib_xml: try: print " gen_lib_xml: reading in %s" %conf_file f=open(conf_file,'r') - lines=f.readlines() + line=f.readlines() f.close() except: print " gen_lib_xml: Couldn't open %s for reading" %conf_file print " Exiting" sys.exit(0) + lines.extend(line) if len(file_list) == 0: print " gen_lib_xml: no conf files found" @@ -114,4 +116,4 @@ def main(): write_xml(new_xml,filename) if __name__ == "__main__": - main()
\ No newline at end of file + main() diff --git a/abs/core/LinHES-system/lh_system_backup_job b/abs/core/LinHES-system/lh_system_backup_job index 3ac9de0..ca6800a 100644 --- a/abs/core/LinHES-system/lh_system_backup_job +++ b/abs/core/LinHES-system/lh_system_backup_job @@ -33,12 +33,15 @@ function backup_status_check(){ function backup(){ + echo echo "Starting Backup" mkdir -p $BACKUPDIR/$DATE #backup database if [ $SystemType = Master_backend -o $SystemType = Standalone ] then + echo + echo "Backup mysql databases" pacman -Q mysql 2>/dev/null if [ $? = 0 ] then @@ -57,20 +60,17 @@ function backup(){ echo " All databases in one file" mysqldump -x --all-databases > $BACKUPDIR/$DATE/all_databases backup_status_check $? - - - fi fi - #backup saved settings + echo "Backup saved settings" if [ -e /usr/MythVantage/templates/settings ] then cp -rp /usr/MythVantage/templates/settings $BACKUPDIR/$DATE/settings backup_status_check $? fi - #backup etc + echo "Backup etc" cp -rp /etc $BACKUPDIR/$DATE/etc if [ -e /var/lib/oss ] then @@ -78,30 +78,40 @@ function backup(){ backup_status_check $? fi - #backup func keys + echo "Backup func keys" cp -rp /etc/pki $BACKUPDIR/$DATE/pki if [ ! -f $MYTHHOME/backup_config/backup_exclude.txt ] then mkdir -p $MYTHHOME/backup_config/ - echo ".mythtv/themecache" > $MYTHHOME/backup_config/backup_exclude.txt - echo "tmp" >> $MYTHHOME/backup_config/backup_exclude.txt - echo ".vnc/*log" >> $MYTHHOME/backup_config/backup_exclude.txt - echo ".vnc/*pid" >> $MYTHHOME/backup_config/backup_exclude.txt + touch $MYTHHOME/backup_config/backup_exclude.txt chmod 777 $MYTHHOME/backup_config/backup_exclude.txt fi + for i in ".mythtv/themecache" ".mythtv/remotecache" ".mythtv/Cache-myth*" ".cache" "tmp" ".vnc/*log" ".vnc/*pid" + do + grep -qF "$i" $MYTHHOME/backup_config/backup_exclude.txt + rc=$? + if [ $rc != 0 ] + then + echo "$i" >> $MYTHHOME/backup_config/backup_exclude.txt + fi + done + + echo "Backup home dirs" tar -zcf $BACKUPDIR/$DATE/home_dir.tar.gz -X $MYTHHOME/backup_config/backup_exclude.txt $MYTHHOME /home/vncsvc /home/xymon if [ -f $MYTHHOME/backup_config/backup_include.txt ] then + echo + echo "Backup items from $MYTHHOME/backup_config/backup_include.txt" tar -zcf $BACKUPDIR/$DATE/other.tar.gz -T $MYTHHOME/backup_config/backup_include.txt backup_status_check $? fi - #make_zip file + echo "Compress backup file" cd $BACKUPDIR - tar -zcvf $BACKUPDIR/backup.$DATE.tgz $DATE + tar -zcf $BACKUPDIR/backup.$DATE.tgz $DATE backup_status_check $? if [ -d $BACKUPDIR/$DATE ] then @@ -114,7 +124,7 @@ function backup(){ chown nobody:nobody /data/srv/httpd/htdocs/hobbit/notes/* 2> /dev/null >/dev/null fi echo - echo "Created file:" + echo "Created backup file:" echo " $BACKUPDIR/backup.$DATE.tgz" } diff --git a/abs/core/LinHES-system/myth_mtc.cron b/abs/core/LinHES-system/myth_mtc.cron index 4f63dec..d3dc50a 100755 --- a/abs/core/LinHES-system/myth_mtc.cron +++ b/abs/core/LinHES-system/myth_mtc.cron @@ -4,20 +4,56 @@ MYTH_RUN_STATUS=1 date=`date +%Y-%m-%d` timestamp=`date +'%Y-%m-%d %H:%M'` -logFile="/var/log/$date/myth_mtc.log" +hostname=`hostname` +logFile="/var/log/${date}/${hostname}_myth_mtc.log" +log="logger -t myth_mtc -p local6.info" if [ ! -f $logFile ]; then touch $logFile + echo "" | $log fi #check logfile for Finished and if not run myth_mtc.py -if ! grep -q "Finished" $logFile +if ! grep -q "Finished Maintenance" $logFile then - MYTHCONFDIR=/usr/share/mythtv unbuffer myth_mtc.py >> $logFile 2>&1 - if [ $? = 0 ] + if ! grep -q "Finished Optimize" $logFile then - echo "Finished $timestamp" >> $logFile - else - echo "Time Exceeded $timestamp" >> $logFile + MYTHCONFDIR=/usr/share/mythtv unbuffer myth_mtc.py --optimize | $log + if [ $? = 0 ] + then + echo "" | $log + else + echo "Time Exceeded" | $log + exit + fi + fi + + if ! grep -q "Finished Backup" $logFile && grep -q "Finished Optimize" $logFile + then + MYTHCONFDIR=/usr/share/mythtv unbuffer myth_mtc.py --backup | $log + if [ $? = 0 ] + then + echo "" | $log + else + echo "Time Exceeded" | $log + exit + fi + fi + + if ! grep -q "Finished Update" $logFile + then + MYTHCONFDIR=/usr/share/mythtv unbuffer myth_mtc.py --update | $log + if [ $? = 0 ] + then + echo "" | $log + else + echo "Time Exceeded" | $log + exit + fi + fi + + if grep -q "Finished Optimize" $logFile && grep -q "Finished Backup" $logFile && grep -q "Finished Update" $logFile + then + echo "Finished Maintenance" | $log fi fi diff --git a/abs/core/LinHES-system/myth_mtc.py b/abs/core/LinHES-system/myth_mtc.py index b1ec75d..8a08c05 100755 --- a/abs/core/LinHES-system/myth_mtc.py +++ b/abs/core/LinHES-system/myth_mtc.py @@ -1,13 +1,11 @@ #!/usr/bin/python2 import sys, subprocess -import optparse import re import socket import os import datetime,time import shlex sys.dont_write_bytecode = True -import idle try: from MythTV import MythBE @@ -30,7 +28,7 @@ def optimize(): result = cursor.fetchall() except: print "\n%s Problem getting tables from the database" %(get_timestamp()) - return + return 1 ops=["REPAIR","OPTIMIZE","ANALYZE"] for row in result: ctable=row[0] @@ -38,6 +36,7 @@ def optimize(): print " %s %s" %(op,ctable) cmd= "%s table %s" %(op,ctable) cursor.execute(cmd) + return 0 def cleanup_inuseprograms(): fourHoursAgo=datetime.datetime.today() - datetime.timedelta(hours=4) @@ -60,18 +59,26 @@ def bail_if_another_is_running(): def run_stuff(): print "\n%s" %get_timestamp() - if idle.main(): - print "\n#######################################" - print "\n%s Running Optimize" %(get_timestamp()) - optimize() + if not subprocess.call(["/usr/bin/python2", "/usr/LH/bin/idle.py"]): + if ("--optimize" in sys.argv) or (len(sys.argv) == 1): + print "\n#######################################" + print "\n%s Running Optimize" %(get_timestamp()) + if not optimize(): + print "\nFinished Optimize" + else: + return True - print "\n#######################################" - print "\n%s Running Backup" %(get_timestamp()) - os.system('/usr/LH/bin/lh_system_backup_job') + if ("--backup" in sys.argv) or (len(sys.argv) == 1): + print "\n#######################################" + print "\n%s Running Backup" %(get_timestamp()) + if not os.system('/usr/LH/bin/lh_system_backup_job'): + print "\nFinished Backup" - print "\n#######################################" - print "\n%s Running System Update" %(get_timestamp()) - os.system('/usr/LH/bin/lh_system_host_update') + if ("--update" in sys.argv) or (len(sys.argv) == 1): + print "\n#######################################" + print "\n%s Running System Update" %(get_timestamp()) + if not os.system('/usr/LH/bin/lh_system_host_update'): + print "\nFinished Update" print "\n#######################################" continue_loop=False @@ -86,7 +93,7 @@ ctin=True while ctin: cleanup_inuseprograms() ctin=run_stuff() - if ctin: + if ctin: print "\n%s Waiting 10 minutes before trying again." %(get_timestamp()) time.sleep(600) diff --git a/abs/core/LinHES-system/mythvidexport.py b/abs/core/LinHES-system/mythvidexport.py index 5fdfb6d..9160f1d 100755 --- a/abs/core/LinHES-system/mythvidexport.py +++ b/abs/core/LinHES-system/mythvidexport.py @@ -5,14 +5,12 @@ # Python Script # Author: Raymond Wagner # Purpose -# This python script is intended to function as a user job, run through -# mythjobqueue, capable of exporting recordings into MythVideo. -# https://github.com/wagnerrp/mythtv-scripts/blob/master/python/mythvidexport.py -# http://www.mythtv.org/wiki/Mythvidexport.py +# This python script is intended to function as a user job, run through +# mythjobqueue, capable of exporting recordings into MythVideo. #--------------------------- -__title__ = "MythVidExport" +__title__ = "MythVidExport" __author__ = "Raymond Wagner" -__version__= "v0.7.5" +__version__= "v0.7.6" from MythTV import MythDB, Job, Recorded, Video, VideoGrabber,\ MythLog, MythError, static, MythBE @@ -58,8 +56,10 @@ class VIDEO: # prep objects self.rec = Recorded((self.chanid,self.starttime), db=self.db) + if "_" in self.rec.inetref: + self.rec.inetref = self.rec.inetref.split("_")[1] self.log(MythLog.GENERAL, MythLog.INFO, 'Using recording', - '%s - %s' % (self.rec.title.encode('utf-8'), + '%s - %s' % (self.rec.title.encode('utf-8'), self.rec.subtitle.encode('utf-8'))) self.vid = Video(db=self.db).create({'title':'', 'filename':'', 'host':gethostname()}) @@ -151,7 +151,7 @@ class VIDEO: 'Attempting TV export.') grab = VideoGrabber(self.type) match = grab.sortedSearch(self.rec.title, self.rec.subtitle) - else: # assume movie + else: # assume movie self.type = 'MOVIE' self.log(self.log.GENERAL, self.log.INFO, 'Attempting Movie export.') @@ -189,10 +189,10 @@ class VIDEO: # replace fields from viddata #print self.vid.data ext = '.'+self.rec.basename.rsplit('.',1)[1] - rep = ( ('%TITLE%','title','%s'), ('%SUBTITLE%','subtitle','%s'), - ('%SEASON%','season','%d'), ('%SEASONPAD%','season','%02d'), - ('%EPISODE%','episode','%d'), ('%EPISODEPAD%','episode','%02d'), - ('%YEAR%','year','%s'), ('%DIRECTOR%','director','%s')) + rep = ( ('%TITLE%','title','%s'), ('%SUBTITLE%','subtitle','%s'), + ('%SEASON%','season','%d'), ('%SEASONPAD%','season','%02d'), + ('%EPISODE%','episode','%d'), ('%EPISODEPAD%','episode','%02d'), + ('%YEAR%','year','%s'), ('%DIRECTOR%','director','%s')) for tag, data, format in rep: if self.vid[data]: fmt = fmt.replace(tag,format % self.vid[data]) @@ -200,27 +200,27 @@ class VIDEO: fmt = fmt.replace(tag,'') # replace fields from program data - rep = ( ('%HOSTNAME%', 'hostname', '%s'), + rep = ( ('%HOSTNAME%', 'hostname', '%s'), ('%STORAGEGROUP%','storagegroup','%s')) for tag, data, format in rep: data = getattr(self.rec, data) fmt = fmt.replace(tag,format % data) -# fmt = fmt.replace('%CARDID%',self.rec.cardid) -# fmt = fmt.replace('%CARDNAME%',self.rec.cardid) -# fmt = fmt.replace('%SOURCEID%',self.rec.cardid) -# fmt = fmt.replace('%SOURCENAME%',self.rec.cardid) -# fmt = fmt.replace('%CHANNUM%',self.rec.channum) -# fmt = fmt.replace('%CHANNAME%',self.rec.cardid) +# fmt = fmt.replace('%CARDID%',self.rec.cardid) +# fmt = fmt.replace('%CARDNAME%',self.rec.cardid) +# fmt = fmt.replace('%SOURCEID%',self.rec.cardid) +# fmt = fmt.replace('%SOURCENAME%',self.rec.cardid) +# fmt = fmt.replace('%CHANNUM%',self.rec.channum) +# fmt = fmt.replace('%CHANNAME%',self.rec.cardid) if len(self.vid.genre): fmt = fmt.replace('%GENRE%',self.vid.genre[0].genre) else: fmt = fmt.replace('%GENRE%','') -# if len(self.country): -# fmt = fmt.replace('%COUNTRY%',self.country[0]) -# else: -# fmt = fmt.replace('%COUNTRY%','') +# if len(self.country): +# fmt = fmt.replace('%COUNTRY%',self.country[0]) +# else: +# fmt = fmt.replace('%COUNTRY%','') return fmt+ext def copy(self): @@ -235,7 +235,6 @@ class VIDEO: srcfp = self.rec.open('r') dstfp = self.vid.open('w', nooverwrite=True) - if self.job: self.job.setStatus(Job.RUNNING) tsize = 2**24 @@ -261,7 +260,7 @@ class VIDEO: self.job.setComment("Checking file hashes") self.log(MythLog.GENERAL|MythLog.FILE, MythLog.INFO, "Checking file hashes.") srchash = hashfile(self.rec.open('r')) - dsthash = hashfile(self.vid.open('r')) + dsthash = hashfile(self.rec.open('r')) if srchash != dsthash: raise MythError('Source hash (%s) does not match destination hash (%s)' \ % (srchash, dsthash)) @@ -294,30 +293,30 @@ class VIDEO: def usage_format(): usagestr = """The default strings are: - Television: Television/%TITLE%/Season %SEASON%/%TITLE% - S%SEASON%E%EPISODEPAD% - %SUBTITLE% - Movie: Movies/%TITLE% - Generic: Videos/%TITLE% +Television: Television/%TITLE%/Season %SEASON%/%TITLE% - S%SEASON%E%EPISODEPAD% - %SUBTITLE% +Movie: Movies/%TITLE% +Generic: Videos/%TITLE% Available strings: - %TITLE%: series title - %SUBTITLE%: episode title - %SEASON%: season number - %SEASONPAD%: season number, padded to 2 digits - %EPISODE%: episode number - %EPISODEPAD%: episode number, padded to 2 digits - %YEAR%: year - %DIRECTOR%: director - %HOSTNAME%: backend used to record show - %STORAGEGROUP%: storage group containing recorded show - %GENRE%: first genre listed for recording +%TITLE%: series title +%SUBTITLE%: episode title +%SEASON%: season number +%SEASONPAD%: season number, padded to 2 digits +%EPISODE%: episode number +%EPISODEPAD%: episode number, padded to 2 digits +%YEAR%: year +%DIRECTOR%: director +%HOSTNAME%: backend used to record show +%STORAGEGROUP%: storage group containing recorded show +%GENRE%: first genre listed for recording """ -# %CARDID%: ID of tuner card used to record show -# %CARDNAME%: name of tuner card used to record show -# %SOURCEID%: ID of video source used to record show -# %SOURCENAME%: name of video source used to record show -# %CHANNUM%: ID of channel used to record show -# %CHANNAME%: name of channel used to record show -# %COUNTRY%: first country listed for recording +# %CARDID%: ID of tuner card used to record show +# %CARDNAME%: name of tuner card used to record show +# %SOURCEID%: ID of video source used to record show +# %SOURCENAME%: name of video source used to record show +# %CHANNUM%: ID of channel used to record show +# %CHANNAME%: name of channel used to record show +# %COUNTRY%: first country listed for recording print usagestr def print_format(): @@ -333,9 +332,9 @@ def print_format(): if not gfmt: gfmt = 'Videos/%TITLE%' print "Current output formats:" - print " TV: "+tfmt - print " Movies: "+mfmt - print " Generic: "+gfmt + print " TV: "+tfmt + print " Movies: "+mfmt + print " Generic: "+gfmt def main(): parser = OptionParser(usage="usage: %prog [options] [jobid]") @@ -361,7 +360,7 @@ def main(): "in place of the job id.") sourcegroup.add_option("--chanid", action="store", type="int", dest="chanid", help="Use chanid for manual operation") - sourcegroup.add_option("--starttime", action="store", type="string", dest="starttime", + sourcegroup.add_option("--starttime", action="store", type="int", dest="starttime", help="Use starttime for manual operation") parser.add_option_group(sourcegroup) @@ -436,4 +435,3 @@ def main(): if __name__ == "__main__": main() - diff --git a/abs/core/LinHES-system/xfs_defrag.cron b/abs/core/LinHES-system/xfs_defrag.cron index 4d35507..e47176b 100755 --- a/abs/core/LinHES-system/xfs_defrag.cron +++ b/abs/core/LinHES-system/xfs_defrag.cron @@ -1,3 +1,3 @@ #!/bin/bash #. /etc/profile -/usr/LH/bin/checkXFSfrag.sh > /var/log/xfs_defrag.log +/usr/LH/bin/checkXFSfrag.sh | /usr/bin/logger -t xfs_defrag |