def run(argv): """Parse command-line options and start Audiolog.""" parser = OptionParser(usage="audiolog [OPTIONS] [INPUT_DIR]...") parser.add_option("--no-gui", action="store_false", dest="showGUI", default=True, help="run program without GUI (on by default)") parser.add_option("-s", metavar="SORTED_DIR", dest="sortedPath", help="the directory correctly sorted music should be moved to") options, inputPaths = parser.parse_args(argv) configuration.loadConfigFile() if options.sortedPath: configuration.PATHS["SORTED"] = toUnicode(options.sortedPath) if inputPaths: configuration.PATHS["TO_SCAN"] = [toUnicode(path) for path in inputPaths] if options.showGUI: from PyQt4.QtGui import QApplication from gui.MainWindow import MainWindow app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() if inputPaths: mainWindow.start() app.exec_() elif not options.showGUI and inputPaths: logOutputs.append(sys.stdout) traverse.handleIt()
def run(argv): """Parse command-line options and start Audiolog.""" parser = OptionParser(usage="audiolog [OPTIONS] [INPUT_DIR]...") parser.add_option("--no-gui", action="store_false", dest="showGUI", default=True, help="run program without GUI (on by default)") parser.add_option( "-s", metavar="SORTED_DIR", dest="sortedPath", help="the directory correctly sorted music should be moved to") options, inputPaths = parser.parse_args(argv) configuration.loadConfigFile() if options.sortedPath: configuration.PATHS["SORTED"] = toUnicode(options.sortedPath) if inputPaths: configuration.PATHS["TO_SCAN"] = [ toUnicode(path) for path in inputPaths ] if options.showGUI: from PyQt4.QtGui import QApplication from gui.MainWindow import MainWindow app = QApplication(sys.argv) mainWindow = MainWindow() mainWindow.show() if inputPaths: mainWindow.start() app.exec_() elif not options.showGUI and inputPaths: logOutputs.append(sys.stdout) traverse.handleIt()