From 1b28d4879e5c6391dec91de9344c7ce9da918de5 Mon Sep 17 00:00:00 2001
From: Britney Fransen <brfransen@gmail.com>
Date: Mon, 23 Jan 2023 12:06:46 -0500
Subject: linhes-system: gen_lib_xml.py use lh_home_check.sh

---
 linhes/linhes-system/PKGBUILD                  | 16 ++++++++--------
 linhes/linhes-system/balance_storage_groups.py |  2 +-
 linhes/linhes-system/checkXFSfrag.sh           |  2 +-
 linhes/linhes-system/empty_storage_groups.py   |  2 +-
 linhes/linhes-system/gen_lib_xml.py            | 10 +++-------
 linhes/linhes-system/misc_status_info.sh       |  6 +++---
 linhes/linhes-system/myth2mp3                  |  2 +-
 linhes/linhes-system/xfs_defrag.cron           |  2 +-
 8 files changed, 19 insertions(+), 23 deletions(-)

diff --git a/linhes/linhes-system/PKGBUILD b/linhes/linhes-system/PKGBUILD
index f336947..0711dbc 100755
--- a/linhes/linhes-system/PKGBUILD
+++ b/linhes/linhes-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=linhes-system
 pkgver=9.0.0
-pkgrel=28
+pkgrel=29
 arch=('x86_64')
 #install=$pkgname.install
 pkgdesc="Everything that makes LinHES a system"
