summaryrefslogtreecommitdiffstats
path: root/linhes/linhes-system/find_orphans.py
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2023-03-10 02:36:54 (GMT)
committerBritney Fransen <brfransen@gmail.com>2023-03-10 02:36:54 (GMT)
commit671639b525d1ccdd06b29756ba0ba2ea4178205c (patch)
treea09ee50c065628dfe182dc7a246ee3ae905ef758 /linhes/linhes-system/find_orphans.py
parentbf89bcadcae5053e80abd14ea03052ce3b1d607b (diff)
downloadlinhes_pkgbuild-671639b525d1ccdd06b29756ba0ba2ea4178205c.zip
linhes_pkgbuild-671639b525d1ccdd06b29756ba0ba2ea4178205c.tar.gz
linhes_pkgbuild-671639b525d1ccdd06b29756ba0ba2ea4178205c.tar.bz2
linhes-system: find_orphans.py: fixes for mythtv 33 and python3
misc_which_recorder.pl: fix for mythtv 33
Diffstat (limited to 'linhes/linhes-system/find_orphans.py')
-rwxr-xr-xlinhes/linhes-system/find_orphans.py15
1 files changed, 8 insertions, 7 deletions
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():