Esempio n. 1
0
    def _scan_thread(cls, database):
        if cls.scan_for_files:
            scanner = FileScanner(
                cls.paths,
                cls.purge_other_dirs,
                on_status=cls.on_status,
                stop_check=cls.stop_check,
            )
            scanner.scan()
            if cls.stop_check():
                return

        # if cls.scan_for_configs or
        # if cls.update_game_database:
        scanner = ConfigurationScanner(cls.paths,
                                       on_status=cls.on_status,
                                       stop_check=cls.stop_check)
        scanner.scan(database)

        if cls.update_game_database:

            context = SynchronizerContext()

            synchronizer = MetaSynchronizer(context,
                                            on_status=cls.on_status,
                                            stop_check=cls.stop_check)
            synchronizer.synchronize()

            synchronizer = GameRatingSynchronizer(
                context,
                database,
                on_status=cls.on_status,
                stop_check=cls.stop_check,
            )
            synchronizer.username = "******"
            synchronizer.password = LauncherSettings.get("database_auth")
            synchronizer.synchronize()

            synchronizer = ListsSynchronizer(context,
                                             on_status=cls.on_status,
                                             stop_check=cls.stop_check)
            synchronizer.synchronize()

            scanner = GameScanner(
                context,
                cls.paths,
                on_status=cls.on_status,
                stop_check=cls.stop_check,
            )
            scanner.update_game_database()

        scanner = GameScanner(None,
                              cls.paths,
                              on_status=cls.on_status,
                              stop_check=cls.stop_check)
        scanner.scan(database)
Esempio n. 2
0
    def _run(self, database):
        # FIXME, dependency on fs_uae_launcher
        # from fs_uae_launcher.Scanner import Scanner
        # Scanner.start([], scan_for_files=False, update_game_database=True)
        from fsgs.ogd.game_rating_synchronizer \
            import GameRatingSynchronizer
        from launcher.game_scanner import GameScanner

        context = SynchronizerContext()

        synchronizer = MetaSynchronizer(context,
                                        on_status=self.on_status,
                                        stop_check=self.stop_check)
        synchronizer.synchronize()

        synchronizer = GameRatingSynchronizer(context,
                                              database,
                                              on_status=self.on_status,
                                              stop_check=self.stop_check)
        synchronizer.username = "******"
        synchronizer.password = app.settings["database_auth"]
        synchronizer.synchronize()

        synchronizer = ListsSynchronizer(context,
                                         on_status=self.on_status,
                                         stop_check=self.stop_check)
        synchronizer.synchronize()

        scanner = GameScanner(context,
                              None,
                              on_status=self.on_status,
                              stop_check=self.stop_check)
        scanner.update_game_database()
        scanner.scan(database)

        # FIXME: review what signals should be sent when a scan is performed
        # FIXME: these should be removed soon
        app.settings["last_scan"] = str(time.time())
        app.settings["config_refresh"] = str(time.time())
        # this must be called from main, since callbacks are broadcast
        # when settings are changed
        Signal("scan_done").notify()