summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/timezip.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2013-02-09 00:52:00 (GMT)
committerJames Meyer <james.meyer@operamail.com>2013-02-09 00:52:00 (GMT)
commit72555a87c8775dd404fa62d7003e557ad05c90ba (patch)
tree5f23731c6ca3c9b5bab612029d7f9d41e0b0a2d2 /abs/core/LinHES-config/timezip.py
parentc7564c42181a089ab43bff917007d31f5c4eaaa9 (diff)
downloadlinhes_pkgbuild-72555a87c8775dd404fa62d7003e557ad05c90ba.zip
linhes_pkgbuild-72555a87c8775dd404fa62d7003e557ad05c90ba.tar.gz
linhes_pkgbuild-72555a87c8775dd404fa62d7003e557ad05c90ba.tar.bz2
LinHES-config: timezip.py add syncing up of parental lvl passwords and starting level with MBE.
Diffstat (limited to 'abs/core/LinHES-config/timezip.py')
-rwxr-xr-xabs/core/LinHES-config/timezip.py42
1 files changed, 41 insertions, 1 deletions
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: