1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:57:24 +08:00

Merge pull request #24943 from peppy/fix-batch-import-score-missing-notifications

Don't show replay import "missing beatmap" notifications during stable import
This commit is contained in:
Bartłomiej Dach 2023-09-27 18:11:42 +02:00 committed by GitHub
commit 41efee19e7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 9 deletions

View File

@ -280,7 +280,7 @@ namespace osu.Game.Beatmaps
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 @@ namespace osu.Game.Database
try
{
model = CreateModel(archive);
model = CreateModel(archive, parameters);
if (model == null)
return null;
@ -474,8 +474,9 @@ namespace osu.Game.Database
/// 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 @@ namespace osu.Game.Scoring
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 @@ namespace osu.Game.Scoring
{
Logger.Log($@"Score '{archive.Name}' failed to import: no corresponding beatmap with the hash '{notFound.Hash}' could be found.", LoggingTarget.Database);
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 = notFound.Hash });
req.Success += res => PostNotification?.Invoke(new MissingBeatmapNotification(res, archive, notFound.Hash));
api.Queue(req);
}
return null;
}
catch (Exception e)

View File

@ -39,7 +39,7 @@ namespace osu.Game.Skinning
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";