Expand description
The PlayOnBSD database is a human readable database listing commercial games that can be played on OpenBSD. Currently, each game is represented by 17 lines (one for each field), in the following order:
- Game: string, leading “A “ or “The “ treated specially for alphabetic ordering
- Cover: path to cover art image file (
.png,.jpg) - Engine: string of valid engine entry
- Setup: string (package, command, text)
- Runtime: string; should correspond to an executable in packages
- Store: strings of URLs, whitespace-separated
- Hints: string
- Genre: strings, comma-separated
- Tags: strings, comma-separated
- Year: integer (release year)
- Dev: string (developer), comma-separated
- Pub: string (publisher), comma-separated
- Version: version number/string
- Status: numerical status with date when tested on -current in parentheses (doesn’t apply to upstream bugs that have nothing to do with the OpenBSD platform); note highest numerical description reached applies
- 0 = doesn’t run
- 1 = game launches (not enough information to comment meaningfully on status beyond launching the game)
- 2 = major bugs: potentially game-breaking, making finishing the game impossible or a chore; noticeably degrading the enjoyment compared to running the game on other platforms
- 3 = medium-impact bugs: noticeable, but not game-breaking
- 4 = minor bugs: barely noticeable, or not relevant to core game
- 5 = completable: game can be played through until the credits roll, without major bugs (category 2); doesn’t (necessarily) include optional side content, DLC, optional multiplayer, achievements etc.
- 6 = 100%: the complete game including optional content like DLC, side quests, multiplayer can be enjoyed
- Added: date (ISO 8601 format) when the entry was added (EPOCH when the information is not available)
- Updated: date (ISO 8601 format) when the entry was last updated
- IgdbId: id of the game in the IGDB database
The libpobsd provide a Parser to parse the PlayOnBSD database and a GameDataBase to
query the PlayOnBSD database. The result of a GameDataBase query are returned as a QueryResult
of Item or Game depending on the nature of the query. Game collections can also
be filtered using a GameFilter.
§Examples
Loading the games listed in the PlayOnBSD database in a vector:
use libpobsd::{Parser, ParserResult, Game};
let games: Vec<Game> = match Parser::default()
.load_from_file("openbsd-games.db")
.expect("Failed to load database") {
ParserResult::WithoutError(games) => games,
ParserResult::WithError(games, _) => games,
};Loading the games listed in the PlayOnBSD database
into the GameDataBase without dealing with parsing
errors if any:
use libpobsd::{Parser, ParserResult, GameDataBase, Game};
let games: Vec<Game> = match Parser::default()
.load_from_file("openbsd-games.db")
.expect("Failed to load database") {
ParserResult::WithoutError(games) => games,
ParserResult::WithError(games, _) => games,
};
let db = GameDataBase::new(games);Perform a non case sensitive search of games by name using
the GameDataBase, the query result being return in a form
of a QueryResult:
let db = GameDataBase::new(games);
let st = SearchType::CaseSensitive;
let games: QueryResult<&Game> = db.search_games_by_name("Barrow", &st);Filter a query result (represented by the QueryResult struct)
by year:
let db = GameDataBase::new(games);
let st = SearchType::CaseSensitive;
let games = db.search_games_by_name("Barrow", &st);
let games = games.filter_games_by_year("2018", &st);List the games of a query result:
let db = GameDataBase::new(games);
let st = SearchType::CaseSensitive;
let games = db.search_games_by_name("Barrow", &st);
for game in games.into_inner() {
println!("Game: {}", game.name);
}More examples are available in each module documentation.
Re-exports§
pub use crate::db::game_filer::GameFilter;pub use crate::db::GameDataBase;pub use crate::db::Item;pub use crate::db::QueryResult;pub use crate::db::SearchType;pub use crate::models::Game;pub use crate::models::GameStatus;pub use crate::models::Status;pub use crate::models::Store;pub use crate::models::StoreLink;pub use crate::models::StoreLinks;pub use crate::parsing::Parser;pub use crate::parsing::ParserResult;pub use crate::parsing::ParsingMode;
Modules§
- db
- Povides a
GameDataBase,GameFilterand aQueryResultstructs, each struct providing a set of methods to interrogate the PlayOnBSD database in a friendly manner, without having to deal with a SQL database. - models
- Provides a set of structs representing the PlayOnBSD database items.
- parsing
- Provides a simplistic
Parserthat converts the PlayOnBSD Database (either provided as a string or as a file) into a vector ofGames.