Fixed bug where playlist saved as kss files.
Fixed bug where multi-track files were consolidated into a single entry on saving/loading a playlist.CQTexperiment
parent
74bfd92971
commit
6f6b01b15c
|
@ -150,7 +150,7 @@ increase/decrease as long as the user holds the left/right, plus/minus button */
|
||||||
|
|
||||||
p = [NSSavePanel savePanel];
|
p = [NSSavePanel savePanel];
|
||||||
|
|
||||||
[p setAllowedFileTypes:[playlistLoader acceptableContainerTypes]];
|
[p setAllowedFileTypes:[playlistLoader acceptablePlaylistTypes]];
|
||||||
[p beginSheetForDirectory:nil file:nil modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
|
[p beginSheetForDirectory:nil file:nil modalForWindow:mainWindow modalDelegate:self didEndSelector:@selector(savePanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,7 @@ typedef enum {
|
||||||
- (BOOL)savePls:(NSString *)filename;
|
- (BOOL)savePls:(NSString *)filename;
|
||||||
|
|
||||||
- (NSArray *)acceptableFileTypes;
|
- (NSArray *)acceptableFileTypes;
|
||||||
|
- (NSArray *)acceptablePlaylistTypes; //Only m3u and pls saving
|
||||||
- (NSArray *)acceptableContainerTypes;
|
- (NSArray *)acceptableContainerTypes;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
{
|
{
|
||||||
NSString *basePath = [[[filename stringByStandardizingPath] stringByDeletingLastPathComponent] stringByAppendingString:@"/"];
|
NSString *basePath = [[[filename stringByStandardizingPath] stringByDeletingLastPathComponent] stringByAppendingString:@"/"];
|
||||||
|
|
||||||
if ([entryURL isFileURL]) {
|
if ([entryURL isFileURL] && [[entryURL fragment] isEqualToString:@""]) {
|
||||||
//We want relative paths.
|
//We want relative paths.
|
||||||
NSMutableString *entryPath = [[[[entryURL path] stringByStandardizingPath] mutableCopy] autorelease];
|
NSMutableString *entryPath = [[[[entryURL path] stringByStandardizingPath] mutableCopy] autorelease];
|
||||||
|
|
||||||
|
@ -62,32 +62,6 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (NSURL *)urlForPath:(NSString *)path relativeTo:(NSString *)baseFilename
|
|
||||||
{
|
|
||||||
if ([path hasPrefix:@"/"]) {
|
|
||||||
return [NSURL fileURLWithPath:path];
|
|
||||||
}
|
|
||||||
|
|
||||||
NSEnumerator *e = [[AudioPlayer schemes] objectEnumerator];
|
|
||||||
NSString *scheme;
|
|
||||||
while (scheme = [e nextObject])
|
|
||||||
{
|
|
||||||
if ([path hasPrefix:[scheme stringByAppendingString:@"://"]])
|
|
||||||
{
|
|
||||||
return [NSURL URLWithString:path];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
NSString *basePath = [[[baseFilename stringByStandardizingPath] stringByDeletingLastPathComponent] stringByAppendingString:@"/"];
|
|
||||||
NSMutableString *unixPath = [path mutableCopy];
|
|
||||||
|
|
||||||
//Only relative paths would have windows backslashes.
|
|
||||||
[unixPath replaceOccurrencesOfString:@"\\" withString:@"/" options:0 range:NSMakeRange(0, [unixPath length])];
|
|
||||||
|
|
||||||
return [NSURL fileURLWithPath:[basePath stringByAppendingString:[unixPath autorelease]]];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
- (BOOL)saveM3u:(NSString *)filename
|
- (BOOL)saveM3u:(NSString *)filename
|
||||||
{
|
{
|
||||||
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filename createFile:YES];
|
NSFileHandle *fileHandle = [NSFileHandle fileHandleForWritingAtPath:filename createFile:YES];
|
||||||
|
@ -318,6 +292,11 @@
|
||||||
return [[self acceptableContainerTypes] arrayByAddingObjectsFromArray:[AudioPlayer fileTypes]];
|
return [[self acceptableContainerTypes] arrayByAddingObjectsFromArray:[AudioPlayer fileTypes]];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (NSArray *)acceptablePlaylistTypes
|
||||||
|
{
|
||||||
|
return [NSArray arrayWithObjects:@"m3u", @"pls", nil];
|
||||||
|
}
|
||||||
|
|
||||||
- (NSArray *)acceptableContainerTypes
|
- (NSArray *)acceptableContainerTypes
|
||||||
{
|
{
|
||||||
return [AudioPlayer containerTypes];
|
return [AudioPlayer containerTypes];
|
||||||
|
|
Loading…
Reference in New Issue