1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 14:53:21 +08:00

Centralise video file extensions

This commit is contained in:
Dean Herbert 2022-06-06 20:11:43 +09:00
parent cb383d4bdc
commit da000ee5f0
2 changed files with 7 additions and 8 deletions

View File

@ -34,7 +34,7 @@ namespace osu.Game.Beatmaps
protected override string[] HashableFileTypes => new[] { ".osu" }; protected override string[] HashableFileTypes => new[] { ".osu" };
private static readonly string[] video_extensions = { ".mp4", ".mov", ".avi", ".flv" }; public static readonly string[] VIDEO_EXTENSIONS = { ".mp4", ".mov", ".avi", ".flv" };
public BeatmapModelManager(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null) public BeatmapModelManager(RealmAccess realm, Storage storage, BeatmapOnlineLookupQueue? onlineLookupQueue = null)
: base(realm, storage, onlineLookupQueue) : base(realm, storage, onlineLookupQueue)
@ -146,7 +146,7 @@ namespace osu.Game.Beatmaps
notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})"; notification.Text = $"Deleting videos from {HumanisedModelName}s ({++i} of {items.Count})";
var video = b.Files.FirstOrDefault(f => video_extensions.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal))); var video = b.Files.FirstOrDefault(f => VIDEO_EXTENSIONS.Any(ex => f.Filename.EndsWith(ex, StringComparison.Ordinal)));
if (video != null) if (video != null)
DeleteFile(b, video); DeleteFile(b, video);

View File

@ -2,11 +2,13 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.IO; using System.IO;
using System.Linq;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Sprites; using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Beatmaps;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
@ -65,6 +67,9 @@ namespace osu.Game.Graphics.UserInterfaceV2
{ {
get get
{ {
if (BeatmapModelManager.VIDEO_EXTENSIONS.Contains(File.Extension))
return FontAwesome.Regular.FileVideo;
switch (File.Extension) switch (File.Extension)
{ {
case @".ogg": case @".ogg":
@ -77,12 +82,6 @@ namespace osu.Game.Graphics.UserInterfaceV2
case @".png": case @".png":
return FontAwesome.Regular.FileImage; return FontAwesome.Regular.FileImage;
case @".mp4":
case @".avi":
case @".mov":
case @".flv":
return FontAwesome.Regular.FileVideo;
default: default:
return FontAwesome.Regular.File; return FontAwesome.Regular.File;
} }