ControlHandler.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. using MediaBrowser.Common.Extensions;
  2. using MediaBrowser.Controller.Configuration;
  3. using Emby.Dlna.Server;
  4. using Emby.Dlna.Service;
  5. using MediaBrowser.Model.Dlna;
  6. using MediaBrowser.Model.Logging;
  7. using System;
  8. using System.Collections.Generic;
  9. namespace Emby.Dlna.ConnectionManager
  10. {
  11. public class ControlHandler : BaseControlHandler
  12. {
  13. private readonly DeviceProfile _profile;
  14. public ControlHandler(ILogger logger, DeviceProfile profile, IServerConfigurationManager config)
  15. : base(config, logger)
  16. {
  17. _profile = profile;
  18. }
  19. protected override IEnumerable<KeyValuePair<string, string>> GetResult(string methodName, Headers methodParams)
  20. {
  21. if (string.Equals(methodName, "GetProtocolInfo", StringComparison.OrdinalIgnoreCase))
  22. {
  23. return HandleGetProtocolInfo();
  24. }
  25. throw new ResourceNotFoundException("Unexpected control request name: " + methodName);
  26. }
  27. private IEnumerable<KeyValuePair<string, string>> HandleGetProtocolInfo()
  28. {
  29. return new Headers(true)
  30. {
  31. { "Source", _profile.ProtocolInfo },
  32. { "Sink", "" }
  33. };
  34. }
  35. }
  36. }