From 2f64ac7a22ef6d46d8faa894716b9348434e5e5e Mon Sep 17 00:00:00 2001 From: Damiano Galassi Date: Fri, 16 Mar 2018 18:11:21 +0100 Subject: [PATCH] Remember recent destinations in queue options. --- Base.lproj/QueueOptions.xib | 11 +- .../MetadataImporters/MetadataHelper.swift | 34 --- .../MetadataImporters/MetadataImporter.swift | 2 +- Classes/OptionsViewController.swift | 268 ++++++++++++++++++ Classes/QueueScriptCommand.swift | 37 +++ Classes/SBOptionsViewController.h | 19 -- Classes/SBOptionsViewController.m | 262 ----------------- Classes/SBQueueController.m | 2 - Classes/SBQueueScriptCommand.h | 18 -- Classes/SBQueueScriptCommand.m | 44 --- Subler-Bridging-Header.h | 1 + Subler.xcodeproj/project.pbxproj | 20 +- 12 files changed, 321 insertions(+), 397 deletions(-) create mode 100644 Classes/OptionsViewController.swift create mode 100644 Classes/QueueScriptCommand.swift delete mode 100644 Classes/SBOptionsViewController.h delete mode 100644 Classes/SBOptionsViewController.m delete mode 100644 Classes/SBQueueScriptCommand.h delete mode 100644 Classes/SBQueueScriptCommand.m diff --git a/Base.lproj/QueueOptions.xib b/Base.lproj/QueueOptions.xib index 04faacf..36c4267 100644 --- a/Base.lproj/QueueOptions.xib +++ b/Base.lproj/QueueOptions.xib @@ -1,14 +1,14 @@ - + - + - + @@ -90,11 +90,12 @@ - + + @@ -114,7 +115,7 @@ - + diff --git a/Classes/MetadataImporters/MetadataHelper.swift b/Classes/MetadataImporters/MetadataHelper.swift index d8882bb..a2015c9 100644 --- a/Classes/MetadataImporters/MetadataHelper.swift +++ b/Classes/MetadataImporters/MetadataHelper.swift @@ -7,40 +7,6 @@ import Foundation -/// Wrapper for Objc compatibility -@objc public class SBMetadataImporter : NSObject { - - @objc public static var movieProviders: [String] { - return MetadataSearch.movieProviders - } - - @objc public static var tvProviders: [String] { - return MetadataSearch.tvProviders - } - - @objc public static func defaultLanguage(provider: String) -> String { - return MetadataSearch.service(name: provider).defaultLanguage - } - - @objc public static func importer(provider: String) -> SBMetadataImporter { - return SBMetadataImporter(provider: provider) - } - - private let service: MetadataService - - @objc init(provider: String) { - service = MetadataSearch.service(name: provider) - } - - @objc public var languageType: LanguageType { - return service.languageType - } - - @objc public var languages: [String] { - return service.languages - } -} - // MARK: - Filename public enum MetadataSearchTerms { diff --git a/Classes/MetadataImporters/MetadataImporter.swift b/Classes/MetadataImporters/MetadataImporter.swift index e37dcac..9f2c998 100644 --- a/Classes/MetadataImporters/MetadataImporter.swift +++ b/Classes/MetadataImporters/MetadataImporter.swift @@ -7,7 +7,7 @@ import Foundation -@objc(SBMetadataImporterLanguageType) public enum LanguageType: Int { +public enum LanguageType { case ISO case custom diff --git a/Classes/OptionsViewController.swift b/Classes/OptionsViewController.swift new file mode 100644 index 0000000..421e438 --- /dev/null +++ b/Classes/OptionsViewController.swift @@ -0,0 +1,268 @@ +// +// OptionsViewController.swift +// Subler +// +// Created by Damiano Galassi on 16/03/2018. +// + +import Cocoa + +@objc(SBOptionsViewController) class OptionsViewController: NSViewController { + + @IBOutlet var destButton: NSPopUpButton! + + private static var observerContext = 0 + + @objc private dynamic let options: NSMutableDictionary + + @objc private dynamic var sets: [MetadataPreset] + private var presetsObserver: Any? + + @objc private dynamic let moviesProviders: [String] + @objc private dynamic let tvShowsProviders: [String] + + private let moviesProvidersKeyPath: String + private let tvShowsProvidersKeyPath: String + + @objc private dynamic var movieLanguages: [String] + @objc private dynamic var tvShowLanguages: [String] + + @objc private dynamic let languages: [String] + private let langManager: MP42Languages + + private var recentDestinations: [URL] + + override var nibName: NSNib.Name? { + return NSNib.Name(rawValue: "QueueOptions") + } + + @objc init(options: NSMutableDictionary) { + self.options = options + + self.sets = [] + + self.moviesProviders = MetadataSearch.movieProviders + self.tvShowsProviders = MetadataSearch.tvProviders + self.moviesProvidersKeyPath = "options.SBQueueMovieProvider" + self.tvShowsProvidersKeyPath = "options.SBQueueTVShowProvider" + self.movieLanguages = [] + self.tvShowLanguages = [] + + self.langManager = MP42Languages.defaultManager + self.languages = self.langManager.localizedExtendedLanguages + + self.recentDestinations = [] + + super.init(nibName: nil, bundle: nil) + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + deinit { + removeObserver(self, forKeyPath: moviesProvidersKeyPath, context: &OptionsViewController.observerContext) + removeObserver(self, forKeyPath: tvShowsProvidersKeyPath, context: &OptionsViewController.observerContext) + } + + override func viewDidLoad() { + super.viewDidLoad() + + // Hack to fix crappy anti-aliasing on Yosemite + // unfortunately it fixes the checkboxes anti-aliasing, + // but break the popup buttons one… + view.wantsLayer = true + + for subview in view.subviews { + if let button = subview as? NSButton { + button.attributedTitle = NSAttributedString(string: button.title, + attributes: [NSAttributedStringKey.foregroundColor: NSColor.labelColor, + NSAttributedStringKey.font: NSFont.labelFont(ofSize: 11)]) + + } + } + + // Observe the providers changes + // to update the specific provider languages popup + addObserver(self, forKeyPath: moviesProvidersKeyPath, options: [.initial, .new], context: &OptionsViewController.observerContext) + addObserver(self, forKeyPath: tvShowsProvidersKeyPath, options: [.initial, .new], context: &OptionsViewController.observerContext) + + prepareDestinationPopUp() + preparePresetsPopUp() + } + + override func observeValue(forKeyPath keyPath: String?, of object: Any?, change: [NSKeyValueChangeKey : Any]?, context: UnsafeMutableRawPointer?) { + guard context == &OptionsViewController.observerContext, let changeDict = change else { + super.observeValue(forKeyPath: keyPath, of: object, change: change, context: context) + return + } + + if keyPath == moviesProvidersKeyPath { + let newProvider = changeDict[.newKey] as? String ?? MetadataSearch.movieProviders.first + let oldLanguage = options[SBQueueMovieProviderLanguage] as? String ?? "und" + let service = MetadataSearch.service(name: newProvider) + + movieLanguages = localizedLanguages(service: service) + + if service.languages.contains(oldLanguage) == false { + options[SBQueueMovieProviderLanguage] = service.defaultLanguage + } + } else if keyPath == tvShowsProvidersKeyPath { + let newProvider = changeDict[.newKey] as? String ?? MetadataSearch.tvProviders.first + let oldLanguage = options[SBQueueTVShowProviderLanguage] as? String ?? "und" + let service = MetadataSearch.service(name: newProvider) + + tvShowLanguages = localizedLanguages(service: service) + + if service.languages.contains(oldLanguage) == false { + options[SBQueueTVShowProviderLanguage] = service.defaultLanguage + } + } + } + + override func validateMenuItem(_ menuItem: NSMenuItem) -> Bool { + switch menuItem.action { + case #selector(chooseDestination(_:)), + #selector(destination(_:)): + return true + default: + return false + } + } + + private func localizedLanguages(service: MetadataService) -> [String] { + let type = service.languageType + return service.languages.map { (lang: String) -> String in + if type == LanguageType.ISO { + return langManager.localizedLang(forExtendedTag: lang) + } else { + return lang + } + } + } + + // MARK: Destination popUp + + private func menuItem(url: URL) -> NSMenuItem { + let icon = NSWorkspace.shared.icon(forFile: url.path) + icon.size = NSSize(width: 16, height: 16) + let item = NSMenuItem(title: url.lastPathComponent, action: #selector(destination(_:)), keyEquivalent: "") + item.image = icon + item.target = self + item.representedObject = url + return item + } + + private func moviesFolderURL() -> URL? { + let fileManager = FileManager.default + return fileManager.urls(for: .moviesDirectory, in: .userDomainMask).first + } + + private func insertDestinationItem(_ item: NSMenuItem) { + destButton.menu?.insertItem(item, at: 0) + } + + private func insertAndSelect(_ url: URL) { + if let item = (destButton.menu?.items.filter { $0.representedObject as? URL == url })?.first { + destButton.menu?.removeItem(item) + insertDestinationItem(item) + destButton.select(item) + } else { + let item = menuItem(url: url) + insertDestinationItem(item) + destButton.select(item) + } + } + + private func selectCurrentDestination() { + if let url = self.options[SBQueueDestination] as? URL, let item = (destButton.menu?.items.filter { $0.representedObject as? URL == url })?.first { + destButton.select(item) + } else { + destButton.selectItem(withTag: sameAsFileTag) + } + + } + + private func saveRecentDestinations() { + let destinationsPath = recentDestinations.map { $0.path } + UserDefaults.standard.set(destinationsPath, forKey: "SBQueueRecentDestinations") + // TODO: Sandbox + } + + private func loadRecentDestinations() { + if let loadedDestinations = UserDefaults.standard.array(forKey: "SBQueueRecentDestinations") as? [String] { + recentDestinations = loadedDestinations.compactMap { URL(fileURLWithPath: $0) } + if recentDestinations.count > 6 { + recentDestinations = Array(recentDestinations[0..<6]) + } + } + } + + private let sameAsFileTag = 10 + + private func prepareDestinationPopUp() { + loadRecentDestinations() + + if let moviesURL = moviesFolderURL(), recentDestinations.contains(moviesURL) == false { + recentDestinations.append(moviesURL) + } + + if let currentURL = self.options[SBQueueDestination] as? URL, recentDestinations.contains(currentURL) == false { + recentDestinations.insert(currentURL, at: 0) + } + + for url in recentDestinations { + let item = menuItem(url: url) + insertDestinationItem(item) + } + + selectCurrentDestination() + } + + @IBAction func chooseDestination(_ sender: Any) { + let panel = NSOpenPanel() + panel.allowsMultipleSelection = false + panel.canChooseFiles = false + panel.canChooseDirectories = true + panel.canCreateDirectories = true + + panel.begin(completionHandler: { (response) in + if response == NSApplication.ModalResponse.OK, let url = panel.url { + self.options[SBQueueDestination] = url + self.insertAndSelect(url) + self.recentDestinations.insert(url, at: 0) + self.saveRecentDestinations() + } else { + self.selectCurrentDestination() + } + }) + } + + @IBAction func destination(_ sender: NSMenuItem) { + if let url = sender.representedObject as? URL { + options[SBQueueDestination] = url + } else { + options[SBQueueDestination] = nil + } + } + + // MARK: Presets popUp + + private func preparePresetsPopUp() { + let update: (Notification) -> Void = { [weak self] notification in + guard let s = self else { return } + s.sets = PresetManager.shared.metadataPresets + if let set = s.options[SBQueueSet] as? MetadataPreset, s.sets.contains(set) == false { + s.options[SBQueueSet] = nil + } + } + + update(Notification(name: Notification.Name(rawValue: ""))) + + presetsObserver = NotificationCenter.default.addObserver(forName: PresetManager.shared.updateNotification, + object: nil, + queue: OperationQueue.main, + using: update) + } + +} diff --git a/Classes/QueueScriptCommand.swift b/Classes/QueueScriptCommand.swift new file mode 100644 index 0000000..83e356b --- /dev/null +++ b/Classes/QueueScriptCommand.swift @@ -0,0 +1,37 @@ +// +// QueueScriptCommand.swift +// Subler +// +// Created by Damiano Galassi on 16/03/2018. +// + +import Foundation + +@objc(SBQueueScriptCommand) class QueueScriptCommand: NSScriptCommand { + + override func performDefaultImplementation() -> Any? { + guard let args = directParameter as? [URL] else { return nil } + SBQueueController.sharedManager.addItems(from: args, at: 0) + return nil + } + +} + +@objc(SBQueueStartScriptCommand) class QueueStartScriptCommand: NSScriptCommand { + + override func performDefaultImplementation() -> Any? { + SBQueueController.sharedManager.start(self) + self.suspendExecution() + return nil + } + +} + +@objc(SBQueueStopScriptCommand) class QueueStopScriptCommand: NSScriptCommand { + + override func performDefaultImplementation() -> Any? { + SBQueueController.sharedManager.stop(self) + return nil + } + +} diff --git a/Classes/SBOptionsViewController.h b/Classes/SBOptionsViewController.h deleted file mode 100644 index 9be8ee7..0000000 --- a/Classes/SBOptionsViewController.h +++ /dev/null @@ -1,19 +0,0 @@ -// -// QueueOptionsController.h -// Subler -// -// Created by Damiano Galassi on 16/03/14. -// -// - -#import - -NS_ASSUME_NONNULL_BEGIN - -@interface SBOptionsViewController : NSViewController - -- (instancetype)initWithOptions:(NSMutableDictionary *)options; - -@end - -NS_ASSUME_NONNULL_END diff --git a/Classes/SBOptionsViewController.m b/Classes/SBOptionsViewController.m deleted file mode 100644 index f8a6359..0000000 --- a/Classes/SBOptionsViewController.m +++ /dev/null @@ -1,262 +0,0 @@ -// -// QueueOptionsController.m -// Subler -// -// Created by Damiano Galassi on 16/03/14. -// -// - -#import "SBOptionsViewController.h" -#import "SBQueuePreferences.h" - -#import -#import - -#import "Subler-Swift.h" - -static void *SBOptionsViewContex = &SBOptionsViewContex; - -@interface SBOptionsViewController () - -@property (nonatomic, weak) IBOutlet NSPopUpButton *destButton; - -@property (nonatomic) NSMutableDictionary *options; -@property (nonatomic, strong) NSMutableArray *sets; - -@property (nonatomic, strong) NSArray *moviesProviders; -@property (nonatomic, strong) NSArray *tvShowsProviders; -@property (nonatomic, strong) NSArray *movieLanguages; -@property (nonatomic, strong) NSArray *tvShowLanguages; - -@property (nonatomic, strong) NSArray *languages; -@property (nonatomic, strong) MP42Languages *langManager; - -- (IBAction)chooseDestination:(id)sender; -- (IBAction)destination:(id)sender; - -@property (nonatomic, strong) NSURL *destination; - -@end - -@implementation SBOptionsViewController - -- (instancetype)initWithOptions:(NSMutableDictionary *)options { - self = [self init]; - if (self) { - _options = options; - _sets = [[NSMutableArray alloc] init]; - _moviesProviders = [SBMetadataImporter movieProviders]; - _tvShowsProviders = [SBMetadataImporter tvProviders]; - _languages = [[MP42Languages defaultManager] localizedExtendedLanguages]; - _langManager = MP42Languages.defaultManager; - } - return self; -} - -- (instancetype)init { - self = [super initWithNibName:@"QueueOptions" bundle:nil]; - if (self) { - } - return self; -} - -- (void)viewDidLoad { - [super viewDidLoad]; - - // Hack to fix crappy anti-aliasing on Yosemite - // unfortunately it fixes the checkboxes anti-aliasing, - // but break the popup buttons one… - self.view.wantsLayer = YES; - - for (NSButton *subview in self.view.subviews) { - if ([subview isKindOfClass:[NSButton class]]) { - NSAttributedString *string = [[NSAttributedString alloc] initWithString:subview.title - attributes:@{NSForegroundColorAttributeName:[NSColor labelColor], - NSFontAttributeName:[NSFont labelFontOfSize:11]}]; - subview.attributedTitle = string; - } - } - - // Observe the providers changes - // to update the specific provider languages popup - [self addObserver:self - forKeyPath:@"options.SBQueueMovieProvider" - options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew - context:SBOptionsViewContex]; - - [self addObserver:self - forKeyPath:@"options.SBQueueTVShowProvider" - options:NSKeyValueObservingOptionInitial | NSKeyValueObservingOptionNew - context:SBOptionsViewContex]; - - [self prepareDestPopup]; - [self prepareSetsPopup]; -} - -- (BOOL)validateUserInterfaceItem:(id < NSValidatedUserInterfaceItem >)anItem { - SEL action = anItem.action; - - if (action == @selector(chooseDestination:)) - return YES; - - if (action == @selector(destination:)) - return YES; - - return NO; -} - -- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { - if (context == SBOptionsViewContex) { - // Update the languages popup - if ([keyPath isEqualToString:@"options.SBQueueMovieProvider"]){ - NSString *newProvider = [change valueForKey:NSKeyValueChangeNewKey]; - NSString *oldLanguage = self.options[SBQueueMovieProviderLanguage]; - - SBMetadataImporter *importer = [SBMetadataImporter importerWithProvider:newProvider]; - self.movieLanguages = [self localizedLanguagesForImporter:importer]; - - if (![importer.languages containsObject:oldLanguage]) { - self.options[SBQueueMovieProviderLanguage] = [SBMetadataImporter defaultLanguageWithProvider:newProvider]; - } - } else if ([keyPath isEqualToString:@"options.SBQueueTVShowProvider"]) { - NSString *newProvider = [change valueForKey:NSKeyValueChangeNewKey]; - NSString *oldLanguage = self.options[SBQueueTVShowProviderLanguage]; - - SBMetadataImporter *importer = [SBMetadataImporter importerWithProvider:newProvider]; - self.tvShowLanguages = [self localizedLanguagesForImporter:importer]; - - if (![importer.languages containsObject:oldLanguage]) { - self.options[SBQueueTVShowProviderLanguage] = [SBMetadataImporter defaultLanguageWithProvider:newProvider]; - } - } else { - [super observeValueForKeyPath:keyPath ofObject:object change:change context:context]; - } - } -} - -- (NSArray *)localizedLanguagesForImporter:(SBMetadataImporter *)importer -{ - NSMutableArray *languages = [NSMutableArray array]; - SBMetadataImporterLanguageType type = importer.languageType; - - for (NSString *lang in importer.languages) { - if (type == SBMetadataImporterLanguageTypeISO) { - [languages addObject:[_langManager localizedLangForExtendedTag:lang]]; - } - else { - [languages addObject:lang]; - } - } - return languages; -} - -#pragma mark Destination PopUp - -- (void)prepareDestPopup { - NSMenuItem *folderItem = nil; - - if (self.options[SBQueueDestination]) { - self.destination = self.options[SBQueueDestination]; - - if (![[NSFileManager defaultManager] fileExistsAtPath:self.destination.path isDirectory:nil]) { - self.destination = nil; - } - } - - if (!self.destination) { - NSArray *allPaths = NSSearchPathForDirectoriesInDomains(NSMoviesDirectory, - NSUserDomainMask, - YES); - if (allPaths.count) { - self.destination = [NSURL fileURLWithPath:allPaths.lastObject]; - } - } - - if (self.destination) { - folderItem = [self prepareDestPopupItem:self.destination]; - - [_destButton.menu insertItem:[NSMenuItem separatorItem] atIndex:0]; - [_destButton.menu insertItem:folderItem atIndex:0]; - - if (self.options[SBQueueDestination]) { - [_destButton selectItem:folderItem]; - } - else { - [_destButton selectItemWithTag:10]; - } - } -} - -- (IBAction)chooseDestination:(id)sender { - NSOpenPanel *panel = [NSOpenPanel openPanel]; - panel.allowsMultipleSelection = NO; - panel.canChooseFiles = NO; - panel.canChooseDirectories = YES; - panel.canCreateDirectories = YES; - - panel.prompt = NSLocalizedString(@"Select", @"Select queue destination."); - [panel beginWithCompletionHandler:^(NSInteger result) { - if (result == NSFileHandlingPanelOKButton) { - NSMenuItem *folderItem = [self prepareDestPopupItem:panel.URL]; - - [self->_destButton.menu removeItemAtIndex:0]; - [self->_destButton.menu insertItem:folderItem atIndex:0]; - - [self->_destButton selectItem:folderItem]; - - self.options[SBQueueDestination] = panel.URL; - self.destination = panel.URL; - [[NSUserDefaults standardUserDefaults] setBool:YES forKey:@"SBQueueDestinationSelected"]; - } else { - [self->_destButton selectItemAtIndex:2]; - } - }]; -} - -- (NSMenuItem *)prepareDestPopupItem:(nonnull NSURL *)dest { - NSMenuItem *folderItem = [[NSMenuItem alloc] initWithTitle:dest.lastPathComponent action:@selector(destination:) keyEquivalent:@""]; - - NSImage *menuItemIcon = [[NSWorkspace sharedWorkspace] iconForFile:dest.path]; - menuItemIcon.size = NSMakeSize(16, 16); - - folderItem.image = menuItemIcon; - folderItem.action = @selector(destination:); - folderItem.target = self; - - return folderItem; -} - -- (IBAction)destination:(id)sender { - if ([sender tag] == 10) { - [self.options removeObjectForKey:SBQueueDestination]; - } else { - self.options[SBQueueDestination] = self.destination; - } -} - -#pragma mark Sets PopUp - -- (void)prepareSetsPopup { - [[NSNotificationCenter defaultCenter] addObserver:self - selector:@selector(updateSetsMenu:) - name:@"SBPresetManagerUpdatedNotification" object:nil]; - [self updateSetsMenu:self]; -} - -- (void)updateSetsMenu:(id)sender { - self.sets = [SBPresetManager.shared.metadataPresets mutableCopy]; - if (![self.sets containsObject:self.options[SBQueueSet]]) { - [self.options removeObjectForKey:SBQueueSet]; - } -} - -- (void)dealloc { - [[NSNotificationCenter defaultCenter] removeObserver:self]; - - @try { - [self removeObserver:self forKeyPath:@"options.SBQueueMovieProvider"]; - [self removeObserver:self forKeyPath:@"options.SBQueueTVShowProvider"]; - } @catch (NSException * __unused exception) {} -} - -@end diff --git a/Classes/SBQueueController.m b/Classes/SBQueueController.m index b761097..606ca5e 100755 --- a/Classes/SBQueueController.m +++ b/Classes/SBQueueController.m @@ -10,8 +10,6 @@ #import "SBQueueItem.h" #import "SBQueuePreferences.h" -#import "SBOptionsViewController.h" - #import #import "Subler-Swift.h" diff --git a/Classes/SBQueueScriptCommand.h b/Classes/SBQueueScriptCommand.h deleted file mode 100644 index 82c29f7..0000000 --- a/Classes/SBQueueScriptCommand.h +++ /dev/null @@ -1,18 +0,0 @@ -// -// SBQueueScriptCommand.h -// Subler -// -// Created by Damiano Galassi on 02/02/17. -// -// - -#import - -@interface SBQueueScriptCommand : NSScriptCommand -@end - -@interface SBQueueStartScriptCommand : NSScriptCommand -@end - -@interface SBQueueStopScriptCommand : NSScriptCommand -@end diff --git a/Classes/SBQueueScriptCommand.m b/Classes/SBQueueScriptCommand.m deleted file mode 100644 index 1dca50d..0000000 --- a/Classes/SBQueueScriptCommand.m +++ /dev/null @@ -1,44 +0,0 @@ -// -// SBQueueScriptCommand.m -// Subler -// -// Created by Damiano Galassi on 02/02/17. -// -// - -#import "SBQueueScriptCommand.h" -#import "SBQueueController.h" - -@implementation SBQueueScriptCommand - -- (id)performDefaultImplementation -{ - NSArray *args = [self directParameter]; - - [SBQueueController.sharedManager addItemsFromURLs:args atIndex:0]; - - return nil; -} - -@end - -@implementation SBQueueStartScriptCommand - -- (id)performDefaultImplementation -{ - [SBQueueController.sharedManager start:self]; - [self suspendExecution]; - return nil; -} - -@end - -@implementation SBQueueStopScriptCommand - -- (id)performDefaultImplementation -{ - [SBQueueController.sharedManager stop:self]; - return nil; -} - -@end diff --git a/Subler-Bridging-Header.h b/Subler-Bridging-Header.h index 8ca1459..5723997 100644 --- a/Subler-Bridging-Header.h +++ b/Subler-Bridging-Header.h @@ -3,6 +3,7 @@ // #import "SBQueueController.h" +#import "SBQueuePreferences.h" #import "SBQueueItem.h" #import "SBMovieViewController.h" #import "SBVideoViewController.h" diff --git a/Subler.xcodeproj/project.pbxproj b/Subler.xcodeproj/project.pbxproj index d8d1d36..7e399b9 100644 --- a/Subler.xcodeproj/project.pbxproj +++ b/Subler.xcodeproj/project.pbxproj @@ -37,6 +37,7 @@ A92BBABE1F5584EA007EA182 /* PresetEditorViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A92BBABC1F558388007EA182 /* PresetEditorViewController.xib */; }; A92ECCE31F49984C0063BFBD /* PrefsWindowController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A92ECCE21F49984C0063BFBD /* PrefsWindowController.swift */; }; A93105391F9758EC00605146 /* FileImportController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A93105351F9758EC00605146 /* FileImportController.xib */; }; + A932C9F3205C268A004E52FE /* QueueScriptCommand.swift in Sources */ = {isa = PBXBuildFile; fileRef = A932C9F2205C268A004E52FE /* QueueScriptCommand.swift */; }; A9395E351F8B9ACA004C402B /* MP42FileAdditions.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9395E341F8B9ACA004C402B /* MP42FileAdditions.swift */; }; A9433A8D1F2F5C3600BB38CA /* ChapterResult.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9433A8C1F2F5C3600BB38CA /* ChapterResult.swift */; }; A9433A911F2F5D8A00BB38CA /* ChapterDB.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9433A901F2F5D8A00BB38CA /* ChapterDB.swift */; }; @@ -75,7 +76,6 @@ A9A4A966202F51FA00482D12 /* SaveOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9A4A968202F51FA00482D12 /* SaveOptions.xib */; }; A9A4A96B202F51FF00482D12 /* ProgressViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9A4A96D202F51FF00482D12 /* ProgressViewController.xib */; }; A9A77C4E1F306FA70018023B /* AttributedStyles.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A77C4D1F306FA70018023B /* AttributedStyles.swift */; }; - A9A8CEF91E43754400BC2AE1 /* SBQueueScriptCommand.m in Sources */ = {isa = PBXBuildFile; fileRef = A9A8CEF81E43754400BC2AE1 /* SBQueueScriptCommand.m */; }; A9A91B5D1FB6FBB700250D93 /* ChapterViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9A91B5C1FB6FBB700250D93 /* ChapterViewController.swift */; }; A9AB485617F0AEAC000AA72E /* SBMovieViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AB484F17F0AEAC000AA72E /* SBMovieViewController.m */; }; A9AB485817F0AEAC000AA72E /* SBVideoViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9AB485317F0AEAC000AA72E /* SBVideoViewController.m */; }; @@ -100,6 +100,7 @@ A9C31E5D2029A79000CEF474 /* GeneralPrefsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C31E5B2029A78F00CEF474 /* GeneralPrefsViewController.xib */; }; A9C31E602029A80F00CEF474 /* AdvancedPrefsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C31E5E2029A80F00CEF474 /* AdvancedPrefsViewController.swift */; }; A9C31E642029A82200CEF474 /* AdvancedPrefsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C31E622029A82200CEF474 /* AdvancedPrefsViewController.xib */; }; + A9C3E44A205C07F4004DE24E /* OptionsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9C3E449205C07F4004DE24E /* OptionsViewController.swift */; }; A9C5FA7419FA2FEC0051F3FF /* SBActivityWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9C5FA7219FA2FEC0051F3FF /* SBActivityWindow.xib */; }; A9C828F5195950C3004C4718 /* SBQueuePreferences.m in Sources */ = {isa = PBXBuildFile; fileRef = A9C828F4195950C3004C4718 /* SBQueuePreferences.m */; }; A9CBAB1E1F29C083001C26B3 /* MetadataImporter.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9CBAB1D1F29C083001C26B3 /* MetadataImporter.swift */; }; @@ -115,7 +116,6 @@ A9ECA05A2029A10F00D5F30C /* TracksViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9ECA05C2029A10F00D5F30C /* TracksViewController.xib */; }; A9ECA05D2029A11500D5F30C /* DetailsViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9ECA05F2029A11500D5F30C /* DetailsViewController.xib */; }; A9ECA0602029A13800D5F30C /* OffsetViewController.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9ECA0622029A13800D5F30C /* OffsetViewController.xib */; }; - A9EEA5F218D65490008B54B4 /* SBOptionsViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A9EEA5F018D65490008B54B4 /* SBOptionsViewController.m */; }; A9EEA5F818D654B9008B54B4 /* QueueOptions.xib in Resources */ = {isa = PBXBuildFile; fileRef = A9EEA5F618D654B9008B54B4 /* QueueOptions.xib */; }; A9F2A2662026EACD00C4B69A /* DetailsViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9F2A2642026EACD00C4B69A /* DetailsViewController.swift */; }; A9F4FF4B1FB708FB004473A8 /* SoundViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9F4FF4A1FB708FB004473A8 /* SoundViewController.swift */; }; @@ -231,6 +231,7 @@ A92BBABD1F558388007EA182 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Classes/Base.lproj/PresetEditorViewController.xib; sourceTree = ""; }; A92ECCE21F49984C0063BFBD /* PrefsWindowController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = PrefsWindowController.swift; path = Classes/PrefsWindowController.swift; sourceTree = ""; }; A93105361F9758EC00605146 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/FileImportController.xib; sourceTree = ""; }; + A932C9F2205C268A004E52FE /* QueueScriptCommand.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = QueueScriptCommand.swift; path = Classes/QueueScriptCommand.swift; sourceTree = ""; }; A9395E341F8B9ACA004C402B /* MP42FileAdditions.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MP42FileAdditions.swift; path = Classes/MP42FileAdditions.swift; sourceTree = ""; }; A9433A8C1F2F5C3600BB38CA /* ChapterResult.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChapterResult.swift; path = Classes/MetadataImporters/ChapterResult.swift; sourceTree = ""; }; A9433A901F2F5D8A00BB38CA /* ChapterDB.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChapterDB.swift; path = Classes/MetadataImporters/ChapterDB.swift; sourceTree = ""; }; @@ -279,8 +280,6 @@ A9A4A967202F51FA00482D12 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/SaveOptions.xib; sourceTree = ""; }; A9A4A96C202F51FF00482D12 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/ProgressViewController.xib; 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 = ""; }; A9A91B5C1FB6FBB700250D93 /* ChapterViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ChapterViewController.swift; path = Classes/PropertyView/ChapterViewController.swift; sourceTree = ""; }; A9AB484E17F0AEAC000AA72E /* SBMovieViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBMovieViewController.h; path = Classes/PropertyView/SBMovieViewController.h; sourceTree = ""; }; A9AB484F17F0AEAC000AA72E /* SBMovieViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBMovieViewController.m; path = Classes/PropertyView/SBMovieViewController.m; sourceTree = ""; }; @@ -321,6 +320,7 @@ A9C31E5C2029A78F00CEF474 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/GeneralPrefsViewController.xib; sourceTree = ""; }; A9C31E5E2029A80F00CEF474 /* AdvancedPrefsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AdvancedPrefsViewController.swift; path = Classes/AdvancedPrefsViewController.swift; sourceTree = ""; }; A9C31E632029A82200CEF474 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/AdvancedPrefsViewController.xib; sourceTree = ""; }; + A9C3E449205C07F4004DE24E /* OptionsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = OptionsViewController.swift; path = Classes/OptionsViewController.swift; sourceTree = ""; }; 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 = ""; }; @@ -338,8 +338,6 @@ A9ECA05E2029A11500D5F30C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/DetailsViewController.xib; sourceTree = ""; }; A9ECA0612029A13800D5F30C /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/OffsetViewController.xib; sourceTree = ""; }; A9ED7B21180067A2008FD3A8 /* IOKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = IOKit.framework; path = System/Library/Frameworks/IOKit.framework; sourceTree = SDKROOT; }; - A9EEA5EF18D65490008B54B4 /* SBOptionsViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SBOptionsViewController.h; path = Classes/SBOptionsViewController.h; sourceTree = ""; }; - A9EEA5F018D65490008B54B4 /* SBOptionsViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = SBOptionsViewController.m; path = Classes/SBOptionsViewController.m; sourceTree = ""; }; A9F2A2642026EACD00C4B69A /* DetailsViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = DetailsViewController.swift; path = Classes/DetailsViewController.swift; sourceTree = ""; }; A9F4FF4A1FB708FB004473A8 /* SoundViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SoundViewController.swift; path = Classes/PropertyView/SoundViewController.swift; sourceTree = ""; }; A9F5820B1DCC861F005F3E92 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; @@ -569,8 +567,7 @@ A961476513F568210068F161 /* Queue.xib */, A9C828F3195950C3004C4718 /* SBQueuePreferences.h */, A9C828F4195950C3004C4718 /* SBQueuePreferences.m */, - A9EEA5EF18D65490008B54B4 /* SBOptionsViewController.h */, - A9EEA5F018D65490008B54B4 /* SBOptionsViewController.m */, + A9C3E449205C07F4004DE24E /* OptionsViewController.swift */, A9EEA5F618D654B9008B54B4 /* QueueOptions.xib */, A9676A2F1FB6E85300C1E300 /* LanguageTransformer.swift */, A9676A331FB6EAAD00C1E300 /* ItemViewController.swift */, @@ -580,8 +577,7 @@ A982D0BE140AB66400B92357 /* SBQueueItem.h */, A982D0BF140AB66400B92357 /* SBQueueItem.m */, A91B196B1F2B0DCB0008675F /* QueueAction.swift */, - A9A8CEF71E43754400BC2AE1 /* SBQueueScriptCommand.h */, - A9A8CEF81E43754400BC2AE1 /* SBQueueScriptCommand.m */, + A932C9F2205C268A004E52FE /* QueueScriptCommand.swift */, ); name = Queue; sourceTree = ""; @@ -849,6 +845,7 @@ A9D64527202CA92400BA172B /* SaveOptions.swift in Sources */, A9859ACE1F4B43CC00022828 /* QueuePreset.swift in Sources */, A9F2A2662026EACD00C4B69A /* DetailsViewController.swift in Sources */, + A932C9F3205C268A004E52FE /* QueueScriptCommand.swift in Sources */, A9915AC31F4B293B003C57D1 /* PresetManager.swift in Sources */, A90BC5E31F3A139700F9F3F3 /* MetadataResult.swift in Sources */, A99189CD1F2F87EC00623ED7 /* ChapterImporter.swift in Sources */, @@ -867,7 +864,6 @@ A90057BE1F99E2D800FA4ED1 /* TokenFieldCell.swift in Sources */, A9ECA0532029948900D5F30C /* OffsetViewController.swift in Sources */, A9395E351F8B9ACA004C402B /* MP42FileAdditions.swift in Sources */, - A9A8CEF91E43754400BC2AE1 /* SBQueueScriptCommand.m in Sources */, A902E0CA20504FD400445AC8 /* TokenDelegate.swift in Sources */, A91EB969205ABAF400392E1C /* NSWindowAdditions.swift in Sources */, A9C09C9A1F9A0808007939EE /* EmptyViewController.swift in Sources */, @@ -891,6 +887,7 @@ A92BBAB41F557CC0007EA182 /* PresetEditorViewController.swift in Sources */, A9FC6FF61EF2E3280034CCED /* TheTVDBService.swift in Sources */, A961476313F567E10068F161 /* SBQueueController.m in Sources */, + A9C3E44A205C07F4004DE24E /* OptionsViewController.swift in Sources */, A982D0C0140AB66400B92357 /* SBQueueItem.m in Sources */, A90057C01F99E35300FA4ED1 /* PopUpCellView.swift in Sources */, A91B196C1F2B0DCB0008675F /* QueueAction.swift in Sources */, @@ -903,7 +900,6 @@ A944E5921F498FC4002E43F6 /* PresetPrefsViewController.swift in Sources */, A9E97F141F274F1100DBA586 /* iTunesStore.swift in Sources */, A9433A8D1F2F5C3600BB38CA /* ChapterResult.swift in Sources */, - A9EEA5F218D65490008B54B4 /* SBOptionsViewController.m in Sources */, A9C09C9C1F9A08A9007939EE /* MultiSelectViewController.swift in Sources */, A9AE70E11F2F7B3D001CF27C /* MetadataHelper.swift in Sources */, A90057B61F99DE2700FA4ED1 /* ComboBoxCellView.swift in Sources */,