using MediaBrowser.Common;
using MediaBrowser.Controller.Library;
using ServiceStack;
using System;
using System.Collections.Generic;
using System.Linq;
namespace MediaBrowser.Api.Library
{
///
/// Class GetPhyscialPaths
///
[Route("/Library/PhysicalPaths", "GET")]
[Api(Description = "Gets a list of physical paths from virtual folders")]
public class GetPhyscialPaths : IReturn>
{
}
///
/// Class LibraryService
///
public class LibraryService : BaseApiService
{
///
/// The _app host
///
private readonly IApplicationHost _appHost;
private readonly ILibraryManager _libraryManager;
///
/// Initializes a new instance of the class.
///
/// The app host.
/// The library manager.
/// appHost
public LibraryService(IApplicationHost appHost, ILibraryManager libraryManager)
{
if (appHost == null)
{
throw new ArgumentNullException("appHost");
}
_appHost = appHost;
_libraryManager = libraryManager;
}
///
/// Gets the specified request.
///
/// The request.
/// System.Object.
public object Get(GetPhyscialPaths request)
{
var result = _libraryManager.RootFolder.Children
.SelectMany(c => c.PhysicalLocations)
.ToList();
return ToOptimizedSerializedResultUsingCache(result);
}
}
}