emby-toolbox/EmbyToolbox/Services/SupportedVideoFormats.cs
Emby Toolbox 6264b487fe Initial commit: Emby Toolbox (conversion scroll fix, bulk Del for tracks).
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-05-12 21:33:47 +05:00

34 lines
1.3 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.IO;
using System.Linq;
namespace EmbyToolbox.Services;
/// <summary>Единый список поддерживаемых расширений видео для очереди, объединения и анализа.</summary>
public static class SupportedVideoFormats
{
private static readonly HashSet<string> Extensions = new(StringComparer.OrdinalIgnoreCase)
{
".mkv", ".mp4", ".avi", ".mov", ".wmv", ".flv", ".ts", ".m2ts", ".webm", ".mpeg", ".mpg", ".m4v",
".3gp", ".ogv", ".vob", ".rmvb", ".asf", ".divx", ".f4v", ".mts", ".m2v", ".mp2", ".mpv", ".qt",
".hevc", ".h265", ".h264",
};
public static bool IsSupportedVideoFile(string path)
{
if (string.IsNullOrWhiteSpace(path))
{
return false;
}
var extension = Path.GetExtension(path);
return !string.IsNullOrWhiteSpace(extension) && Extensions.Contains(extension);
}
/// <summary>Фильтр для OpenFileDialog: только поддерживаемые видео.</summary>
public static string BuildOpenFileDialogFilter()
{
var globs = string.Join(";", Extensions.OrderBy(e => e, StringComparer.Ordinal).Select(e => $"*{e}"));
return $"Видеофайлы|{globs}|Все файлы|*.*";
}
}