aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/EnvironmentService.cs
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-06 16:25:03 -0400
committerLuke Pulverenti <luke.pulverenti@gmail.com>2013-09-06 16:25:03 -0400
commit0d599415392d1248c6925134fc0da7fa5049ddc8 (patch)
tree8abd9fcb201d3852c411a8f52c574c599f55c430 /MediaBrowser.Api/EnvironmentService.cs
parente4dfbb6f55ac8583cddae822d68bb35e05e4308c (diff)
restored network browser
Diffstat (limited to 'MediaBrowser.Api/EnvironmentService.cs')
-rw-r--r--MediaBrowser.Api/EnvironmentService.cs35
1 files changed, 35 insertions, 0 deletions
diff --git a/MediaBrowser.Api/EnvironmentService.cs b/MediaBrowser.Api/EnvironmentService.cs
index 985e3c89b..ffc54b6fb 100644
--- a/MediaBrowser.Api/EnvironmentService.cs
+++ b/MediaBrowser.Api/EnvironmentService.cs
@@ -56,6 +56,15 @@ namespace MediaBrowser.Api
}
/// <summary>
+ /// Class GetNetworkComputers
+ /// </summary>
+ [Route("/Environment/NetworkDevices", "GET")]
+ [Api(Description = "Gets a list of devices on the network")]
+ public class GetNetworkDevices : IReturn<List<FileSystemEntryInfo>>
+ {
+ }
+
+ /// <summary>
/// Class EnvironmentService
/// </summary>
public class EnvironmentService : BaseApiService
@@ -139,6 +148,32 @@ namespace MediaBrowser.Api
}
/// <summary>
+ /// Gets the specified request.
+ /// </summary>
+ /// <param name="request">The request.</param>
+ /// <returns>System.Object.</returns>
+ public object Get(GetNetworkDevices request)
+ {
+ var result = GetNetworkDevices().OrderBy(i => i.Path).ToList();
+
+ return ToOptimizedResult(result);
+ }
+
+ /// <summary>
+ /// Gets the network computers.
+ /// </summary>
+ /// <returns>IEnumerable{FileSystemEntryInfo}.</returns>
+ private IEnumerable<FileSystemEntryInfo> GetNetworkDevices()
+ {
+ return _networkManager.GetNetworkDevices().Select(c => new FileSystemEntryInfo
+ {
+ Name = c,
+ Path = NetworkPrefix + c,
+ Type = FileSystemEntryType.NetworkComputer
+ });
+ }
+
+ /// <summary>
/// Gets the name.
/// </summary>
/// <param name="drive">The drive.</param>