#44: Adjust relevant article categories
This commit is contained in:
parent
5905095565
commit
70e85d2907
5 changed files with 87 additions and 11 deletions
|
@ -457098,6 +457098,28 @@ PPDD:
|
||||||
store: steam
|
store: steam
|
||||||
steam:
|
steam:
|
||||||
id: 1131680
|
id: 1131680
|
||||||
|
PPSSPP:
|
||||||
|
files:
|
||||||
|
"<base>/memstick/PSP/SAVEDATA":
|
||||||
|
tags:
|
||||||
|
- save
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
"<base>/memstick/PSP/SYSTEM":
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
"<winDocuments>/PPSSPP/PSP/SAVEDATA":
|
||||||
|
tags:
|
||||||
|
- save
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
"<winDocuments>/PPSSPP/PSP/SYSTEM":
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
"PRE:ONE":
|
"PRE:ONE":
|
||||||
installDir:
|
installDir:
|
||||||
PREONE: {}
|
PREONE: {}
|
||||||
|
@ -532547,6 +532569,18 @@ Rysen:
|
||||||
store: steam
|
store: steam
|
||||||
steam:
|
steam:
|
||||||
id: 789280
|
id: 789280
|
||||||
|
Ryujinx:
|
||||||
|
files:
|
||||||
|
"<winAppData>/Ryujinx":
|
||||||
|
tags:
|
||||||
|
- config
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
|
"<winAppData>/Ryujinx/bis/user/save":
|
||||||
|
tags:
|
||||||
|
- save
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
Ryzom:
|
Ryzom:
|
||||||
installDir:
|
installDir:
|
||||||
Ryzom: {}
|
Ryzom: {}
|
||||||
|
@ -722561,6 +722595,13 @@ Visual Out:
|
||||||
store: steam
|
store: steam
|
||||||
steam:
|
steam:
|
||||||
id: 675910
|
id: 675910
|
||||||
|
Vita3K:
|
||||||
|
files:
|
||||||
|
"<winAppData>/Vita3K/Vita3K/ux0/user/00":
|
||||||
|
tags:
|
||||||
|
- save
|
||||||
|
when:
|
||||||
|
- os: windows
|
||||||
Vitamin Girl:
|
Vitamin Girl:
|
||||||
files:
|
files:
|
||||||
"<winLocalAppData>/EndlessRunnerProject/Saved/SaveGames/*.sav":
|
"<winLocalAppData>/EndlessRunnerProject/Saved/SaveGames/*.sav":
|
||||||
|
|
|
@ -7266,6 +7266,7 @@
|
||||||
* [Doritos VR Battle](https://www.pcgamingwiki.com/wiki/?curid=52898)
|
* [Doritos VR Battle](https://www.pcgamingwiki.com/wiki/?curid=52898)
|
||||||
* [Dorke and Ymp](https://www.pcgamingwiki.com/wiki/?curid=51925)
|
* [Dorke and Ymp](https://www.pcgamingwiki.com/wiki/?curid=51925)
|
||||||
* [Dormant World](https://www.pcgamingwiki.com/wiki/?curid=69573)
|
* [Dormant World](https://www.pcgamingwiki.com/wiki/?curid=69573)
|
||||||
|
* [DOSBox](https://www.pcgamingwiki.com/wiki/?curid=1720)
|
||||||
* [Dotori](https://www.pcgamingwiki.com/wiki/?curid=151446)
|
* [Dotori](https://www.pcgamingwiki.com/wiki/?curid=151446)
|
||||||
* [Dots](https://www.pcgamingwiki.com/wiki/?curid=77984)
|
* [Dots](https://www.pcgamingwiki.com/wiki/?curid=77984)
|
||||||
* [Dots eXtreme](https://www.pcgamingwiki.com/wiki/?curid=38917)
|
* [Dots eXtreme](https://www.pcgamingwiki.com/wiki/?curid=38917)
|
||||||
|
@ -7512,6 +7513,7 @@
|
||||||
* [DreamLand](https://www.pcgamingwiki.com/wiki/?curid=42539)
|
* [DreamLand](https://www.pcgamingwiki.com/wiki/?curid=42539)
|
||||||
* [Dreamland Defender](https://www.pcgamingwiki.com/wiki/?curid=81111)
|
* [Dreamland Defender](https://www.pcgamingwiki.com/wiki/?curid=81111)
|
||||||
* [Dreamlike Worlds](https://www.pcgamingwiki.com/wiki/?curid=59011)
|
* [Dreamlike Worlds](https://www.pcgamingwiki.com/wiki/?curid=59011)
|
||||||
|
* [DREAMM](https://www.pcgamingwiki.com/wiki/?curid=189910)
|
||||||
* [DREAMO](https://www.pcgamingwiki.com/wiki/?curid=150588)
|
* [DREAMO](https://www.pcgamingwiki.com/wiki/?curid=150588)
|
||||||
* [DREAMO VR](https://www.pcgamingwiki.com/wiki/?curid=151030)
|
* [DREAMO VR](https://www.pcgamingwiki.com/wiki/?curid=151030)
|
||||||
* [Dreamo VR](https://www.pcgamingwiki.com/wiki/?curid=182471)
|
* [Dreamo VR](https://www.pcgamingwiki.com/wiki/?curid=182471)
|
||||||
|
|
|
@ -47174,6 +47174,8 @@ DOKA 2 KISHKI EDITION:
|
||||||
DOOMTANK:
|
DOOMTANK:
|
||||||
pageId: 136846
|
pageId: 136846
|
||||||
steam: 1087310
|
steam: 1087310
|
||||||
|
DOSBox:
|
||||||
|
pageId: 1720
|
||||||
DOTOKOI / 像素男友:
|
DOTOKOI / 像素男友:
|
||||||
cloud:
|
cloud:
|
||||||
steam: true
|
steam: true
|
||||||
|
@ -47204,6 +47206,15 @@ DRAG:
|
||||||
DREAM GIRLS VR:
|
DREAM GIRLS VR:
|
||||||
pageId: 121955
|
pageId: 121955
|
||||||
steam: 974670
|
steam: 974670
|
||||||
|
DREAMM:
|
||||||
|
pageId: 189910
|
||||||
|
templates:
|
||||||
|
- "{{Game data/config|Windows|C:\\Users\\<username>\\AppData\\Roaming\\Aaron Giles\\DREAMM\\install}}"
|
||||||
|
- "{{Game data/config|OS X|/Users/<username>/Application Support/Aaron Giles/DREAMM/install}}"
|
||||||
|
- "{{Game data/config|Linux|/home/<username>/.local/share/Aaron Giles/DREAMM/install}}"
|
||||||
|
- "{{Game data/saves|Windows|C:\\Users\\<username>\\AppData\\Roaming\\Aaron Giles\\DREAMM\\gamedata}}"
|
||||||
|
- "{{Game data/saves|OS X|/Users/<username>/Application Support/Aaron Giles/DREAMM/gamedata}}"
|
||||||
|
- "{{Game data/saves|Linux|/home/<username>/.local/share/Aaron Giles/DREAMM/gamedata}}"
|
||||||
DREAMO:
|
DREAMO:
|
||||||
pageId: 150588
|
pageId: 150588
|
||||||
renamedFrom:
|
renamedFrom:
|
||||||
|
@ -145045,6 +145056,11 @@ PORN Pizza Delivery Boy:
|
||||||
PPDD:
|
PPDD:
|
||||||
pageId: 144160
|
pageId: 144160
|
||||||
steam: 1131680
|
steam: 1131680
|
||||||
|
PPSSPP:
|
||||||
|
pageId: 88524
|
||||||
|
templates:
|
||||||
|
- "{{Game data/config|Windows|{{p|game}}\\memstick\\PSP\\SYSTEM\\|\n{{p|userprofile\\documents}}\\PPSSPP\\PSP\\SYSTEM\\{{Note|Location when run without elevated privileges.}}}}"
|
||||||
|
- "{{Game data/saves|Windows|{{p|game}}\\memstick\\PSP\\SAVEDATA\\|\n{{p|userprofile\\documents}}\\PPSSPP\\PSP\\SAVEDATA\\{{Note|Location when run without elevated privileges.}}}}"
|
||||||
"PRE:ONE":
|
"PRE:ONE":
|
||||||
pageId: 92127
|
pageId: 92127
|
||||||
steam: 820840
|
steam: 820840
|
||||||
|
@ -168996,6 +169012,11 @@ Rysen:
|
||||||
steam: 789280
|
steam: 789280
|
||||||
Ryu ga Gotoku Online:
|
Ryu ga Gotoku Online:
|
||||||
pageId: 123045
|
pageId: 123045
|
||||||
|
Ryujinx:
|
||||||
|
pageId: 181466
|
||||||
|
templates:
|
||||||
|
- "{{Game data/config|Windows|{{p|appdata}}\\Ryujinx\\}}"
|
||||||
|
- "{{Game data/saves|Windows|{{p|appdata}}\\Ryujinx\\bis\\user\\save}}"
|
||||||
Ryzom:
|
Ryzom:
|
||||||
pageId: 43161
|
pageId: 43161
|
||||||
steam: 373720
|
steam: 373720
|
||||||
|
@ -230039,6 +230060,10 @@ Vistascapes VR:
|
||||||
Visual Out:
|
Visual Out:
|
||||||
pageId: 77341
|
pageId: 77341
|
||||||
steam: 675910
|
steam: 675910
|
||||||
|
Vita3K:
|
||||||
|
pageId: 181469
|
||||||
|
templates:
|
||||||
|
- "{{Game data/saves|Windows|{{p|appdata}}\\Vita3K\\Vita3K\\ux0\\user\\00\\}}"
|
||||||
Vitamin Girl:
|
Vitamin Girl:
|
||||||
pageId: 72832
|
pageId: 72832
|
||||||
steam: 718910
|
steam: 718910
|
||||||
|
|
|
@ -118,7 +118,7 @@ pub async fn run(
|
||||||
wiki_cache.flag_recent_changes(wiki_meta_cache).await?;
|
wiki_cache.flag_recent_changes(wiki_meta_cache).await?;
|
||||||
}
|
}
|
||||||
if missing_pages {
|
if missing_pages {
|
||||||
wiki_cache.add_new_games().await?;
|
wiki_cache.add_new_articles().await?;
|
||||||
}
|
}
|
||||||
wiki_cache.refresh(outdated_only, None, limit, wiki_from).await?;
|
wiki_cache.refresh(outdated_only, None, limit, wiki_from).await?;
|
||||||
|
|
||||||
|
|
28
src/wiki.rs
28
src/wiki.rs
|
@ -12,6 +12,7 @@ use crate::{
|
||||||
};
|
};
|
||||||
|
|
||||||
const SAVE_INTERVAL: u32 = 100;
|
const SAVE_INTERVAL: u32 = 100;
|
||||||
|
const RELEVANT_CATEGORIES: &[&str] = &["Category:Games", "Category:Emulators"];
|
||||||
|
|
||||||
async fn make_client() -> Result<mediawiki::api::Api, Error> {
|
async fn make_client() -> Result<mediawiki::api::Api, Error> {
|
||||||
mediawiki::api::Api::new("https://www.pcgamingwiki.com/w/api.php")
|
mediawiki::api::Api::new("https://www.pcgamingwiki.com/w/api.php")
|
||||||
|
@ -63,7 +64,7 @@ async fn get_page_title(id: u64) -> Result<Option<String>, Error> {
|
||||||
Ok(None)
|
Ok(None)
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn is_game_article(query: &str) -> Result<bool, Error> {
|
async fn is_article_relevant(query: &str) -> Result<bool, Error> {
|
||||||
let wiki = make_client().await?;
|
let wiki = make_client().await?;
|
||||||
let params = wiki.params_into(&[("action", "query"), ("prop", "categories"), ("titles", query)]);
|
let params = wiki.params_into(&[("action", "query"), ("prop", "categories"), ("titles", query)]);
|
||||||
|
|
||||||
|
@ -81,7 +82,7 @@ async fn is_game_article(query: &str) -> Result<bool, Error> {
|
||||||
let category_name = category["title"]
|
let category_name = category["title"]
|
||||||
.as_str()
|
.as_str()
|
||||||
.ok_or(Error::WikiData("query.pages[].categories[].title"))?;
|
.ok_or(Error::WikiData("query.pages[].categories[].title"))?;
|
||||||
if category_name == "Category:Games" {
|
if RELEVANT_CATEGORIES.contains(&category_name) {
|
||||||
return Ok(true);
|
return Ok(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -166,7 +167,7 @@ impl WikiCache {
|
||||||
match old_name {
|
match old_name {
|
||||||
None => {
|
None => {
|
||||||
// Brand new page.
|
// Brand new page.
|
||||||
match is_game_article(&title).await {
|
match is_article_relevant(&title).await {
|
||||||
Ok(true) => {
|
Ok(true) => {
|
||||||
// It's a game, so add it to the cache.
|
// It's a game, so add it to the cache.
|
||||||
println!("[ C] {}", &title);
|
println!("[ C] {}", &title);
|
||||||
|
@ -203,12 +204,19 @@ impl WikiCache {
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn add_new_games(&mut self) -> Result<(), Error> {
|
pub async fn add_new_articles(&mut self) -> Result<(), Error> {
|
||||||
|
for category in RELEVANT_CATEGORIES {
|
||||||
|
self.add_new_category_members(category).await?;
|
||||||
|
}
|
||||||
|
Ok(())
|
||||||
|
}
|
||||||
|
|
||||||
|
async fn add_new_category_members(&mut self, category: &str) -> Result<(), Error> {
|
||||||
let wiki = make_client().await?;
|
let wiki = make_client().await?;
|
||||||
let params = wiki.params_into(&[
|
let params = wiki.params_into(&[
|
||||||
("action", "query"),
|
("action", "query"),
|
||||||
("list", "categorymembers"),
|
("list", "categorymembers"),
|
||||||
("cmtitle", "Category:Games"),
|
("cmtitle", category),
|
||||||
("cmlimit", "500"),
|
("cmlimit", "500"),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
@ -300,7 +308,7 @@ impl WikiCache {
|
||||||
if let Some(new_title) = latest.new_title.take() {
|
if let Some(new_title) = latest.new_title.take() {
|
||||||
println!(" page {} redirected to '{}'", cached.page_id, &new_title);
|
println!(" page {} redirected to '{}'", cached.page_id, &new_title);
|
||||||
|
|
||||||
match is_game_article(&new_title).await {
|
match is_article_relevant(&new_title).await {
|
||||||
Ok(true) => {}
|
Ok(true) => {}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
println!(" page is no longer a game");
|
println!(" page is no longer a game");
|
||||||
|
@ -336,7 +344,7 @@ impl WikiCache {
|
||||||
|
|
||||||
println!(" page {} renamed to '{}'", cached.page_id, &new_title);
|
println!(" page {} renamed to '{}'", cached.page_id, &new_title);
|
||||||
|
|
||||||
match is_game_article(&new_title).await {
|
match is_article_relevant(&new_title).await {
|
||||||
Ok(true) => {}
|
Ok(true) => {}
|
||||||
Ok(false) => {
|
Ok(false) => {
|
||||||
println!(" page is no longer a game");
|
println!(" page is no longer a game");
|
||||||
|
@ -1107,8 +1115,8 @@ mod tests {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn test_is_game_article() {
|
async fn test_is_article_relevant() {
|
||||||
assert!(matches!(is_game_article("Celeste").await, Ok(true)));
|
assert!(matches!(is_article_relevant("Celeste").await, Ok(true)));
|
||||||
assert!(matches!(is_game_article("Template:Path").await, Ok(false)));
|
assert!(matches!(is_article_relevant("Template:Path").await, Ok(false)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue