2021-12-24 09:01:21 +00:00
|
|
|
//
|
|
|
|
// NSTableViewDataSource+sqlite.h
|
|
|
|
// Cog
|
|
|
|
//
|
|
|
|
// Created by Christopher Snowhill on 12/22/21.
|
|
|
|
//
|
|
|
|
|
|
|
|
#ifndef NSTableViewDataSource_sqlite_h
|
2022-02-07 05:49:27 +00:00
|
|
|
#import "PlaylistEntry.h"
|
2021-12-24 09:01:21 +00:00
|
|
|
#import <Cocoa/Cocoa.h>
|
|
|
|
#import <sqlite3.h>
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
@interface SQLiteStore : NSObject {
|
|
|
|
@private
|
|
|
|
NSString *g_databasePath;
|
|
|
|
@private
|
|
|
|
sqlite3 *g_database;
|
|
|
|
@private
|
2022-02-23 07:10:02 +00:00
|
|
|
sqlite3_stmt *stmt[41];
|
2022-02-07 05:49:27 +00:00
|
|
|
@private
|
|
|
|
NSMutableArray *databaseMirror;
|
2022-02-11 06:37:37 +00:00
|
|
|
NSMutableDictionary *artTable;
|
2022-02-17 00:57:47 +00:00
|
|
|
NSMutableDictionary *stringTable;
|
2021-12-24 09:01:21 +00:00
|
|
|
}
|
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
@property(nonatomic, readwrite) NSString *databasePath;
|
|
|
|
@property(nonatomic, assign, readwrite) sqlite3 *database;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
|
|
|
+ (SQLiteStore *)sharedStore;
|
2022-06-16 14:14:33 +00:00
|
|
|
+ (BOOL)databaseStarted;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
|
|
|
- (id)init;
|
|
|
|
- (void)dealloc;
|
|
|
|
|
2022-06-16 14:14:33 +00:00
|
|
|
- (void)shutdown;
|
|
|
|
|
|
|
|
#if 0
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)trackUpdate:(PlaylistEntry *)track;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)playlistInsertTracks:(NSArray *)tracks atIndex:(int64_t)index progressCall:(void (^)(double progress))callback;
|
|
|
|
- (void)playlistInsertTracks:(NSArray *)tracks atObjectIndexes:(NSIndexSet *)indexes progressCall:(void (^)(double progress))callback;
|
|
|
|
- (void)playlistRemoveTracks:(int64_t)index forCount:(int64_t)count progressCall:(void (^)(double progress))callback;
|
|
|
|
- (void)playlistRemoveTracksAtIndexes:(NSIndexSet *)indexes progressCall:(void (^)(double progress))callback;
|
2021-12-24 09:01:21 +00:00
|
|
|
- (PlaylistEntry *)playlistGetItem:(int64_t)index;
|
2022-06-16 14:14:33 +00:00
|
|
|
#endif
|
2022-01-15 06:42:57 +00:00
|
|
|
- (PlaylistEntry *)playlistGetCachedItem:(int64_t)index;
|
2021-12-24 09:01:21 +00:00
|
|
|
- (int64_t)playlistGetCount;
|
2022-01-24 12:42:26 +00:00
|
|
|
|
2022-06-16 14:14:33 +00:00
|
|
|
#if 0
|
2022-01-24 12:42:26 +00:00
|
|
|
- (void)playlistMoveObjectsInArrangedObjectsFromIndexes:(NSIndexSet *)indexSet toIndex:(NSUInteger)insertIndex progressCall:(void (^)(double))callback;
|
|
|
|
- (void)playlistMoveObjectsFromIndex:(NSUInteger)fromIndex toArrangedObjectIndexes:(NSIndexSet *)indexSet progressCall:(void (^)(double))callback;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
2022-02-07 05:49:27 +00:00
|
|
|
- (void)syncPlaylistEntries:(NSArray *)entries progressCall:(void (^)(double progress))callback;
|
2021-12-24 09:01:21 +00:00
|
|
|
|
|
|
|
- (void)queueAddItem:(int64_t)playlistIndex;
|
|
|
|
- (void)queueAddItems:(NSArray *)playlistIndexes;
|
|
|
|
- (void)queueRemoveItem:(int64_t)queueIndex;
|
|
|
|
- (void)queueRemovePlaylistItems:(NSArray *)playlistIndexes;
|
2022-06-16 14:14:33 +00:00
|
|
|
#endif
|
2021-12-24 09:01:21 +00:00
|
|
|
- (int64_t)queueGetEntry:(int64_t)queueIndex;
|
|
|
|
- (int64_t)queueGetCount;
|
2022-06-16 14:14:33 +00:00
|
|
|
#if 0
|
2021-12-24 09:01:21 +00:00
|
|
|
- (void)queueEmpty;
|
2022-06-16 14:14:33 +00:00
|
|
|
#endif
|
2021-12-24 09:01:21 +00:00
|
|
|
|
|
|
|
@end
|
|
|
|
|
|
|
|
#define NSTableViewDataSource_sqlite_h
|
|
|
|
|
|
|
|
#endif /* NSTableViewDataSource_sqlite_h */
|