2007-03-07 01:26:50 +00:00
|
|
|
//
|
|
|
|
// PlaylistLoader.h
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 3/05/07.
|
|
|
|
// Copyright 2007 Vincent Spader All rights reserved.
|
|
|
|
//
|
|
|
|
|
2008-05-09 21:24:49 +00:00
|
|
|
#import "PlaylistController.h"
|
2018-05-23 07:34:22 +00:00
|
|
|
#import "PlaylistView.h"
|
2022-02-07 05:49:27 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2007-03-07 01:26:50 +00:00
|
|
|
|
2022-06-29 03:26:55 +00:00
|
|
|
#import <stdatomic.h>
|
|
|
|
|
2007-03-07 01:26:50 +00:00
|
|
|
@class PlaylistController;
|
2008-05-03 15:15:45 +00:00
|
|
|
@class PlaybackController;
|
2008-03-01 18:29:14 +00:00
|
|
|
@class PlaylistEntry;
|
2007-03-07 01:26:50 +00:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
kPlaylistM3u,
|
|
|
|
kPlaylistPls,
|
2022-02-07 05:49:27 +00:00
|
|
|
kPlaylistXml,
|
2007-03-07 01:26:50 +00:00
|
|
|
} PlaylistType;
|
|
|
|
|
|
|
|
@interface PlaylistLoader : NSObject {
|
2007-03-09 01:16:06 +00:00
|
|
|
IBOutlet PlaylistController *playlistController;
|
2022-02-07 05:49:27 +00:00
|
|
|
IBOutlet NSScrollView *playlistView;
|
|
|
|
IBOutlet PlaybackController *playbackController;
|
|
|
|
|
2009-03-06 04:37:44 +00:00
|
|
|
NSOperationQueue *queue;
|
[Job Queue] Overhauled long action handling
Long actions, such as file opening, playlist loading, metadata loading
and refreshing, etc, are now handled through NSProgress. Additionally,
a new status bar change displays the progress of the task instead of
the total duration of the playlist. Finally, app quit is blocked by a
running task, and if the app is quit while a task is running, it will
be delayed until the task completes, at which time the app will
terminate cleanly.
Signed-off-by: Christopher Snowhill <kode54@gmail.com>
2022-06-15 08:01:45 +00:00
|
|
|
|
|
|
|
BOOL metadataLoadInProgress;
|
2022-06-21 06:22:07 +00:00
|
|
|
|
|
|
|
NSMutableDictionary *queuedURLs;
|
2022-06-29 03:26:55 +00:00
|
|
|
|
|
|
|
dispatch_queue_t loaderQueue;
|
|
|
|
atomic_int loaderQueueRefCount;
|
2007-03-07 01:26:50 +00:00
|
|
|
}
|
|
|
|
|
2009-08-16 16:49:34 +00:00
|
|
|
- (void)initDefaults;
|
|
|
|
|
|
|
|
// Clear playlist
|
|
|
|
- (void)clear:(id)sender;
|
|
|
|
|
2009-03-06 04:37:44 +00:00
|
|
|
// Load arrays of urls...
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSArray *)addURLs:(NSArray *)urls sort:(BOOL)sort;
|
|
|
|
- (NSArray *)addURL:(NSURL *)url;
|
|
|
|
- (NSArray *)insertURLs:(NSArray *)urls atIndex:(NSInteger)index sort:(BOOL)sort;
|
2008-02-10 22:46:12 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSArray *)addDatabase;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
2022-06-16 14:14:33 +00:00
|
|
|
- (BOOL)addDataStore;
|
|
|
|
|
2009-03-06 04:37:44 +00:00
|
|
|
// Save playlist, auto-determines type based on extension. Uses m3u if it cannot be determined.
|
2007-03-07 01:26:50 +00:00
|
|
|
- (BOOL)save:(NSString *)filename;
|
|
|
|
- (BOOL)save:(NSString *)filename asType:(PlaylistType)type;
|
|
|
|
- (BOOL)saveM3u:(NSString *)filename;
|
|
|
|
- (BOOL)savePls:(NSString *)filename;
|
2013-10-09 15:45:16 +00:00
|
|
|
- (BOOL)saveXml:(NSString *)filename;
|
2007-03-07 01:26:50 +00:00
|
|
|
|
2009-03-06 04:37:44 +00:00
|
|
|
// Read info for a playlist entry
|
2016-06-29 02:33:21 +00:00
|
|
|
//- (NSDictionary *)readEntryInfo:(PlaylistEntry *)pe;
|
2008-03-01 18:29:14 +00:00
|
|
|
|
2008-05-09 21:24:49 +00:00
|
|
|
- (void)loadInfoForEntries:(NSArray *)entries;
|
|
|
|
|
2019-12-06 03:04:46 +00:00
|
|
|
// To be dispatched on main thread only
|
|
|
|
- (void)syncLoadInfoForEntries:(NSArray *)entries;
|
|
|
|
|
2007-03-09 01:16:06 +00:00
|
|
|
- (NSArray *)acceptableFileTypes;
|
2022-02-07 05:49:27 +00:00
|
|
|
- (NSArray *)acceptablePlaylistTypes; // Only m3u and pls saving
|
2007-10-09 01:20:46 +00:00
|
|
|
- (NSArray *)acceptableContainerTypes;
|
2007-03-07 01:26:50 +00:00
|
|
|
|
2009-03-06 04:37:44 +00:00
|
|
|
// Events (passed to playlist controler):
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)willInsertURLs:(NSArray *)urls origin:(URLOrigin)origin;
|
|
|
|
- (void)didInsertURLs:(NSArray *)entries origin:(URLOrigin)origin;
|
2008-05-09 21:24:49 +00:00
|
|
|
|
2007-03-07 01:26:50 +00:00
|
|
|
@end
|