Metadata loading now filters the request list down to unique file paths that don't have metadata loaded, makes sure that another instance of the loader isn't already loading the same files, and waits for previous instances to complete before beginning another metadata load task. It also will update the playlist entries for all affected tracks, even if they were not explicitly selected for loading or reloading. Signed-off-by: Christopher Snowhill <kode54@gmail.com>
72 lines
1.8 KiB
Objective-C
72 lines
1.8 KiB
Objective-C
//
|
|
// PlaylistLoader.h
|
|
// Cog
|
|
//
|
|
// Created by Vincent Spader on 3/05/07.
|
|
// Copyright 2007 Vincent Spader All rights reserved.
|
|
//
|
|
|
|
#import "PlaylistController.h"
|
|
#import "PlaylistView.h"
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
@class PlaylistController;
|
|
@class PlaybackController;
|
|
@class PlaylistEntry;
|
|
|
|
typedef enum {
|
|
kPlaylistM3u,
|
|
kPlaylistPls,
|
|
kPlaylistXml,
|
|
} PlaylistType;
|
|
|
|
@interface PlaylistLoader : NSObject {
|
|
IBOutlet PlaylistController *playlistController;
|
|
IBOutlet NSScrollView *playlistView;
|
|
IBOutlet PlaybackController *playbackController;
|
|
|
|
NSOperationQueue *queue;
|
|
|
|
BOOL metadataLoadInProgress;
|
|
|
|
NSMutableDictionary *queuedURLs;
|
|
}
|
|
|
|
- (void)initDefaults;
|
|
|
|
// Clear playlist
|
|
- (void)clear:(id)sender;
|
|
|
|
// Load arrays of urls...
|
|
- (NSArray *)addURLs:(NSArray *)urls sort:(BOOL)sort;
|
|
- (NSArray *)addURL:(NSURL *)url;
|
|
- (NSArray *)insertURLs:(NSArray *)urls atIndex:(NSInteger)index sort:(BOOL)sort;
|
|
|
|
- (NSArray *)addDatabase;
|
|
|
|
- (BOOL)addDataStore;
|
|
|
|
// Save playlist, auto-determines type based on extension. Uses m3u if it cannot be determined.
|
|
- (BOOL)save:(NSString *)filename;
|
|
- (BOOL)save:(NSString *)filename asType:(PlaylistType)type;
|
|
- (BOOL)saveM3u:(NSString *)filename;
|
|
- (BOOL)savePls:(NSString *)filename;
|
|
- (BOOL)saveXml:(NSString *)filename;
|
|
|
|
// Read info for a playlist entry
|
|
//- (NSDictionary *)readEntryInfo:(PlaylistEntry *)pe;
|
|
|
|
- (void)loadInfoForEntries:(NSArray *)entries;
|
|
|
|
// To be dispatched on main thread only
|
|
- (void)syncLoadInfoForEntries:(NSArray *)entries;
|
|
|
|
- (NSArray *)acceptableFileTypes;
|
|
- (NSArray *)acceptablePlaylistTypes; // Only m3u and pls saving
|
|
- (NSArray *)acceptableContainerTypes;
|
|
|
|
// Events (passed to playlist controler):
|
|
- (void)willInsertURLs:(NSArray *)urls origin:(URLOrigin)origin;
|
|
- (void)didInsertURLs:(NSArray *)entries origin:(URLOrigin)origin;
|
|
|
|
@end
|