AudioHandler.cs 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using System;
  2. using MediaBrowser.Common.Net.Handlers;
  3. using MediaBrowser.Controller;
  4. using MediaBrowser.Model.Entities;
  5. namespace MediaBrowser.Api.HttpHandlers
  6. {
  7. public class AudioHandler : StaticFileHandler
  8. {
  9. private BaseItem _LibraryItem;
  10. /// <summary>
  11. /// Gets the library item that will be played, if any
  12. /// </summary>
  13. private BaseItem LibraryItem
  14. {
  15. get
  16. {
  17. if (_LibraryItem == null)
  18. {
  19. string id = QueryString["id"];
  20. if (!string.IsNullOrEmpty(id))
  21. {
  22. _LibraryItem = Kernel.Instance.GetItemById(Guid.Parse(id));
  23. }
  24. }
  25. return _LibraryItem;
  26. }
  27. }
  28. public override string Path
  29. {
  30. get
  31. {
  32. if (LibraryItem != null)
  33. {
  34. return LibraryItem.Path;
  35. }
  36. return base.Path;
  37. }
  38. }
  39. }
  40. }