First commit for ChapterDB support.
This commit is contained in:
1 parent
fd2a6118df
commit
be1a335591
24 files changed
+1394
-230
No files matched your search
@@ -7,6 +7,7 @@
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SBMetadataHelper.h"
|
||||
|
||||
@class MP42Metadata;
|
||||
|
||||
@@ -17,17 +18,6 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
BOOL _isCancelled;
|
||||
}
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SBCachePolicy) {
|
||||
SBDefaultPolicy,
|
||||
SBReturnCacheElseLoad,
|
||||
SBReloadIgnoringLocalCacheData,
|
||||
};
|
||||
|
||||
#pragma mark Helper routines
|
||||
+ (NSDictionary<NSString *, NSString *> *)parseFilename:(NSString *)filename;
|
||||
+ (NSString *)urlEncoded:(NSString *)string;
|
||||
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy;
|
||||
|
||||
#pragma mark Class methods
|
||||
+ (NSArray<NSString *> *) movieProviders;
|
||||
+ (NSArray<NSString *> *) tvProviders;
|
||||
|
||||
@@ -13,13 +13,10 @@
|
||||
|
||||
#import "SBMetadataSearchController.h"
|
||||
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
#import "iTunesStore.h"
|
||||
#import "TheMovieDB3.h"
|
||||
#import "TheTVDB.h"
|
||||
|
||||
|
||||
@interface MetadataImporter ()
|
||||
|
||||
@property (atomic, readwrite) BOOL isCancelled;
|
||||
@@ -30,190 +27,6 @@
|
||||
|
||||
@synthesize isCancelled = _isCancelled;
|
||||
|
||||
#pragma mark Helper routines
|
||||
|
||||
+ (NSDictionary<NSString *, NSString *> *)parseFilename:(NSString *)filename
|
||||
{
|
||||
NSParameterAssert(filename);
|
||||
|
||||
NSMutableDictionary<NSString *, NSString *> *results = nil;
|
||||
|
||||
// Try with the usual anime filename
|
||||
__block NSDictionary<NSString *, NSString *> *resultDictionary = nil;
|
||||
|
||||
NSString *pattern = @"^\\[(.+)\\](?:(?:\\s|_)+)?([^()]+)(?:(?:\\s|_)+)(?:(?:-\\s|-_|Ep)+)([0-9]+)";
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern
|
||||
options:NSRegularExpressionCaseInsensitive
|
||||
error:nil];
|
||||
|
||||
[regex enumerateMatchesInString:filename
|
||||
options:0
|
||||
range:NSMakeRange(0, filename.length)
|
||||
usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop) {
|
||||
|
||||
resultDictionary = @{ @"fanSubGroup": [filename substringWithRange:[match rangeAtIndex:1]],
|
||||
@"seriesName": [filename substringWithRange:[match rangeAtIndex:2]],
|
||||
@"episodeNumber": [filename substringWithRange:[match rangeAtIndex:3]] };
|
||||
|
||||
}];
|
||||
|
||||
if (resultDictionary.count) {
|
||||
results = [[NSMutableDictionary alloc] init];
|
||||
NSString *seriesName = [resultDictionary[@"seriesName"] stringByReplacingOccurrencesOfString:@"_" withString:@" "];
|
||||
NSInteger episodeNumber = [resultDictionary[@"episodeNumber"] integerValue];
|
||||
|
||||
results[@"type"] = @"tv";
|
||||
results[@"seriesName"] = seriesName;
|
||||
results[@"seasonNum"] = @"1";
|
||||
results[@"episodeNum"] = [NSString stringWithFormat:@"%ld", (long)episodeNumber];
|
||||
|
||||
return [results autorelease];
|
||||
}
|
||||
|
||||
// Else use the ParseFilename perl script
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
[task setLaunchPath:@"/usr/bin/perl"];
|
||||
|
||||
NSMutableArray<NSString *> *args = [[NSMutableArray alloc] initWithCapacity:3];
|
||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"ParseFilename" ofType:@""];
|
||||
[args addObject:[NSString stringWithFormat:@"-I%@/lib", path]];
|
||||
[args addObject:[NSString stringWithFormat:@"%@/ParseFilename.pl", path]];
|
||||
[args addObject:filename];
|
||||
[task setArguments:args];
|
||||
|
||||
NSPipe *stdOut = [[NSPipe alloc] init];
|
||||
NSFileHandle *stdOutWrite = [stdOut fileHandleForWriting];
|
||||
[task setStandardOutput:stdOutWrite];
|
||||
|
||||
[task launch];
|
||||
[task waitUntilExit];
|
||||
[stdOutWrite closeFile];
|
||||
|
||||
NSData *outputData = [[stdOut fileHandleForReading] readDataToEndOfFile];
|
||||
NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];
|
||||
NSArray<NSString *> *lines = [outputString componentsSeparatedByString:@"\n"];
|
||||
|
||||
if (lines.count) {
|
||||
|
||||
if ([lines.firstObject isEqualToString:@"tv"]) {
|
||||
|
||||
if (lines.count >= 4) {
|
||||
|
||||
results = [[NSMutableDictionary alloc] initWithCapacity:4];
|
||||
results[@"type"] = @"tv";
|
||||
|
||||
NSString *newSeriesName=[lines[1] stringByReplacingOccurrencesOfString:@"."
|
||||
withString:@" "];
|
||||
results[@"seriesName"] = newSeriesName;
|
||||
|
||||
if ([lines[2] integerValue]) {
|
||||
results[@"seasonNum"] = lines[2];
|
||||
}
|
||||
else {
|
||||
results[@"seasonNum"] = @"0";
|
||||
}
|
||||
|
||||
results[@"episodeNum"] = lines[3];
|
||||
}
|
||||
}
|
||||
else if ([lines.firstObject isEqualToString:@"movie"]) {
|
||||
|
||||
if (lines.count >= 2) {
|
||||
|
||||
results = [[NSMutableDictionary alloc] initWithCapacity:2];
|
||||
results[@"type"] = @"movie";
|
||||
|
||||
NSString *newTitle=[lines[1] stringByReplacingOccurrencesOfString:@"."
|
||||
withString:@" "];
|
||||
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@"(" withString:@" "];
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@")" withString:@" "];
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@"[" withString:@" "];
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@"]" withString:@" "];
|
||||
newTitle = [newTitle stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
||||
results[@"title"] = newTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[outputString release];
|
||||
[stdOut release];
|
||||
[args release];
|
||||
[task release];
|
||||
|
||||
return [results autorelease];
|
||||
}
|
||||
|
||||
+ (NSString *)urlEncoded:(NSString *)string {
|
||||
string = [string precomposedStringWithCompatibilityMapping];
|
||||
CFStringRef urlString = CFURLCreateStringByAddingPercentEscapes(
|
||||
NULL,
|
||||
(CFStringRef) string,
|
||||
NULL,
|
||||
(CFStringRef) @"!*'\"();:@&=+$,/?%#[]% ",
|
||||
kCFStringEncodingUTF8);
|
||||
return [(NSString *)urlString autorelease];
|
||||
}
|
||||
|
||||
+ (NSString *)md5String:(NSString *)s {
|
||||
const char *cStr = s.UTF8String;
|
||||
unsigned char result[CC_MD5_DIGEST_LENGTH];
|
||||
CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
|
||||
NSMutableString *r = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
|
||||
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; ++i) {
|
||||
[r appendFormat:@"%02x", result[i]];
|
||||
}
|
||||
return [NSString stringWithString:r];
|
||||
}
|
||||
|
||||
+ (NSString *)sha256String:(NSString *)s {
|
||||
const char *cStr = s.UTF8String;
|
||||
unsigned char result[CC_SHA256_DIGEST_LENGTH];
|
||||
CC_SHA256(cStr, (CC_LONG)strlen(cStr), result);
|
||||
NSMutableString *r = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2];
|
||||
for (int i = 0; i < CC_SHA256_DIGEST_LENGTH; ++i) {
|
||||
[r appendFormat:@"%02x", result[i]];
|
||||
}
|
||||
return [NSString stringWithString:r];
|
||||
}
|
||||
|
||||
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy error:(NSError **)error {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
|
||||
NSURL *cacheURL = [[[fileManager URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask]
|
||||
firstObject] URLByAppendingPathComponent:bundleName];
|
||||
|
||||
|
||||
NSURL *fileURL = [cacheURL URLByAppendingPathComponent:[MetadataImporter sha256String:url.absoluteString]];
|
||||
fileURL = [fileURL URLByAppendingPathExtension:url.pathExtension];
|
||||
|
||||
if (policy != SBReloadIgnoringLocalCacheData) {
|
||||
NSDictionary<NSString *, id> *attrs = [fileURL resourceValuesForKeys:@[NSURLCreationDateKey] error:NULL];
|
||||
NSDate *creationDate = attrs[NSURLCreationDateKey];
|
||||
|
||||
if (creationDate) {
|
||||
NSTimeInterval oldness = creationDate.timeIntervalSinceNow;
|
||||
|
||||
// if less than 2 hours old or jpg
|
||||
if ([url.pathExtension caseInsensitiveCompare:@"jpg"] == NSOrderedSame ||
|
||||
(oldness > -60 * 60 * 2) ||
|
||||
policy == SBReturnCacheElseLoad) {
|
||||
return [NSData dataWithContentsOfURL:fileURL options:0 error:error];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NSData *downloadedData = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached error:error];
|
||||
[downloadedData writeToURL:fileURL atomically:YES];
|
||||
|
||||
return downloadedData;
|
||||
}
|
||||
|
||||
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy {
|
||||
return [MetadataImporter downloadDataFromURL:url withCachePolicy:policy error:NULL];
|
||||
}
|
||||
|
||||
#pragma mark Class methods
|
||||
|
||||
+ (NSArray<NSString *> *)movieProviders {
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// SBChapterDB.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 25/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SBChapterImporter.h"
|
||||
|
||||
@interface SBChapterDB : SBChapterImporter
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,141 @@
|
||||
//
|
||||
// SBChapterDB.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 25/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBChapterDB.h"
|
||||
#import "SBChapterResult.h"
|
||||
|
||||
#import <MP42Foundation/MP42ChapterTrack.h>
|
||||
|
||||
#define API_KEY @"ETET7TXFJH45YNYW0I4A"
|
||||
|
||||
@implementation SBChapterDB
|
||||
|
||||
- (NSArray<SBChapterResult *> *)searchTitle:(NSString *)aTitle duration:(NSUInteger)duration
|
||||
{
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.chapterdb.org/chapters/search?title=%@", [SBMetadataHelper urlEncoded:aTitle]]];
|
||||
|
||||
NSDictionary *headerOptions = @{@"ApiKey" : API_KEY};
|
||||
NSData *xmlData = xmlData = [SBMetadataHelper dataFromUrl:url withHTTPMethod:@"GET" headerOptions:headerOptions error:nil];
|
||||
|
||||
NSXMLDocument *xml = [[NSXMLDocument alloc] initWithData:xmlData
|
||||
options:0
|
||||
error:nil];
|
||||
|
||||
NSMutableArray<SBChapterResult *> *resultsArray = [[[NSMutableArray alloc] init] autorelease];
|
||||
|
||||
if (xml) {
|
||||
NSArray<NSXMLNode *> *children = [xml nodesForXPath:@"//*:chapterInfo" error:nil];
|
||||
|
||||
for (NSXMLNode *child in children) {
|
||||
SBChapterResult *result = [self parseResult:child];
|
||||
if (result) {
|
||||
[resultsArray addObject:result];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[xml release];
|
||||
|
||||
if (duration > 0) {
|
||||
NSArray<SBChapterResult *> *filteredArray = [self filterArray:resultsArray byDuration:duration delta:10000];
|
||||
if (filteredArray.count) {
|
||||
return filteredArray;
|
||||
}
|
||||
}
|
||||
|
||||
return resultsArray;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the results by the duration plus/minus a delta time
|
||||
*
|
||||
* @param array the array of SBChapterResult
|
||||
* @param duration the movie duration
|
||||
* @param delta the delta in ms
|
||||
*
|
||||
* @return the filtered array.
|
||||
*/
|
||||
- (NSArray<SBChapterResult *> *)filterArray:(NSArray *)array byDuration:(NSUInteger)duration delta:(NSUInteger)delta
|
||||
{
|
||||
NSMutableArray<SBChapterResult *> *filteredArray = [NSMutableArray array];
|
||||
|
||||
for (SBChapterResult *result in array) {
|
||||
if (result.duration < (duration + delta) && result.duration > (duration - delta)) {
|
||||
[filteredArray addObject:result];
|
||||
}
|
||||
}
|
||||
|
||||
return filteredArray;
|
||||
}
|
||||
|
||||
#pragma mark - Result convertion
|
||||
|
||||
- (NSString *)titleForNode:(NSXMLNode *)node
|
||||
{
|
||||
NSArray<NSXMLNode *> *tag = [node nodesForXPath:@"./*:title" error:NULL];
|
||||
return tag.firstObject.stringValue;
|
||||
}
|
||||
|
||||
- (NSUInteger)confirmationsForNode:(NSXMLNode *)node
|
||||
{
|
||||
NSArray<NSXMLNode *> *tag = [node nodesForXPath:@"./@confirmations" error:NULL];
|
||||
return tag.firstObject.stringValue.integerValue;
|
||||
}
|
||||
|
||||
- (NSUInteger)durationForNode:(NSXMLNode *)node
|
||||
{
|
||||
NSArray<NSXMLNode *> *tag = [node nodesForXPath:@"./*:source/*:duration" error:NULL];
|
||||
NSString *durationString = tag.firstObject.stringValue;
|
||||
if (durationString) {
|
||||
return ParseSubTime(durationString.UTF8String, 1000, NO);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
- (SBChapterResult *)parseResult:(NSXMLNode *)child
|
||||
{
|
||||
NSMutableArray<MP42TextSample *> *chapters = [NSMutableArray array];
|
||||
|
||||
NSString *title = [self titleForNode:child];
|
||||
NSUInteger confirmations = [self confirmationsForNode:child];
|
||||
NSUInteger duration = [self durationForNode:child];
|
||||
|
||||
NSArray<NSXMLNode *> *times = [child nodesForXPath:@"./*:chapters/*:chapter/@time" error:NULL];
|
||||
NSArray<NSXMLNode *> *names = [child nodesForXPath:@"./*:chapters/*:chapter/@name" error:NULL];
|
||||
|
||||
if (times && names) {
|
||||
|
||||
for (NSInteger i = 0; i < times.count && i < names.count; i++) {
|
||||
|
||||
NSString *name = names[i].stringValue;
|
||||
NSString *timestamp = times[i].stringValue;
|
||||
|
||||
if (name && timestamp) {
|
||||
unsigned time = ParseSubTime(timestamp.UTF8String, 1000, NO);
|
||||
|
||||
MP42TextSample *chapter = [[MP42TextSample alloc] init];
|
||||
chapter.title = name;
|
||||
chapter.timestamp = time;
|
||||
|
||||
[chapters addObject:chapter];
|
||||
[chapter release];
|
||||
}
|
||||
}
|
||||
|
||||
SBChapterResult *result = [[SBChapterResult alloc] initWithTitle:title
|
||||
duration:duration
|
||||
confirmations:confirmations
|
||||
chapters:chapters];
|
||||
|
||||
return [result autorelease];
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,33 @@
|
||||
//
|
||||
// SBChapterImporter.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Michael Hueber on 21.11.15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "SBMetadataHelper.h"
|
||||
|
||||
@class SBChapterResult;
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SBChapterImporter : NSObject {
|
||||
@private
|
||||
BOOL _isCancelled;
|
||||
}
|
||||
|
||||
+ (NSString *)defaultProvider;
|
||||
|
||||
+ (instancetype)importerForProvider:(NSString *)aProviderName;
|
||||
- (void) searchTitle:(NSString *)title duration:(NSUInteger)duration completionHandler:(void(^)(NSArray<SBChapterResult *> * _Nullable results))handler;
|
||||
- (void) cancel;
|
||||
|
||||
#pragma mark Methods to be overridden
|
||||
|
||||
- (NSArray<SBChapterResult *> *)searchTitle:(NSString *)title duration:(NSUInteger)duration;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,61 @@
|
||||
//
|
||||
// SBChapterImporter.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Michael Hueber on 21.11.15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBChapterImporter.h"
|
||||
#import <MP42Foundation/MP42ChapterTrack.h>
|
||||
|
||||
#import "SBChapterDB.h"
|
||||
|
||||
@interface SBChapterImporter ()
|
||||
|
||||
@property (atomic, readwrite) BOOL isCancelled;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBChapterImporter
|
||||
|
||||
@synthesize isCancelled = _isCancelled;
|
||||
|
||||
+ (NSString *)defaultProvider
|
||||
{
|
||||
return @"ChapterDB";
|
||||
}
|
||||
|
||||
+ (instancetype)importerForProvider:(NSString *)aProvider
|
||||
{
|
||||
if ([aProvider isEqualToString:@"ChapterDB"]) {
|
||||
return [[[SBChapterDB alloc] init] autorelease];
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)searchTitle:(NSString *)title duration:(NSUInteger)duration completionHandler:(void(^)(NSArray<SBChapterResult *> * _Nullable results))handler
|
||||
{
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
NSArray *results = [self searchTitle:title duration:duration];
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
if (!self.isCancelled) {
|
||||
handler(results);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
- (void)cancel
|
||||
{
|
||||
self.isCancelled = YES;
|
||||
}
|
||||
|
||||
- (NSArray<SBChapterResult *> *)searchTitle:(NSString *)title duration:(NSUInteger)duration
|
||||
{
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException
|
||||
reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]
|
||||
userInfo:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,34 @@
|
||||
//
|
||||
// SBChapterResult.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 25/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class MP42TextSample;
|
||||
|
||||
@interface SBChapterResult : NSObject {
|
||||
@private
|
||||
NSString *_title;
|
||||
NSUInteger _duration;
|
||||
NSUInteger _confirmations;
|
||||
|
||||
NSArray<MP42TextSample *> *_chapters;
|
||||
}
|
||||
|
||||
- (instancetype)initWithTitle:(NSString *)title duration:(NSUInteger)duration confirmations:(NSUInteger)confirmations chapters:(NSArray<MP42TextSample *> *)chapters;
|
||||
|
||||
@property (nonatomic, readonly) NSString *title;
|
||||
@property (nonatomic, readonly) NSUInteger duration;
|
||||
@property (nonatomic, readonly) NSUInteger confirmations;
|
||||
|
||||
@property (nonatomic, readonly) NSArray<MP42TextSample *> *chapters;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
// SBChapterResult.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 25/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBChapterResult.h"
|
||||
|
||||
@implementation SBChapterResult
|
||||
|
||||
@synthesize title = _title;
|
||||
@synthesize duration = _duration;
|
||||
@synthesize confirmations = _confirmations;
|
||||
|
||||
@synthesize chapters = _chapters;
|
||||
|
||||
- (instancetype)initWithTitle:(NSString *)title duration:(NSUInteger)duration confirmations:(NSUInteger)confirmations chapters:(NSArray<MP42TextSample *> *)chapters
|
||||
{
|
||||
self = [super init];
|
||||
if (self) {
|
||||
_title = [title copy];
|
||||
_duration = duration;
|
||||
_confirmations = confirmations;
|
||||
_chapters = [chapters copy];
|
||||
}
|
||||
return self;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,30 @@
|
||||
//
|
||||
// SBMetadataHelper.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 25/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@interface SBMetadataHelper : NSObject
|
||||
|
||||
typedef NS_ENUM(NSUInteger, SBCachePolicy) {
|
||||
SBDefaultPolicy,
|
||||
SBReturnCacheElseLoad,
|
||||
SBReloadIgnoringLocalCacheData,
|
||||
};
|
||||
|
||||
#pragma mark Helper routines
|
||||
+ (NSDictionary<NSString *, NSString *> *)parseFilename:(NSString *)filename;
|
||||
+ (NSString *)urlEncoded:(NSString *)string;
|
||||
|
||||
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy;
|
||||
+ (nullable NSData *)dataFromUrl:(NSURL *)url withHTTPMethod:(NSString *)method headerOptions:(nullable NSDictionary *)header error:(NSError **)outError;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,230 @@
|
||||
//
|
||||
// SBMetadataHelper.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Damiano Galassi on 25/11/15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBMetadataHelper.h"
|
||||
#import <CommonCrypto/CommonDigest.h>
|
||||
|
||||
@implementation SBMetadataHelper
|
||||
|
||||
+ (NSDictionary<NSString *, NSString *> *)parseFilename:(NSString *)filename
|
||||
{
|
||||
NSParameterAssert(filename);
|
||||
|
||||
NSMutableDictionary<NSString *, NSString *> *results = nil;
|
||||
|
||||
// Try with the usual anime filename
|
||||
__block NSDictionary<NSString *, NSString *> *resultDictionary = nil;
|
||||
|
||||
NSString *pattern = @"^\\[(.+)\\](?:(?:\\s|_)+)?([^()]+)(?:(?:\\s|_)+)(?:(?:-\\s|-_|Ep)+)([0-9]+)";
|
||||
NSRegularExpression *regex = [NSRegularExpression regularExpressionWithPattern:pattern
|
||||
options:NSRegularExpressionCaseInsensitive
|
||||
error:nil];
|
||||
|
||||
[regex enumerateMatchesInString:filename
|
||||
options:0
|
||||
range:NSMakeRange(0, filename.length)
|
||||
usingBlock:^(NSTextCheckingResult *match, NSMatchingFlags flags, BOOL *stop) {
|
||||
|
||||
resultDictionary = @{ @"fanSubGroup": [filename substringWithRange:[match rangeAtIndex:1]],
|
||||
@"seriesName": [filename substringWithRange:[match rangeAtIndex:2]],
|
||||
@"episodeNumber": [filename substringWithRange:[match rangeAtIndex:3]] };
|
||||
|
||||
}];
|
||||
|
||||
if (resultDictionary.count) {
|
||||
results = [[NSMutableDictionary alloc] init];
|
||||
NSString *seriesName = [resultDictionary[@"seriesName"] stringByReplacingOccurrencesOfString:@"_" withString:@" "];
|
||||
NSInteger episodeNumber = [resultDictionary[@"episodeNumber"] integerValue];
|
||||
|
||||
results[@"type"] = @"tv";
|
||||
results[@"seriesName"] = seriesName;
|
||||
results[@"seasonNum"] = @"1";
|
||||
results[@"episodeNum"] = [NSString stringWithFormat:@"%ld", (long)episodeNumber];
|
||||
|
||||
return [results autorelease];
|
||||
}
|
||||
|
||||
// Else use the ParseFilename perl script
|
||||
NSTask *task = [[NSTask alloc] init];
|
||||
[task setLaunchPath:@"/usr/bin/perl"];
|
||||
|
||||
NSMutableArray<NSString *> *args = [[NSMutableArray alloc] initWithCapacity:3];
|
||||
NSString *path = [[NSBundle bundleForClass:[self class]] pathForResource:@"ParseFilename" ofType:@""];
|
||||
[args addObject:[NSString stringWithFormat:@"-I%@/lib", path]];
|
||||
[args addObject:[NSString stringWithFormat:@"%@/ParseFilename.pl", path]];
|
||||
[args addObject:filename];
|
||||
[task setArguments:args];
|
||||
|
||||
NSPipe *stdOut = [[NSPipe alloc] init];
|
||||
NSFileHandle *stdOutWrite = [stdOut fileHandleForWriting];
|
||||
[task setStandardOutput:stdOutWrite];
|
||||
|
||||
[task launch];
|
||||
[task waitUntilExit];
|
||||
[stdOutWrite closeFile];
|
||||
|
||||
NSData *outputData = [[stdOut fileHandleForReading] readDataToEndOfFile];
|
||||
NSString *outputString = [[NSString alloc] initWithData:outputData encoding:NSUTF8StringEncoding];
|
||||
NSArray<NSString *> *lines = [outputString componentsSeparatedByString:@"\n"];
|
||||
|
||||
if (lines.count) {
|
||||
|
||||
if ([lines.firstObject isEqualToString:@"tv"]) {
|
||||
|
||||
if (lines.count >= 4) {
|
||||
|
||||
results = [[NSMutableDictionary alloc] initWithCapacity:4];
|
||||
results[@"type"] = @"tv";
|
||||
|
||||
NSString *newSeriesName=[lines[1] stringByReplacingOccurrencesOfString:@"."
|
||||
withString:@" "];
|
||||
results[@"seriesName"] = newSeriesName;
|
||||
|
||||
if ([lines[2] integerValue]) {
|
||||
results[@"seasonNum"] = lines[2];
|
||||
}
|
||||
else {
|
||||
results[@"seasonNum"] = @"0";
|
||||
}
|
||||
|
||||
results[@"episodeNum"] = lines[3];
|
||||
}
|
||||
}
|
||||
else if ([lines.firstObject isEqualToString:@"movie"]) {
|
||||
|
||||
if (lines.count >= 2) {
|
||||
|
||||
results = [[NSMutableDictionary alloc] initWithCapacity:2];
|
||||
results[@"type"] = @"movie";
|
||||
|
||||
NSString *newTitle=[lines[1] stringByReplacingOccurrencesOfString:@"."
|
||||
withString:@" "];
|
||||
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@"(" withString:@" "];
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@")" withString:@" "];
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@"[" withString:@" "];
|
||||
newTitle = [newTitle stringByReplacingOccurrencesOfString:@"]" withString:@" "];
|
||||
newTitle = [newTitle stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
|
||||
|
||||
results[@"title"] = newTitle;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[outputString release];
|
||||
[stdOut release];
|
||||
[args release];
|
||||
[task release];
|
||||
|
||||
return [results autorelease];
|
||||
}
|
||||
|
||||
+ (NSString *)urlEncoded:(NSString *)string {
|
||||
string = [string precomposedStringWithCompatibilityMapping];
|
||||
CFStringRef urlString = CFURLCreateStringByAddingPercentEscapes(
|
||||
NULL,
|
||||
(CFStringRef) string,
|
||||
NULL,
|
||||
(CFStringRef) @"!*'\"();:@&=+$,/?%#[]% ",
|
||||
kCFStringEncodingUTF8);
|
||||
return [(NSString *)urlString autorelease];
|
||||
}
|
||||
|
||||
+ (NSString *)md5String:(NSString *)s {
|
||||
const char *cStr = s.UTF8String;
|
||||
unsigned char result[CC_MD5_DIGEST_LENGTH];
|
||||
CC_MD5(cStr, (CC_LONG)strlen(cStr), result);
|
||||
NSMutableString *r = [NSMutableString stringWithCapacity:CC_MD5_DIGEST_LENGTH * 2];
|
||||
for (int i = 0; i < CC_MD5_DIGEST_LENGTH; ++i) {
|
||||
[r appendFormat:@"%02x", result[i]];
|
||||
}
|
||||
return [NSString stringWithString:r];
|
||||
}
|
||||
|
||||
+ (NSString *)sha256String:(NSString *)s {
|
||||
const char *cStr = s.UTF8String;
|
||||
unsigned char result[CC_SHA256_DIGEST_LENGTH];
|
||||
CC_SHA256(cStr, (CC_LONG)strlen(cStr), result);
|
||||
NSMutableString *r = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2];
|
||||
for (int i = 0; i < CC_SHA256_DIGEST_LENGTH; ++i) {
|
||||
[r appendFormat:@"%02x", result[i]];
|
||||
}
|
||||
return [NSString stringWithString:r];
|
||||
}
|
||||
|
||||
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy error:(NSError **)error {
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSString *bundleName = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleIdentifier"];
|
||||
NSURL *cacheURL = [[[fileManager URLsForDirectory:NSCachesDirectory inDomains:NSUserDomainMask]
|
||||
firstObject] URLByAppendingPathComponent:bundleName];
|
||||
|
||||
|
||||
NSURL *fileURL = [cacheURL URLByAppendingPathComponent:[SBMetadataHelper sha256String:url.absoluteString]];
|
||||
fileURL = [fileURL URLByAppendingPathExtension:url.pathExtension];
|
||||
|
||||
if (policy != SBReloadIgnoringLocalCacheData) {
|
||||
NSDictionary<NSString *, id> *attrs = [fileURL resourceValuesForKeys:@[NSURLCreationDateKey] error:NULL];
|
||||
NSDate *creationDate = attrs[NSURLCreationDateKey];
|
||||
|
||||
if (creationDate) {
|
||||
NSTimeInterval oldness = creationDate.timeIntervalSinceNow;
|
||||
|
||||
// if less than 2 hours old or jpg
|
||||
if ([url.pathExtension caseInsensitiveCompare:@"jpg"] == NSOrderedSame ||
|
||||
(oldness > -60 * 60 * 2) ||
|
||||
policy == SBReturnCacheElseLoad) {
|
||||
return [NSData dataWithContentsOfURL:fileURL options:0 error:error];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NSData *downloadedData = [NSData dataWithContentsOfURL:url options:NSDataReadingUncached error:error];
|
||||
[downloadedData writeToURL:fileURL atomically:YES];
|
||||
|
||||
return downloadedData;
|
||||
}
|
||||
|
||||
+ (nullable NSData *)downloadDataFromURL:(NSURL *)url withCachePolicy:(SBCachePolicy)policy {
|
||||
return [SBMetadataHelper downloadDataFromURL:url withCachePolicy:policy error:NULL];
|
||||
}
|
||||
|
||||
#pragma mark NSURLRequest
|
||||
+ (nullable NSData *)dataFromUrl:(NSURL *)url withHTTPMethod:(NSString *)method headerOptions:(nullable NSDictionary *)header error:(NSError **)outError
|
||||
{
|
||||
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
|
||||
cachePolicy:NSURLRequestUseProtocolCachePolicy
|
||||
timeoutInterval:30.0];
|
||||
[request setHTTPMethod:method];
|
||||
|
||||
if (header) {
|
||||
for (NSString *key in header.allKeys) {
|
||||
[request addValue:header[key] forHTTPHeaderField:key];
|
||||
}
|
||||
}
|
||||
|
||||
NSURLResponse *response = nil;
|
||||
NSError *error = nil;
|
||||
NSData *data = [NSURLConnection sendSynchronousRequest:request
|
||||
returningResponse:&response
|
||||
error:&error];
|
||||
|
||||
if (data) {
|
||||
NSUInteger statusCode = 0;
|
||||
if ([response isKindOfClass:[NSHTTPURLResponse class]]) {
|
||||
statusCode = (long)[(NSHTTPURLResponse *)response statusCode];
|
||||
}
|
||||
|
||||
if (statusCode == 200) {
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
return nil;
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -25,8 +25,8 @@
|
||||
|
||||
- (NSArray *) searchMovie:(NSString *)aMovieTitle language:(NSString *)aLanguage {
|
||||
NSString *lang = [MP42Languages iso6391CodeFor:aLanguage];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/search/movie?api_key=%@&query=%@&language=%@", API_KEY, [MetadataImporter urlEncoded:aMovieTitle], lang]];
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/search/movie?api_key=%@&query=%@&language=%@", API_KEY, [SBMetadataHelper urlEncoded:aMovieTitle], lang]];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
if (jsonData) {
|
||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
// load image variables from configuration
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/configuration?api_key=%@", API_KEY]];
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSArray *posters = [r valueForKeyPath:@"images.posters"];
|
||||
|
||||
if (jsonData && posters && [posters isKindOfClass:[NSArray class]]) {
|
||||
@@ -99,7 +99,7 @@
|
||||
NSString *lang = [MP42Languages iso6391CodeFor:aLanguage];
|
||||
NSNumber *theMovieDBID = [[aMetadata tagsDict] valueForKey:@"TheMovieDB ID"];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://api.themoviedb.org/3/movie/%@?api_key=%@&language=%@&append_to_response=casts,releases,images", theMovieDBID, API_KEY, lang]];
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
if (jsonData) {
|
||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||
|
||||
@@ -24,7 +24,7 @@ static NSArray *TVDBlanguages;
|
||||
+ (void)initialize {
|
||||
if (self == [TheTVDB class]) {
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://thetvdb.com/api/%@/languages.xml", API_KEY]];
|
||||
NSData *languagesXML = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBReturnCacheElseLoad];
|
||||
NSData *languagesXML = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBReturnCacheElseLoad];
|
||||
NSDictionary *languages = [XMLReader dictionaryForXMLData:languagesXML error:NULL];
|
||||
|
||||
if (languages) {
|
||||
@@ -53,8 +53,8 @@ static NSArray *TVDBlanguages;
|
||||
- (NSArray *) searchTVSeries:(NSString *)aSeriesName language:(NSString *)aLanguage {
|
||||
NSURL *url;
|
||||
// search for series
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"http://thetvdb.com/api/GetSeries.php?seriesname=%@&language=all", [MetadataImporter urlEncoded:aSeriesName]]];
|
||||
NSData *seriesXML = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"http://thetvdb.com/api/GetSeries.php?seriesname=%@&language=all", [SBMetadataHelper urlEncoded:aSeriesName]]];
|
||||
NSData *seriesXML = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSDictionary *series = [XMLReader dictionaryForXMLData:seriesXML error:NULL];
|
||||
if (!series) return nil;
|
||||
NSArray *seriesArray = [series retrieveArrayForPath:@"Data.Series"];
|
||||
@@ -71,8 +71,8 @@ static NSArray *TVDBlanguages;
|
||||
NSURL *url;
|
||||
|
||||
// search for series
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"http://thetvdb.com/api/GetSeries.php?seriesname=%@&language=all", [MetadataImporter urlEncoded:aSeriesName]]];
|
||||
NSData *seriesXML = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"http://thetvdb.com/api/GetSeries.php?seriesname=%@&language=all", [SBMetadataHelper urlEncoded:aSeriesName]]];
|
||||
NSData *seriesXML = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSDictionary *series = [XMLReader dictionaryForXMLData:seriesXML error:NULL];
|
||||
|
||||
if (!series) return nil;
|
||||
@@ -102,7 +102,7 @@ static NSArray *TVDBlanguages;
|
||||
continue;
|
||||
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"http://thetvdb.com/api/%@/series/%@/all/%@.xml", API_KEY, seriesID, lang]];
|
||||
NSData *episodesXML = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSData *episodesXML = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSDictionary *episodes = [XMLReader dictionaryForXMLData:episodesXML error:NULL];
|
||||
|
||||
if (!episodes)
|
||||
@@ -150,7 +150,7 @@ static NSArray *TVDBlanguages;
|
||||
[newArtworkProviderNames addObjectsFromArray:[aMetadata artworkProviderNames]];
|
||||
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://thetvdb.com/api/%@/series/%@/banners.xml", API_KEY, [[aMetadata tagsDict] valueForKey:@"TheTVDB Series ID"]]];
|
||||
NSData *bannersXML = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSData *bannersXML = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSDictionary *banners = [XMLReader dictionaryForXMLData:bannersXML error:NULL];
|
||||
if (!banners) return nil;
|
||||
NSArray *bannersArray = [banners retrieveArrayForPath:@"Banners.Banner"];
|
||||
|
||||
@@ -127,11 +127,11 @@ NSInteger sortMP42Metadata(id ep1, id ep2, void *context)
|
||||
|
||||
NSURL *url;
|
||||
if (aSeasonNum && [aSeasonNum length]) {
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=tvSeasonTerm&entity=tvEpisode&limit=200", country, [language lowercaseString], [MetadataImporter urlEncoded:[NSString stringWithFormat:@"%@ %@ %@", aSeriesName, season, aSeasonNum]]]];
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=tvSeasonTerm&entity=tvEpisode&limit=200", country, [language lowercaseString], [SBMetadataHelper urlEncoded:[NSString stringWithFormat:@"%@ %@ %@", aSeriesName, season, aSeasonNum]]]];
|
||||
} else {
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=showTerm&entity=tvEpisode&limit=200", country, [language lowercaseString], [MetadataImporter urlEncoded:aSeriesName]]];
|
||||
url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&attribute=showTerm&entity=tvEpisode&limit=200", country, [language lowercaseString], [SBMetadataHelper urlEncoded:aSeriesName]]];
|
||||
}
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
|
||||
if (jsonData) {
|
||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
@@ -169,8 +169,8 @@ NSInteger sortMP42Metadata(id ep1, id ep2, void *context)
|
||||
}
|
||||
NSString *country = [store valueForKey:@"country2"];
|
||||
NSString *language = [store valueForKey:@"language2"];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=tvEpisode", country, [language lowercaseString], [MetadataImporter urlEncoded:[NSString stringWithFormat:@"%@ %@", aSeriesName, aEpisodeTitle]]]];
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=tvEpisode", country, [language lowercaseString], [SBMetadataHelper urlEncoded:[NSString stringWithFormat:@"%@ %@", aSeriesName, aEpisodeTitle]]]];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
if (jsonData) {
|
||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||
@@ -188,8 +188,8 @@ NSInteger sortMP42Metadata(id ep1, id ep2, void *context)
|
||||
}
|
||||
NSString *country = [store valueForKey:@"country2"];
|
||||
NSString *language = [store valueForKey:@"language2"];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=movie", country, language, [MetadataImporter urlEncoded:aMovieName]]];
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=movie", country, language, [SBMetadataHelper urlEncoded:aMovieName]]];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
if (jsonData) {
|
||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||
@@ -212,8 +212,8 @@ NSInteger sortMP42Metadata(id ep1, id ep2, void *context)
|
||||
language = [store valueForKey:@"language2"];
|
||||
}
|
||||
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=movie&limit=150", country, language, [MetadataImporter urlEncoded:aMovieTitle]]];
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/search?country=%@&lang=%@&term=%@&entity=movie&limit=150", country, language, [SBMetadataHelper urlEncoded:aMovieTitle]]];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
if (jsonData) {
|
||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||
@@ -233,7 +233,7 @@ NSInteger sortMP42Metadata(id ep1, id ep2, void *context)
|
||||
NSString *country = [store valueForKey:@"country2"];
|
||||
NSString *language = [store valueForKey:@"language2"];
|
||||
NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"https://itunes.apple.com/lookup?country=%@&lang=%@&id=%@", country, [language lowercaseString], [[aMetadata tagsDict] valueForKey:@"playlistID"]]];
|
||||
NSData *jsonData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSData *jsonData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
if (jsonData) {
|
||||
NSDictionary *d = [NSJSONSerialization JSONObjectWithData:jsonData options:0 error:nil];
|
||||
if ([d isKindOfClass:[NSDictionary class]]) {
|
||||
@@ -248,7 +248,7 @@ NSInteger sortMP42Metadata(id ep1, id ep2, void *context)
|
||||
}
|
||||
|
||||
- (MP42Metadata *) loadMovieMetadata:(MP42Metadata *)aMetadata language:(NSString *)aLanguage {
|
||||
NSData *xmlData = [MetadataImporter downloadDataFromURL:[NSURL URLWithString:[[aMetadata tagsDict] valueForKey:@"iTunes URL"]] withCachePolicy:SBDefaultPolicy];
|
||||
NSData *xmlData = [SBMetadataHelper downloadDataFromURL:[NSURL URLWithString:[[aMetadata tagsDict] valueForKey:@"iTunes URL"]] withCachePolicy:SBDefaultPolicy];
|
||||
if (xmlData) {
|
||||
NSDictionary *store = [iTunesStore getStoreFor:aLanguage];
|
||||
NSXMLDocument *xml = [[NSXMLDocument alloc] initWithData:xmlData options:NSXMLDocumentTidyHTML error:NULL];
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
//
|
||||
|
||||
#import "SBArtworkSelector.h"
|
||||
#import "MetadataImporter.h"
|
||||
#import "SBMetadataHelper.h"
|
||||
|
||||
#pragma mark IKImageBrowserItem data source objects
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
// Get the data outside the main thread
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
if (!self.isCancelled) {
|
||||
self.data = [MetadataImporter downloadDataFromURL:_url withCachePolicy:SBDefaultPolicy];
|
||||
self.data = [SBMetadataHelper downloadDataFromURL:_url withCachePolicy:SBDefaultPolicy];
|
||||
self.version = 2;
|
||||
// We got the data, tell the controller to update the view
|
||||
dispatch_async(dispatch_get_main_queue(), ^{
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
//
|
||||
// SBChapterSearchController.h
|
||||
// Subler
|
||||
//
|
||||
// Created by Michael Hueber on 20.11.15.
|
||||
//
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <MP42Foundation/MP42TextSample.h>
|
||||
|
||||
NS_ASSUME_NONNULL_BEGIN
|
||||
|
||||
@class SBTableView;
|
||||
@class SBChapterResult;
|
||||
@class SBChapterImporter;
|
||||
|
||||
@protocol SBChapterSearchControllerDelegate
|
||||
|
||||
- (void)chapterImportDone:(NSArray<MP42TextSample *> *)chaptersToBeImported;
|
||||
|
||||
@end
|
||||
|
||||
@interface SBChapterSearchController : NSWindowController {
|
||||
@private
|
||||
id <SBChapterSearchControllerDelegate> delegate;
|
||||
|
||||
NSString *_searchString;
|
||||
NSUInteger _searchDuration;
|
||||
|
||||
NSDictionary *_detailBoldAttr;
|
||||
NSDictionary *_detailBoldMonospacedAttr;
|
||||
NSDictionary *_detailMonospacedAttr;
|
||||
|
||||
IBOutlet NSTextField *searchTitle;
|
||||
IBOutlet NSTextField *searchDuration;
|
||||
|
||||
NSArray<SBChapterResult *> *_resultsArray;
|
||||
IBOutlet NSTableView *resultsTable;
|
||||
NSArray *_selectedChaptersArray;
|
||||
IBOutlet SBTableView *chapterTable;
|
||||
|
||||
|
||||
IBOutlet NSButton *searchButton;
|
||||
IBOutlet NSButton *addButton;
|
||||
|
||||
SBChapterImporter *_currentSearcher;
|
||||
|
||||
IBOutlet NSProgressIndicator *progress;
|
||||
IBOutlet NSTextField *progressText;
|
||||
}
|
||||
|
||||
|
||||
- (instancetype)initWithDelegate:(id <SBChapterSearchControllerDelegate>)del searchTitle:(NSString *)title andDuration:(NSUInteger)duration;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
@@ -0,0 +1,327 @@
|
||||
//
|
||||
// SBChapterSearchController.m
|
||||
// Subler
|
||||
//
|
||||
// Created by Michael Hueber on 20.11.15.
|
||||
//
|
||||
//
|
||||
|
||||
#import "SBChapterSearchController.h"
|
||||
|
||||
#import <MP42Foundation/MP42Utilities.h>
|
||||
|
||||
#import "SBChapterImporter.h"
|
||||
#import "SBChapterResult.h"
|
||||
|
||||
@interface SBChapterSearchController () <NSTableViewDelegate>
|
||||
|
||||
@property (nonatomic, readwrite, retain) SBChapterImporter *currentSearcher;
|
||||
@property (nonatomic, readwrite, retain) NSArray<SBChapterResult *> *resultsArray;
|
||||
@property (nonatomic, readwrite, retain) NSArray<MP42TextSample *> *selectedChaptersArray;
|
||||
|
||||
@end
|
||||
|
||||
@implementation SBChapterSearchController
|
||||
|
||||
@synthesize currentSearcher = _currentSearcher;
|
||||
@synthesize resultsArray = _resultsArray;
|
||||
@synthesize selectedChaptersArray = _selectedChaptersArray;
|
||||
|
||||
|
||||
- (instancetype)initWithDelegate:(id <SBChapterSearchControllerDelegate>)del searchTitle:(NSString *)title andDuration:(NSUInteger)duration
|
||||
{
|
||||
self = [super initWithWindowNibName:@"SBChapterSearch"];
|
||||
|
||||
if (self) {
|
||||
|
||||
delegate = del;
|
||||
_searchString = [title copy];
|
||||
_searchDuration = duration;
|
||||
|
||||
[self setupFontAttributes];
|
||||
|
||||
[self updateSearchButtonVisibility];
|
||||
|
||||
if (searchButton.enabled) {
|
||||
[self searchForResults:nil];
|
||||
}
|
||||
}
|
||||
|
||||
return self;
|
||||
}
|
||||
|
||||
- (void)setupFontAttributes
|
||||
{
|
||||
NSMutableParagraphStyle *ps = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
||||
ps.headIndent = -10.0;
|
||||
ps.alignment = NSTextAlignmentRight;
|
||||
|
||||
_detailBoldMonospacedAttr = [@{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
||||
NSParagraphStyleAttributeName: ps,
|
||||
NSForegroundColorAttributeName: [NSColor grayColor]} retain];
|
||||
|
||||
NSMutableParagraphStyle *psL = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
|
||||
psL.headIndent = -10.0;
|
||||
psL.alignment = NSTextAlignmentLeft;
|
||||
_detailBoldAttr = [@{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold],
|
||||
NSParagraphStyleAttributeName: psL,
|
||||
NSForegroundColorAttributeName: [NSColor grayColor]} retain];
|
||||
|
||||
|
||||
_detailMonospacedAttr = [@{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular],
|
||||
NSParagraphStyleAttributeName: ps} retain];
|
||||
}
|
||||
|
||||
- (void)windowDidLoad {
|
||||
[super windowDidLoad];
|
||||
|
||||
[self.window makeFirstResponder:searchTitle];
|
||||
|
||||
if (_searchString) {
|
||||
NSDictionary *parsed = [SBMetadataHelper parseFilename:_searchString];
|
||||
if (parsed) {
|
||||
|
||||
if ([@"movie" isEqualToString:(NSString *) [parsed valueForKey:@"type"]]) {
|
||||
if ([parsed valueForKey:@"title"]) searchTitle.stringValue = [parsed valueForKey:@"title"];
|
||||
} else if ([@"tv" isEqualToString:(NSString *) [parsed valueForKey:@"type"]]) {
|
||||
searchTitle.stringValue = _searchString.stringByDeletingPathExtension;
|
||||
}
|
||||
|
||||
searchDuration.stringValue = StringFromTime(_searchDuration, 1000);
|
||||
|
||||
[self updateSearchButtonVisibility];
|
||||
|
||||
if (searchButton.enabled) {
|
||||
[self searchForResults:nil];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Search for results
|
||||
|
||||
- (IBAction)searchForResults:(id)sender
|
||||
{
|
||||
[addButton setEnabled:NO];
|
||||
|
||||
if (self.currentSearcher) {
|
||||
[self.currentSearcher cancel];
|
||||
}
|
||||
|
||||
if (searchTitle.stringValue.length) {
|
||||
|
||||
[self startProgressReportWithString:[NSString stringWithFormat:@"Searching %@ for chapter information…", @"ChapterDB"]];
|
||||
|
||||
self.currentSearcher = [SBChapterImporter importerForProvider:[SBChapterImporter defaultProvider]];
|
||||
|
||||
[self.currentSearcher searchTitle:searchTitle.stringValue
|
||||
duration:_searchDuration
|
||||
completionHandler:^(NSArray<SBChapterResult *> *results) {
|
||||
[self searchForResultsDone:results];
|
||||
}];
|
||||
|
||||
}
|
||||
else {
|
||||
// Nothing to search, reset the table view
|
||||
self.resultsArray = nil;
|
||||
self.selectedChaptersArray = nil;
|
||||
[resultsTable reloadData];
|
||||
[chapterTable reloadData];
|
||||
}
|
||||
}
|
||||
|
||||
- (void)searchForResultsDone:(NSArray<SBChapterResult *> *)results
|
||||
{
|
||||
self.resultsArray = nil;
|
||||
|
||||
[self stopProgressReport];
|
||||
|
||||
self.resultsArray = results;
|
||||
self.selectedChaptersArray = nil;
|
||||
|
||||
[resultsTable reloadData];
|
||||
[chapterTable reloadData];
|
||||
|
||||
[self tableViewSelectionDidChange:[NSNotification notificationWithName:@"tableViewSelectionDidChange" object:resultsTable]];
|
||||
|
||||
if (self.resultsArray.count) {
|
||||
[self.window makeFirstResponder:resultsTable];
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Search input fields
|
||||
|
||||
- (void)updateSearchButtonVisibility
|
||||
{
|
||||
if (searchTitle.stringValue.length > 0) {
|
||||
[searchButton setEnabled:YES];
|
||||
return;
|
||||
}
|
||||
|
||||
[searchButton setEnabled:NO];
|
||||
}
|
||||
|
||||
- (void)controlTextDidChange:(NSNotification *)aNotification
|
||||
{
|
||||
[self updateSearchButtonVisibility];
|
||||
addButton.keyEquivalent = @"";
|
||||
searchButton.keyEquivalent = @"\r";
|
||||
}
|
||||
|
||||
#pragma mark - Finishing up
|
||||
|
||||
- (IBAction)addChapter:(id)sender
|
||||
{
|
||||
[self addChapterTrack];
|
||||
}
|
||||
|
||||
- (void) addChapterTrack
|
||||
{
|
||||
[delegate chapterImportDone:self.selectedChaptersArray];
|
||||
|
||||
[chapterTable setDelegate:nil];
|
||||
[chapterTable setDataSource:nil];
|
||||
[resultsTable setDelegate:nil];
|
||||
[resultsTable setDataSource:nil];
|
||||
|
||||
[NSApp endSheet:self.window returnCode:1];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction)closeWindow:(id)sender
|
||||
{
|
||||
[resultsTable setDelegate:nil];
|
||||
[resultsTable setDataSource:nil];
|
||||
|
||||
[NSApp endSheet:self.window returnCode:0];
|
||||
}
|
||||
|
||||
#pragma mark - Progress
|
||||
|
||||
- (void)startProgressReportWithString:(NSString *)progressString
|
||||
{
|
||||
[progress startAnimation:self];
|
||||
[progress setHidden:NO];
|
||||
progressText.stringValue = progressString;
|
||||
[progressText setHidden:NO];
|
||||
|
||||
[resultsTable setEnabled:NO];
|
||||
[chapterTable setEnabled:NO];
|
||||
}
|
||||
|
||||
- (void)stopProgressReport
|
||||
{
|
||||
[progress setHidden:YES];
|
||||
[progressText setHidden:YES];
|
||||
[progress stopAnimation:self];
|
||||
|
||||
[resultsTable setEnabled:YES];
|
||||
[chapterTable setEnabled:YES];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Miscellaneous
|
||||
|
||||
- (NSAttributedString *)boldString:(NSString *)string monospaced:(BOOL)monospaced
|
||||
{
|
||||
if (monospaced) {
|
||||
return [[[NSAttributedString alloc] initWithString:string attributes:_detailBoldMonospacedAttr] autorelease];
|
||||
}
|
||||
return [[[NSAttributedString alloc] initWithString:string attributes:_detailBoldAttr] autorelease];
|
||||
}
|
||||
|
||||
- (NSAttributedString *)monospacedString:(NSString *)string
|
||||
{
|
||||
return [[[NSAttributedString alloc] initWithString:string attributes:_detailMonospacedAttr] autorelease];
|
||||
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
|
||||
#pragma mark NSTableView delegates and protocols
|
||||
|
||||
- (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView
|
||||
{
|
||||
if (tableView == resultsTable) {
|
||||
return self.resultsArray.count;
|
||||
}
|
||||
else if (tableView == (NSTableView *) chapterTable) {
|
||||
return self.selectedChaptersArray.count;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
- (id)tableView:(NSTableView *)tableView objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
|
||||
{
|
||||
if (tableView == resultsTable) {
|
||||
if (self.resultsArray != nil) {
|
||||
SBChapterResult *result = self.resultsArray[rowIndex];
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"title"]) {
|
||||
return result.title;
|
||||
}
|
||||
else if ([tableColumn.identifier isEqualToString:@"chaptercount"]) {
|
||||
return [self monospacedString:@(result.chapters.count).stringValue];
|
||||
}
|
||||
else if ([tableColumn.identifier isEqualToString:@"duration"]) {
|
||||
return [self monospacedString:StringFromTime(result.duration, 1000)];
|
||||
}
|
||||
else if ([tableColumn.identifier isEqualToString:@"confirmations"]) {
|
||||
return [self monospacedString:@(result.confirmations).stringValue];
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (tableView == (NSTableView *)chapterTable) {
|
||||
if (self.selectedChaptersArray != nil) {
|
||||
MP42TextSample *chapter = (self.selectedChaptersArray)[rowIndex];
|
||||
|
||||
if ([tableColumn.identifier isEqualToString:@"time"]) {
|
||||
return [self boldString:StringFromTime(chapter.timestamp, 1000) monospaced:YES];
|
||||
}
|
||||
else if ([tableColumn.identifier isEqualToString:@"name"]) {
|
||||
return chapter.title;
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil;
|
||||
}
|
||||
|
||||
- (void)tableViewSelectionDidChange:(NSNotification *)aNotification {
|
||||
if (aNotification.object == resultsTable || aNotification.object == chapterTable) {
|
||||
if (self.resultsArray && (self.resultsArray).count > 0 && resultsTable.selectedRow > -1) {
|
||||
|
||||
self.selectedChaptersArray = self.resultsArray[resultsTable.selectedRow].chapters;
|
||||
|
||||
[chapterTable reloadData];
|
||||
[addButton setEnabled:YES];
|
||||
addButton.keyEquivalent = @"\r";
|
||||
searchButton.keyEquivalent = @"";
|
||||
}
|
||||
}
|
||||
else {
|
||||
[addButton setEnabled:NO];
|
||||
addButton.keyEquivalent = @"";
|
||||
searchButton.keyEquivalent = @"\r";
|
||||
}
|
||||
}
|
||||
|
||||
- (void)tableView:(NSTableView *)tableView willDisplayCell:(id)cell forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)rowIndex
|
||||
{
|
||||
if ([tableColumn.identifier isEqualToString:@"time"]) {
|
||||
if ([tableView.selectedRowIndexes containsIndex:rowIndex]) {
|
||||
|
||||
// Without this, the color won't change ...
|
||||
NSMutableAttributedString *highlightedString = [[[NSMutableAttributedString alloc] initWithAttributedString:[cell attributedStringValue]] autorelease];
|
||||
[highlightedString addAttribute:NSForegroundColorAttributeName value:[NSColor blackColor] range:NSMakeRange(0, highlightedString.length)];
|
||||
[cell setAttributedStringValue:highlightedString];
|
||||
|
||||
[cell setTextColor:[NSColor blackColor]];
|
||||
} else {
|
||||
[cell setTextColor:[NSColor grayColor]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
+48
-1
@@ -20,6 +20,8 @@
|
||||
#import "SBMetadataSearchController.h"
|
||||
#import "SBArtworkSelector.h"
|
||||
|
||||
#import "SBChapterSearchController.h"
|
||||
|
||||
#import "SBMediaTagsController.h"
|
||||
|
||||
#import <MP42Foundation/MP42File.h>
|
||||
@@ -29,7 +31,7 @@
|
||||
|
||||
#define SublerTableViewDataType @"SublerTableViewDataType"
|
||||
|
||||
@interface SBDocument () <NSTableViewDelegate, SBFileImportDelegate, SBMetadataSearchControllerDelegate>
|
||||
@interface SBDocument () <NSTableViewDelegate, SBFileImportDelegate, SBMetadataSearchControllerDelegate, SBChapterSearchControllerDelegate>
|
||||
|
||||
@property (nonatomic, retain) MP42File *mp4;
|
||||
|
||||
@@ -368,6 +370,9 @@
|
||||
if (action == @selector(searchMetadata:))
|
||||
return YES;
|
||||
|
||||
if (action == @selector(searchChapters:))
|
||||
return YES;
|
||||
|
||||
if (action == @selector(sendToQueue:))
|
||||
return YES;
|
||||
|
||||
@@ -636,6 +641,8 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
}
|
||||
}
|
||||
|
||||
#pragma mark - Metadata search
|
||||
|
||||
- (IBAction)searchMetadata:(id)sender
|
||||
{
|
||||
NSString *filename = nil;
|
||||
@@ -680,6 +687,46 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
||||
[metadataToBeImported release];
|
||||
}
|
||||
|
||||
#pragma mark - Chapters search
|
||||
|
||||
- (IBAction)searchChapters:(id)sender
|
||||
{
|
||||
NSString *title = self.mp4.metadata[@"Name"];
|
||||
NSUInteger duration = self.mp4.duration;
|
||||
|
||||
_sheet = [[SBChapterSearchController alloc] initWithDelegate:self searchTitle:title andDuration:duration];
|
||||
|
||||
[NSApp beginSheet:_sheet.window
|
||||
modalForWindow:documentWindow
|
||||
modalDelegate:self
|
||||
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
||||
contextInfo:nil];
|
||||
}
|
||||
|
||||
- (void)chapterImportDone:(NSArray<MP42TextSample *> *)chapterToBeImported
|
||||
{
|
||||
[chapterToBeImported retain];
|
||||
|
||||
if (chapterToBeImported) {
|
||||
|
||||
MP42ChapterTrack *newChapter = [[MP42ChapterTrack alloc] init];
|
||||
for (MP42TextSample *chapter in chapterToBeImported) {
|
||||
[newChapter addChapter:chapter];
|
||||
}
|
||||
[newChapter setDuration:self.mp4.duration];
|
||||
[self.mp4 addTrack:newChapter];
|
||||
[newChapter release];
|
||||
|
||||
[self updateChangeCount:NSChangeDone];
|
||||
|
||||
[fileTracksTable reloadData];
|
||||
[self reloadPropertyView];
|
||||
[self updateChangeCount:NSChangeDone];
|
||||
}
|
||||
|
||||
[chapterToBeImported release];
|
||||
}
|
||||
|
||||
- (IBAction)showTrackOffsetSheet:(id)sender
|
||||
{
|
||||
[offset setStringValue:[NSString stringWithFormat:@"%lld",
|
||||
|
||||
@@ -102,7 +102,7 @@
|
||||
[self metadataProviderSelected:tvMetadataProvider];
|
||||
|
||||
if (_searchString) {
|
||||
NSDictionary *parsed = [MetadataImporter parseFilename:_searchString];
|
||||
NSDictionary *parsed = [SBMetadataHelper parseFilename:_searchString];
|
||||
if (parsed) {
|
||||
|
||||
if ([@"movie" isEqualToString:(NSString *) [parsed valueForKey:@"type"]]) {
|
||||
@@ -364,7 +364,7 @@
|
||||
dispatch_async(dispatch_get_global_queue(0, 0), ^{
|
||||
|
||||
[indexes enumerateIndexesUsingBlock:^(NSUInteger idx, BOOL *stop) {
|
||||
NSData *artworkData = [MetadataImporter downloadDataFromURL:URLs[idx] withCachePolicy:SBDefaultPolicy];
|
||||
NSData *artworkData = [SBMetadataHelper downloadDataFromURL:URLs[idx] withCachePolicy:SBDefaultPolicy];
|
||||
|
||||
// Hack, download smaller iTunes version if big iTunes version is not available
|
||||
if (!artworkData) {
|
||||
@@ -372,7 +372,7 @@
|
||||
if ([provider isEqualToString:@"iTunes"]) {
|
||||
NSURL *url = URLs[idx];
|
||||
url = [[url URLByDeletingPathExtension] URLByAppendingPathExtension:@"600x600bb.jpg"];
|
||||
artworkData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
artworkData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@
|
||||
}
|
||||
|
||||
- (MP42Image *)loadArtwork:(NSURL *)url {
|
||||
NSData *artworkData = [MetadataImporter downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
NSData *artworkData = [SBMetadataHelper downloadDataFromURL:url withCachePolicy:SBDefaultPolicy];
|
||||
if (artworkData && artworkData.length) {
|
||||
MP42Image *artwork = [[MP42Image alloc] initWithData:artworkData type:MP42_ART_JPEG];
|
||||
if (artwork != nil) {
|
||||
@@ -140,7 +140,7 @@
|
||||
MP42Metadata *metadata = nil;
|
||||
|
||||
// Parse FileName and search for metadata
|
||||
NSDictionary<NSString *, NSString *> *parsed = [MetadataImporter parseFilename:url.lastPathComponent];
|
||||
NSDictionary<NSString *, NSString *> *parsed = [SBMetadataHelper parseFilename:url.lastPathComponent];
|
||||
NSString *type = parsed[@"type"];
|
||||
|
||||
if ([@"movie" isEqualToString:type]) {
|
||||
|
||||
@@ -156,6 +156,12 @@
|
||||
<action selector="searchMetadata:" target="-1" id="593"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Search chapters online…" id="blb-EP-gbJ">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
<action selector="searchChapters:" target="-1" id="TBD-2j-3Yu"/>
|
||||
</connections>
|
||||
</menuItem>
|
||||
<menuItem title="Metadata…" id="564">
|
||||
<modifierMask key="keyEquivalentModifierMask"/>
|
||||
<connections>
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="8187.4" systemVersion="15A262e" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15C47a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="8187.4"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SBMetadataSearchController">
|
||||
@@ -441,6 +441,7 @@ DQ
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<point key="canvasLocation" x="422" y="285"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -0,0 +1,297 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<document type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="3.0" toolsVersion="9060" systemVersion="15C47a" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" customObjectInstantitationMethod="direct">
|
||||
<dependencies>
|
||||
<deployment identifier="macosx"/>
|
||||
<plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="9060"/>
|
||||
</dependencies>
|
||||
<objects>
|
||||
<customObject id="-2" userLabel="File's Owner" customClass="SBChapterSearchController">
|
||||
<connections>
|
||||
<outlet property="addButton" destination="TwZ-hH-t4o" id="x1U-bO-DxZ"/>
|
||||
<outlet property="chapterTable" destination="rAm-CY-3va" id="08S-Hh-2nQ"/>
|
||||
<outlet property="progress" destination="VDL-VM-PgA" id="nlz-TO-CRu"/>
|
||||
<outlet property="progressText" destination="bkZ-I4-AOn" id="DoB-DJ-QrL"/>
|
||||
<outlet property="resultsTable" destination="4Q0-U2-W6V" id="CQn-uV-G1f"/>
|
||||
<outlet property="searchButton" destination="cCz-52-sHg" id="fLu-y9-7QM"/>
|
||||
<outlet property="searchDuration" destination="lDD-CV-XEt" id="19l-fh-A6J"/>
|
||||
<outlet property="searchTitle" destination="PZG-F6-4dQ" id="2L8-qm-FDY"/>
|
||||
<outlet property="window" destination="QvC-M9-y7g" id="vD9-Oz-kVE"/>
|
||||
</connections>
|
||||
</customObject>
|
||||
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
|
||||
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
|
||||
<window title="Chapter Search" allowsToolTipsWhenApplicationIsInactive="NO" autorecalculatesKeyViewLoop="NO" showsToolbarButton="NO" visibleAtLaunch="NO" frameAutosaveName="chapterWindow" animationBehavior="default" id="QvC-M9-y7g">
|
||||
<windowStyleMask key="styleMask" titled="YES" closable="YES" resizable="YES"/>
|
||||
<windowPositionMask key="initialPositionMask" leftStrut="YES" rightStrut="YES" topStrut="YES" bottomStrut="YES"/>
|
||||
<rect key="contentRect" x="196" y="240" width="550" height="468"/>
|
||||
<rect key="screenRect" x="0.0" y="0.0" width="1440" height="900"/>
|
||||
<value key="minSize" type="size" width="550" height="468"/>
|
||||
<view key="contentView" id="EiT-Mj-1SZ">
|
||||
<rect key="frame" x="0.0" y="0.0" width="550" height="468"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<subviews>
|
||||
<button verticalHuggingPriority="750" id="TwZ-hH-t4o">
|
||||
<rect key="frame" x="440" y="13" width="96" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Add" bezelStyle="rounded" alignment="center" enabled="NO" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="6W1-pC-dAo">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="addChapter:" target="-2" id="sqr-KC-4m5"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" id="Zyk-o3-yzW">
|
||||
<rect key="frame" x="344" y="13" width="96" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Cancel" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="2Ki-5k-XEP">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
<string key="keyEquivalent" base64-UTF8="YES">
|
||||
Gw
|
||||
</string>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="closeWindow:" target="-2" id="haz-vm-Uuy"/>
|
||||
</connections>
|
||||
</button>
|
||||
<splitView id="bYt-6B-9xM">
|
||||
<rect key="frame" x="20" y="61" width="510" height="346"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="sfb-N4-GGo">
|
||||
<rect key="frame" x="0.0" y="0.0" width="510" height="139"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<clipView key="contentView" id="KWU-UC-z0x">
|
||||
<rect key="frame" x="1" y="0.0" width="508" height="138"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="14" headerView="8oc-IY-tJx" id="4Q0-U2-W6V">
|
||||
<rect key="frame" x="0.0" y="0.0" width="508" height="115"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn identifier="title" width="265.8203125" minWidth="40" maxWidth="1000" id="htV-Xa-Z7y">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Title">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" controlSize="small" lineBreakMode="truncatingTail" alignment="left" title="Text Cell" id="Oen-p2-RWv">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="chaptercount" editable="NO" width="50" minWidth="10" maxWidth="3.4028234663852886e+38" id="lfp-EW-qOv">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Chapter">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" controlSize="small" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="lkd-uW-eid">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="duration" editable="NO" width="100" minWidth="10" maxWidth="3.4028234663852886e+38" id="wqo-sz-7xt">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Duration">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" controlSize="small" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="GWw-pe-rYT">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="confirmations" editable="NO" width="80" minWidth="10" maxWidth="3.4028234663852886e+38" id="rAU-DM-LSF">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Confirmations">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" controlSize="small" lineBreakMode="truncatingTail" selectable="YES" editable="YES" alignment="left" title="Text Cell" id="STa-3L-ysZ">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" userResizable="YES"/>
|
||||
</tableColumn>
|
||||
</tableColumns>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-2" id="FVb-9R-yZP"/>
|
||||
<outlet property="delegate" destination="-2" id="7AM-1R-7L1"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</clipView>
|
||||
<animations/>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="BFm-CX-YOM">
|
||||
<rect key="frame" x="1" y="97" width="508" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="F0B-th-j7i">
|
||||
<rect key="frame" x="-15" y="23" width="16" height="0.0"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</scroller>
|
||||
<tableHeaderView key="headerView" id="8oc-IY-tJx">
|
||||
<rect key="frame" x="0.0" y="0.0" width="508" height="23"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</tableHeaderView>
|
||||
</scrollView>
|
||||
<scrollView autohidesScrollers="YES" horizontalLineScroll="16" horizontalPageScroll="10" verticalLineScroll="16" verticalPageScroll="10" usesPredominantAxisScrolling="NO" id="y6v-SF-vqw">
|
||||
<rect key="frame" x="0.0" y="148" width="510" height="198"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<clipView key="contentView" id="Lsd-dB-ca0">
|
||||
<rect key="frame" x="1" y="0.0" width="508" height="197"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
|
||||
<subviews>
|
||||
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" alternatingRowBackgroundColors="YES" columnReordering="NO" multipleSelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="14" headerView="Cch-hl-a6n" id="rAm-CY-3va">
|
||||
<rect key="frame" x="0.0" y="0.0" width="508" height="174"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
<size key="intercellSpacing" width="3" height="2"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableViewGridLines key="gridStyleMask" vertical="YES"/>
|
||||
<color key="gridColor" name="gridColor" catalog="System" colorSpace="catalog"/>
|
||||
<tableColumns>
|
||||
<tableColumn identifier="time" width="101" minWidth="40" maxWidth="1000" id="63j-1W-8G5">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Time">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" controlSize="small" alignment="right" title="Text Cell" id="MaK-bD-4NO">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</tableColumn>
|
||||
<tableColumn identifier="name" editable="NO" width="401" minWidth="40" maxWidth="1000" id="leg-gf-Wgj">
|
||||
<tableHeaderCell key="headerCell" lineBreakMode="truncatingTail" borderStyle="border" alignment="left" title="Title">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="headerTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" white="0.33333298560000002" alpha="1" colorSpace="calibratedWhite"/>
|
||||
</tableHeaderCell>
|
||||
<textFieldCell key="dataCell" controlSize="small" alignment="left" title="Text Cell" id="p96-MW-U2Y">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
|
||||
</tableColumn>
|
||||
</tableColumns>
|
||||
<connections>
|
||||
<outlet property="dataSource" destination="-2" id="LEV-qs-Y3y"/>
|
||||
<outlet property="delegate" destination="-2" id="bGD-ld-paL"/>
|
||||
</connections>
|
||||
</tableView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</clipView>
|
||||
<animations/>
|
||||
<scroller key="horizontalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="YES" id="veD-gi-zkS">
|
||||
<rect key="frame" x="1" y="7" width="0.0" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</scroller>
|
||||
<scroller key="verticalScroller" hidden="YES" verticalHuggingPriority="750" horizontal="NO" id="ri2-nS-xXv">
|
||||
<rect key="frame" x="-15" y="23" width="16" height="0.0"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</scroller>
|
||||
<tableHeaderView key="headerView" id="Cch-hl-a6n">
|
||||
<rect key="frame" x="0.0" y="0.0" width="508" height="23"/>
|
||||
<autoresizingMask key="autoresizingMask"/>
|
||||
<animations/>
|
||||
</tableHeaderView>
|
||||
</scrollView>
|
||||
</subviews>
|
||||
<animations/>
|
||||
<holdingPriorities>
|
||||
<real value="250"/>
|
||||
<real value="250"/>
|
||||
</holdingPriorities>
|
||||
</splitView>
|
||||
<progressIndicator hidden="YES" wantsLayer="YES" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" id="VDL-VM-PgA">
|
||||
<rect key="frame" x="20" y="21" width="16" height="16"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
</progressIndicator>
|
||||
<textField hidden="YES" verticalHuggingPriority="750" id="bkZ-I4-AOn">
|
||||
<rect key="frame" x="41" y="22" width="297" height="14"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" controlSize="small" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" title="Progress status" id="VxI-Tj-e1F">
|
||||
<font key="font" metaFont="smallSystem"/>
|
||||
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<button verticalHuggingPriority="750" id="cCz-52-sHg">
|
||||
<rect key="frame" x="440" y="420" width="96" height="32"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<buttonCell key="cell" type="push" title="Search" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="yAN-Rr-Kwt">
|
||||
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="searchForResults:" target="-2" id="hPr-85-c2D"/>
|
||||
</connections>
|
||||
</button>
|
||||
<textField verticalHuggingPriority="750" id="PZG-F6-4dQ">
|
||||
<rect key="frame" x="59" y="427" width="277" height="22"/>
|
||||
<autoresizingMask key="autoresizingMask" widthSizable="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" sendsActionOnEndEditing="YES" state="on" borderStyle="bezel" drawsBackground="YES" id="yrS-im-Pbr">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="textColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
<connections>
|
||||
<outlet property="delegate" destination="-2" id="hNL-bJ-EM9"/>
|
||||
</connections>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="qd5-NC-nta">
|
||||
<rect key="frame" x="18" y="430" width="35" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="Title:" id="W86-Ok-9nr">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
<textField horizontalHuggingPriority="251" verticalHuggingPriority="750" id="lDD-CV-XEt">
|
||||
<rect key="frame" x="348" y="430" width="88" height="17"/>
|
||||
<autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
|
||||
<animations/>
|
||||
<textFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" sendsActionOnEndEditing="YES" placeholderString="Duration" id="c4C-yO-p4R">
|
||||
<font key="font" metaFont="system"/>
|
||||
<color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
|
||||
<color key="backgroundColor" name="controlColor" catalog="System" colorSpace="catalog"/>
|
||||
</textFieldCell>
|
||||
</textField>
|
||||
</subviews>
|
||||
<animations/>
|
||||
</view>
|
||||
<point key="canvasLocation" x="347" y="-3"/>
|
||||
</window>
|
||||
</objects>
|
||||
</document>
|
||||
@@ -218,6 +218,15 @@
|
||||
<key>NSTemporaryExceptionMinimumTLSVersion</key>
|
||||
<string>TLSv1.1</string>
|
||||
</dict>
|
||||
<key>chapterdb.org</key>
|
||||
<dict>
|
||||
<key>NSIncludesSubdomains</key>
|
||||
<true/>
|
||||
<key>NSTemporaryExceptionAllowsInsecureHTTPLoads</key>
|
||||
<true/>
|
||||
<key>NSTemporaryExceptionMinimumTLSVersion</key>
|
||||
<string>TLSv1.1</string>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
8D15AC2F0486D014006FF6A4 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165FFE840EACC02AAC07 /* InfoPlist.strings */; };
|
||||
8D15AC320486D014006FF6A4 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 2A37F4B0FDCFA73011CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
|
||||
8D15AC340486D014006FF6A4 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A7FEA54F5311CA2CBB /* Cocoa.framework */; };
|
||||
A901C51E1C04F03F00430DC3 /* SBChapterDB.m in Sources */ = {isa = PBXBuildFile; fileRef = A901C51B1C04F03F00430DC3 /* SBChapterDB.m */; };
|
||||
A901C51F1C04F03F00430DC3 /* SBChapterImporter.m in Sources */ = {isa = PBXBuildFile; fileRef = A901C51D1C04F03F00430DC3 /* SBChapterImporter.m */; };
|
||||
A90B023B10F3290A000416F3 /* Prefs.xib in Resources */ = {isa = PBXBuildFile; fileRef = A90B023910F3290A000416F3 /* Prefs.xib */; };
|
||||
A917286119FD288B00348DF8 /* SBLogger.m in Sources */ = {isa = PBXBuildFile; fileRef = A917286019FD288B00348DF8 /* SBLogger.m */; };
|
||||
A925AA8518378D8A00BE84D4 /* MP42Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A925AA8218378D7900BE84D4 /* MP42Foundation.framework */; };
|
||||
@@ -65,12 +67,16 @@
|
||||
A9C4259318DB6D1F00E99DB8 /* stopTemplate.pdf in Resources */ = {isa = PBXBuildFile; fileRef = A9C4259218DB6D1F00E99DB8 /* stopTemplate.pdf */; };
|
||||
A9C5FA6E19FA22590051F3FF /* SBLogWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C5FA6C19FA22590051F3FF /* SBLogWindowController.m */; };
|
||||
A9C5FA7419FA2FEC0051F3FF /* SBLogWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C5FA7219FA2FEC0051F3FF /* SBLogWindow.xib */; };
|
||||
A9C703121C05E08B00C89151 /* SBMetadataHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C703111C05E08B00C89151 /* SBMetadataHelper.m */; };
|
||||
A9C828F5195950C3004C4718 /* SBQueuePreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C828F4195950C3004C4718 /* SBQueuePreferences.m */; };
|
||||
A9C9E34413FBC1EB00CA3B4E /* EncodeWorking.png in Resources */ = {isa = PBXBuildFile; fileRef = A9C9E34113FBC1EB00CA3B4E /* EncodeWorking.png */; };
|
||||
A9D47B5817B239E200900BCA /* EncodeCanceled.png in Resources */ = {isa = PBXBuildFile; fileRef = A9D47B5417B239E200900BCA /* EncodeCanceled.png */; };
|
||||
A9D47B5917B239E200900BCA /* EncodeCanceled@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9D47B5517B239E200900BCA /* EncodeCanceled@2x.png */; };
|
||||
A9D47B5A17B239E200900BCA /* EncodeComplete.png in Resources */ = {isa = PBXBuildFile; fileRef = A9D47B5617B239E200900BCA /* EncodeComplete.png */; };
|
||||
A9D47B5B17B239E200900BCA /* EncodeComplete@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = A9D47B5717B239E200900BCA /* EncodeComplete@2x.png */; };
|
||||
A9D4B8641C05BC61007845C4 /* SBChapterSearchController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D4B8631C05BC61007845C4 /* SBChapterSearchController.m */; };
|
||||
A9D4B8671C05BD04007845C4 /* SBChapterSearch.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9D4B8651C05BD04007845C4 /* SBChapterSearch.xib */; };
|
||||
A9D4B86A1C05CBEB007845C4 /* SBChapterResult.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D4B8691C05CBEB007845C4 /* SBChapterResult.m */; };
|
||||
A9D73C5218BF3F1100C6FFA6 /* SBQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = A9D73C5118BF3F1100C6FFA6 /* SBQueue.m */; };
|
||||
A9DA3B9C1B918D5C00F1E40C /* SBApplication.m in Sources */ = {isa = PBXBuildFile; fileRef = A9DA3B991B918D5C00F1E40C /* SBApplication.m */; };
|
||||
A9DA3B9D1B918D5C00F1E40C /* SBExceptionAlertController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9DA3B9B1B918D5C00F1E40C /* SBExceptionAlertController.m */; };
|
||||
@@ -168,6 +174,10 @@
|
||||
8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D15AC370486D014006FF6A4 /* Subler.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Subler.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
948058B5106E07990037A911 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
|
||||
A901C51A1C04F03F00430DC3 /* SBChapterDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterDB.h; path = Classes/MetadataImporters/SBChapterDB.h; sourceTree = "<group>"; };
|
||||
A901C51B1C04F03F00430DC3 /* SBChapterDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterDB.m; path = Classes/MetadataImporters/SBChapterDB.m; sourceTree = "<group>"; };
|
||||
A901C51C1C04F03F00430DC3 /* SBChapterImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterImporter.h; path = Classes/MetadataImporters/SBChapterImporter.h; sourceTree = "<group>"; };
|
||||
A901C51D1C04F03F00430DC3 /* SBChapterImporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterImporter.m; path = Classes/MetadataImporters/SBChapterImporter.m; sourceTree = "<group>"; };
|
||||
A90B023A10F3290A000416F3 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/Prefs.xib; sourceTree = "<group>"; };
|
||||
A917286019FD288B00348DF8 /* SBLogger.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBLogger.m; path = Classes/SBLogger.m; sourceTree = "<group>"; };
|
||||
A917286419FD289F00348DF8 /* SBLogger.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = SBLogger.h; path = Classes/SBLogger.h; sourceTree = "<group>"; };
|
||||
@@ -252,6 +262,8 @@
|
||||
A9C5FA6B19FA22590051F3FF /* SBLogWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBLogWindowController.h; path = Classes/SBLogWindowController.h; sourceTree = "<group>"; };
|
||||
A9C5FA6C19FA22590051F3FF /* SBLogWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBLogWindowController.m; path = Classes/SBLogWindowController.m; sourceTree = "<group>"; };
|
||||
A9C5FA7319FA2FEC0051F3FF /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/SBLogWindow.xib; sourceTree = "<group>"; };
|
||||
A9C703101C05E08B00C89151 /* SBMetadataHelper.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBMetadataHelper.h; path = Classes/MetadataImporters/SBMetadataHelper.h; sourceTree = "<group>"; };
|
||||
A9C703111C05E08B00C89151 /* SBMetadataHelper.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBMetadataHelper.m; path = Classes/MetadataImporters/SBMetadataHelper.m; sourceTree = "<group>"; };
|
||||
A9C8182C0F74D6E300019BFF /* QuickTime.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuickTime.framework; path = /System/Library/Frameworks/QuickTime.framework; sourceTree = "<absolute>"; };
|
||||
A9C828F3195950C3004C4718 /* SBQueuePreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBQueuePreferences.h; path = Classes/SBQueuePreferences.h; sourceTree = "<group>"; };
|
||||
A9C828F4195950C3004C4718 /* SBQueuePreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueuePreferences.m; path = Classes/SBQueuePreferences.m; sourceTree = "<group>"; };
|
||||
@@ -260,6 +272,11 @@
|
||||
A9D47B5517B239E200900BCA /* EncodeCanceled@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "EncodeCanceled@2x.png"; path = "images/EncodeCanceled@2x.png"; sourceTree = "<group>"; };
|
||||
A9D47B5617B239E200900BCA /* EncodeComplete.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = EncodeComplete.png; path = images/EncodeComplete.png; sourceTree = "<group>"; };
|
||||
A9D47B5717B239E200900BCA /* EncodeComplete@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; name = "EncodeComplete@2x.png"; path = "images/EncodeComplete@2x.png"; sourceTree = "<group>"; };
|
||||
A9D4B8621C05BC61007845C4 /* SBChapterSearchController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterSearchController.h; path = Classes/SBChapterSearchController.h; sourceTree = "<group>"; };
|
||||
A9D4B8631C05BC61007845C4 /* SBChapterSearchController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterSearchController.m; path = Classes/SBChapterSearchController.m; sourceTree = "<group>"; };
|
||||
A9D4B8661C05BD04007845C4 /* English */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = English; path = English.lproj/SBChapterSearch.xib; sourceTree = "<group>"; };
|
||||
A9D4B8681C05CBEB007845C4 /* SBChapterResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterResult.h; path = Classes/MetadataImporters/SBChapterResult.h; sourceTree = "<group>"; };
|
||||
A9D4B8691C05CBEB007845C4 /* SBChapterResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterResult.m; path = Classes/MetadataImporters/SBChapterResult.m; sourceTree = "<group>"; };
|
||||
A9D73C5018BF3F1100C6FFA6 /* SBQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBQueue.h; path = Classes/SBQueue.h; sourceTree = "<group>"; };
|
||||
A9D73C5118BF3F1100C6FFA6 /* SBQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueue.m; path = Classes/SBQueue.m; sourceTree = "<group>"; };
|
||||
A9DA3B991B918D5C00F1E40C /* SBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBApplication.m; path = Classes/SBApplication.m; sourceTree = "<group>"; };
|
||||
@@ -517,6 +534,7 @@
|
||||
A9C055360F6D395B00AF15B5 /* FileImport.xib */,
|
||||
CD71FEA412F1B62600F0A98D /* MetadataSearch.xib */,
|
||||
CD4E6E5B12F744210095C84F /* ArtworkSelector.xib */,
|
||||
A9D4B8651C05BD04007845C4 /* SBChapterSearch.xib */,
|
||||
A961476513F568210068F161 /* Queue.xib */,
|
||||
A9EEA5F618D654B9008B54B4 /* QueueOptions.xib */,
|
||||
A9BC410618D9ABC000F8C92C /* QueueItem.xib */,
|
||||
@@ -562,6 +580,8 @@
|
||||
CD71FEA212F1B5AF00F0A98D /* SBMetadataSearchController.m */,
|
||||
CD56963012FAAD680029FADB /* SBArtworkSelector.h */,
|
||||
CD56963112FAAD680029FADB /* SBArtworkSelector.m */,
|
||||
A9D4B8621C05BC61007845C4 /* SBChapterSearchController.h */,
|
||||
A9D4B8631C05BC61007845C4 /* SBChapterSearchController.m */,
|
||||
A9FD5D150F3C692400817716 /* PropertyView */,
|
||||
);
|
||||
name = Document;
|
||||
@@ -637,6 +657,8 @@
|
||||
CD71FF1A12F1C46900F0A98D /* MetadataImporters */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
A9C703101C05E08B00C89151 /* SBMetadataHelper.h */,
|
||||
A9C703111C05E08B00C89151 /* SBMetadataHelper.m */,
|
||||
CD03087717576AE50093A0BE /* MetadataImporter.h */,
|
||||
CD03087817576AE50093A0BE /* MetadataImporter.m */,
|
||||
CDC06FCC1747494D003C1D0A /* iTunesStore.h */,
|
||||
@@ -645,6 +667,12 @@
|
||||
CD03087317576A550093A0BE /* TheMovieDB3.m */,
|
||||
CD71FF1B12F1C4A900F0A98D /* TheTVDB.h */,
|
||||
CD71FF1C12F1C4A900F0A98D /* TheTVDB.m */,
|
||||
A901C51C1C04F03F00430DC3 /* SBChapterImporter.h */,
|
||||
A901C51D1C04F03F00430DC3 /* SBChapterImporter.m */,
|
||||
A9D4B8681C05CBEB007845C4 /* SBChapterResult.h */,
|
||||
A9D4B8691C05CBEB007845C4 /* SBChapterResult.m */,
|
||||
A901C51A1C04F03F00430DC3 /* SBChapterDB.h */,
|
||||
A901C51B1C04F03F00430DC3 /* SBChapterDB.m */,
|
||||
);
|
||||
name = MetadataImporters;
|
||||
sourceTree = "<group>";
|
||||
@@ -791,6 +819,7 @@
|
||||
A975644F132A325C0051ED08 /* info-pressed.pdf in Resources */,
|
||||
A9BC410818D9ABC000F8C92C /* QueueItem.xib in Resources */,
|
||||
A9F284A0133C9F6E00F10951 /* close.pdf in Resources */,
|
||||
A9D4B8671C05BD04007845C4 /* SBChapterSearch.xib in Resources */,
|
||||
A9F284A1133C9F6E00F10951 /* close-over.pdf in Resources */,
|
||||
A998DABF1BA54CFF004D7969 /* SBMediaTagsController.xib in Resources */,
|
||||
A9F284A2133C9F6E00F10951 /* close-pressed.pdf in Resources */,
|
||||
@@ -843,6 +872,7 @@
|
||||
A9AB484917F0AEA2000AA72E /* SBAppDelegate.m in Sources */,
|
||||
A9B46A8C12B79B240040517A /* SBFileImport.m in Sources */,
|
||||
A9B46A8E12B79B240040517A /* SBPrefsController.m in Sources */,
|
||||
A9D4B86A1C05CBEB007845C4 /* SBChapterResult.m in Sources */,
|
||||
A9B46A8F12B79B240040517A /* SBTableView.m in Sources */,
|
||||
A9B46A9012B79B240040517A /* SBView.m in Sources */,
|
||||
A9B46A9E12B79B990040517A /* ButtonToolbarItem.m in Sources */,
|
||||
@@ -850,6 +880,7 @@
|
||||
A9AB485417F0AEAC000AA72E /* SBChapterViewController.m in Sources */,
|
||||
A9AB485817F0AEAC000AA72E /* SBVideoViewController.m in Sources */,
|
||||
A9B46ABF12B79D1C0040517A /* SBDocument.m in Sources */,
|
||||
A9C703121C05E08B00C89151 /* SBMetadataHelper.m in Sources */,
|
||||
CD71FEA312F1B5AF00F0A98D /* SBMetadataSearchController.m in Sources */,
|
||||
CD71FF1D12F1C4A900F0A98D /* TheTVDB.m in Sources */,
|
||||
A9C5FA6E19FA22590051F3FF /* SBLogWindowController.m in Sources */,
|
||||
@@ -858,14 +889,17 @@
|
||||
A9C828F5195950C3004C4718 /* SBQueuePreferences.m in Sources */,
|
||||
A9DA3B9C1B918D5C00F1E40C /* SBApplication.m in Sources */,
|
||||
CD56963212FAAD680029FADB /* SBArtworkSelector.m in Sources */,
|
||||
A901C51E1C04F03F00430DC3 /* SBChapterDB.m in Sources */,
|
||||
A961476313F567E10068F161 /* SBQueueController.m in Sources */,
|
||||
A961476413F567E10068F161 /* SBPresetManager.m in Sources */,
|
||||
A95688AA1B91B11B004456A6 /* NSMutableArray+Subscript.m in Sources */,
|
||||
A901C51F1C04F03F00430DC3 /* SBChapterImporter.m in Sources */,
|
||||
A95688AB1B91B11B004456A6 /* NSMutableDictionary+Subscript.m in Sources */,
|
||||
A982D0C0140AB66400B92357 /* SBQueueItem.m in Sources */,
|
||||
A9AF6A7518D0496400FAAB08 /* SBQueueAction.m in Sources */,
|
||||
CDC06FCE1747494D003C1D0A /* iTunesStore.m in Sources */,
|
||||
A917286119FD288B00348DF8 /* SBLogger.m in Sources */,
|
||||
A9D4B8641C05BC61007845C4 /* SBChapterSearchController.m in Sources */,
|
||||
CD03087417576A550093A0BE /* TheMovieDB3.m in Sources */,
|
||||
A9EEA5F218D65490008B54B4 /* SBOptionsViewController.m in Sources */,
|
||||
CD03087917576AE50093A0BE /* MetadataImporter.m in Sources */,
|
||||
@@ -1019,6 +1053,14 @@
|
||||
name = SBLogWindow.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9D4B8651C05BD04007845C4 /* SBChapterSearch.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
A9D4B8661C05BD04007845C4 /* English */,
|
||||
);
|
||||
name = SBChapterSearch.xib;
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
A9DA3BA11B918D6F00F1E40C /* ExceptionAlert.xib */ = {
|
||||
isa = PBXVariantGroup;
|
||||
children = (
|
||||
|
||||
Reference in new issue
Block a user