From 72555a87c8775dd404fa62d7003e557ad05c90ba Mon Sep 17 00:00:00 2001 From: James Meyer Date: Fri, 8 Feb 2013 18:52:00 -0600 Subject: LinHES-config: timezip.py add syncing up of parental lvl passwords and starting level with MBE. --- abs/core/LinHES-config/PKGBUILD | 2 +- abs/core/LinHES-config/timezip.py | 42 ++++++++++++++++++++++++++++++++++++++- 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index e1d00c8..4c08e2f 100755 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -145,7 +145,7 @@ md5sums=('32fc2b52809231d75a72492b91eeed74' '2a7f3b34e522acfd08283b86c8926aba' 'b596d2e3779a434435bc0f0277b1ba3e' '5012fbd31d205a6d6b0a1d8caf3eba8f' - 'b02bc06fc6623bf6473175165578e1d5' + '157e73d0f90d7b306aba8f5921aeedd3' 'a6faa20d905e2fd92ce79acab044b759' '8ba06c2ce6129371548cc360ccca27f8' '5f890ea9bda6aef652d2560ca19dac07' diff --git a/abs/core/LinHES-config/timezip.py b/abs/core/LinHES-config/timezip.py index adf7d1b..eb373b4 100755 --- a/abs/core/LinHES-config/timezip.py +++ b/abs/core/LinHES-config/timezip.py @@ -95,6 +95,10 @@ def printvars(): print "Gallery Dir:" + gallerydir print "Music dir:" + musicdir print "Music template:" + filenametemplate + + for key,value in video_dict.items(): + print "%s: %s" %(key,value) + print "-----------------------------------" print "\n\n\n" @@ -117,6 +121,8 @@ def selectvars(): global musicdir global gallerydir global filenametemplate + #video parent level + global video_dict db = MySQLdb.connect(host=masterdb, user="mythtv", passwd="mythtv", db="mythconverg") # create a cursor @@ -232,7 +238,6 @@ def selectvars(): except TypeError: filenametemplate="" - try: cursor.execute("select data from settings where value='GalleryDir' and hostname=(%s)",(BEhostname)) result = cursor.fetchone() @@ -240,6 +245,22 @@ def selectvars(): except TypeError: gallerydir="" +# video parental level + video_list=['VideoAdminPassword', + 'VideoAdminPasswordThree', + 'VideoAdminPasswordTwo', + 'VideoAggressivePC', + 'VideoDefaultParentalLevel', + 'mythvideo.ParentalLevelFromRating'] + + for i in video_list: + sql_query="select data from settings where value='%s' and hostname='%s'" %(i,BEhostname) + try: + cursor.execute(sql_query) + result = cursor.fetchone() + video_dict[i]=result[0] + except TypeError: + video_dict[i]='' def insertvars(): @@ -378,6 +399,22 @@ def insertvars(): cursor.execute("update settings set data=(%s) where hostname=(%s) and value='GalleryDir'",(gallerydir,thishostname)) print "updating gallerydir" +# parental level + for key,value in video_dict.items(): + if ( value != "" ): + sql_query = "select * from settings where value='%s' and hostname='%s'" %(key,thishostname) + cursor.execute(sql_query) + result = cursor.fetchone() + if (result == None): + insert_sql ="INSERT INTO settings (value,data,hostname) VALUES ('%s','%s','%s')" %(key,value,thishostname) + cursor.execute(insert_sql) + print "inserting %s" %(key) + else: + no_update(key) + #update_sql="update settings set data='%s' where hostname='%s' and value='%s'" %(value,thishostname,key) + #cursor.execute(update_sql) + #print "updating %s" %(key) + @@ -397,6 +434,9 @@ def main(argv): global gallerydir global filenametemplate + global video_dict + video_dict = {} + try: opts, args = getopt.getopt(argv, "hm:d:n:", ["help", "masterdb=", "installdb=" , "hostname=" ] ) except getopt.GetoptError: -- cgit v0.12