mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-08 20:38:24 +02:00
45 lines
1.1 KiB
C#
45 lines
1.1 KiB
C#
|
using System.IO;
|
|||
|
using MediaBrowser.Controller.Events;
|
|||
|
using MediaBrowser.Model.Entities;
|
|||
|
|
|||
|
namespace MediaBrowser.Controller.Resolvers
|
|||
|
{
|
|||
|
public class AudioResolver : BaseItemResolver<Audio>
|
|||
|
{
|
|||
|
protected override Audio Resolve(ItemResolveEventArgs args)
|
|||
|
{
|
|||
|
if (!args.IsFolder)
|
|||
|
{
|
|||
|
if (IsAudioFile(args.Path))
|
|||
|
{
|
|||
|
return new Audio();
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
return null;
|
|||
|
}
|
|||
|
|
|||
|
private static bool IsAudioFile(string path)
|
|||
|
{
|
|||
|
string extension = Path.GetExtension(path).ToLower();
|
|||
|
|
|||
|
switch (extension)
|
|||
|
{
|
|||
|
case ".mp3":
|
|||
|
case ".wma":
|
|||
|
case ".acc":
|
|||
|
case ".flac":
|
|||
|
case ".m4a":
|
|||
|
case ".m4b":
|
|||
|
case ".wav":
|
|||
|
case ".ape":
|
|||
|
return true;
|
|||
|
|
|||
|
default:
|
|||
|
return false;
|
|||
|
}
|
|||
|
|
|||
|
}
|
|||
|
}
|
|||
|
}
|