def main(): conn, cur = check_and_setup() if len(sys.argv) == 1: # no args, use curdir target_files = None else: target_files = sys.argv[1:] if (target_files is None): # use cwd as target_files files_with_data, files_wo_data = process_dir(u'.', conn, cur) else: files_with_data = [] files_wo_data = [] #target_files should be in cwd #make all target_files non_absolute for i in range(len(target_files)): target_files[i] = unicode(os.path.basename(target_files[i]), 'utf-8') for fil in target_files: if os.path.isdir(fil): f_with, f_wo = process_dir(fil, conn, cur) files_with_data.extend(f_with) files_wo_data.extend(f_wo) else: if is_movie_file(fil): if is_in_db(conn, cur, fil): files_with_data.append(fil) else: files_wo_data.append(fil) print 'files_with_data', files_with_data print 'files_wo_data', files_wo_data #spawn threads if (config.platform == 'windows' and config.config['debug']): app = wx.App(redirect=True) else: app = wx.App(redirect=False) if (not config.config['debug']): wx.Log_SetActiveTarget(wx.LogStderr()) frame = MyFrame(None, conn, cur) check_for_updates(frame) app.SetTopWindow(frame) frame.Maximize() for f in files_with_data: frame.add_row(f) if len(files_wo_data) > 0: start_dbbuilder(frame, files_wo_data) frame.Show() frame.Layout() app.MainLoop()
def setup_db_dir(): try: shutil.rmtree('test') except: pass os.mkdir('test') home_var = 'HOME' if (home_var not in os.environ): home_var = 'USERPROFILE' home_old = os.environ[home_var] os.environ[home_var] = os.path.abspath('./test') conn, cur, mdb_dir = check_and_setup() os.environ[home_var] = home_old return conn, cur, mdb_dir
def setup_db_dir(): try: shutil.rmtree("test") except: pass os.mkdir("test") home_var = "HOME" if home_var not in os.environ: home_var = "USERPROFILE" home_old = os.environ[home_var] os.environ[home_var] = os.path.abspath("./test") conn, cur, mdb_dir = check_and_setup() os.environ[home_var] = home_old return conn, cur, mdb_dir