More error condition checking

This commit is contained in:
noisymime 2008-02-11 21:52:58 +00:00
parent d9cafafcdf
commit 04fc6bddbe
3 changed files with 9 additions and 9 deletions

View File

@ -62,6 +62,9 @@ class MainApp:
#Create a master mySQL connection #Create a master mySQL connection
self.dbMgr = mythDB() self.dbMgr = mythDB()
if not self.dbMgr.connected:
return
#Update splash status msg #Update splash status msg
for mods in modules: for mods in modules:
#print "Loading mod..." #print "Loading mod..."

View File

@ -1,12 +1,15 @@
import MySQLdb import MySQLdb
import os, socket import os, socket
import clutter
class mythDB(): class mythDB():
def __init__(self): def __init__(self):
self.localHost = socket.gethostname() self.localHost = socket.gethostname()
self.read_config() if not self.read_config():
self.connected = False
return
try: try:
self.db = MySQLdb.connect(self.server, self.uid, self.passwd,self.db) self.db = MySQLdb.connect(self.server, self.uid, self.passwd,self.db)
@ -17,14 +20,6 @@ class mythDB():
return None return None
self.cursor = self.db.cursor() self.cursor = self.db.cursor()
#self.get_gallery_directory()
#cursor.execute("SELECT * FROM videometadatagenre")
# get the resultset as a tuple
#result = cursor.fetchall()
# iterate through resultset
#for record in result:
#print record[0] , "-->", record[1]
#Attempts to read the local mythtv config file to get the server, username and password #Attempts to read the local mythtv config file to get the server, username and password
def read_config(self): def read_config(self):
@ -49,6 +44,8 @@ class mythDB():
if variables[0] == "DBName": if variables[0] == "DBName":
self.db = variables[1].rstrip() self.db = variables[1].rstrip()
return True
def run_sql(self, sql): def run_sql(self, sql):
if not self.connected: if not self.connected:
print "Unable to start video, could not establish connection to SQL server" print "Unable to start video, could not establish connection to SQL server"

Binary file not shown.