mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 08:12:55 +08:00
compare metdata and remove duplicate from beatmap to prevent redundant storage
This commit is contained in:
parent
0df5432f5e
commit
e3a230320a
@ -515,6 +515,10 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
if (existing == null)
|
if (existing == null)
|
||||||
{
|
{
|
||||||
|
// Exclude beatmap-metadata if it's equal to beatmapset-metadata
|
||||||
|
if (metadata.Equals(beatmap.Metadata))
|
||||||
|
beatmap.BeatmapInfo.Metadata = null;
|
||||||
|
|
||||||
RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID);
|
RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID);
|
||||||
|
|
||||||
// TODO: this should be done in a better place once we actually need to dynamically update it.
|
// TODO: this should be done in a better place once we actually need to dynamically update it.
|
||||||
|
@ -66,5 +66,23 @@ namespace osu.Game.Beatmaps
|
|||||||
Source,
|
Source,
|
||||||
Tags
|
Tags
|
||||||
}.Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
}.Where(s => !string.IsNullOrEmpty(s)).ToArray();
|
||||||
|
|
||||||
|
public override bool Equals(object other)
|
||||||
|
{
|
||||||
|
var otherMetadata = other as BeatmapMetadata;
|
||||||
|
if (otherMetadata == null) return false;
|
||||||
|
|
||||||
|
return (onlineBeatmapSetID?.Equals(otherMetadata.onlineBeatmapSetID) ?? false)
|
||||||
|
&& (Title?.Equals(otherMetadata.Title) ?? false)
|
||||||
|
&& (TitleUnicode?.Equals(otherMetadata.TitleUnicode) ?? false)
|
||||||
|
&& (Artist?.Equals(otherMetadata.Artist) ?? false)
|
||||||
|
&& (ArtistUnicode?.Equals(otherMetadata.ArtistUnicode) ?? false)
|
||||||
|
&& (AuthorString?.Equals(otherMetadata.AuthorString) ?? false)
|
||||||
|
&& (Source?.Equals(otherMetadata.Source) ?? false)
|
||||||
|
&& (Tags?.Equals(otherMetadata.Tags) ?? false)
|
||||||
|
&& PreviewTime.Equals(otherMetadata.PreviewTime)
|
||||||
|
&& (AudioFile?.Equals(otherMetadata.AudioFile) ?? false)
|
||||||
|
&& (BackgroundFile?.Equals(otherMetadata.BackgroundFile) ?? false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user