def main(): """Application entry point. """ configure_logging() plugin_manager = create_plugin_manager() config = PiConfigParser("~/.config/pibooth/pibooth.cfg", plugin_manager) counters = Counters(config.join_path("counters.pickle"), taken=0, printed=0, forgotten=0, remaining_duplicates=config.getint( 'PRINTER', 'max_duplicates')) if '--json' in sys.argv: print(json.dumps(counters.data)) elif '--update' in sys.argv: try: print("\nUpdating counters (current value in square bracket):\n") for name in counters: value = input(" -> {:.<18} [{:>4}] : ".format( name.capitalize(), counters[name])) if value.strip(): setattr(counters, name, int(value)) except KeyboardInterrupt: pass print() else: print("\nListing current counters:\n") for name in counters: print(" -> {:.<25} : {:>4}".format(name.capitalize(), counters[name])) print()
def main(): """Application entry point. """ configure_logging() plugin_manager = create_plugin_manager() config = PiConfigParser("~/.config/pibooth/pibooth.cfg", plugin_manager) # Register plugins plugin_manager.load_all_plugins( config.gettuple('GENERAL', 'plugins', 'path'), config.gettuple('GENERAL', 'plugins_disabled', str)) LOGGER.info( "Installed plugins: %s", ", ".join([ plugin_manager.get_friendly_name(p) for p in plugin_manager.list_external_plugins() ])) # Update configuration with plugins ones plugin_manager.hook.pibooth_configure(cfg=config) # Initialize varibales normally done by the app picture_plugin = plugin_manager.get_plugin('pibooth-core:picture') picture_plugin.texts_vars['date'] = datetime.now() picture_plugin.texts_vars['count'] = Counters( config.join_path("counters.pickle"), taken=0, printed=0, forgotten=0, remaining_duplicates=config.getint('PRINTER', 'max_duplicates')) for path in config.gettuple('GENERAL', 'directory', 'path'): regenerate_all_images(plugin_manager, config, path)