Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
QiuYeHong90 committed Sep 5, 2023
1 parent 6dff1d9 commit 37c39ba
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 0 deletions.
2 changes: 2 additions & 0 deletions KTVHTTPCache/Classes/KTVHCTools/M3U8Tool.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ NS_ASSUME_NONNULL_BEGIN
@interface M3U8Tool : NSObject
+(NSString *)saveM3u8WithUrl: (NSString *)url;
+(void)proxyURLWithOriginalURL: (NSString *)urlStr complete: (void(^)(NSURL * url))complete;

+ (NSError *)deleteAll;
@end

NS_ASSUME_NONNULL_END
14 changes: 14 additions & 0 deletions KTVHTTPCache/Classes/KTVHCTools/M3U8Tool.m
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,20 @@ +(NSString *)getM3u8PathWithUrl: (NSURL *)url {
return filePath;
}

+ (NSError *)deleteAll
{
NSString * path = [self rootDirectory];
if (path.length <= 0) {
return nil;
}
NSError *error = nil;
BOOL isDirectory = NO;
BOOL result = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory];
if (result && isDirectory) {
result = [[NSFileManager defaultManager] removeItemAtPath:path error:&error];
}
return error;
}

+(NSString *)saveM3u8WithUrl: (NSString *)url {

Expand Down
2 changes: 2 additions & 0 deletions KTVHTTPCache/KTVHTTPCache.m
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ + (void)cacheDeleteCacheWithURL:(NSURL *)URL
+ (void)cacheDeleteAllCaches
{
[[KTVHCDataStorage storage] deleteAllCaches];

[M3U8Tool deleteAll];
}

#pragma mark - Encode
Expand Down

0 comments on commit 37c39ba

Please sign in to comment.