Filter out secondary IDs that also appear as primary IDs

This commit is contained in:
mtkennerly 2024-05-20 21:03:35 -04:00
parent 6b03d46b67
commit e0d2092c5e
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
3 changed files with 39 additions and 95 deletions

View file

@ -28684,8 +28684,6 @@ Alone in the Dark 2:
gog:
id: 1207660963
id:
gogExtra:
- 1207658923
lutris: alone-in-the-dark-2
steam:
id: 548890
@ -28699,8 +28697,6 @@ Alone in the Dark 3:
gog:
id: 1207660973
id:
gogExtra:
- 1207658923
lutris: alone-in-the-dark-3
steam:
id: 548900
@ -56720,8 +56716,6 @@ Baldr Sky:
gog:
id: 1207658886
id:
gogExtra:
- 1207666353
lutris: baldurs-gate-the-original-saga
"Baldur's Gate 3":
files:
@ -56832,8 +56826,6 @@ Baldr Sky:
gog:
id: 1207658893
id:
gogExtra:
- 1207666373
lutris: baldurs-gate-ii-complete
"Baldur's Gate III":
alias: "Baldur's Gate 3"
@ -120463,7 +120455,6 @@ Cogmind:
id: 1207659633
id:
gogExtra:
- 1207659633
- 1207659643
- 1207659653
- 1207659663
@ -144291,9 +144282,6 @@ DRAG:
- config
when:
- os: windows
id:
steamExtra:
- 773840
installDir:
DRAG: {}
launch:
@ -174908,7 +174896,6 @@ Don Bradman Cricket 17:
- 1739447650
- 1742170347
steamExtra:
- 1335800
- 1606220
installDir:
dont_forget_me: {}
@ -180402,9 +180389,6 @@ Dragon of Legends:
steam:
id: 663530
"Dragon's Prophet":
id:
steamExtra:
- 1380940
steam:
id: 1380940
"Dragon's Wake":
@ -185065,9 +185049,6 @@ DrummingVR:
- save
when:
- os: windows
id:
steamExtra:
- 1039290
installDir:
Drumpf 2 Lost But Not Forgotten: {}
launch:
@ -186347,8 +186328,6 @@ Duke Nukem 3D:
id: 1207658730
id:
lutris: duke-nukem-3d
steamExtra:
- 225140
installDir:
Duke Nukem 3D: {}
launch:
@ -192877,7 +192856,6 @@ EXceed - Gun Bullet Children:
- os: windows
id:
steamExtra:
- 15960
- 59925
installDir:
eXceed - Gun Bullet Children: {}
@ -199131,7 +199109,6 @@ Elven Legacy:
id:
lutris: elven-legacy
steamExtra:
- 25850
- 25880
- 42930
- 42940
@ -215597,7 +215574,6 @@ Fabula Mortis:
id:
steamExtra:
- 1310220
- 2060550
installDir:
Fabular Once upon a Spacetime: {}
launch:
@ -225994,8 +225970,6 @@ Final Doom:
gog:
id: 1435848742
id:
gogExtra:
- 1440161275
lutris: final-doom
installDir:
Final Doom: {}
@ -265960,7 +265934,6 @@ Gremlins vs Automatons:
- 1615869028
- 1964148149
steamExtra:
- 369990
- 458160
- 459850
- 459851
@ -296346,7 +296319,6 @@ House Flipper:
steamExtra:
- 825570
- 942290
- 1021110
- 1126050
- 1460920
- 1569190
@ -304165,8 +304137,6 @@ Icewind Dale:
gog:
id: 1207658888
id:
gogExtra:
- 1207666683
lutris: icewind-dale-1-complete
Icewind Dale II:
files:
@ -319174,7 +319144,6 @@ Jagged Alliance 2:
steamExtra:
- 2950
- 12370
- 12380
- 545210
steam:
id: 1620
@ -319192,9 +319161,6 @@ Jagged Alliance 2:
- os: windows
gog:
id: 1207658653
id:
steamExtra:
- 1620
installDir:
Jagged Alliance 2 Gold Unfinished Business: {}
launch:
@ -320331,8 +320297,6 @@ Jazz Jackrabbit 2:
gog:
id: 1917711239
id:
gogExtra:
- 1917711239
lutris: jazz-jackrabbit-2
"Jazz Lightning : Castle Dungeons":
installDir:
@ -346833,8 +346797,6 @@ Leisure Suit Larry - Wet Dreams Dry Twice:
gog:
id: 1207662073
id:
gogExtra:
- 1207659158
lutris: leisure-suit-larry-5-passionate-patti-does-a-littl
installDir:
Larry Suit Larry 5 Passionate Patti Does a Little Undercover Work: {}
@ -346889,8 +346851,6 @@ Leisure Suit Larry Goes Looking for Love (in Several Wrong Places):
gog:
id: 1207662053
id:
gogExtra:
- 1207659158
lutris: leisure-suit-larry-2-looking-for-love-in-several-w
installDir:
Leisure Suit Larry 2 Looking For Love (In Several Wrong Places): {}
@ -346917,8 +346877,6 @@ Leisure Suit Larry Goes Looking for Love (in Several Wrong Places):
gog:
id: 1207662063
id:
gogExtra:
- 1207659158
lutris: leisure-suit-larry-3-passionate-patti-in-pursuit-o
installDir:
Leisure Suit Larry 3 Passionate Patti in Pursuit of the Pulsating Pectorals: {}
@ -348615,9 +348573,6 @@ Level 22:
- os: windows
gog:
id: 1454602861
id:
steamExtra:
- 293300
installDir:
Level22: {}
launch:
@ -353370,7 +353325,6 @@ Little Nightmares:
gogExtra:
- 1185734803
- 1352220891
- 1433377508
- 1675156362
- 1863057712
- 1866912153
@ -356572,8 +356526,6 @@ Lords of the Realm II:
gog:
id: 1207663263
id:
gogExtra:
- 1207658780
lutris: lords-of-the-realm-ii
installDir:
Lords of the Realm II: {}
@ -410863,8 +410815,6 @@ Neighbours Back from Hell:
id: 2053240278
id:
lutris: neighbours-back-from-hell
steamExtra:
- 1283190
installDir:
Neighbours back From Hell: {}
launch:
@ -410903,8 +410853,6 @@ Neighbours from Hell:
gogExtra:
- 1207658765
lutris: neighbours-from-hell
steamExtra:
- 1283190
installDir:
Neighbours from Hell: {}
launch:
@ -442512,9 +442460,6 @@ Papercraft:
when:
- os: windows
store: steam
id:
steamExtra:
- 905660
installDir:
PaperWar: {}
launch:
@ -466102,9 +466047,6 @@ Prison Planet:
steam:
id: 1148410
Prison Princess:
id:
steamExtra:
- 1151740
installDir:
Prison Princess: {}
launch:
@ -494918,8 +494860,6 @@ Return to Castle Wolfenstein:
gogExtra:
- 1441704976
lutris: return-to-castle-wolfenstein
steamExtra:
- 1379630
installDir:
Return to Castle Wolfenstein: {}
launch:
@ -503539,9 +503479,6 @@ Rocket League:
steam:
id: 252950
Rocket Mania:
id:
steamExtra:
- 1949810
installDir:
RocketMania: {}
launch:
@ -504858,7 +504795,6 @@ Rogue Trooper Redux:
gogExtra:
- 1360356045
- 1639809483
- 2076502816
steamExtra:
- 710410
installDir:
@ -528659,7 +528595,6 @@ Shadow Warrior (2013):
id: 1207659573
id:
gogExtra:
- 1429878383
- 1430392753
lutris: shadow-warrior
installDir:
@ -549744,9 +549679,6 @@ Softened Cookie:
Softporn Adventure:
gog:
id: 1207662103
id:
gogExtra:
- 1207659158
Software Inc.:
files:
"<base>/Saves":
@ -560551,8 +560483,6 @@ Spear of Destiny:
gog:
id: 1441705126
id:
gogExtra:
- 1441705226
lutris: wolfenstein-3d-spear-of-destiny
steamExtra:
- 9000
@ -582947,8 +582877,6 @@ Sudden Strike 2:
gog:
id: 1421964930
id:
gogExtra:
- 1421964930
lutris: sudden-strike-2-gold
installDir:
Sudden Strike 2 Gold: {}
@ -635608,7 +635536,6 @@ The Outer Worlds:
- 1393110
- 1393111
- 1425450
- 1920490
installDir:
TheOuterWorlds: {}
steam:
@ -637873,9 +637800,6 @@ The Raven Remastered:
- os: linux
gog:
id: 1749614448
id:
gogExtra:
- 1749614448
installDir:
The Raven Remastered: {}
launch:
@ -641626,7 +641550,6 @@ The Sinking City:
id: 1134504983
id:
gogExtra:
- 1134504983
- 1281247417
- 1705130517
- 1801191124
@ -660381,7 +660304,6 @@ Torimodosu:
- 1563444452
- 1700870503
- 1832019184
- 1958306970
lutris: torment-tides-of-numenera
steamExtra:
- 342210
@ -665397,7 +665319,6 @@ Train Simulator:
- 277747
- 277748
- 277749
- 277751
- 277752
- 277753
- 277754
@ -675404,9 +675325,6 @@ Two Worlds II Castle Defense:
- os: windows
gog:
id: 1207661843
id:
gogExtra:
- 1207659214
installDir:
Two Worlds II Castle Defense: {}
launch:
@ -683890,9 +683808,6 @@ Urban Empire:
store: steam
gog:
id: 1936881415
id:
gogExtra:
- 1936881415
installDir:
Urban Empire: {}
launch:
@ -693087,8 +693002,6 @@ Viscera Cleanup Detail:
gog:
id: 1429878383
id:
gogExtra:
- 1207659573
lutris: viscera-cleanup-detail-shadow-warrior
installDir:
Viscera Cleanup Detail Shadow Warrior: {}
@ -710587,7 +710500,6 @@ Wildlife Park:
id:
steamExtra:
- 337970
- 664120
installDir:
Wildlife Park: {}
launch:
@ -724482,7 +724394,6 @@ Yooka-Laylee:
id:
gogExtra:
- 1354053863
- 1445853962
steamExtra:
- 426750
installDir:

