2019-01-13 19:54:44 +00:00
|
|
|
using System;
|
2018-09-12 17:26:21 +00:00
|
|
|
using System.IO;
|
|
|
|
using Emby.Naming.Common;
|
2021-06-19 16:02:33 +00:00
|
|
|
using Jellyfin.Extensions;
|
2018-09-12 17:26:21 +00:00
|
|
|
|
|
|
|
namespace Emby.Naming.Audio
|
|
|
|
{
|
2020-11-10 16:11:48 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Static helper class to determine if file at path is audio file.
|
|
|
|
/// </summary>
|
2020-02-19 20:56:35 +00:00
|
|
|
public static class AudioFileParser
|
2018-09-12 17:26:21 +00:00
|
|
|
{
|
2020-11-10 16:11:48 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Static helper method to determine if file at path is audio file.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="path">Path to file.</param>
|
|
|
|
/// <param name="options"><see cref="NamingOptions"/> containing AudioFileExtensions.</param>
|
|
|
|
/// <returns>True if file at path is audio file.</returns>
|
2020-02-19 20:56:35 +00:00
|
|
|
public static bool IsAudioFile(string path, NamingOptions options)
|
2018-09-12 17:26:21 +00:00
|
|
|
{
|
2021-05-16 12:49:11 +00:00
|
|
|
var extension = Path.GetExtension(path.AsSpan());
|
|
|
|
return options.AudioFileExtensions.Contains(extension, StringComparison.OrdinalIgnoreCase);
|
2018-09-12 17:26:21 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|