From 671639b525d1ccdd06b29756ba0ba2ea4178205c Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Thu, 9 Mar 2023 21:36:54 -0500 Subject: linhes-system: find_orphans.py: fixes for mythtv 33 and python3 misc_which_recorder.pl: fix for mythtv 33 --- linhes/linhes-system/PKGBUILD | 15 ++++++++------- linhes/linhes-system/find_orphans.py | 15 ++++++++------- linhes/linhes-system/lh_system_backup | 11 +++++++---- linhes/linhes-system/lh_system_backup_job | 2 +- linhes/linhes-system/misc_status_config.py | 2 +- linhes/linhes-system/misc_which_recorder.pl | 4 ++-- 6 files changed, 27 insertions(+), 22 deletions(-) diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD index 5f56fb8..061412a 100755 --- a/linhes/linhes-system/PKGBUILD +++ b/linhes/linhes-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=linhes-system pkgver=9.0.0 -pkgrel=55 +pkgrel=56 arch=('x86_64') #install=$pkgname.install pkgdesc="Everything that makes LinHES a system" @@ -13,7 +13,7 @@ depends=('cronie' 'dbus-python' 'dvb-firmware' 'expect' 'flatpak' 'firefox' 'gla binfiles="add_storage.py balance_storage_groups.py empty_storage_groups.py remove_storage.py checkXFSfrag.sh enableIRWake.sh idle.py lh_system_start.sh lh_notify-send lh_home_check.sh lh_myth_status.py lh_system_backup lh_system_backup_job - jobqueue_helper.py gen_lib_xml.py + jobqueue_helper.py gen_lib_xml.py lh_setup_fileshare.py diskspace.sh find_orphans.py optimize_mythdb.py lh_mtc.py misc_recent_recordings.pl misc_status_config.py misc_status_info.sh misc_upcoming_recordings.pl misc_which_recorder.pl plexmediascanner.sh @@ -37,19 +37,20 @@ sha256sums=('525bfe29b63d3ec5a17a32fa29745e24070020490c3f5b6dd6b03250348fb324' '6d4fb0ed1a5ed961b3a3884dce093118e50c2981a9cd5837d20abc5a6d4fd8aa' '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787' '93d664f4a46fda05d0f754d19df40cbda120e325b80c07092345b14763993833' - '8d6d09cedc85e49712144699ccb905be6ef663e9ab0bc01abd434370ab12fede' - 'b10f85c7d1d8a728af595da3f7c2f93921a6944346444cf319ca991ee324ae6f' + 'a523388ffdc6f30f2dd2ef4803b21bded8a35bfded499dc66b786adec71840a3' + '4e88e3b3a105d923fb7fecad07c5a9fab0eab0904b7cd2831a539ecb91ef2ef4' '91bdec992bb2c933e15625c181f2195c402060b879168ebf35944cb064c904b9' '5cacfdd02833e5a3130d765573e772e6bd5030336ba86239c5e4db5ffa36fc69' + 'd51253c207d3315997d7122cb774c6d0fc38975c33e66bf416f0b1b95cf86e5b' 'ebdb3ee0212e0cc72526bb5e50a032573e1894acb7bf75617243b0b49aa1f8f2' - '4d006f0fe3b13e67de1b961d611e81911905a30d140849dfdb8e5c0dc4da2f7c' + 'cd3306991c8b63f5402c0e52405cc1a6581cb3c42af74b7c2f879c8192f95610' 'e371c6a289c68fe200d7da856c20a8c579efa23178f4d62235f7359d7f6e49a1' 'c29eead1fee5b3738dae6fc1dc7592cfede0440cfe7ccfd1d8505327495f07f9' 'd2d69b2bf6315bd37ff5f5b2f0cde8ab2fb89bae18f8796dc5208ffc1a9d743e' - 'a3f8ba840853e4a189dd52520a6958f4030e1cc3391200a6aeef055fb469f0b4' + 'a745356952470a5d718bef1961309ea30e4fa6a2860961cd52e09d6ec11e708e' '1819085bd2c9106482c5f243b95fddf3dae69212330ab76cb493add5c26a45a4' '62a5a195ddfaa13bbc7b5bc627cdd748f5d697d178a5238b71a703533bfdd587' - '1d12a128a01dbf6327a80daab9edfdc57d393d02074d19c6a5bd54560cc6b0c0' + '8d92160ef094c6186cb0aaeeddcf8730f3e1a05a933ad4147269a74f09c70b19' 'bfb0cc87bf350214f38a262400bee0174fca75f15bed4eec6bdad4a34dde174c' 'bffcc13e4b480f720feb2b3c781bc4247c63303250c3d885022c699573d45a33' '51093acab5e5a4de51a55f4bdf7b935f4f69edf3d84f1c37db710853ec95eca8' diff --git a/linhes/linhes-system/find_orphans.py b/linhes/linhes-system/find_orphans.py index 8072b8f..786f01b 100755 --- a/linhes/linhes-system/find_orphans.py +++ b/linhes/linhes-system/find_orphans.py @@ -1,4 +1,5 @@ -#!/usr/bin/env python +#!/usr/bin/python3 +# based on https://www.mythtv.org/wiki/Find_orphans.py from MythTV import MythDB, MythBE, Recorded, MythError from socket import timeout @@ -24,7 +25,7 @@ class File( str ): self.size = int(size) def pprint(self): name = '%s: %s' % (self.host, os.path.join(self.path, self)) - print(' {0:<90}{1:>8}'.format(name, human_size(self.size)).encode('utf-8')) + print(' {0:<90}{1:>8}'.format(name, human_size(self.size))) def delete(self): be = MythBE(self.host, db=DB) be.deleteFile(self, self.group) @@ -35,20 +36,20 @@ class MyRecorded( Recorded ): name = '{0.hostname}: {0.title}'.format(self) if self.subtitle: name += ' - '+self.subtitle - print(' {0:<70}{1:>28}'.format(name,self.basename).encode('utf-8')) + print(' {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('{0:>87}{1:>12}'.format('Count:',len(recs)).encode('utf-8')) + print('{0:>87}{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('{0:>87}{1:>12}'.format('Total:',human_size(size)).encode('utf-8')) + print('{0:>87}{1:>12}'.format('Total:',human_size(size))) def populate(host=None): unfiltered = [] @@ -57,7 +58,7 @@ def populate(host=None): with DB as c: c.execute("""SELECT count(1) FROM settings WHERE hostname=%s AND value=%s""", - (host, 'BackendServerIP')) + (host, 'BackendServerAddr')) if c.fetchone()[0] == 0: raise Exception('Invalid hostname specified on command line.') hosts = [host] @@ -65,7 +66,7 @@ def populate(host=None): else: with DB as c: c.execute("""SELECT hostname FROM settings - WHERE value='BackendServerIP'""") + WHERE value='BackendServerAddr'""") hosts = [r[0] for r in c.fetchall()] for host in hosts: for sg in DB.getStorageGroup(): diff --git a/linhes/linhes-system/lh_system_backup b/linhes/linhes-system/lh_system_backup index f970f4f..b3df6e1 100755 --- a/linhes/linhes-system/lh_system_backup +++ b/linhes/linhes-system/lh_system_backup @@ -4,20 +4,23 @@ lh_notify-send "Starting Backup..." #alert user the database will not be backed up if [ $SystemType != MasterBackend -a $SystemType != Standalone ] then - lh_notify-send "This is not the Master backend.\n Skipping backup of database." + lh_notify-send "This is not the MasterBackend.\n Skipping backup of database." fi if [ $SystemType = MasterBackend -o $SystemType = Standalone ] then - backend_control.sh stop 127.0.0.1 + lh_notify-send "Stopping MythBackend..." + systemctl stop mythbackend.service fi #do the backup -lh_system_backup_job 2>&1 > /var/run/backup.log +lh_notify-send "Starting system backup..." +lh_system_backup_job 2>&1 > /var/log/system_backup.log rc=$? if [ $SystemType = MasterBackend -o $SystemType = Standalone ] then - backend_control.sh start 127.0.0.1 + lh_notify-send "Starting MythBackend..." + systemctl start mythbackend.service fi if [ $rc = 0 ] diff --git a/linhes/linhes-system/lh_system_backup_job b/linhes/linhes-system/lh_system_backup_job index 7d699f0..14a3cf8 100755 --- a/linhes/linhes-system/lh_system_backup_job +++ b/linhes/linhes-system/lh_system_backup_job @@ -299,7 +299,7 @@ lock_myth if [ "x$1" = "x" ] then backup - update_backup_status + #update_backup_status #only remove old backups if there was no problems if [ $backup_status -eq 0 ] then diff --git a/linhes/linhes-system/misc_status_config.py b/linhes/linhes-system/misc_status_config.py index 80205cd..b025886 100755 --- a/linhes/linhes-system/misc_status_config.py +++ b/linhes/linhes-system/misc_status_config.py @@ -37,5 +37,5 @@ for line in config_file: #this is how you reference a value from mv_hostype.py if (systemconfig.get("SystemType") == "Standalone"): dbSettingChange() -elif systemconfig.get("SystemType") == "Master_backend": +elif systemconfig.get("SystemType") == "MasterBackend": dbSettingChange() diff --git a/linhes/linhes-system/misc_which_recorder.pl b/linhes/linhes-system/misc_which_recorder.pl index 05c8600..57947f1 100755 --- a/linhes/linhes-system/misc_which_recorder.pl +++ b/linhes/linhes-system/misc_which_recorder.pl @@ -61,7 +61,7 @@ else while (<$fh>) { # Myth .25 & .27 regex to find start of recording for digital and analog MPEG - if (/^(\d+-\d+-\d+T\d+\:\d+\:\d+)(?:.*) (?:Started|Tuning) recording: (.*): channel (\d+) on cardid \[(\d+)\], sourceid (\d+)/ || /^(\d+-\d+-\d+T\d+\:\d+\:\d+)(?:.*) \(UpdateRecStatus\) Updating status for (.*)() on cardid \[(\d+)\] \(Will Record => Recording\)()/) + if (/^(\D\D\D +\d+ \d+\:\d+\:\d+)(?:.*) \(HandleRecordingStatusChange\) (?:Started|Tuning) recording: (.*): channel (\d+) on cardid \[(\d+)\], sourceid (\d+)/ || /^(\d+-\d+-\d+T\d+\:\d+\:\d+)(?:.*) \(UpdateRecStatus\) Updating status for (.*)() on cardid \[(\d+)\] \(Will Record => Recording\)()/) { if ($mode eq "--noheader") { @@ -77,7 +77,7 @@ while (<$fh>) ($time, $title, $chanid, $cardid, $sourceid) = ($1, $2, $3, $4, $5); $time =~ s/T/' '/; - $time = `date -d $time +%a' '%m/%d' '%l:%M' '%p`; + $time = `date -d "$time" +%a' '%-m/%-d' '%l:%M' '%p`; chomp ($time); if (($title =~ /"?(.+)"?:"?(.*)"?/) || ($title =~ /(.+) "(.*)"/)) { -- cgit v0.12