[Playlist Loader] Add option to load more files

Add option to load every file in a folder when opening just one or more
files in that folder.

Signed-off-by: Christopher Snowhill <kode54@gmail.com>
main
Christopher Snowhill 2022-07-24 23:12:11 -07:00
parent 72350a8b4c
commit e6bafa0b38
6 changed files with 40 additions and 7 deletions

View File

@ -62,7 +62,8 @@ extern NSMutableDictionary<NSString *, AlbumArtwork *> *kArtworkDictionary;
}
- (void)initDefaults {
NSDictionary *defaultsDictionary = @{ @"readCueSheetsInFolders": @(YES) };
NSDictionary *defaultsDictionary = @{ @"readCueSheetsInFolders": @(YES),
@"addOtherFilesInFolders": @(NO) };
[[NSUserDefaults standardUserDefaults] registerDefaults:defaultsDictionary];
}
@ -338,8 +339,11 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
NSMutableArray *containedURLs = [NSMutableArray array];
NSMutableArray *fileURLs = [NSMutableArray array];
NSMutableArray *validURLs = [NSMutableArray array];
NSMutableArray *folderURLs = [NSMutableArray array];
NSDictionary *xmlData = nil;
BOOL addOtherFilesInFolder = [[NSUserDefaults standardUserDefaults] boolForKey:@"addOtherFilesInFolders"];
double progress;
if(!urls) {
@ -367,6 +371,13 @@ static inline void dispatch_sync_reentrant(dispatch_queue_t queue, dispatch_bloc
// Get subpaths
[[SandboxBroker sharedSandboxBroker] addFolderIfMissing:url];
[expandedURLs addObjectsFromArray:[self fileURLsAtPath:[url path]]];
} else if(addOtherFilesInFolder) {
NSURL *folderUrl = [url URLByDeletingLastPathComponent];
if(![folderURLs containsObject:folderUrl]) {
[[SandboxBroker sharedSandboxBroker] requestFolderForFile:url];
[expandedURLs addObjectsFromArray:[self fileURLsAtPath:[folderUrl path]]];
[folderURLs addObject:folderUrl];
}
} else {
[[SandboxBroker sharedSandboxBroker] addFileIfMissing:url];
[expandedURLs addObject:[NSURL fileURLWithPath:[url path]]];

View File

@ -21,11 +21,11 @@
<customObject id="-1" userLabel="First Responder" customClass="FirstResponder"/>
<customObject id="-3" userLabel="Application" customClass="NSObject"/>
<customView id="231" userLabel="PlaylistView">
<rect key="frame" x="0.0" y="0.0" width="640" height="173"/>
<rect key="frame" x="0.0" y="0.0" width="640" height="201"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<subviews>
<button fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="310">
<rect key="frame" x="18" y="75" width="602" height="18"/>
<rect key="frame" x="18" y="103" width="602" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Read CUE sheets when adding folders to playlist" bezelStyle="regularSquare" imagePosition="left" alignment="left" state="on" inset="2" id="311">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
@ -36,7 +36,7 @@
</connections>
</button>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="261">
<rect key="frame" x="18" y="99" width="180" height="35"/>
<rect key="frame" x="18" y="127" width="180" height="35"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" sendsActionOnEndEditing="YES" alignment="right" title="When opening file with ⇧ or ⌃⌘ held:" id="262">
<font key="font" metaFont="system"/>
@ -45,7 +45,7 @@
</textFieldCell>
</textField>
<textField verticalHuggingPriority="750" fixedFrame="YES" allowsCharacterPickerTouchBarItem="YES" translatesAutoresizingMaskIntoConstraints="NO" id="259">
<rect key="frame" x="18" y="140" width="180" height="17"/>
<rect key="frame" x="18" y="168" width="180" height="17"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<textFieldCell key="cell" lineBreakMode="clipping" sendsActionOnEndEditing="YES" alignment="right" title="When opening files:" id="260">
<font key="font" metaFont="system"/>
@ -54,7 +54,7 @@
</textFieldCell>
</textField>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="247">
<rect key="frame" x="201" y="133" width="423" height="26"/>
<rect key="frame" x="201" y="161" width="423" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" title="Item 1" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" state="on" borderStyle="borderAndBezel" inset="2" selectedItem="250" id="248">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
@ -97,7 +97,7 @@
</connections>
</button>
<popUpButton verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="253">
<rect key="frame" x="201" y="95" width="423" height="26"/>
<rect key="frame" x="201" y="123" width="423" height="26"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<popUpButtonCell key="cell" type="push" bezelStyle="rounded" alignment="left" lineBreakMode="truncatingTail" borderStyle="borderAndBezel" inset="2" id="254">
<behavior key="behavior" lightByBackground="YES" lightByGray="YES"/>
@ -117,6 +117,17 @@
<binding destination="52" name="selectedObject" keyPath="values.openingFilesAlteredBehavior" previousBinding="308" id="309"/>
</connections>
</popUpButton>
<button verticalHuggingPriority="750" fixedFrame="YES" translatesAutoresizingMaskIntoConstraints="NO" id="RiU-1B-ZKm">
<rect key="frame" x="18" y="75" width="602" height="18"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
<buttonCell key="cell" type="check" title="Add other files in the same folder when adding a file" bezelStyle="regularSquare" imagePosition="left" inset="2" id="ws4-en-un8">
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
<font key="font" metaFont="system"/>
</buttonCell>
<connections>
<binding destination="52" name="value" keyPath="values.addOtherFilesInFolders" id="9V7-qF-e8q"/>
</connections>
</button>
</subviews>
<point key="canvasLocation" x="-151" y="-283.5"/>
</customView>

View File

@ -235,3 +235,6 @@
/* Class = "NSButtonCell"; title = "Enable FreeSurround stereo to surround upmixing"; ObjectID = "F0i-UK-6Nu"; */
"F0i-UK-6Nu.title" = "Enable FreeSurround stereo to surround upmixing";
/* Class = "NSButtonCell"; title = "Add other files in the same folder when adding a file"; ObjectID = "ws4-en-un8"; */
"ws4-en-un8.title" = "Add other files in the same folder when adding a file";

View File

@ -234,3 +234,6 @@
/* Class = "NSButtonCell"; title = "Enable FreeSurround stereo to surround upmixing"; ObjectID = "F0i-UK-6Nu"; */
"F0i-UK-6Nu.title" = "Activar conversión de sonido estéreo a envolvente";
/* Class = "NSButtonCell"; title = "Add other files in the same folder when adding a file"; ObjectID = "ws4-en-un8"; */
"ws4-en-un8.title" = "Add other files in the same folder when adding a file";

View File

@ -101,3 +101,5 @@
/* Class = "NSMenuItem"; title = "Delete Path"; ObjectID = "nva-pz-xSS"; */
"nva-pz-xSS.title" = "usunąć ścieżkę";
/* Class = "NSButtonCell"; title = "Add other files in the same folder when adding a file"; ObjectID = "ws4-en-un8"; */
"ws4-en-un8.title" = "Add other files in the same folder when adding a file";

View File

@ -196,3 +196,6 @@
/* Class = "NSButtonCell"; title = "Enable FreeSurround stereo to surround upmixing"; ObjectID = "F0i-UK-6Nu"; */
"F0i-UK-6Nu.title" = "Включить FreeSurround апмикс стерео в объемный звук";
/* Class = "NSButtonCell"; title = "Add other files in the same folder when adding a file"; ObjectID = "ws4-en-un8"; */
"ws4-en-un8.title" = "Add other files in the same folder when adding a file";