@@ -23,32 +23,32 @@ source=($binfiles
     'system-sudo.rules' 'linhes-profile.sh' 'lh_sqlserver.cnf'
     'lh_system_start.sh.desktop' 'rc6_mce.toml')
 sha256sums=('7f91d2afcb76e8e9063c6bbe05f5c3d134a6f67541aead8894d342c32d34ad98'
-            'b0e8fe4d04e1f779d52a28156489fb51efc13e173efccba2d6d458044bf35904'
-            '4ab36bbabf0964f666278c225f4c2d41f4277acb42e9023163fa3a9599282466'
+            '1ec3c266cafb0c1b231e88df88b97fec1a1b7465b5d95a0c1e64c8cb727b7c47'
+            '97fe9e851c782fa9f85c5b69b110ccff2817dd4fa2a6d9ff6ee225dc558677e4'
             'ff261f41efec8a9963f9f59100cbe75f015028a2ed3a863ce0cb473f2ebb7b76'
-            '11168c9cd3b117decaab6bc665c183b4aab917cf0a976bce4c1b5e4686a27bc9'
+            'c7a2b2de44645e3a905b39d7411e5b8b27b60bd2944533fd4655c3b175755da1'
             'ae34515e144830f424d3bd3f6b1b446892d62beed20bca6f0fb19b0bbb779f27'
             '23358a7bff4968eccd469613b81b1415c2ae0ebe77f14f74426697333e4d88d7'
             '7c6485d07ca67d2a4f089ed885c8ae3a9205d6f43f373ae8a32c2da55daa6de8'
             '6d4fb0ed1a5ed961b3a3884dce093118e50c2981a9cd5837d20abc5a6d4fd8aa'
             '87875d9e5f5ce18208f419698ce69b6bcbcd08955a57a4a13940e715af58b787'
             '91bdec992bb2c933e15625c181f2195c402060b879168ebf35944cb064c904b9'
-            'e1e77ef14f1a0a29adf29206972ae5d6a13c9f87d41252a253486104895cb97c'
+            '5cacfdd02833e5a3130d765573e772e6bd5030336ba86239c5e4db5ffa36fc69'
             'ebdb3ee0212e0cc72526bb5e50a032573e1894acb7bf75617243b0b49aa1f8f2'
             '4d006f0fe3b13e67de1b961d611e81911905a30d140849dfdb8e5c0dc4da2f7c'
             'e371c6a289c68fe200d7da856c20a8c579efa23178f4d62235f7359d7f6e49a1'
             'd2d69b2bf6315bd37ff5f5b2f0cde8ab2fb89bae18f8796dc5208ffc1a9d743e'
             'a3f8ba840853e4a189dd52520a6958f4030e1cc3391200a6aeef055fb469f0b4'
-            '6a700f73241de796447bbaf9475b627ae5e662aec3f7fd42b7efa28333aa8801'
+            '1819085bd2c9106482c5f243b95fddf3dae69212330ab76cb493add5c26a45a4'
             '62a5a195ddfaa13bbc7b5bc627cdd748f5d697d178a5238b71a703533bfdd587'
             '1d12a128a01dbf6327a80daab9edfdc57d393d02074d19c6a5bd54560cc6b0c0'
             'bffcc13e4b480f720feb2b3c781bc4247c63303250c3d885022c699573d45a33'
             '51093acab5e5a4de51a55f4bdf7b935f4f69edf3d84f1c37db710853ec95eca8'
             '9ea1b5583cd38f53bb79d9e4ccae91a028db0b6850162d7991b19122c564b9c9'
-            'cab7724cd7c792adae79ba11cf59a0908edf197c437ae6b356ce86c6a365f0da'
+            'a81fdb81d8890e73b7891756623d536a133410ea43205b7152a295ad9ab8f3c9'
             '9e97b4d68c9e8988daacadd40f1de9f0b5945d870eba596a2ceb5e0c023fa9c0'
             '186203d3c0520bb3d611da99d33a7713e9c1563814285f1f101097234f214b2f'
-            '4533e15b9141ab722f9b02c3ec7855f61c1e4d2deedd8591b1abd0ed551be581'
+            'cdfc0c836b8194f631f4a9e022c232ff75a13ff1a161a1a011858578bea5f930'
             '5f502b1bc8815d69c802320790745e4526d5817fd8ecc7b00cf8b16078f8d440'
             '12e424432bdf2d50afe3e632c018fef847e860a35a53525eccbe656b9c4118aa'
             'ee745056d018f860572f8363ed5e730ba501394c23cdd6f316719d7141c10050'
diff --git a/linhes/linhes-system/balance_storage_groups.py b/linhes/linhes-system/balance_storage_groups.py
index 0dd4b01..e525a27 100755
--- a/linhes/linhes-system/balance_storage_groups.py
+++ b/linhes/linhes-system/balance_storage_groups.py
@@ -132,7 +132,7 @@ if __name__ == '__main__':
         else:
             print("------------------------------------------------")
             print("Checking System Status...")
-            if subprocess.call(["/usr/bin/python2", "/usr/LH/bin/idle.py", "-s"]):
+            if subprocess.call(["/usr/bin/python", "/usr/bin/idle.py", "-s"]):
                 print("  System is busy. The file will not be moved.")
                 sys.exit()
             print("Moving File...")
diff --git a/linhes/linhes-system/checkXFSfrag.sh b/linhes/linhes-system/checkXFSfrag.sh
index d25eaa8..12c4549 100755
--- a/linhes/linhes-system/checkXFSfrag.sh
+++ b/linhes/linhes-system/checkXFSfrag.sh
@@ -31,7 +31,7 @@ e='/usr/bin/echo -e'                                # Use the echo command, not
 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.
 ionice=/usr/bin/ionice                             # Set variable with the path to ionice.
-idle='/usr/LH/bin/idle.py -s'                      # Set varialbe with path to idle.py.
+idle='/usr/bin/idle.py -s'                      # Set variable with path to idle.py.
 pctmax=12                                        # Set maxiumum frag percent needed for defrag.
                                                 # This is zero here for testing purposes only
                                                 # a higher number should be used in production.
diff --git a/linhes/linhes-system/empty_storage_groups.py b/linhes/linhes-system/empty_storage_groups.py
index 4b5aff8..708c118 100755
--- a/linhes/linhes-system/empty_storage_groups.py
+++ b/linhes/linhes-system/empty_storage_groups.py
@@ -165,7 +165,7 @@ if __name__ == '__main__':
         else:
             print("------------------------------------------------")
             print("Checking System Status...")
-            if subprocess.call(["/usr/bin/python2", "/usr/LH/bin/idle.py", "-s"]):
+            if subprocess.call(["/usr/bin/python", "/usr/bin/idle.py", "-s"]):
                 print("  System is busy. The file will not be moved.")
                 sys.exit()
             print("Moving File...")
diff --git a/linhes/linhes-system/gen_lib_xml.py b/linhes/linhes-system/gen_lib_xml.py
index 31dcdc2..8169f4e 100755
--- a/linhes/linhes-system/gen_lib_xml.py
+++ b/linhes/linhes-system/gen_lib_xml.py
@@ -4,7 +4,7 @@
 #This script should be run everytime an entry is added or removed
 
 
-import os, sys
+import os, sys, subprocess
 import glob
 
 class Gen_lib_xml:
@@ -93,12 +93,8 @@ def write_xml(xml,filename):
     f.close()
 
 def main():
-    sys.path.append('/usr/MythVantage/bin/')
-    config_file = "mv_config"
-    data_config = __import__(config_file,  globals(),  locals(),  [])
-
-    filename="%s/.mythtv/library.xml" %data_config.MYTHHOME
-    #filename="/tmp/library.xml"
+    MYTHHOME=subprocess.check_output("lh_home_check.sh").decode('utf-8').strip()
+    filename="%s/.mythtv/library.xml" %MYTHHOME
     orig_theme_file="/usr/share/mythtv/themes/defaultmenu/library.xml"
     lib_xml_dir="/etc/gen_lib_xml.d/"
 
diff --git a/linhes/linhes-system/misc_status_info.sh b/linhes/linhes-system/misc_status_info.sh
index 347fb93..3061a08 100755
--- a/linhes/linhes-system/misc_status_info.sh
+++ b/linhes/linhes-system/misc_status_info.sh
@@ -1,13 +1,13 @@
 #!/bin/bash
 
 # Show all upcoming conflicts
-/usr/LH/bin/misc_upcoming_recordings.pl --recordings -1 \
+/usr/bin/misc_upcoming_recordings.pl --recordings -1 \
                             --no_show_scheduled \
                             --heading '<h3>Recording Conflicts</h3>' \
                             --no_conflicts_message '<h3>No Recording Conflicts</h3>'
 
 # Show all the shows recorded today
-/usr/LH/bin/misc_recent_recordings.pl --recordings=-1 --hours=24 \
+/usr/bin/misc_recent_recordings.pl --recordings=-1 --hours=24 \
                           --heading '<h3>Shows Recorded In The Last 24 Hours</h3>'
 
 # Get Encoder that was used for recordings from the backend log
@@ -19,5 +19,5 @@ do
         echo "<h3>Encoder Information</h3><div class=\"schedule\""
         firstrun=0
     fi
-    /usr/LH/bin/misc_which_recorder.pl --noheader $i
+    /usr/bin/misc_which_recorder.pl --noheader $i
 done
diff --git a/linhes/linhes-system/myth2mp3 b/linhes/linhes-system/myth2mp3
index 69d5d3f..ebc588b 100755
--- a/linhes/linhes-system/myth2mp3
+++ b/linhes/linhes-system/myth2mp3
@@ -9,7 +9,7 @@
 # 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%"
+# /usr/bin/myth2mp3 "%DIR%/%FILE%" "%TITLE% - %SUBTITLE%" "%CHANID%" "%STARTTIME%"
 
 # options:
 BITRATE=256k		#ie. 128k, 160k, 192k, 224k, 256k
diff --git a/linhes/linhes-system/xfs_defrag.cron b/linhes/linhes-system/xfs_defrag.cron
index 792a4b4..208f5e8 100644
--- a/linhes/linhes-system/xfs_defrag.cron
+++ b/linhes/linhes-system/xfs_defrag.cron
@@ -1,3 +1,3 @@
 #!/bin/bash
 #. /etc/profile
-/usr/LH/bin/checkXFSfrag.sh --idle | /usr/bin/logger -t xfs_defrag
+/usr/bin/checkXFSfrag.sh --idle | /usr/bin/logger -t xfs_defrag
-- 
cgit v0.12

