jellyfin/MediaBrowser.Dlna/ConnectionManager/ControlHandler.cs

42 lines
1.3 KiB
C#
Raw Normal View History

2014-05-21 00:56:24 +00:00
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.Configuration;
using MediaBrowser.Dlna.Server;
using MediaBrowser.Dlna.Service;
using MediaBrowser.Model.Dlna;
using MediaBrowser.Model.Logging;
2014-06-22 05:52:31 +00:00
using System;
2014-05-21 00:56:24 +00:00
using System.Collections.Generic;
namespace MediaBrowser.Dlna.ConnectionManager
{
public class ControlHandler : BaseControlHandler
{
private readonly DeviceProfile _profile;
public ControlHandler(ILogger logger, DeviceProfile profile, IServerConfigurationManager config)
: base(config, logger)
{
_profile = profile;
}
protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
{
2014-06-22 05:52:31 +00:00
if (string.Equals(methodName, "GetProtocolInfo", StringComparison.OrdinalIgnoreCase))
{
return HandleGetProtocolInfo();
}
2014-05-21 00:56:24 +00:00
throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
}
2014-06-22 05:52:31 +00:00
private IEnumerable<KeyValuePair<string, string>> HandleGetProtocolInfo()
{
return new Headers(true)
{
{ "Source", _profile.ProtocolInfo },
{ "Sink", "" }
};
}
2014-05-21 00:56:24 +00:00
}
}