Implement button to delete all beatmap videos

This commit is contained in:
Noah M
2022-05-18 01:09:58 -05:00
parent 02198d0436
commit 69351d2cdf
5 changed files with 76 additions and 0 deletions

View File

@ -319,6 +319,18 @@ namespace osu.Game.Beatmaps
});
}
public void DeleteVideos(Expression<Func<BeatmapSetInfo, bool>>? filter = null, bool silent = false)
{
realm.Write(r =>
{
var items = r.All<BeatmapSetInfo>().Where(s => !s.DeletePending && !s.Protected);
if (filter != null)
items = items.Where(filter);
beatmapModelManager.DeleteVideos(items.ToList(), silent);
});
}
public void UndeleteAll()
{
realm.Run(r => beatmapModelManager.Undelete(r.All<BeatmapSetInfo>().Where(s => s.DeletePending).ToList()));