mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 14:12:54 +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)
|
||||
{
|
||||
// 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);
|
||||
|
||||
// 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,
|
||||
Tags
|
||||
}.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