Ejemplo n.º 1
0
def update_game(source, id, force=False, sleep_between_downloads=0):
    if not force:
        game = db.load_game_by_key(source, id, ignore_empty=False)
        if game:
            print 'up-to-date %s/%d...' % (source, int(id))
            return game
    else:
        print 'force',
    print 'updating %s/%d...' % (source, int(id)),
    sys.stdout.flush()

    if sleep_between_downloads:
        print  'sleeping %s sec...' % sleep_between_downloads,
        sys.stdout.flush()
        time.sleep(sleep_between_downloads)

    game = parse_game(source, id)
    if game:
        print 'found:"' + game.name + '"...',
        db.save_game(game)
    else:
        print 'no game found...',
        g = Game()
        g.source = source
        g.id = id
        db.save_game(g)

    print 'OK'
    return game
Ejemplo n.º 2
0
    def parse_game(self, id):
        game = Game()

        game.id = id

        url = self.getGameHomePage(id)
        if not url:
            return None
        parser = self.WebParser.WebParser(url)

        # buy it!
        all_images = "|".join(parser.getImages())
        if "buy" in all_images.lower():
            return None
        if "protected" in all_images.lower():
            return None

        game.home_url = url
        game.source = self.name
        self.parse(game, parser)
        if not game:
            return None

        if not game.name:
            return None
        # example: http://www.abandonia.com/en/games/248/index.html
        if game.name.lower == "download":
            return None

        return game
Ejemplo n.º 3
0
    def parse_game(self, id):
        game = Game()

        game.id = id

        url = self.getGameHomePage(id)
        if not url:
            return None
        parser = self.WebParser.WebParser(url)

        # buy it!
        all_images = '|'.join(parser.getImages())
        if 'buy' in all_images.lower():
            return None
        if 'protected' in all_images.lower():
            return None

        game.home_url = url
        game.source = self.name
        self.parse(game, parser)
        if not game:
            return None

        if not game.name:
            return None
        # example: http://www.abandonia.com/en/games/248/index.html
        if game.name.lower == "download":
            return None

        return game
Ejemplo n.º 4
0
    def parse_game(self, id):
        game = Game()

        game.id = id

        url = self.getGameHomePage(id)
        if not url:
            return None
        parser = self.WebParser.WebParser(url)
        game.home_url = url
        game.source = self.name
        self.parse(game, parser)
        if not game:
            return None

        if not game.name:
            return None
        return game
Ejemplo n.º 5
0
    def parse_game(self, id):
        game = Game()

        game.id = id

        url = self.getGameHomePage(id)
        if not url:
            return None
        parser = self.WebParser.WebParser(url)
        game.home_url = url
        game.source = self.name
        self.parse(game, parser)
        if not game:
            return None

        if not game.name:
            return None
        return game
Ejemplo n.º 6
0
    def parse_game(self, id):
        game = Game()

        game.id = id

        url = self.getGameHomePage(id)
        parser = self.WebParser.WebParser(url)
        game.home_url = url
        game.source = self.name
        self.parse(game, parser)

        if not game:
            return None

        if not game.name:
            return None

        if not game.platform:
            return None

        if game.genre.lower() == ("emulator"):
            return None

        if game.genre.lower() == ("operation system"):
            return None

        if game.genre.lower() == ("music"):
            return None

        if game.genre.lower() == ("utilities"):
            return None

        if game.genre.lower() == ("document"):
            return None

        return game
Ejemplo n.º 7
0
    def parse_game(self, id):
        game = Game()

        game.id = id

        url = self.getGameHomePage(id)
        parser = self.WebParser.WebParser(url)
        game.home_url = url
        game.source = self.name
        self.parse(game, parser)

        if not game:
            return None

        if not game.name:
            return None

        if not game.platform:
            return None

        if (game.genre.lower() == ("emulator")):
            return None

        if (game.genre.lower() == ("operation system")):
            return None

        if (game.genre.lower() == ("music")):
            return None

        if (game.genre.lower() == ("utilities")):
            return None

        if (game.genre.lower() == ("document")):
            return None

        return game
Ejemplo n.º 8
0
    def parse_game(self, id):
        game = Game()

        game.id = id

        url = self.getGameHomePage(id)
        parser = self.WebParser.WebParser(url)
        game.home_url = url
        game.source = self.name
        self.parseLinks(game, parser)

        game.screenshot_url_list = '|'.join(
            self.selectScreenshots(parser.getImages(), id))

        if not game or not game.name or "Banner Exchange" in game.name:
            return None
        if not game.game_file_url:
            log.debug('no file to download for "%s"' % game.name)
            return None

        game.platform = 'c64'
        return game