2007-03-06 22:26:50 -03:00
|
|
|
//
|
|
|
|
// PlaylistLoader.h
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Vincent Spader on 3/05/07.
|
|
|
|
// Copyright 2007 Vincent Spader All rights reserved.
|
|
|
|
//
|
|
|
|
|
2008-05-09 17:24:49 -04:00
|
|
|
#import "PlaylistController.h"
|
2018-05-23 03:34:22 -04:00
|
|
|
#import "PlaylistView.h"
|
2022-02-07 02:49:27 -03:00
|
|
|
#import <Cocoa/Cocoa.h>
|
2007-03-06 22:26:50 -03:00
|
|
|
|
2022-06-28 23:26:55 -04:00
|
|
|
#import <stdatomic.h>
|
|
|
|
|
2007-03-06 22:26:50 -03:00
|
|
|
@class PlaylistController;
|
2008-05-03 11:15:45 -04:00
|
|
|
@class PlaybackController;
|
2008-03-01 15:29:14 -03:00
|
|
|
@class PlaylistEntry;
|
2007-03-06 22:26:50 -03:00
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
kPlaylistM3u,
|
|
|
|
kPlaylistPls,
|
2022-02-07 02:49:27 -03:00
|
|
|
kPlaylistXml,
|
2007-03-06 22:26:50 -03:00
|
|
|
} PlaylistType;
|
|
|
|
|
|
|
|
@interface PlaylistLoader : NSObject {
|
2007-03-08 22:16:06 -03:00
|
|
|
IBOutlet PlaylistController *playlistController;
|
2022-02-07 02:49:27 -03:00
|
|
|
IBOutlet NSScrollView *playlistView;
|
|
|
|
IBOutlet PlaybackController *playbackController;
|
|
|
|
|
2025-02-28 00:02:33 -03:00
|
|
|
NSOperationQueue *containerQueue;
|
2009-03-06 01:37:44 -03: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 04:01:45 -04:00
|
|
|
|
|
|
|
BOOL metadataLoadInProgress;
|
2022-06-21 02:22:07 -04:00
|
|
|
|
|
|
|
NSMutableDictionary *queuedURLs;
|
2007-03-06 22:26:50 -03:00
|
|
|
}
|
|
|
|
|
2009-08-16 12:49:34 -04:00
|
|
|
- (void)initDefaults;
|
|
|
|
|
|
|
|
// Clear playlist
|
|
|
|
- (void)clear:(id)sender;
|
|
|
|
|
2009-03-06 01:37:44 -03:00
|
|
|
// Load arrays of urls...
|
2022-02-07 02:49:27 -03: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 19:46:12 -03:00
|
|
|
|
2022-02-07 02:49:27 -03:00
|
|
|
- (NSArray *)addDatabase;
|
2021-12-24 06:01:21 -03:00
|
|
|
|
2022-06-16 10:14:33 -04:00
|
|
|
- (BOOL)addDataStore;
|
|
|
|
|
2009-03-06 01:37:44 -03:00
|
|
|
// Save playlist, auto-determines type based on extension. Uses m3u if it cannot be determined.
|
2007-03-06 22:26:50 -03:00
|
|
|
- (BOOL)save:(NSString *)filename;
|
|
|
|
- (BOOL)save:(NSString *)filename asType:(PlaylistType)type;
|
|
|
|
- (BOOL)saveM3u:(NSString *)filename;
|
|
|
|
- (BOOL)savePls:(NSString *)filename;
|
2013-10-09 12:45:16 -03:00
|
|
|
- (BOOL)saveXml:(NSString *)filename;
|
2007-03-06 22:26:50 -03:00
|
|
|
|
2009-03-06 01:37:44 -03:00
|
|
|
// Read info for a playlist entry
|
2016-06-28 22:33:21 -04:00
|
|
|
//- (NSDictionary *)readEntryInfo:(PlaylistEntry *)pe;
|
2008-03-01 15:29:14 -03:00
|
|
|
|
2008-05-09 17:24:49 -04:00
|
|
|
- (void)loadInfoForEntries:(NSArray *)entries;
|
|
|
|
|
2019-12-06 00:04:46 -03:00
|
|
|
// To be dispatched on main thread only
|
|
|
|
- (void)syncLoadInfoForEntries:(NSArray *)entries;
|
|
|
|
|
2007-03-08 22:16:06 -03:00
|
|
|
- (NSArray *)acceptableFileTypes;
|
2022-02-07 02:49:27 -03:00
|
|
|
- (NSArray *)acceptablePlaylistTypes; // Only m3u and pls saving
|
2007-10-08 21:20:46 -04:00
|
|
|
- (NSArray *)acceptableContainerTypes;
|
2007-03-06 22:26:50 -03:00
|
|
|
|
2009-03-06 01:37:44 -03:00
|
|
|
// Events (passed to playlist controler):
|
2022-02-07 02:49:27 -03:00
|
|
|
- (void)willInsertURLs:(NSArray *)urls origin:(URLOrigin)origin;
|
|
|
|
- (void)didInsertURLs:(NSArray *)entries origin:(URLOrigin)origin;
|
2022-07-06 17:28:14 -04:00
|
|
|
- (void)addURLsInBackground:(NSDictionary *)input;
|
|
|
|
- (void)insertURLsInBackground:(NSDictionary *)input;
|
2008-05-09 17:24:49 -04:00
|
|
|
|
2007-03-06 22:26:50 -03:00
|
|
|
@end
|