From c44e74d193210fe8bcf016128f1bd16b4f120e6c Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Tue, 1 Aug 2017 11:05:31 +0200 Subject: [PATCH] Switch to the Swift chapter importer. --- Classes/AttributedStyles.swift | 78 ++++ Classes/ChapterSearchController.swift | 209 +++++++++- Classes/MetadataImporters/ChapterDB.swift | 8 +- Classes/MetadataImporters/SBChapterDB.h | 14 - Classes/MetadataImporters/SBChapterDB.m | 165 -------- Classes/MetadataImporters/SBChapterImporter.h | 29 -- Classes/MetadataImporters/SBChapterImporter.m | 43 --- Classes/MetadataImporters/SBChapterResult.h | 35 -- Classes/MetadataImporters/SBChapterResult.m | 31 -- Classes/SBChapterSearchController.h | 26 -- Classes/SBChapterSearchController.m | 365 ------------------ Classes/SBDocument.m | 10 +- Subler.xcodeproj/project.pbxproj | 28 +- 13 files changed, 297 insertions(+), 744 deletions(-) create mode 100644 Classes/AttributedStyles.swift delete mode 100644 Classes/MetadataImporters/SBChapterDB.h delete mode 100644 Classes/MetadataImporters/SBChapterDB.m delete mode 100644 Classes/MetadataImporters/SBChapterImporter.h delete mode 100644 Classes/MetadataImporters/SBChapterImporter.m delete mode 100644 Classes/MetadataImporters/SBChapterResult.h delete mode 100644 Classes/MetadataImporters/SBChapterResult.m delete mode 100644 Classes/SBChapterSearchController.h delete mode 100644 Classes/SBChapterSearchController.m diff --git a/Classes/AttributedStyles.swift b/Classes/AttributedStyles.swift new file mode 100644 index 0000000..ad66a2f --- /dev/null +++ b/Classes/AttributedStyles.swift @@ -0,0 +1,78 @@ +// +// AttributedStyles.swift +// Subler +// +// Created by Damiano Galassi on 01/08/2017. +// + +import Cocoa + +// MARK: - Attributed styles + +private let detailBoldMonospacedAttr = { () -> [NSAttributedStringKey : Any] in + let ps = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + ps.headIndent = -10.0 + ps.alignment = NSTextAlignment.right + + if #available(macOS 10.11, *) { + return [NSAttributedStringKey.font: NSFont.monospacedDigitSystemFont(ofSize: NSFont.smallSystemFontSize, + weight: NSFont.Weight.bold), + NSAttributedStringKey.paragraphStyle: ps, + NSAttributedStringKey.foregroundColor: NSColor.gray] + } + else { + return [NSAttributedStringKey.font: NSFont.boldSystemFont(ofSize: NSFont.smallSystemFontSize), + NSAttributedStringKey.paragraphStyle: ps, + NSAttributedStringKey.foregroundColor: NSColor.gray] + } +}() + +private let detailBoldAttr = { () -> [NSAttributedStringKey : Any] in + let ps = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + ps.headIndent = -10.0 + ps.alignment = NSTextAlignment.left + + if #available(macOS 10.11, *) { + return [NSAttributedStringKey.font: NSFont.monospacedDigitSystemFont(ofSize: NSFont.smallSystemFontSize, + weight: NSFont.Weight.bold), + NSAttributedStringKey.paragraphStyle: ps, + NSAttributedStringKey.foregroundColor: NSColor.gray] + } + else { + return [NSAttributedStringKey.font: NSFont.boldSystemFont(ofSize: NSFont.smallSystemFontSize), + NSAttributedStringKey.paragraphStyle: ps, + NSAttributedStringKey.foregroundColor: NSColor.gray] + } +}() + +private let detailMonospacedAttr = { () -> [NSAttributedStringKey : Any] in + let ps = NSParagraphStyle.default.mutableCopy() as! NSMutableParagraphStyle + ps.headIndent = -10.0 + ps.alignment = NSTextAlignment.right + + if #available(macOS 10.11, *) { + return [NSAttributedStringKey.font: NSFont.monospacedDigitSystemFont(ofSize: NSFont.smallSystemFontSize, + weight: NSFont.Weight.regular), + NSAttributedStringKey.paragraphStyle: ps] + } + else { + return [NSAttributedStringKey.font: NSFont.boldSystemFont(ofSize: NSFont.smallSystemFontSize), + NSAttributedStringKey.paragraphStyle: ps] + } +}() + +extension String { + + func boldAttributedString() -> NSAttributedString { + return NSAttributedString(string: self, attributes: detailBoldAttr) + } + + func boldMonospacedAttributedString() -> NSAttributedString { + return NSAttributedString(string: self, attributes: detailBoldMonospacedAttr) + } + + func monospacedAttributedString() -> NSAttributedString { + return NSAttributedString(string: self, attributes: detailMonospacedAttr) + } + +} diff --git a/Classes/ChapterSearchController.swift b/Classes/ChapterSearchController.swift index ecfa843..c7bfa89 100644 --- a/Classes/ChapterSearchController.swift +++ b/Classes/ChapterSearchController.swift @@ -7,12 +7,215 @@ import Cocoa -class ChapterSearchController: NSWindowController { + +@objc protocol ChapterSearchControllerDelegate { + func chapterImportDone(chaptersToBeImported: [MP42TextSample]) +} + +@objc class ChapterSearchController: NSWindowController, NSTableViewDataSource, NSTableViewDelegate { + + @IBOutlet var searchTitle: NSTextField! + + @IBOutlet var resultsTable: NSTableView! + @IBOutlet var chapterTable: NSTableView! + + @IBOutlet var searchButton: NSButton! + @IBOutlet var addButton: NSButton! + + @IBOutlet var progress: NSProgressIndicator! + @IBOutlet var progressText: NSTextField! + + private enum ChapterSearchState { + case none + case searching(task: MetadataSearchTask) + case completed(results: [ChapterResult]) + case closing + } + + private let delegate: ChapterSearchControllerDelegate + private let duration: UInt64 + private var searchTerm: String + private var state: ChapterSearchState + private var selectedResult: ChapterResult? + + @objc init(delegate: ChapterSearchControllerDelegate, filename: String, duration: UInt64) { + if let info = filename.parsedAsFilename() { + switch info { + + case .movie(let title): + searchTerm = title + case .tvShow(_, _, _): + searchTerm = filename + } + } + else { + searchTerm = "" + } + + self.delegate = delegate + self.duration = duration + self.state = .none + + super.init(window: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + override var windowNibName: NSNib.Name? { + return NSNib.Name(rawValue: "SBChapterSearch") + } override func windowDidLoad() { super.windowDidLoad() - - // Implement this method to handle any initialization after your window controller's window has been loaded from its nib file. + self.window?.makeFirstResponder(self.searchTitle) + updateUI() + } + + private func searchDone(results: [ChapterResult]) { + DispatchQueue.main.async { + self.state = .completed(results: results) + self.updateUI() + } + } + + @IBAction func searchForResults(_ sender: Any) { + switch state { + case .none: + break + case .searching(let task): + task.cancel() + case .completed(_): + break + case .closing: + return + } + + let task = ChapterSearch.movieSeach(service: ChapterDB(), title: searchTitle.stringValue, duration: duration).search(completionHandler: searchDone) + state = .searching(task: task) + _ = task.runAsync() + updateUI() + } + + @IBAction func addChapter(_ sender: Any) { + if let chapters = selectedResult?.chapters { + var textChapters: [MP42TextSample] = Array() + for chapter in chapters { + let sample = MP42TextSample() + sample.timestamp = chapter.timestamp + sample.title = chapter.name + textChapters.append(sample) + } + delegate.chapterImportDone(chaptersToBeImported: textChapters) + } + self.window?.sheetParent?.endSheet(self.window!, returnCode: NSApplication.ModalResponse.OK) + } + + @IBAction func closeWindow(_ sender: Any) { + self.window?.sheetParent?.endSheet(self.window!, returnCode: NSApplication.ModalResponse.cancel) + } + + // MARK - UI state + + private func updateUI() { + switch state { + case .none: + searchButton.isEnabled = true; + searchButton.keyEquivalent = "\r"; + case .searching(_): + progress.startAnimation(self) + progress.isHidden = false + progressText.stringValue = NSLocalizedString("Searching for chapter information…", comment: "ChapterDB") + progressText.isHidden = false + resultsTable.isEnabled = false + chapterTable.isEnabled = false + resultsTable.reloadData() + case .completed(let results): + if results.count > 0 { + addButton.isEnabled = true + addButton.keyEquivalent = "\r" + searchButton.keyEquivalent = "" + } + else { + searchButton.keyEquivalent = "\r"; + addButton.isEnabled = false + addButton.keyEquivalent = "" + } + progress.stopAnimation(self) + progress.isHidden = true + progressText.isHidden = true + resultsTable.isEnabled = true + chapterTable.isEnabled = true + resultsTable.reloadData() + case .closing: + return + } + } + + // MARK: - Table View + + func tableViewSelectionDidChange(_ notification: Notification) { + if notification.object as? NSTableView == resultsTable { + switch state { + case .none, .searching, .closing: + selectedResult = nil + case .completed(let results): + selectedResult = results[resultsTable.selectedRow] + chapterTable.reloadData() + } + } + } + + func numberOfRows(in tableView: NSTableView) -> Int { + if tableView == resultsTable { + switch state { + case .completed(let results): + return results.count + default: + return 0 + } + } + else if tableView == chapterTable, let result = selectedResult { + return result.chapters.count + } + return 0 + } + + func tableView(_ tableView: NSTableView, objectValueFor tableColumn: NSTableColumn?, row: Int) -> Any? { + if tableView == resultsTable { + switch state { + case .completed(let results): + let result = results[row] + + if tableColumn?.identifier.rawValue == "title" { + return result.title + } + else if tableColumn?.identifier.rawValue == "chaptercount" { + return "\(result.chapters.count)".monospacedAttributedString() + } + else if tableColumn?.identifier.rawValue == "duration" { + return StringFromTime(Int64(result.duration), 1000).monospacedAttributedString() + } + else if tableColumn?.identifier.rawValue == "confirmations" { + return NSNumber(value: result.confimations) + } + default: + return 0 + } + } + else if tableView == chapterTable, let result = selectedResult { + let chapter = result.chapters[row] + + if tableColumn?.identifier.rawValue == "time" { + return StringFromTime(Int64(chapter.timestamp), 1000).monospacedAttributedString() + } + else if tableColumn?.identifier.rawValue == "name" { + return chapter.name + } + + } + return nil } } diff --git a/Classes/MetadataImporters/ChapterDB.swift b/Classes/MetadataImporters/ChapterDB.swift index b71f520..02a5463 100644 --- a/Classes/MetadataImporters/ChapterDB.swift +++ b/Classes/MetadataImporters/ChapterDB.swift @@ -7,16 +7,16 @@ import Foundation -class ChapterDB : ChapterService { +public struct ChapterDB : ChapterService { - func search(title: String, duration: UInt64) -> [ChapterResult] { + public func search(title: String, duration: UInt64) -> [ChapterResult] { guard let url = URL(string: "http://www.chapterdb.org/chapters/search?title=\(title.urlEncoded())"), let data = fetch(url: url) else { return [] } - let delta: UInt64 = 10000 - return parse(data: data).filter { $0.duration < (duration + delta) && $0.duration > (duration - delta) } + let delta: Int64 = 10000 + return parse(data: data).filter { $0.duration < (Int64(duration) + delta) && $0.duration > (Int64(duration) - delta) } } private func fetch(url: URL) -> Data? { diff --git a/Classes/MetadataImporters/SBChapterDB.h b/Classes/MetadataImporters/SBChapterDB.h deleted file mode 100644 index 5e69d14..0000000 --- a/Classes/MetadataImporters/SBChapterDB.h +++ /dev/null @@ -1,14 +0,0 @@ -// -// SBChapterDB.h -// Subler -// -// Created by Damiano Galassi on 25/11/15. -// -// - -#import -#import "SBChapterImporter.h" - -@interface SBChapterDB : SBChapterImporter - -@end diff --git a/Classes/MetadataImporters/SBChapterDB.m b/Classes/MetadataImporters/SBChapterDB.m deleted file mode 100644 index 3e53e36..0000000 --- a/Classes/MetadataImporters/SBChapterDB.m +++ /dev/null @@ -1,165 +0,0 @@ -// -// SBChapterDB.m -// Subler -// -// Created by Damiano Galassi on 25/11/15. -// -// - -#import "SBChapterDB.h" -#import "SBChapterResult.h" - -#import -#import - -#define API_KEY @"ETET7TXFJH45YNYW0I4A" - -@interface SBChapterDB () - -@property (nonatomic, readwrite) NSURLSessionTask *task; - -@end - -@implementation SBChapterDB - -- (void)searchTitle:(NSString *)title language:(nullable NSString *)language duration:(NSUInteger)duration completionHandler:(void(^)(NSArray *results))handler -{ - NSURL *url = [NSURL URLWithString:[NSString stringWithFormat:@"http://www.chapterdb.org/chapters/search?title=%@", [SBMetadataHelper urlEncoded:title]]]; - - NSDictionary *headerOptions = @{@"ApiKey" : API_KEY}; - self.task = [SBMetadataHelper sessionTaskFromUrl:url HTTPMethod:@"GET" HTTPBody:nil headerOptions:headerOptions cachePolicy:NSURLRequestUseProtocolCachePolicy completionHandler:^(NSData * _Nullable data) { - NSXMLDocument *xml = [[NSXMLDocument alloc] initWithData:data - options:0 - error:NULL]; - - NSMutableArray *resultsArray = [[NSMutableArray alloc] init]; - - if (xml) { - NSArray *children = [xml nodesForXPath:@"//*:chapterInfo" error:nil]; - - for (NSXMLNode *child in children) { - SBChapterResult *result = [self parseResult:child]; - if (result) { - [resultsArray addObject:result]; - } - } - } - - if (duration > 0) { - NSArray *filteredArray = [self filterArray:resultsArray byDuration:duration delta:10000]; - if (filteredArray.count) { - handler(filteredArray); - return; - } - } - - handler(resultsArray); - - }]; - - [self.task resume]; -} - -- (void)cancel; -{ - [self.task cancel]; -} - -/** - * 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 *)filterArray:(NSArray *)array byDuration:(NSUInteger)duration delta:(NSUInteger)delta -{ - NSMutableArray *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 *tag = [node nodesForXPath:@"./*:title" error:NULL]; - return tag.firstObject.stringValue; -} - -- (NSUInteger)confirmationsForNode:(NSXMLNode *)node -{ - NSArray *tag = [node nodesForXPath:@"./@confirmations" error:NULL]; - return tag.firstObject.stringValue.integerValue; -} - -- (NSUInteger)durationForNode:(NSXMLNode *)node -{ - NSArray *tag = [node nodesForXPath:@"./*:source/*:duration" error:NULL]; - NSString *durationString = tag.firstObject.stringValue; - if (durationString) { - return (NSUInteger)TimeFromString(durationString, 1000); - } - return 0; -} - -- (SBChapterResult *)parseResult:(NSXMLNode *)child -{ - NSString *title = [self titleForNode:child]; - NSUInteger confirmations = [self confirmationsForNode:child]; - NSUInteger duration = [self durationForNode:child]; - - NSArray *times = [child nodesForXPath:@"./*:chapters/*:chapter/@time" error:NULL]; - NSArray *names = [child nodesForXPath:@"./*:chapters/*:chapter/@name" error:NULL]; - - MP42Duration currentTime = 0; - - if (title && times && names) { - - NSMutableArray *chapters = [NSMutableArray array]; - - for (NSInteger i = 0; i < times.count && i < names.count; i++) { - - NSString *name = names[i].stringValue; - NSString *timestamp = times[i].stringValue; - - if (name && timestamp) { - MP42Duration time = TimeFromString(timestamp, 1000); - - if (time < currentTime) { - break; - } - else { - currentTime = time; - } - - MP42TextSample *chapter = [[MP42TextSample alloc] init]; - chapter.title = name; - chapter.timestamp = time; - - [chapters addObject:chapter]; - } - } - - if (chapters.count) { - SBChapterResult *result = [[SBChapterResult alloc] initWithTitle:title - duration:duration - confirmations:confirmations - chapters:chapters]; - - return result; - } - } - - return nil; -} - -@end diff --git a/Classes/MetadataImporters/SBChapterImporter.h b/Classes/MetadataImporters/SBChapterImporter.h deleted file mode 100644 index 3e9945b..0000000 --- a/Classes/MetadataImporters/SBChapterImporter.h +++ /dev/null @@ -1,29 +0,0 @@ -// -// SBChapterImporter.h -// Subler -// -// Created by Michael Hueber on 21.11.15. -// -// - -#import -#import "SBMetadataHelper.h" - -@class SBChapterResult; - -NS_ASSUME_NONNULL_BEGIN - -@interface SBChapterImporter : NSObject - -+ (NSString *)defaultProvider; - -+ (nullable instancetype)importerForProvider:(NSString *)providerName; - -#pragma mark Methods to be overridden - -- (void)searchTitle:(NSString *)title language:(nullable NSString *)language duration:(NSUInteger)duration completionHandler:(void(^)(NSArray *results))handler; -- (void)cancel; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Classes/MetadataImporters/SBChapterImporter.m b/Classes/MetadataImporters/SBChapterImporter.m deleted file mode 100644 index 0851611..0000000 --- a/Classes/MetadataImporters/SBChapterImporter.m +++ /dev/null @@ -1,43 +0,0 @@ -// -// SBChapterImporter.m -// Subler -// -// Created by Michael Hueber on 21.11.15. -// -// - -#import "SBChapterImporter.h" -#import - -#import "SBChapterDB.h" - -@implementation SBChapterImporter - -+ (NSString *)defaultProvider -{ - return @"ChapterDB"; -} - -+ (nullable instancetype)importerForProvider:(NSString *)aProvider -{ - if ([aProvider isEqualToString:@"ChapterDB"]) { - return [[SBChapterDB alloc] init]; - } - return nil; -} - -- (void)searchTitle:(NSString *)title language:(nullable NSString *)language duration:(NSUInteger)duration completionHandler:(void(^)(NSArray *results))handler -{ - @throw [NSException exceptionWithName:NSInternalInconsistencyException - reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] - userInfo:nil]; -} - -- (void)cancel -{ - @throw [NSException exceptionWithName:NSInternalInconsistencyException - reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)] - userInfo:nil]; -} - -@end diff --git a/Classes/MetadataImporters/SBChapterResult.h b/Classes/MetadataImporters/SBChapterResult.h deleted file mode 100644 index 62368c5..0000000 --- a/Classes/MetadataImporters/SBChapterResult.h +++ /dev/null @@ -1,35 +0,0 @@ -// -// SBChapterResult.h -// Subler -// -// Created by Damiano Galassi on 25/11/15. -// -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@class MP42TextSample; - -@interface SBChapterResult : NSObject { -@private - NSString *_title; - NSUInteger _duration; - NSUInteger _confirmations; - - NSArray *_chapters; -} - -- (instancetype)init NS_UNAVAILABLE; -- (instancetype)initWithTitle:(NSString *)title duration:(NSUInteger)duration confirmations:(NSUInteger)confirmations chapters:(NSArray *)chapters NS_DESIGNATED_INITIALIZER; - -@property (nonatomic, readonly) NSString *title; -@property (nonatomic, readonly) NSUInteger duration; -@property (nonatomic, readonly) NSUInteger confirmations; - -@property (nonatomic, readonly) NSArray *chapters; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Classes/MetadataImporters/SBChapterResult.m b/Classes/MetadataImporters/SBChapterResult.m deleted file mode 100644 index 5cbd9fb..0000000 --- a/Classes/MetadataImporters/SBChapterResult.m +++ /dev/null @@ -1,31 +0,0 @@ -// -// 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 *)chapters -{ - self = [super init]; - if (self) { - _title = [title copy]; - _duration = duration; - _confirmations = confirmations; - _chapters = [chapters copy]; - } - return self; -} - -@end diff --git a/Classes/SBChapterSearchController.h b/Classes/SBChapterSearchController.h deleted file mode 100644 index 63911d3..0000000 --- a/Classes/SBChapterSearchController.h +++ /dev/null @@ -1,26 +0,0 @@ -// -// SBChapterSearchController.h -// Subler -// -// Created by Michael Hueber on 20.11.15. -// -// - -#import -#import - -NS_ASSUME_NONNULL_BEGIN - -@protocol SBChapterSearchControllerDelegate - -- (void)chapterImportDone:(NSArray *)chaptersToBeImported; - -@end - -@interface SBChapterSearchController : NSWindowController - -- (instancetype)initWithDelegate:(id )del searchTitle:(NSString *)title andDuration:(NSUInteger)duration; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Classes/SBChapterSearchController.m b/Classes/SBChapterSearchController.m deleted file mode 100644 index 112c274..0000000 --- a/Classes/SBChapterSearchController.m +++ /dev/null @@ -1,365 +0,0 @@ -// -// SBChapterSearchController.m -// Subler -// -// Created by Michael Hueber on 20.11.15. -// -// - -#import "SBChapterSearchController.h" - -#import - -#import "SBTableView.h" -#import "SBChapterImporter.h" -#import "SBChapterResult.h" - -@interface SBChapterSearchController () -{ - id delegate; - - NSString *_searchString; - NSUInteger _searchDuration; - - NSDictionary *_detailBoldAttr; - NSDictionary *_detailBoldMonospacedAttr; - NSDictionary *_detailMonospacedAttr; - - IBOutlet NSTextField *searchTitle; - - IBOutlet NSTableView *resultsTable; - IBOutlet SBTableView *chapterTable; - - - IBOutlet NSButton *searchButton; - IBOutlet NSButton *addButton; - - IBOutlet NSProgressIndicator *progress; - IBOutlet NSTextField *progressText; -} - -@property (nonatomic, readwrite, strong) SBChapterImporter *currentSearcher; -@property (nonatomic, readwrite, strong) NSArray *resultsArray; -@property (nonatomic, readwrite, strong) NSArray *selectedChaptersArray; - -@end - -@implementation SBChapterSearchController - -- (instancetype)initWithDelegate:(id )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]; - ps.headIndent = -10.0; - ps.alignment = NSTextAlignmentRight; - - if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { - _detailBoldMonospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold], - NSParagraphStyleAttributeName: ps, - NSForegroundColorAttributeName: [NSColor grayColor]}; - } - else { - _detailBoldMonospacedAttr = @{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]], - NSParagraphStyleAttributeName: ps, - NSForegroundColorAttributeName: [NSColor grayColor]}; - } - - NSMutableParagraphStyle *psL = [[NSParagraphStyle defaultParagraphStyle] mutableCopy]; - psL.headIndent = -10.0; - psL.alignment = NSTextAlignmentLeft; - - if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { - _detailBoldAttr = @{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightBold], - NSParagraphStyleAttributeName: psL, - NSForegroundColorAttributeName: [NSColor grayColor]}; - } - else { - _detailBoldAttr = @{NSFontAttributeName: [NSFont boldSystemFontOfSize:[NSFont smallSystemFontSize]], - NSParagraphStyleAttributeName: ps, - NSForegroundColorAttributeName: [NSColor grayColor]}; - } - - if ([[NSFont class] respondsToSelector:@selector(monospacedDigitSystemFontOfSize:weight:)]) { - _detailMonospacedAttr = @{NSFontAttributeName: [NSFont monospacedDigitSystemFontOfSize:[NSFont smallSystemFontSize] weight:NSFontWeightRegular], - NSParagraphStyleAttributeName: ps}; - } - else { - _detailMonospacedAttr = @{NSFontAttributeName: [NSFont systemFontOfSize:[NSFont smallSystemFontSize]], - NSParagraphStyleAttributeName: ps}; - } -} - -- (void)windowDidLoad { - [super windowDidLoad]; - - [self.window makeFirstResponder:searchTitle]; - - if (_searchString) { - NSDictionary *parsed = [SBMetadataHelper parseFilename:_searchString]; - if (parsed) { - if ([@"movie" isEqualToString:parsed[@"type"]]) { - if (parsed[@"title"]) { - searchTitle.stringValue = [parsed valueForKey:@"title"]; - } - } - else if ([@"tv" isEqualToString:parsed[@"type"]]) { - searchTitle.stringValue = _searchString.stringByDeletingPathExtension; - } - - [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 - language:nil - duration:_searchDuration - completionHandler:^(NSArray *results) { - dispatch_async(dispatch_get_main_queue(), ^{ - [self searchForResultsDone:results]; - }); - }]; - } - else { - // Nothing to search, reset the table view - self.resultsArray = nil; - self.selectedChaptersArray = nil; - [resultsTable reloadData]; - [chapterTable reloadData]; - } -} - -- (void)searchForResultsDone:(NSArray *)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]; - - [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseOK]; -} - -- (IBAction)closeWindow:(id)sender -{ - [resultsTable setDelegate:nil]; - [resultsTable setDataSource:nil]; - - [self.window.sheetParent endSheet:self.window returnCode:NSModalResponseCancel]; -} - -#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]; - } - return [[NSAttributedString alloc] initWithString:string attributes:_detailBoldAttr]; -} - -- (NSAttributedString *)monospacedString:(NSString *)string -{ - return [[NSAttributedString alloc] initWithString:string attributes:_detailMonospacedAttr]; - -} - -#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 @(result.confirmations); - } - } - } - 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]]; - [highlightedString addAttribute:NSForegroundColorAttributeName value:[NSColor blackColor] range:NSMakeRange(0, highlightedString.length)]; - [cell setAttributedStringValue:highlightedString]; - - [cell setTextColor:[NSColor blackColor]]; - } else { - [cell setTextColor:[NSColor grayColor]]; - } - } -} - -@end diff --git a/Classes/SBDocument.m b/Classes/SBDocument.m index 82af71b..5a17820 100644 --- a/Classes/SBDocument.m +++ b/Classes/SBDocument.m @@ -26,8 +26,6 @@ #import "SBMetadataResult.h" #import "SBMetadataResultMap.h" -#import "SBChapterSearchController.h" - #import #import #import @@ -35,9 +33,11 @@ #import +#import "Subler-Swift.h" + #define SublerTableViewDataType @"SublerTableViewDataType" -@interface SBDocument () +@interface SBDocument () { IBOutlet NSSplitView *splitView; @@ -904,13 +904,13 @@ static NSDictionary *_detailMonospacedAttr; NSUInteger duration = self.mp4.duration; - self.sheetController = [[SBChapterSearchController alloc] initWithDelegate:self searchTitle:title andDuration:duration]; + self.sheetController = [[ChapterSearchController alloc] initWithDelegate:self filename:title duration:duration]; [self.documentWindow beginSheet:self.sheetController.window completionHandler:^(NSModalResponse returnCode) { self.sheetController = nil; }]; } -- (void)chapterImportDone:(NSArray *)chapterToBeImported +- (void)chapterImportDoneWithChaptersToBeImported:(NSArray *)chapterToBeImported { if (chapterToBeImported) { diff --git a/Subler.xcodeproj/project.pbxproj b/Subler.xcodeproj/project.pbxproj index 8ff0e3e..b8be940 100644 --- a/Subler.xcodeproj/project.pbxproj +++ b/Subler.xcodeproj/project.pbxproj @@ -14,8 +14,6 @@ 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 */; }; A902E1D51F29DD8900D73C17 /* SBMetadataImporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A902E1D41F29DD8900D73C17 /* SBMetadataImporter.swift */; }; A90300C41DAE6E27008237D8 /* SBSetPrefsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A90300C21DAE6E27008237D8 /* SBSetPrefsViewController.m */; }; A90300C81DAE72C4008237D8 /* SBSetPrefsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A90300CA1DAE72C4008237D8 /* SBSetPrefsViewController.xib */; }; @@ -53,6 +51,7 @@ A998DABF1BA54CFF004D7969 /* SBMediaTagsController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A998DABD1BA54CFF004D7969 /* SBMediaTagsController.xib */; }; A99EEA3F12B801AE002367D3 /* SBDocument.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9B46AC012B79E230040517A /* SBDocument.xib */; }; A9A0542E1DEEC3E000D1AFA4 /* SBLanguageTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = A9A0542D1DEEC3E000D1AFA4 /* SBLanguageTransformer.m */; }; + A9A77C4E1F306FA70018023B /* AttributedStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A77C4D1F306FA70018023B /* AttributedStyles.swift */; }; A9A8CEF91E43754400BC2AE1 /* SBQueueScriptCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A9A8CEF81E43754400BC2AE1 /* SBQueueScriptCommand.m */; }; A9AB484917F0AEA2000AA72E /* SBAppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AB484817F0AEA2000AA72E /* SBAppDelegate.m */; }; A9AB485417F0AEAC000AA72E /* SBChapterViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AB484B17F0AEAC000AA72E /* SBChapterViewController.m */; }; @@ -86,9 +85,7 @@ A9C703121C05E08B00C89151 /* SBMetadataHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C703111C05E08B00C89151 /* SBMetadataHelper.m */; }; A9C828F5195950C3004C4718 /* SBQueuePreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C828F4195950C3004C4718 /* SBQueuePreferences.m */; }; A9CBAB1E1F29C083001C26B3 /* MetadataImporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CBAB1D1F29C083001C26B3 /* MetadataImporter.swift */; }; - 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 */; }; @@ -178,10 +175,6 @@ 8D15AC360486D014006FF6A4 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 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 = ""; }; - A901C51A1C04F03F00430DC3 /* SBChapterDB.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterDB.h; path = Classes/MetadataImporters/SBChapterDB.h; sourceTree = ""; }; - A901C51B1C04F03F00430DC3 /* SBChapterDB.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterDB.m; path = Classes/MetadataImporters/SBChapterDB.m; sourceTree = ""; }; - A901C51C1C04F03F00430DC3 /* SBChapterImporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterImporter.h; path = Classes/MetadataImporters/SBChapterImporter.h; sourceTree = ""; }; - A901C51D1C04F03F00430DC3 /* SBChapterImporter.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterImporter.m; path = Classes/MetadataImporters/SBChapterImporter.m; sourceTree = ""; }; A902E1D41F29DD8900D73C17 /* SBMetadataImporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SBMetadataImporter.swift; path = Classes/MetadataImporters/SBMetadataImporter.swift; sourceTree = ""; }; A90300C11DAE6E27008237D8 /* SBSetPrefsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBSetPrefsViewController.h; path = Classes/SBSetPrefsViewController.h; sourceTree = ""; }; A90300C21DAE6E27008237D8 /* SBSetPrefsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBSetPrefsViewController.m; path = Classes/SBSetPrefsViewController.m; sourceTree = ""; }; @@ -249,6 +242,7 @@ A99189D01F2F88F700623ED7 /* ChapterSearchController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChapterSearchController.swift; path = Classes/ChapterSearchController.swift; sourceTree = ""; }; A9A0542C1DEEC3E000D1AFA4 /* SBLanguageTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBLanguageTransformer.h; path = Classes/SBLanguageTransformer.h; sourceTree = ""; }; A9A0542D1DEEC3E000D1AFA4 /* SBLanguageTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBLanguageTransformer.m; path = Classes/SBLanguageTransformer.m; sourceTree = ""; }; + A9A77C4D1F306FA70018023B /* AttributedStyles.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AttributedStyles.swift; path = Classes/AttributedStyles.swift; sourceTree = ""; }; A9A8CEF71E43754400BC2AE1 /* SBQueueScriptCommand.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBQueueScriptCommand.h; path = Classes/SBQueueScriptCommand.h; sourceTree = ""; }; A9A8CEF81E43754400BC2AE1 /* SBQueueScriptCommand.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueueScriptCommand.m; path = Classes/SBQueueScriptCommand.m; sourceTree = ""; }; A9AB484717F0AEA2000AA72E /* SBAppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBAppDelegate.h; path = Classes/SBAppDelegate.h; sourceTree = ""; }; @@ -320,10 +314,6 @@ A9C828F3195950C3004C4718 /* SBQueuePreferences.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBQueuePreferences.h; path = Classes/SBQueuePreferences.h; sourceTree = ""; }; A9C828F4195950C3004C4718 /* SBQueuePreferences.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueuePreferences.m; path = Classes/SBQueuePreferences.m; sourceTree = ""; }; A9CBAB1D1F29C083001C26B3 /* MetadataImporter.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MetadataImporter.swift; path = Classes/MetadataImporters/MetadataImporter.swift; sourceTree = ""; }; - A9D4B8621C05BC61007845C4 /* SBChapterSearchController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterSearchController.h; path = Classes/SBChapterSearchController.h; sourceTree = ""; }; - A9D4B8631C05BC61007845C4 /* SBChapterSearchController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterSearchController.m; path = Classes/SBChapterSearchController.m; sourceTree = ""; }; - A9D4B8681C05CBEB007845C4 /* SBChapterResult.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBChapterResult.h; path = Classes/MetadataImporters/SBChapterResult.h; sourceTree = ""; }; - A9D4B8691C05CBEB007845C4 /* SBChapterResult.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBChapterResult.m; path = Classes/MetadataImporters/SBChapterResult.m; sourceTree = ""; }; A9D73C5018BF3F1100C6FFA6 /* SBQueue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBQueue.h; path = Classes/SBQueue.h; sourceTree = ""; }; A9D73C5118BF3F1100C6FFA6 /* SBQueue.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBQueue.m; path = Classes/SBQueue.m; sourceTree = ""; }; A9DA3B991B918D5C00F1E40C /* SBApplication.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBApplication.m; path = Classes/SBApplication.m; sourceTree = ""; }; @@ -624,8 +614,7 @@ CD56963012FAAD680029FADB /* SBArtworkSelector.h */, CD56963112FAAD680029FADB /* SBArtworkSelector.m */, A99189D01F2F88F700623ED7 /* ChapterSearchController.swift */, - A9D4B8621C05BC61007845C4 /* SBChapterSearchController.h */, - A9D4B8631C05BC61007845C4 /* SBChapterSearchController.m */, + A9A77C4D1F306FA70018023B /* AttributedStyles.swift */, A909440E1DD4C85B00E9F89C /* Table View */, A9FD5D150F3C692400817716 /* PropertyView */, ); @@ -677,15 +666,9 @@ A98D98471F02820F00A77ABC /* TheMovieDBService.swift */, A9B514181EFC12310055A035 /* TheTVDB.swift */, A9FC6FF51EF2E3280034CCED /* TheTVDBService.swift */, - A901C51C1C04F03F00430DC3 /* SBChapterImporter.h */, - A901C51D1C04F03F00430DC3 /* SBChapterImporter.m */, - A9D4B8681C05CBEB007845C4 /* SBChapterResult.h */, A99189CC1F2F87EC00623ED7 /* ChapterImporter.swift */, A9433A8C1F2F5C3600BB38CA /* ChapterResult.swift */, A9433A901F2F5D8A00BB38CA /* ChapterDB.swift */, - A9D4B8691C05CBEB007845C4 /* SBChapterResult.m */, - A901C51A1C04F03F00430DC3 /* SBChapterDB.h */, - A901C51B1C04F03F00430DC3 /* SBChapterDB.m */, ); name = MetadataImporters; sourceTree = ""; @@ -869,7 +852,6 @@ A93DD7681DACCE930052749A /* SBComboBoxCellView.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 */, @@ -892,11 +874,9 @@ CD56963212FAAD680029FADB /* SBArtworkSelector.m in Sources */, A9CBAB1E1F29C083001C26B3 /* MetadataImporter.swift in Sources */, A9FC6FF61EF2E3280034CCED /* TheTVDBService.swift in Sources */, - A901C51E1C04F03F00430DC3 /* SBChapterDB.m in Sources */, 61CEC0D31E756ADA000FECC1 /* SBMultiSelectViewController.m in Sources */, A961476313F567E10068F161 /* SBQueueController.m in Sources */, A961476413F567E10068F161 /* SBPresetManager.m in Sources */, - A901C51F1C04F03F00430DC3 /* SBChapterImporter.m in Sources */, A982D0C0140AB66400B92357 /* SBQueueItem.m in Sources */, A9AF6A7518D0496400FAAB08 /* SBQueueAction.m in Sources */, A98175501D49F11B00750709 /* SBMetadataResultMap.m in Sources */, @@ -905,8 +885,8 @@ A917286119FD288B00348DF8 /* SBLogger.m in Sources */, A91B196C1F2B0DCB0008675F /* QueueAction.swift in Sources */, A99189D11F2F88F700623ED7 /* ChapterSearchController.swift in Sources */, + A9A77C4E1F306FA70018023B /* AttributedStyles.swift in Sources */, A909440A1DD4B80000E9F89C /* SBComboBoxCell.m in Sources */, - A9D4B8641C05BC61007845C4 /* SBChapterSearchController.m in Sources */, A9E97F141F274F1100DBA586 /* iTunesStore.swift in Sources */, A9433A8D1F2F5C3600BB38CA /* ChapterResult.swift in Sources */, A9EEA5F218D65490008B54B4 /* SBOptionsViewController.m in Sources */,