jellyfin-server/MediaBrowser.Api/Library/LibraryService.cs

62 lines
1.8 KiB
C#
Raw Normal View History

2013-03-04 05:43:06 +00:00
using MediaBrowser.Common;
2013-02-21 01:33:05 +00:00
using MediaBrowser.Controller.Library;
2013-12-07 15:52:38 +00:00
using ServiceStack;
2013-02-21 01:33:05 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
2013-02-25 03:56:00 +00:00
namespace MediaBrowser.Api.Library
2013-02-21 01:33:05 +00:00
{
/// <summary>
/// Class GetPhyscialPaths
/// </summary>
[Route("/Library/PhysicalPaths", "GET")]
[Api(Description = "Gets a list of physical paths from virtual folders")]
2013-02-21 01:33:05 +00:00
public class GetPhyscialPaths : IReturn<List<string>>
{
}
/// <summary>
/// Class LibraryService
/// </summary>
2013-03-16 05:52:33 +00:00
public class LibraryService : BaseApiService
2013-02-21 01:33:05 +00:00
{
2013-02-24 21:53:54 +00:00
/// <summary>
/// The _app host
/// </summary>
private readonly IApplicationHost _appHost;
private readonly ILibraryManager _libraryManager;
2013-02-24 21:53:54 +00:00
/// <summary>
/// Initializes a new instance of the <see cref="LibraryService" /> class.
/// </summary>
/// <param name="appHost">The app host.</param>
/// <param name="libraryManager">The library manager.</param>
2013-02-24 21:53:54 +00:00
/// <exception cref="System.ArgumentNullException">appHost</exception>
2013-04-22 04:38:03 +00:00
public LibraryService(IApplicationHost appHost, ILibraryManager libraryManager)
2013-02-24 21:53:54 +00:00
{
if (appHost == null)
{
throw new ArgumentNullException("appHost");
}
_appHost = appHost;
_libraryManager = libraryManager;
2013-02-21 01:33:05 +00:00
}
/// <summary>
/// Gets the specified request.
/// </summary>
/// <param name="request">The request.</param>
/// <returns>System.Object.</returns>
public object Get(GetPhyscialPaths request)
{
var result = _libraryManager.RootFolder.Children
2014-02-10 20:11:46 +00:00
.SelectMany(c => c.PhysicalLocations)
.ToList();
2013-02-21 01:33:05 +00:00
return ToOptimizedSerializedResultUsingCache(result);
2013-02-21 01:33:05 +00:00
}
}
}