self.window.title = NSLocalizedString(@"HandBrake", nil);
NSURL *mediaURL = [HBUtilities mediaURLFromURL:fileURL];
- NSString *displayName = [HBUtilities displayNameForURL:fileURL];
NSError *outError = NULL;
BOOL suppressWarning = [[NSUserDefaults standardUserDefaults] boolForKey:@"suppressCopyProtectionAlert"];
{
[fSrcTitlePopUp addItemWithTitle:title.description];
}
-
- // Set Source Name at top of window with the browsedSourceDisplayName grokked right before -performScan
- fSrcDVD2Field.stringValue = displayName;
-
self.window.representedURL = mediaURL;
self.window.title = mediaURL.lastPathComponent;
}
fSrcDVD2Field.stringValue = NSLocalizedString(@"No Valid Source Found", @"");
}
+ // Set the last searched source directory in the prefs here
+ if ([[NSWorkspace sharedWorkspace] isFilePackageAtPath:mediaURL.URLByDeletingLastPathComponent.path])
+ {
+ [[NSUserDefaults standardUserDefaults] setURL:mediaURL.URLByDeletingLastPathComponent.URLByDeletingLastPathComponent forKey:@"HBLastSourceDirectoryURL"];
+ }
+ else
+ {
+ [[NSUserDefaults standardUserDefaults] setURL:mediaURL.URLByDeletingLastPathComponent forKey:@"HBLastSourceDirectoryURL"];
+ }
+
completionHandler(self.core.titles);
[self.window.toolbar validateVisibleItems];
}];
// Update the title selection popup.
[fSrcTitlePopUp selectItemWithTitle:title.description];
- // If we are a stream type and a batch scan, grok the output file name from title->name upon title change
+ // Grok the output file name from title.name upon title change
if (title.isStream && self.core.titles.count > 1)
{
// Change the source to read out the parent folder also
- fSrcDVD2Field.stringValue = [NSString stringWithFormat:@"%@/%@", title.url.URLByDeletingLastPathComponent.lastPathComponent, title.name];
+ fSrcDVD2Field.stringValue = [NSString stringWithFormat:@"%@/%@, %@", title.url.URLByDeletingLastPathComponent.lastPathComponent, title.name, title.shortFormatDescription];
+ }
+ else
+ {
+ fSrcDVD2Field.stringValue = [NSString stringWithFormat:@"%@, %@", title.name, title.shortFormatDescription];
}
}
else
{
if (result == NSFileHandlingPanelOKButton)
{
- // Set the last searched source directory in the prefs here
- [[NSUserDefaults standardUserDefaults] setURL:panel.URL.URLByDeletingLastPathComponent forKey:@"HBLastSourceDirectoryURL"];
-
NSInteger titleIdx = self.scanSpecificTitle ? self.scanSpecificTitleIdx : 0;
[self openURL:panel.URL titleIndex:titleIdx];
}
@interface HBTitle : NSObject
@property (nonatomic, readonly) NSString *name;
+@property (nonatomic, readonly) NSString *shortFormatDescription;
@property (nonatomic, readonly, getter=isFeatured) BOOL featured;
@property (nonatomic, readonly, getter=isStream) BOOL stream;
// If the name is empty use file/directory name
if (_name.length == 0)
{
- _name = [@(self.hb_title->path) lastPathComponent];
+ _name = @(self.hb_title->path).lastPathComponent;
}
}
}
}
+- (NSString *)shortFormatDescription
+{
+ NSMutableString *format = [[NSMutableString alloc] init];
+
+ [format appendFormat:@"%dx%d", _hb_title->geometry.width, _hb_title->geometry.height];
+
+ if (_hb_title->geometry.par.num != 1 || _hb_title->geometry.par.den != 1)
+ {
+ [format appendFormat:@" (%dx%d)", _hb_title->geometry.width * _hb_title->geometry.par.num / _hb_title->geometry.par.den,
+ _hb_title->geometry.height];
+ }
+
+ [format appendString:@", "];
+
+ [format appendFormat:@"%.6g FPS", _hb_title->vrate.num / (double)_hb_title->vrate.den];
+
+ hb_list_t *audioList = _hb_title->list_audio;
+ int audioCount = hb_list_count(audioList);
+
+ if (audioCount > 1)
+ {
+ [format appendFormat:NSLocalizedString(@", %d audio tracks", nil), audioCount];
+ }
+ else if (audioCount == 1)
+ {
+ [format appendFormat:NSLocalizedString(@", 1 audio track", nil)];
+ }
+
+ hb_list_t *subList = _hb_title->list_subtitle;
+ int subCount = hb_list_count(subList);
+
+ if (subCount > 1)
+ {
+ [format appendFormat:NSLocalizedString(@", %d subtitles tracks", nil), subCount];
+ }
+ else if (subCount == 1)
+ {
+ [format appendFormat:NSLocalizedString(@", 1 subtitles track", nil)];
+ }
+
+ return format;
+}
+
- (NSURL *)url
{
return [NSURL fileURLWithPath:@(_hb_title->path)];
+ (nullable NSData *)bookmarkFromURL:(NSURL *)url;
+ (nullable NSData *)bookmarkFromURL:(NSURL *)url options:(NSURLBookmarkCreationOptions)options;
-+ (NSString *)displayNameForURL:(NSURL *)URL;
+ (NSURL *)mediaURLFromURL:(NSURL *)URL;
+ (NSString *)automaticNameForJob:(HBJob *)job;
return [HBUtilities bookmarkFromURL:url options:NSURLBookmarkCreationWithSecurityScope];
}
-+ (NSString *)displayNameForURL:(NSURL *)URL
-{
- NSString *displayName = URL.lastPathComponent;
-
- if ([URL.lastPathComponent isEqualToString:@"VIDEO_TS"])
- {
- displayName = URL.URLByDeletingLastPathComponent.lastPathComponent;
- }
-
- return displayName;
-}
-
+ (NSURL *)mediaURLFromURL:(NSURL *)URL
{
NSURL *mediaURL = URL;