|
|
@ -1,11 +1,11 @@
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
using MediaBrowser.Controller.Entities;
|
|
|
|
|
|
|
|
using MediaBrowser.Controller.IO;
|
|
|
|
using MediaBrowser.Controller.IO;
|
|
|
|
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
using System;
|
|
|
|
using System;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.IO;
|
|
|
|
using System.IO;
|
|
|
|
using System.Linq;
|
|
|
|
using System.Linq;
|
|
|
|
using MediaBrowser.Controller.Library;
|
|
|
|
using System.Text.RegularExpressions;
|
|
|
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Resolvers
|
|
|
|
namespace MediaBrowser.Controller.Resolvers
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -46,6 +46,8 @@ namespace MediaBrowser.Controller.Resolvers
|
|
|
|
".mts"
|
|
|
|
".mts"
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Dictionary<string, string> VideoFileExtensionsDictionary = VideoFileExtensions.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
private static readonly Regex MultiFileRegex = new Regex(
|
|
|
|
private static readonly Regex MultiFileRegex = new Regex(
|
|
|
|
@"(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck]|d)[ _.-]*[0-9]+)(.*?)(\.[^.]+)$",
|
|
|
|
@"(.*?)([ _.-]*(?:cd|dvd|p(?:ar)?t|dis[ck]|d)[ _.-]*[0-9]+)(.*?)(\.[^.]+)$",
|
|
|
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
|
|
|
RegexOptions.Compiled | RegexOptions.IgnoreCase);
|
|
|
@ -67,7 +69,7 @@ namespace MediaBrowser.Controller.Resolvers
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// The audio file extensions
|
|
|
|
/// The audio file extensions
|
|
|
|
/// </summary>
|
|
|
|
/// </summary>
|
|
|
|
private static readonly string[] AudioFileExtensions = new[] {
|
|
|
|
private static readonly Dictionary<string,string> AudioFileExtensions = new[] {
|
|
|
|
".mp3",
|
|
|
|
".mp3",
|
|
|
|
".flac",
|
|
|
|
".flac",
|
|
|
|
".wma",
|
|
|
|
".wma",
|
|
|
@ -79,7 +81,8 @@ namespace MediaBrowser.Controller.Resolvers
|
|
|
|
".ape",
|
|
|
|
".ape",
|
|
|
|
".ogg",
|
|
|
|
".ogg",
|
|
|
|
".oga"
|
|
|
|
".oga"
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
}.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|
/// Determines whether [is audio file] [the specified args].
|
|
|
|
/// Determines whether [is audio file] [the specified args].
|
|
|
@ -88,7 +91,14 @@ namespace MediaBrowser.Controller.Resolvers
|
|
|
|
/// <returns><c>true</c> if [is audio file] [the specified args]; otherwise, <c>false</c>.</returns>
|
|
|
|
/// <returns><c>true</c> if [is audio file] [the specified args]; otherwise, <c>false</c>.</returns>
|
|
|
|
public static bool IsAudioFile(string path)
|
|
|
|
public static bool IsAudioFile(string path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
return AudioFileExtensions.Contains(Path.GetExtension(path), StringComparer.OrdinalIgnoreCase);
|
|
|
|
var extension = Path.GetExtension(path);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(extension))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return AudioFileExtensions.ContainsKey(extension);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
@ -98,8 +108,14 @@ namespace MediaBrowser.Controller.Resolvers
|
|
|
|
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
|
|
|
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
|
|
|
|
public static bool IsVideoFile(string path)
|
|
|
|
public static bool IsVideoFile(string path)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var extension = Path.GetExtension(path) ?? String.Empty;
|
|
|
|
var extension = Path.GetExtension(path);
|
|
|
|
return VideoFileExtensions.Contains(extension, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
|
|
|
|
|
|
|
if (string.IsNullOrEmpty(extension))
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return VideoFileExtensionsDictionary.ContainsKey(extension);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// <summary>
|
|
|
|