support plex/xbmc theme song convention

pull/702/head
Luke Pulverenti 11 years ago
parent 626143c93c
commit c21c2f8518

@ -798,25 +798,27 @@ namespace MediaBrowser.Controller.Entities
return new List<Audio.Audio>(); return new List<Audio.Audio>();
} }
var files = new List<FileSystemInfo>();
var folder = resolveArgs.GetFileSystemEntryByName(ThemeSongsFolderName); var folder = resolveArgs.GetFileSystemEntryByName(ThemeSongsFolderName);
// Path doesn't exist. No biggie // Path doesn't exist. No biggie
if (folder == null) if (folder != null)
{ {
return new List<Audio.Audio>(); try
{
files.AddRange(new DirectoryInfo(folder.FullName).EnumerateFiles());
}
catch (IOException ex)
{
Logger.ErrorException("Error loading theme songs for {0}", ex, Name);
}
} }
IEnumerable<FileSystemInfo> files; // Support plex/xbmc convention
files.AddRange(resolveArgs.FileSystemChildren
try .Where(i => string.Equals(System.IO.Path.GetFileNameWithoutExtension(i.FullName), "theme", StringComparison.OrdinalIgnoreCase) && EntityResolutionHelper.IsAudioFile(i.FullName))
{ );
files = new DirectoryInfo(folder.FullName).EnumerateFiles();
}
catch (IOException ex)
{
Logger.ErrorException("Error loading theme songs for {0}", ex, Name);
return new List<Audio.Audio>();
}
return LibraryManager.ResolvePaths<Audio.Audio>(files, null).Select(audio => return LibraryManager.ResolvePaths<Audio.Audio>(files, null).Select(audio =>
{ {

Loading…
Cancel
Save