Another try at the usual issue.
This commit is contained in:
1 parent
6d0d49b1e8
commit
7a88d67a0e
4 files changed
+63
-69
No files matched your search
@@ -46,6 +46,8 @@
|
|||||||
BOOL _optimize;
|
BOOL _optimize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError;
|
||||||
|
|
||||||
- (IBAction)selectFile:(id)sender;
|
- (IBAction)selectFile:(id)sender;
|
||||||
- (IBAction)deleteTrack:(id)sender;
|
- (IBAction)deleteTrack:(id)sender;
|
||||||
- (IBAction)sendToQueue:(id)sender;
|
- (IBAction)sendToQueue:(id)sender;
|
||||||
@@ -69,7 +71,6 @@
|
|||||||
|
|
||||||
- (void)showImportSheet:(NSArray *)fileURLs;
|
- (void)showImportSheet:(NSArray *)fileURLs;
|
||||||
|
|
||||||
- (MP42File *)mp4File;
|
|
||||||
- (void)setMp4File:(MP42File *)mp4;
|
- (void)setMp4File:(MP42File *)mp4;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
+46
-49
@@ -68,6 +68,11 @@
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (instancetype)initWithMP4:(MP42File *)mp4File error:(NSError **)outError
|
||||||
|
{
|
||||||
|
return nil;
|
||||||
|
}
|
||||||
|
|
||||||
- (id)initWithType:(NSString *)typeName error:(NSError **)outError
|
- (id)initWithType:(NSString *)typeName error:(NSError **)outError
|
||||||
{
|
{
|
||||||
if (self = [super initWithType:typeName error:outError])
|
if (self = [super initWithType:typeName error:outError])
|
||||||
@@ -597,6 +602,18 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
#pragma mark Various things
|
#pragma mark Various things
|
||||||
|
|
||||||
|
- (void)didEndSheet:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo
|
||||||
|
{
|
||||||
|
[[importWindow window] orderOut:nil];
|
||||||
|
[importWindow autorelease], importWindow = nil;
|
||||||
|
|
||||||
|
// IKImageBrowserView is a bit problematic, do the refresh at the end of the run loop
|
||||||
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
|
[fileTracksTable reloadData];
|
||||||
|
[self tableViewSelectionDidChange:nil];
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
- (IBAction)sendToQueue:(id)sender
|
- (IBAction)sendToQueue:(id)sender
|
||||||
{
|
{
|
||||||
SBQueueController *queue = [SBQueueController sharedManager];
|
SBQueueController *queue = [SBQueueController sharedManager];
|
||||||
@@ -629,7 +646,7 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
- (IBAction)searchMetadata:(id)sender
|
- (IBAction)searchMetadata:(id)sender
|
||||||
{
|
{
|
||||||
NSString *filename = nil;
|
NSString *filename = nil;
|
||||||
for (MP42Track *track in self.mp4File.tracks) {
|
for (MP42Track *track in self.mp4.tracks) {
|
||||||
if (track.sourceURL) {
|
if (track.sourceURL) {
|
||||||
filename = [track.sourceURL lastPathComponent];
|
filename = [track.sourceURL lastPathComponent];
|
||||||
break;
|
break;
|
||||||
@@ -638,8 +655,32 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
|
|
||||||
importWindow = [[SBMetadataSearchController alloc] initWithDelegate:self searchString:filename];
|
importWindow = [[SBMetadataSearchController alloc] initWithDelegate:self searchString:filename];
|
||||||
|
|
||||||
[NSApp beginSheet:[importWindow window] modalForWindow:documentWindow
|
[NSApp beginSheet:[importWindow window]
|
||||||
modalDelegate:nil didEndSelector:NULL contextInfo:nil];
|
modalForWindow:documentWindow
|
||||||
|
modalDelegate:self
|
||||||
|
didEndSelector:@selector(didEndSheet:returnCode:contextInfo:)
|
||||||
|
contextInfo:nil];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void)metadataImportDone:(MP42Metadata *)metadataToBeImported
|
||||||
|
{
|
||||||
|
[metadataToBeImported retain];
|
||||||
|
if (metadataToBeImported) {
|
||||||
|
[self.mp4.metadata mergeMetadata:metadataToBeImported];
|
||||||
|
|
||||||
|
for (MP42Track *track in self.mp4.tracks)
|
||||||
|
if ([track isKindOfClass:[MP42VideoTrack class]]) {
|
||||||
|
MP42VideoTrack *videoTrack = (MP42VideoTrack *)track;
|
||||||
|
int hdVideo = isHdVideo((uint64_t)videoTrack.trackWidth, (uint64_t)videoTrack.trackHeight);
|
||||||
|
|
||||||
|
if (hdVideo)
|
||||||
|
[self.mp4.metadata setTag:@(hdVideo) forKey:@"HD Video"];
|
||||||
|
|
||||||
|
[self updateChangeCount:NSChangeDone];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
[metadataToBeImported release];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction)showTrackOffsetSheet:(id)sender
|
- (IBAction)showTrackOffsetSheet:(id)sender
|
||||||
@@ -723,26 +764,16 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
if (importWindow) {
|
if (importWindow) {
|
||||||
if ([importWindow onlyContainsSubtitleTracks]) { //execute always. Maybe we should do this only for subtitle
|
if ([importWindow onlyContainsSubtitleTracks]) { //execute always. Maybe we should do this only for subtitle
|
||||||
[importWindow addTracks:nil];
|
[importWindow addTracks:nil];
|
||||||
[self sheetDidEnd:nil returnCode:NSOKButton contextInfo:nil];
|
[self didEndSheet:nil returnCode:NSOKButton contextInfo:nil];
|
||||||
} else { // show the dialog
|
} else { // show the dialog
|
||||||
[NSApp beginSheet:[importWindow window] modalForWindow:documentWindow
|
[NSApp beginSheet:[importWindow window] modalForWindow:documentWindow
|
||||||
modalDelegate:self didEndSelector:@selector(sheetDidEnd:returnCode:contextInfo:) contextInfo:(__bridge void *)(importWindow)];
|
modalDelegate:self didEndSelector:@selector(didEndSheet:returnCode:contextInfo:) contextInfo:NULL];
|
||||||
}
|
}
|
||||||
} else if (error) {
|
} else if (error) {
|
||||||
[self presentError:error modalForWindow:documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
[self presentError:error modalForWindow:documentWindow delegate:nil didPresentSelector:NULL contextInfo:nil];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)sheetDidEnd:(NSWindow *)sheet returnCode:(NSInteger)returnCode contextInfo:(void *)contextInfo;{
|
|
||||||
[importWindow autorelease], importWindow = nil;
|
|
||||||
|
|
||||||
// IKImageBrowserView is a bit problematic, do the refresh at the end of the run loop
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
|
||||||
[fileTracksTable reloadData];
|
|
||||||
[self tableViewSelectionDidChange:nil];
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)importDoneWithTracks:(NSArray *)tracksToBeImported andMetadata:(MP42Metadata *)metadata
|
- (void)importDoneWithTracks:(NSArray *)tracksToBeImported andMetadata:(MP42Metadata *)metadata
|
||||||
{
|
{
|
||||||
if (tracksToBeImported) {
|
if (tracksToBeImported) {
|
||||||
@@ -760,36 +791,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)metadataImportDone:(MP42Metadata *)metadataToBeImported
|
|
||||||
{
|
|
||||||
[metadataToBeImported retain];
|
|
||||||
if (metadataToBeImported) {
|
|
||||||
[self.mp4.metadata mergeMetadata:metadataToBeImported];
|
|
||||||
|
|
||||||
for (MP42Track *track in self.mp4.tracks)
|
|
||||||
if ([track isKindOfClass:[MP42VideoTrack class]]) {
|
|
||||||
MP42VideoTrack *videoTrack = (MP42VideoTrack *)track;
|
|
||||||
int hdVideo = isHdVideo((uint64_t)videoTrack.trackWidth, (uint64_t)videoTrack.trackHeight);
|
|
||||||
|
|
||||||
if (hdVideo)
|
|
||||||
[self.mp4.metadata setTag:@(hdVideo) forKey:@"HD Video"];
|
|
||||||
|
|
||||||
[self updateChangeCount:NSChangeDone];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
[NSApp endSheet:[importWindow window]];
|
|
||||||
[[importWindow window] orderOut:self];
|
|
||||||
[importWindow release], importWindow = nil;
|
|
||||||
|
|
||||||
if (metadataToBeImported) {
|
|
||||||
[self tableViewSelectionDidChange:nil];
|
|
||||||
[self updateChangeCount:NSChangeDone];
|
|
||||||
}
|
|
||||||
|
|
||||||
[metadataToBeImported release];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)addMetadata:(NSURL *)URL
|
- (void)addMetadata:(NSURL *)URL
|
||||||
{
|
{
|
||||||
if ([[URL pathExtension] isEqualToString:@"xml"] || [[URL pathExtension] isEqualToString:@"nfo"]) {
|
if ([[URL pathExtension] isEqualToString:@"xml"] || [[URL pathExtension] isEqualToString:@"nfo"]) {
|
||||||
@@ -939,10 +940,6 @@ objectValueForTableColumn:(NSTableColumn *)tableColumn
|
|||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (MP42File *)mp4File {
|
|
||||||
return self.mp4;
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void)setMp4File:(MP42File *)mp4 {
|
- (void)setMp4File:(MP42File *)mp4 {
|
||||||
self.mp4 = mp4;
|
self.mp4 = mp4;
|
||||||
[fileTracksTable reloadData];
|
[fileTracksTable reloadData];
|
||||||
|
|||||||
@@ -457,8 +457,8 @@
|
|||||||
|
|
||||||
[tracksTableView setDelegate:nil];
|
[tracksTableView setDelegate:nil];
|
||||||
[tracksTableView setDataSource:nil];
|
[tracksTableView setDataSource:nil];
|
||||||
|
|
||||||
[NSApp endSheet:[self window] returnCode:NSOKButton];
|
[NSApp endSheet:[self window] returnCode:NSOKButton];
|
||||||
[[self window] orderOut:self];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
|
|||||||
@@ -419,34 +419,34 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
[delegate metadataImportDone:self.selectedResult];
|
[delegate metadataImportDone:self.selectedResult];
|
||||||
|
|
||||||
|
[NSApp endSheet:[self window] returnCode:1];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (IBAction) closeWindow: (id) sender
|
- (IBAction) closeWindow: (id) sender
|
||||||
{
|
{
|
||||||
if (self.currentSearcher) {
|
[self.currentSearcher cancel];
|
||||||
[self.currentSearcher cancel];
|
self.currentSearcher = nil;
|
||||||
}
|
|
||||||
|
|
||||||
[delegate metadataImportDone:nil];
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) dealloc
|
|
||||||
{
|
|
||||||
if (self.currentSearcher) {
|
|
||||||
[self.currentSearcher cancel];
|
|
||||||
self.currentSearcher = nil;
|
|
||||||
}
|
|
||||||
|
|
||||||
[metadataTable setDataSource:nil];
|
[metadataTable setDataSource:nil];
|
||||||
[metadataTable setDelegate:nil];
|
[metadataTable setDelegate:nil];
|
||||||
[resultsTable setDataSource:nil];
|
[resultsTable setDataSource:nil];
|
||||||
[resultsTable setDelegate:nil];
|
[resultsTable setDelegate:nil];
|
||||||
|
|
||||||
|
[NSApp endSheet:[self window] returnCode:0];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) dealloc
|
||||||
|
{
|
||||||
|
[self.currentSearcher cancel];
|
||||||
|
self.currentSearcher = nil;
|
||||||
|
|
||||||
self.selectedResultTagsArray = nil;
|
self.selectedResultTagsArray = nil;
|
||||||
self.tvSeriesNameSearchArray = nil;
|
|
||||||
self.resultsArray = nil;
|
self.resultsArray = nil;
|
||||||
self.selectedResult = nil;
|
self.selectedResult = nil;
|
||||||
|
|
||||||
|
self.tvSeriesNameSearchArray = nil;
|
||||||
|
|
||||||
[detailBoldAttr release];
|
[detailBoldAttr release];
|
||||||
|
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
@@ -550,13 +550,9 @@
|
|||||||
|
|
||||||
- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView {
|
- (NSInteger) numberOfRowsInTableView:(NSTableView *)tableView {
|
||||||
if (tableView == resultsTable) {
|
if (tableView == resultsTable) {
|
||||||
if (self.resultsArray != nil) {
|
|
||||||
return self.resultsArray.count;
|
return self.resultsArray.count;
|
||||||
}
|
|
||||||
} else if (tableView == (NSTableView *) metadataTable) {
|
} else if (tableView == (NSTableView *) metadataTable) {
|
||||||
if (self.selectedResult != nil) {
|
|
||||||
return self.selectedResultTagsArray.count;
|
return self.selectedResultTagsArray.count;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user