summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-08-23 17:21:34 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-08-23 17:21:34 (GMT)
commit726a9764437fc32e18a3bcbe6c9b174be0e80049 (patch)
tree2ade9524dd068aa8d433e3e25d0e95cd4467300e
parent9c23be6624a56b16a748f94fcfa9d6f2bcce2942 (diff)
downloadlinhes_pkgbuild-726a9764437fc32e18a3bcbe6c9b174be0e80049.zip
linhes_pkgbuild-726a9764437fc32e18a3bcbe6c9b174be0e80049.tar.gz
linhes_pkgbuild-726a9764437fc32e18a3bcbe6c9b174be0e80049.tar.bz2
LinHES-system: added gen_lib_xml.py. This is similiar to gen_is_xml.py
~/.mythtv/library.xml is created by reading /usr/share/mythtv/themes/defaultmenutheme/library.xml and merges it with the snippets found in /etc/gen_lib_xml.d/
-rwxr-xr-xabs/core/LinHES-system/PKGBUILD8
-rw-r--r--abs/core/LinHES-system/gen_lib_xml.py113
-rw-r--r--abs/core/LinHES-system/readme_is_xml2
3 files changed, 119 insertions, 4 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index b0a52db..2bbb8b6 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=2
-pkgrel=56
+pkgrel=57
arch=('i686' 'x86_64')
MVDIR=$startdir/pkg/usr/LH
BINDIR=$startdir/pkg/usr/bin
@@ -23,7 +23,7 @@ binfiles="LinHES-start optimize_mythdb.py
diskspace.sh
cacheclean lh_message.sh switch_web.sh
create_media_dirs.sh
- msg_client.py msg_daemon.py gen_is_xml.py"
+ msg_client.py msg_daemon.py gen_is_xml.py gen_lib_xml.py"
source=(LinHES-session LinHES-profile.sh $binfiles alsa-base myth_mtc.lr
diskspace cacheclean.cron readme_is_xml)
@@ -50,6 +50,7 @@ build() {
install -m644 -D $startdir/src/alsa-base $startdir/pkg/etc/modprobe.d/alsa-base.conf
install -m644 -D $startdir/src/readme_is_xml $startdir/pkg/etc/gen_is_xml.d/readme_is_xml
+ install -m644 -D $startdir/src/readme_is_xml $startdir/pkg/etc/gen_gen_xml.d/readme_gen_xml
# install -m755 -D $startdir/src/smolt.cron $startdir/pkg/etc/cron.weekly/smolt.cron
install -m755 -D $startdir/src/cacheclean.cron $startdir/pkg/etc/cron.weekly/cacheclean.cron
install -m755 -D $startdir/src/diskspace $startdir/pkg/etc/cron.tenminutes/diskspace
@@ -85,8 +86,9 @@ md5sums=('e3838fc12af7aaa8e738683b1034b43c'
'a182af47a7d373b2a63a27e1bb7485b2'
'5148fe4c6ac27fff8152c819c4d2b47a'
'fd21c1b19331581d603d5949c90d5c61'
+ 'f7992ea7de2175bebb498739fe87e9c7'
'eb879fee9603a05d5420d4ce8ed9e450'
'f1870a9522c79e6b248fcbf81dec3280'
'84492954db16740f949d795b74383189'
'02c810c2f47b7c4495fdacaf54189473'
- '93a2af3e723f36c063623f705330d337')
+ '1e2ca4dd872a50df6b70528e06df558a')
diff --git a/abs/core/LinHES-system/gen_lib_xml.py b/abs/core/LinHES-system/gen_lib_xml.py
new file mode 100644
index 0000000..503d39c
--- /dev/null
+++ b/abs/core/LinHES-system/gen_lib_xml.py
@@ -0,0 +1,113 @@
+#! /usr/bin/python2
+#Helper program that generates library.xml thats custom to linhes.
+#Contents are read from /etc/gen_lib_xml.d
+#This script should be run everytime an entry is added or removed
+
+
+import os, sys
+import glob
+
+class Gen_lib_xml:
+ def __init__(self,snippit_dir,orig_theme_file):
+ self.snippit_dir = snippit_dir
+ self.orig_theme_file = orig_theme_file
+ self.xml_snippets=[]
+ self.orig_theme_xml=[]
+ self.new_xml=[]
+
+ def get_new_xml(self):
+ return self.new_xml
+ def get_orig_xml(self):
+ return self.orig_theme_xml
+ def get_snippits(self):
+ return self.xml_snippets
+
+ def read_snippets(self):
+ xml_snippets=""
+ try:
+ os.chdir(self.snippit_dir)
+ except:
+ print " gen_lib_xml: Couldn't change dir to %s" %self.snippit_dir
+ print " Exiting"
+ sys.exit(2)
+ file_list=glob.glob("*.conf")
+ for conf_file in file_list:
+ try:
+ print " gen_lib_xml: reading in %s" %conf_file
+ f=open(conf_file,'r')
+ lines=f.readlines()
+ f.close()
+ except:
+ print " gen_lib_xml: Couldn't open %s for reading" %conf_file
+ print " Exiting"
+ sys.exit(2)
+
+ if len(file_list) == 0:
+ print " gen_lib_xml: no conf files found"
+ lines = []
+ self.xml_snippets = lines
+
+ def read_orig_xml(self):
+ try:
+ print " gen_lib_xml: reading in %s" %self.orig_theme_file
+ f=open(self.orig_theme_file,'r')
+ lines=f.readlines()
+ f.close()
+
+ except:
+ print " gen_lib_xml: Couldn't open %s for reading" %self.orig_theme_file
+ print " Exiting"
+ sys.exit(2)
+ #print lines
+ for i in lines:
+ if i.strip() == "</mythmenu>":
+ lines.remove(i)
+ print " gen_lib_xml: Removing /mythmenu tag "
+ break
+ self.orig_theme_xml=lines
+
+ def make_new_xml(self):
+ self.new_xml = self.orig_theme_xml + self.xml_snippets
+ self.new_xml.append("</mythmenu>\n")
+ pass
+
+
+
+
+
+
+
+
+def write_xml(xml,filename):
+ try:
+ f=open(filename, 'w')
+ except:
+ print " gen_lib_xml: Couldn't open %s" %(filename)
+ print " Exiting"
+ sys.exit(2)
+ print " gen_lib_xml: Writing %s" %(filename)
+ for i in xml:
+ f.write(i)
+ f.close()
+
+def main():
+ filename="/home/mythtv/.mythtv/library.xml"
+ #filename="/tmp/library.xml"
+ orig_theme_file="/usr/share/mythtv/themes/defaultmenu/library.xml"
+ lib_xml_dir="/etc/gen_lib_xml.d/"
+
+ lib_xml = Gen_lib_xml(lib_xml_dir,orig_theme_file)
+ lib_xml.read_snippets()
+ lib_xml.read_orig_xml()
+ lib_xml.make_new_xml()
+ lib_xml.make_new_xml()
+ new_xml = lib_xml.get_new_xml()
+
+ #a = lib_xml.get_new_xml()
+ #b = lib_xml.get_orig_xml()
+ #c = lib_xml.get_snippits()
+
+ write_xml(new_xml,filename)
+
+if __name__ == "__main__":
+ main() \ No newline at end of file
diff --git a/abs/core/LinHES-system/readme_is_xml b/abs/core/LinHES-system/readme_is_xml
index f4931b4..d2af0f6 100644
--- a/abs/core/LinHES-system/readme_is_xml
+++ b/abs/core/LinHES-system/readme_is_xml
@@ -1 +1 @@
-Files ending in .conf will be read by gen_is_xml.py and written out to is.xml
+Files ending in .conf will be read by gen_is_xml.py or gen_lib_xml.py and output xml as appropriate