FSParsePlaylistRequest.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. /*
  2. * This file is part of the FreeStreamer project,
  3. * (C)Copyright 2011-2013 Matias Muhonen.
  4. * See the file ''LICENSE'' for using the code.
  5. */
  6. #import <Foundation/Foundation.h>
  7. /**
  8. * The playlist format.
  9. */
  10. typedef enum {
  11. kFSPlaylistFormatNone,
  12. kFSPlaylistFormatM3U,
  13. kFSPlaylistFormatPLS
  14. } FSPlaylistFormat;
  15. /**
  16. * FSParsePlaylistRequest is a class for parsing a playlist. It supports
  17. * the M3U and PLS formats.
  18. *
  19. * To use the class, define the URL for retrieving the playlist using
  20. * the url property. Then, define the onCompletion and onFailure handlers.
  21. * To start the request, use the start method.
  22. */
  23. @interface FSParsePlaylistRequest : NSObject<NSURLConnectionDelegate> {
  24. NSString *_url;
  25. NSURLConnection *_connection;
  26. NSInteger _httpStatus;
  27. NSMutableData *_receivedData;
  28. NSMutableArray *_playlistItems;
  29. FSPlaylistFormat _format;
  30. }
  31. /**
  32. * The URL of this request.
  33. */
  34. @property (nonatomic,copy) NSString *url;
  35. /**
  36. * Called when the playlist parsing is completed.
  37. */
  38. @property (copy) void (^onCompletion)();
  39. /**
  40. * Called if the playlist parsing failed.
  41. */
  42. @property (copy) void (^onFailure)();
  43. /**
  44. * The playlist items stored in the FSPlaylistItem class.
  45. */
  46. @property (readonly) NSMutableArray *playlistItems;
  47. /**
  48. * Starts the request.
  49. */
  50. - (void)start;
  51. /**
  52. * Cancels the request.
  53. */
  54. - (void)cancel;
  55. @end