Ticket #3593: find_meta.py.diff
File find_meta.py.diff, 2.0 KB (added by , 17 years ago) |
---|
-
mythvideo/mythvideo/scripts/find_meta.py
108 108 print string 109 109 return 110 110 111 db = None112 def init_db():113 global db114 try:115 config = shlex.shlex(open(os.path.expanduser('~/.mythtv/mysql.txt')))116 except:117 print "Error opening ~/.mythtv/mysql.txt"118 return False119 120 121 token = config.get_token()122 db_host = db_user = db_password = None123 while token != config.eof and (db_host == None or db_user == None or db_password == None):124 if token == "DBHostName":125 if config.get_token() == "=":126 db_host = config.get_token()127 elif token == "DBUserName":128 if config.get_token() == "=":129 db_user = config.get_token()130 elif token == "DBPassword":131 if config.get_token() == "=":132 db_password = config.get_token()133 134 token = config.get_token()135 db = MySQLdb.connect(user=db_user, host=db_host, passwd=db_password,136 db="mythconverg")137 print_verbose("Database connection successful.")138 return True139 140 111 def find_imdb_id_from_text_file(textFile): 141 112 142 113 if os.access(textFile, os.R_OK): … … 834 805 def main(): 835 806 global verbose, overwrite, interactive, recursive, dbimport 836 807 global import_from_files, metafiles, poster_dir, poster_search 837 global aka_language 808 global aka_language, videoExtensions 838 809 839 810 usage = "usage: %prog [options] videopath1 [videopath2 videopath3...]" 840 811 … … 910 881 sys.exit(1) 911 882 poster_dir = mythdb.getSetting("VideoArtworkDir", socket.gethostname()) 912 883 884 if mythdb: 885 # We have acces to the database so we will override the 886 # extensions with the values from the database 887 videoExtensions = [] 888 c = mythdb.cursor() 889 c.execute(""" 890 SELECT extension 891 FROM videotypes 892 WHERE f_ignore = 0""") 893 row = c.fetchone() 894 while row is not None: 895 videoExtensions.append(row[0]) 896 row = c.fetchone() 897 c.close() 913 898 914 899 if prune: 915 900 mythvideo.pruneMetadata()