View file

@ -4,7 +4,7 @@ use crate::{
path,
resource::ResourceFile,
steam::{self, SteamCache, SteamCacheEntry},
wiki::{PathKind, WikiCache, WikiCacheEntry},
wiki::{PathKind, PrimaryIds, WikiCache, WikiCacheEntry},
Error,
};
@ -153,13 +153,15 @@ impl Manifest {
) -> Result<(), Error> {
self.0.clear();
let primary_ids = wiki_cache.primary_ids();
for (title, info) in &wiki_cache.0 {
if overrides.0.get(title).map(|x| x.omit).unwrap_or(false) {
continue;
}
let mut game = Game::default();
game.integrate_wiki(info, title);
game.integrate_wiki(info, title, &primary_ids);
for rename in &info.renamed_from {
if rename.to_lowercase() == title.to_lowercase() || self.0.contains_key(rename) {
continue;
@ -213,14 +215,24 @@ pub struct Game {
}
impl Game {
pub fn integrate_wiki(&mut self, cache: &WikiCacheEntry, title: &str) {
pub fn integrate_wiki(&mut self, cache: &WikiCacheEntry, title: &str, primary_ids: &PrimaryIds) {
self.steam = SteamMetadata { id: cache.steam };
self.gog = GogMetadata { id: cache.gog };
self.id = IdMetadata {
flatpak: None,
gog_extra: cache.gog_side.clone(),
gog_extra: cache
.gog_side
.iter()
.filter(|x| !primary_ids.gog.contains(x))
.copied()
.collect(),
lutris: cache.lutris.clone(),
steam_extra: cache.steam_side.clone(),
steam_extra: cache
.steam_side
.iter()
.filter(|x| !primary_ids.steam.contains(x))
.copied()
.collect(),
};
let paths = cache.parse_paths(title.to_string());

View file

@ -1,4 +1,4 @@
use std::collections::{BTreeMap, BTreeSet, HashMap};
use std::collections::{BTreeMap, BTreeSet, HashMap, HashSet};
use once_cell::sync::Lazy;
use regex::Regex;
@ -92,6 +92,12 @@ async fn is_game_article(query: &str) -> Result<bool, Error> {
Ok(false)
}
#[derive(Debug, Default, Clone, PartialEq, Eq)]
pub struct PrimaryIds {
pub steam: HashSet<u32>,
pub gog: HashSet<u64>,
}
impl WikiCache {
pub async fn flag_recent_changes(&mut self, meta: &mut WikiMetaCache) -> Result<(), Error> {
struct RecentChange {
@ -379,6 +385,21 @@ impl WikiCache {
Ok(())
}
pub fn primary_ids(&self) -> PrimaryIds {
let mut out = PrimaryIds::default();
for info in self.0.values() {
if let Some(id) = info.steam {
out.steam.insert(id);
}
if let Some(id) = info.gog {
out.gog.insert(id);
}
}
out
}
}
#[derive(Debug, Default, Clone, serde::Serialize, serde::Deserialize)]