Exemplo n.º 1
0
Arquivo: startup.py Projeto: ndim/miro
def on_frontend_started():
    """Perform startup actions that should happen after the frontend is
    already up and running.

    This function happens using an idle iterator.  Before/after code that
    could take a while to run, we yield to other eventloop callbacks.
    """
    conversions.conversion_manager.startup()
    item.setup_metadata_manager()

    item.setup_change_tracker()
    app.sharing_tracker = sharing.SharingTracker()
    app.sharing_manager.startup()
    app.sharing_tracker.start_tracking()

    app.device_manager = devices.DeviceManager()
    app.device_tracker = devicetracker.DeviceTracker()
    app.device_tracker.start_tracking()

    reconnect_downloaders()
    guide.download_guides()
    feed.remove_orphaned_feed_impls()

    app.download_state_manager = downloader.DownloadStateManager()
    app.download_state_manager.init_controller()
    itemsource.setup_handlers()
    if app.frontend_name == 'widgets':
        app.donate_manager = donate.DonateManager()
    else:
        logging.warn("frontend is %s, not starting DonateManager()",
                     app.frontend_name)

    logging.info("Starting auto downloader...")
    autodler.start_downloader()
    app.icon_cache_updater.start_updates()
    yield None
    feed.expire_items()
    yield None
    commandline.startup()
    yield None
    autoupdate.check_for_updates()
    yield None
    app.local_metadata_manager.schedule_retry_net_lookup()
    # Delay running high CPU/IO operations for a bit
    eventloop.add_timeout(5, app.download_state_manager.startup_downloader,
            "start downloader daemon")
    eventloop.add_timeout(10, workerprocess.startup,
            "start worker process")
    eventloop.add_timeout(20, item.start_deleted_checker,
            "start checking deleted items")
    eventloop.add_timeout(30, feed.start_updates, "start feed updates")
    eventloop.add_timeout(60, item.update_incomplete_metadata,
            "update metadata data")
    eventloop.add_timeout(90, clear_icon_cache_orphans, "clear orphans")
Exemplo n.º 2
0
 def reload_database(self, path=':memory:', upgrade=True, **kwargs):
     self.shutdown_database()
     self.setup_new_database(path, **kwargs)
     if upgrade:
         if self.allow_db_upgrade_error_dialog:
             # this means that exceptions in the upgrade will be sent to a
             # dialog box.  Be careful with this, if you don't handle the
             # dialog, then the unit tests will hang.
             app.db.upgrade_database(context='main')
         else:
             # normal case: use _upgrade_database() because we want
             # exceptions to keep propagating
             app.db._upgrade_database(context='main')
     item.setup_change_tracker()
     database.initialize()
Exemplo n.º 3
0
 def reload_database(self, path=':memory:', upgrade=True, **kwargs):
     self.shutdown_database()
     self.setup_new_database(path, **kwargs)
     if upgrade:
         if self.allow_db_upgrade_error_dialog:
             # this means that exceptions in the upgrade will be sent to a
             # dialog box.  Be careful with this, if you don't handle the
             # dialog, then the unit tests will hang.
             app.db.upgrade_database(context='main')
         else:
             # normal case: use _upgrade_database() because we want
             # exceptions to keep propagating
             app.db._upgrade_database(context='main')
     item.setup_change_tracker()
     database.initialize()
Exemplo n.º 4
0
    app.startup_timer.log_time("after db upgrade")

    app.icon_cache_updater = iconcache.IconCacheUpdater()
    setup_global_feeds()
    # call fix_database_inconsistencies() ASAP after the manual feed is set up
    fix_database_inconsistencies()
    logging.info("setup tabs...")
    setup_tabs()
    logging.info("setup theme...")
    setup_theme()
    install_message_handler()

    app.sharing_manager = sharing.SharingManager()
    app.download_state_manager = downloader.DownloadStateManager()
    item.setup_change_tracker()
    item.setup_metadata_manager()

    _startup_checker.run_checks()

def fix_database_inconsistencies():
    item.fix_non_container_parents()
    item.move_orphaned_items()
    playlist.fix_missing_item_ids()
    folder.fix_playlist_missing_item_ids()

class StartupChecker(object):
    """Handles various checks at startup.

    This class handles the first-time startup check and the movies directory
    gone check.