KBDownloadFile.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. //
  2. // KBYTDownloadStream.h
  3. // Seas0nPass
  4. //
  5. // Created by Kevin Bradley on 3/9/07.
  6. // Copyright 2007 nito, LLC. All rights reserved.
  7. //
  8. #import <Cocoa/Cocoa.h>
  9. /**
  10. This class is used for downloading files from youtube, it takes care of fixing and multiplexing streams when necessary
  11. feed it a stream into downloadStream method and it will take care of the rest.
  12. */
  13. @protocol KBDownloadFileDelegate
  14. - (void)downloadFinished:(NSString *)downloadFile;
  15. - (void)downloadFailed:(NSString *)downloadFile;
  16. - (void)setDownloadProgress:(double)theProgress;
  17. @end
  18. @interface KBDownloadFile : NSObject <NSURLDownloadDelegate> {
  19. NSURLDownload *urlDownload;
  20. NSURLResponse *myResponse;
  21. float bytesReceived;
  22. NSString *downloadLocation;
  23. long long updateFrequency;
  24. long long freq;
  25. NSString *videoDownloadLocation;
  26. }
  27. @property (strong, atomic) void (^ProgressBlock)(double percentComplete);
  28. @property (strong, atomic) void (^FancyProgressBlock)(double percentComplete, NSString *status);
  29. @property (strong, atomic) void (^CompletedBlock)(NSString *downloadedFile);
  30. typedef void(^DownloadProgressBlock)(double percentComplete);
  31. typedef void(^FancyDownloadProgressBlock)(double percentComplete, NSString *downloadedFile);
  32. typedef void(^DownloadCompletedBlock)(NSString *downloadedFile);
  33. @property (nonatomic, retain) NSString *downloadLocation;
  34. @property (readwrite, assign) NSInteger downloadMode; //0 = muxed file, 1 = demuxed tracks
  35. - (void)downloadFileWithURL:(NSURL *)url
  36. toLocation:(NSString *)dlLocation
  37. progress:(DownloadProgressBlock)progressBlock
  38. completed:(DownloadCompletedBlock)completedBlock;
  39. - (long long)updateFrequency;
  40. - (void)setUpdateFrequency:(long long)newUpdateFrequency;
  41. - (void)setDownloadResponse:(NSURLResponse *)response;
  42. - (void)cancel;
  43. @end