示例#1
0
def write_sources(sources):
    db_sources = read_sources()
    for uri in db_sources:
        if uri not in sources:
            sql.db_delete(PGA_DB, "sources", 'uri', uri)
    for uri in sources:
        if uri not in db_sources:
            sql.db_insert(PGA_DB, "sources", {'uri': uri})
示例#2
0
def write_sources(sources):
    db_sources = read_sources()
    for uri in db_sources:
        if uri not in sources:
            sql.db_delete(PGA_DB, "sources", 'uri', uri)
    for uri in sources:
        if uri not in db_sources:
            sql.db_insert(PGA_DB, "sources", {'uri': uri})
示例#3
0
文件: pga.py 项目: aoighost/lutris
def add_game(name, runner=None, slug=None, directory=None):
    """Adds a game to the PGA database."""
    if not slug:
        slug = slugify(name)
    game_data = {'name': name, 'slug': slug, 'runner': runner}
    if directory:
        game_data['directory'] = directory
    print game_data
    sql.db_insert(PGA_DB, "games", game_data)
示例#4
0
 def test_can_create_table(self):
     fields = [
         {'name': 'id', 'type': 'INTEGER', 'indexed': True},
         {'name': 'name', 'type': 'TEXT'}
     ]
     pga.create_table('testing', fields)
     sql.db_insert(TEST_PGA_PATH, 'testing', {'name': "testok"})
     results = sql.db_select(TEST_PGA_PATH, 'testing',
                             fields=['id', 'name'])
     self.assertEqual(results[0]['name'], "testok")
示例#5
0
def add_game(name, **game_data):
    """Add a game to the PGA database."""
    game_data['name'] = name
    if 'slug' not in game_data:
        game_data['slug'] = slugify(name)
    inserted_id = sql.db_insert(PGA_DB, "games", game_data)
    return inserted_id
示例#6
0
def add_game(name, **game_data):
    """Add a game to the PGA database."""
    game_data["name"] = name
    game_data["installed_at"] = int(time.time())
    if "slug" not in game_data:
        game_data["slug"] = slugify(name)
    return sql.db_insert(PGA_DB, "games", game_data)
示例#7
0
def add_game(name, **game_data):
    """Add a game to the PGA database."""
    game_data['name'] = name
    game_data['installed_at'] = int(time.time())
    if 'slug' not in game_data:
        game_data['slug'] = slugify(name)
    return sql.db_insert(PGA_DB, "games", game_data)
示例#8
0
def add_games_bulk(games):
    """
        Add a list of games to the PGA database.
        The dicts must have an identical set of keys.

        Args:
            games (list): list of games in dict format
        Returns:
            list: List of inserted game ids
    """
    return [sql.db_insert(PGA_DB, "games", game) for game in games]
示例#9
0
文件: pga.py 项目: Ryochan7/lutris
def add_games_bulk(games):
    """
        Add a list of games to the PGA database.
        The dicts must have an identical set of keys.

        Args:
            games (list): list of games in dict format
        Returns:
            list: List of inserted game ids
    """
    return [sql.db_insert(PGA_DB, "games", game) for game in games]
示例#10
0
def add_games_bulk(games):
    """Add a list of games to the PGA database.

    The dicts must have an identical set of keys.

    :type games: list of dicts
    """
    inserted_ids = []
    for game in games:
        inserted_id = sql.db_insert(PGA_DB, "games", game)
        inserted_ids.append(inserted_id)
    return inserted_ids
示例#11
0
def add_source(uri):
    sql.db_insert(PGA_DB, "sources", {"uri": uri})
示例#12
0
def add_game(name, **game_data):
    """Adds a game to the PGA database."""
    game_data['name'] = name
    if not 'slug' in game_data:
        game_data['slug'] = slugify(name)
    sql.db_insert(PGA_DB, "games", game_data)
示例#13
0
def add_source(uri):
    sql.db_insert(PGA_DB, "sources", {"uri": uri})
示例#14
0
文件: pga.py 项目: wberrier/lutris
def add_game_to_category(game_id, category_id):
    """Add a category to a game"""
    return sql.db_insert(PGA_DB, "games_categories", {
        "game_id": game_id,
        "category_id": category_id
    })
示例#15
0
文件: pga.py 项目: wberrier/lutris
def add_category(category_name):
    """Add a category to the database"""
    return sql.db_insert(PGA_DB, "categories", {"name": category_name})