Beispiel #1
0
def open_locker_uri(uri):
    sha1 = uri[9:]
    assert len(sha1) == 40
    context = SynchronizerContext()
    url = "{0}/api/locker/{1}".format(openretro_url_prefix(), sha1)
    path = Downloader.cache_file_from_url(url,
                                          auth=(context.username,
                                                context.password))
    return path
Beispiel #2
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)
Beispiel #3
0
def open_locker_uri(uri, opener_cache_dict=None):
    sha1 = uri[9:]
    assert len(sha1) == 40
    context = SynchronizerContext()
    opener = opener_for_url_prefix(openretro_url_prefix(),
                                   username=context.username,
                                   password=context.password,
                                   cache_dict=opener_cache_dict)
    url = "{0}/api/locker/{1}".format(openretro_url_prefix(), sha1)
    path = Downloader.cache_file_from_url(url, opener=opener)
    return path
Beispiel #4
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()
Beispiel #5
0
    def _run(self, database):
        context = SynchronizerContext()

        paths = [FSGSDirectories.downloads_dir()]
        scanner = FileScanner(paths,
                              purge_other_dirs=False,
                              on_status=self.on_status,
                              stop_check=self.stop_check)
        scanner.scan()

        scanner = GameScanner(context,
                              None,
                              on_status=self.on_status,
                              stop_check=self.stop_check)
        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()