Start tracking cloud support for games

This commit is contained in:
mtkennerly 2024-05-31 23:36:47 -04:00
parent 5a8369af1e
commit adf4da57c6
No known key found for this signature in database
GPG key ID: E764BE00BE6E6408
8 changed files with 2027 additions and 31 deletions

View file

@ -198,6 +198,8 @@ impl Manifest {
pub struct Game {
#[serde(skip_serializing_if = "Option::is_none")]
pub alias: Option<String>,
#[serde(skip_serializing_if = "CloudMetadata::is_empty")]
pub cloud: CloudMetadata,
#[serde(skip_serializing_if = "BTreeMap::is_empty")]
pub files: BTreeMap<String, GameFileEntry>,
#[serde(skip_serializing_if = "GogMetadata::is_empty")]
@ -234,6 +236,13 @@ impl Game {
.copied()
.collect(),
};
self.cloud = CloudMetadata {
epic: cache.cloud.epic,
gog: cache.cloud.gog,
origin: cache.cloud.origin,
steam: cache.cloud.steam,
uplay: cache.cloud.uplay,
};
let paths = cache.parse_paths(title.to_string());
for path in paths {
@ -574,6 +583,35 @@ impl IdMetadata {
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct CloudMetadata {
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub epic: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub gog: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub origin: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub steam: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub uplay: bool,
}
impl CloudMetadata {
pub fn is_empty(&self) -> bool {
let Self {
epic,
gog,
origin,
steam,
uplay,
} = self;
!epic && !gog && !origin && !steam && !uplay
}
}
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct ManifestOverride(pub BTreeMap<String, OverrideGame>);

View file

@ -407,6 +407,8 @@ impl WikiCache {
pub struct WikiCacheEntry {
#[serde(skip_serializing_if = "State::is_handled")]
pub state: State,
#[serde(skip_serializing_if = "CloudMetadata::is_empty")]
pub cloud: CloudMetadata,
#[serde(skip_serializing_if = "Option::is_none")]
pub gog: Option<u64>,
#[serde(skip_serializing_if = "BTreeSet::is_empty")]
@ -535,6 +537,34 @@ impl WikiCacheEntry {
}
}
}
"save game cloud syncing" => {
for attribute in attributes {
match attribute.name.as_deref() {
Some("discord") => {
out.cloud.discord = attribute.value.to_string() == "true";
}
Some("epic games launcher" | "epic games store") => {
out.cloud.epic = attribute.value.to_string() == "true";
}
Some("gog galaxy") => {
out.cloud.gog = attribute.value.to_string() == "true";
}
Some("ea desktop" | "origin") => {
out.cloud.origin = attribute.value.to_string() == "true";
}
Some("steam cloud") => {
out.cloud.steam = attribute.value.to_string() == "true";
}
Some("ubisoft connect" | "uplay") => {
out.cloud.uplay = attribute.value.to_string() == "true";
}
Some("xbox cloud") => {
out.cloud.xbox = attribute.value.to_string() == "true";
}
_ => {}
}
}
}
_ => {}
}
}
@ -1022,6 +1052,41 @@ static MAPPED_PATHS: Lazy<HashMap<&'static str, MappedPath>> = Lazy::new(|| {
])
});
#[derive(Clone, Debug, Default, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
#[serde(default, rename_all = "camelCase")]
pub struct CloudMetadata {
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub discord: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub epic: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub gog: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub origin: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub steam: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub uplay: bool,
#[serde(skip_serializing_if = "std::ops::Not::not")]
pub xbox: bool,
}
impl CloudMetadata {
pub fn is_empty(&self) -> bool {
let Self {
discord,
epic,
gog,
origin,
steam,
uplay,
xbox,
} = self;
!discord && !epic && !gog && !origin && !steam && !uplay && !xbox
}
}
#[derive(Debug, Default, serde::Serialize, serde::Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct WikiMetaCache {