Don't show replay import "missing beatmap" notifications during stable import

Closes https://github.com/ppy/osu/issues/24926.
This commit is contained in:
Dean Herbert 2023-09-27 17:02:47 +09:00
parent 0a208a5a47
commit 2481c0b64b
4 changed files with 14 additions and 9 deletions

View File

@ -280,7 +280,7 @@ protected override void UndeleteForReuse(BeatmapSetInfo existing)
public override string HumanisedModelName => "beatmap";
protected override BeatmapSetInfo? CreateModel(ArchiveReader reader)
protected override BeatmapSetInfo? CreateModel(ArchiveReader reader, ImportParameters parameters)
{
// let's make sure there are actually .osu files to import.
string? mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu", StringComparison.OrdinalIgnoreCase));

View File

@ -229,7 +229,7 @@ await Task.WhenAll(tasks.Select(async task =>
try
{
model = CreateModel(archive);
model = CreateModel(archive, parameters);
if (model == null)
return null;
@ -474,8 +474,9 @@ private List<RealmNamedFileUsage> createFileInfos(ArchiveReader reader, RealmFil
/// Actual expensive population should be done in <see cref="Populate"/>; this should just prepare for duplicate checking.
/// </summary>
/// <param name="archive">The archive to create the model for.</param>
/// <param name="parameters">Parameters to further configure the import process.</param>
/// <returns>A model populated with minimal information. Returning a null will abort importing silently.</returns>
protected abstract TModel? CreateModel(ArchiveReader archive);
protected abstract TModel? CreateModel(ArchiveReader archive, ImportParameters parameters);
/// <summary>
/// Populate the provided model completely from the given archive.

View File

@ -42,7 +42,7 @@ public ScoreImporter(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Stora
this.api = api;
}
protected override ScoreInfo? CreateModel(ArchiveReader archive)
protected override ScoreInfo? CreateModel(ArchiveReader archive, ImportParameters parameters)
{
string name = archive.Filenames.First(f => f.EndsWith(".osr", StringComparison.OrdinalIgnoreCase));
@ -56,10 +56,14 @@ public ScoreImporter(RulesetStore rulesets, Func<BeatmapManager> beatmaps, Stora
{
Logger.Log($@"Score '{archive.Name}' failed to import: no corresponding beatmap with the hash '{e.Hash}' could be found.", LoggingTarget.Database);
// In the case of a missing beatmap, let's attempt to resolve it and show a prompt to the user to download the required beatmap.
var req = new GetBeatmapRequest(new BeatmapInfo { MD5Hash = e.Hash });
req.Success += res => PostNotification?.Invoke(new MissingBeatmapNotification(res, archive, e.Hash));
api.Queue(req);
if (!parameters.Batch)
{
// In the case of a missing beatmap, let's attempt to resolve it and show a prompt to the user to download the required beatmap.
var req = new GetBeatmapRequest(new BeatmapInfo { MD5Hash = e.Hash });
req.Success += res => PostNotification?.Invoke(new MissingBeatmapNotification(res, archive, e.Hash));
api.Queue(req);
}
return null;
}
}

View File

@ -39,7 +39,7 @@ public SkinImporter(Storage storage, RealmAccess realm, IStorageResourceProvider
protected override bool ShouldDeleteArchive(string path) => Path.GetExtension(path).ToLowerInvariant() == @".osk";
protected override SkinInfo CreateModel(ArchiveReader archive) => new SkinInfo { Name = archive.Name ?? @"No name" };
protected override SkinInfo? CreateModel(ArchiveReader archive, ImportParameters parameters) => new SkinInfo { Name = archive.Name ?? @"No name" };
private const string unknown_creator_string = @"Unknown";