Ticket #4686: tabbing.patch
| File tabbing.patch, 1.8 KB (added by , 18 years ago) |
|---|
-
MythDB.py
old new 34 34 'user' : None, 35 35 'pass' : None 36 36 } 37 37 38 38 # Try to read the mysql.txt file used by MythTV. 39 39 # Order taken from libs/libmyth/mythcontext.cpp 40 40 config_files = [ … … 46 46 ] 47 47 if 'MYTHCONFDIR' in os.environ: 48 48 config_locations.append('%s/mysql.txt' % os.environ['MYTHCONFDIR']) 49 49 50 50 found_config = False 51 51 for config_file in config_files: 52 52 try: … … 54 54 config.wordchars += "." 55 55 except: 56 56 continue 57 57 58 58 dbconn['host'] = None 59 59 dbconn['name'] = None 60 60 dbconn['user'] = None … … 80 80 break 81 81 82 82 # Overrides from command line parameters 83 try:83 try: 84 84 opts, args = getopt.getopt(args, '', ['dbhost=', 'user=', 'pass=', 'database=']) 85 85 for o, a in opts: 86 86 if o == '--dbhost': … … 106 106 def getAllSettings(self, hostname=None): 107 107 """ 108 108 Returns values for all settings. 109 109 110 110 Returns None if there are no settings. If multiple rows are 111 111 found (multiple hostnames), returns the value of the first one. 112 112 """ … … 126 126 ) 127 127 rows = c.fetchall() 128 128 c.close() 129 129 130 130 if rows: 131 131 return rows 132 132 else: … … 135 135 def getSetting(self, value, hostname=None): 136 136 """ 137 137 Returns the value for the given MythTV setting. 138 138 139 139 Returns None if the setting was not found. If multiple rows are 140 140 found (multiple hostnames), returns the value of the first one. 141 141 """ 142 142 log.Msg(DEBUG, 'Looking for setting %s for host %s', value, hostname) 143 143 c = self.db.cursor() 144 if hostname is None:144 if hostname is None: 145 145 c.execute(""" 146 146 SELECT data 147 147 FROM settings … … 155 155 (value, hostname)) 156 156 row = c.fetchone() 157 157 c.close() 158 158 159 159 if row: 160 160 return row[0] 161 161 else:
