MLMediaLibrary.h 3.05 KB
Newer Older
1 2 3 4 5
/*****************************************************************************
 * MLMediaLibrary.h
 * MobileMediaLibraryKit
 *****************************************************************************
 * Copyright (C) 2010 Pierre d'Herbemont
6
 * Copyright (C) 2010-2014 VLC authors and VideoLAN
7 8 9
 * $Id$
 *
 * Authors: Pierre d'Herbemont <pdherbemont # videolan.org>
10 11
 *          Felix Paul Kühne <fkuehne # videolan.org>
 *          Tobias Conradi <videolan # tobias-conradi.de>
12
 *
13 14 15
 * This program is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2.1 of the License, or
16 17 18 19
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 21
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
22
 *
23 24 25
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
26
 *****************************************************************************/
Pierre's avatar
Pierre committed
27

Pierre's avatar
Pierre committed
28
#import <CoreData/CoreData.h>
Pierre's avatar
Pierre committed
29

30 31
@class MLFile;

32
@interface MLMediaLibrary : NSObject
Pierre's avatar
Pierre committed
33

34
@property (nonatomic, strong) id delegate;
35
// base path for the database and thumbnails
36
// setting the library base path resets the path derived from it
37
@property (nonatomic, copy) NSString *libraryBasePath;
38 39
@property (nonatomic, strong) NSURL *persistentStoreURL;
@property (nonatomic, strong) NSPersistentStoreCoordinator *persistentStoreCoordinator;
40
@property (nonatomic, copy) NSDictionary *additionalPersitentStoreOptions;
41
@property (nonatomic, readonly) int deviceSpeedCategory;
42 43
// default is group.org.videolan.vlc-ios
@property (nonatomic, copy) NSString *applicationGroupIdentifier;
44

45 46 47
#if TARGET_OS_IOS
@property (nonatomic, getter = isSpotlightIndexingEnabled) BOOL spotlightIndexingEnabled;
#endif
Pierre's avatar
Pierre committed
48 49
+ (id)sharedMediaLibrary;

50 51
- (BOOL)libraryMigrationNeeded;
- (void)migrateLibrary;
52 53
- (void)overrideLibraryWithLibraryFromURL:(NSURL *)replacementURL;

54

Pierre's avatar
Pierre committed
55
- (void)addFilePaths:(NSArray *)filepaths;
56
- (void)updateMediaDatabase;
Pierre's avatar
Pierre committed
57 58 59 60

// May be internal
- (NSFetchRequest *)fetchRequestForEntity:(NSString *)entity;
- (id)createObjectForEntity:(NSString *)entity;
61
- (void)removeObject:(NSManagedObject *)object;
62
- (NSString *)thumbnailFolderPath;
63
- (NSString *)documentFolderPath;
Pierre's avatar
Pierre committed
64

65 66 67
- (NSString *)pathRelativeToDocumentsFolderFromAbsolutPath:(NSString *)absolutPath;
- (NSString *)absolutPathFromPathRelativeToDocumentsFolder:(NSString *)relativePath;

68
- (NSManagedObject *)objectForURIRepresentation:(NSURL *)uriRepresenation;
69 70
- (void)computeThumbnailForFile:(MLFile *)file;
- (void)fetchMetaDataForFile:(MLFile *)file;
71

Pierre's avatar
Pierre committed
72
- (void)applicationWillStart;
73 74
- (void)applicationWillExit;

Pierre's avatar
Pierre committed
75 76 77
- (void)save;
- (void)libraryDidDisappear;
- (void)libraryDidAppear;
78 79


Pierre's avatar
Pierre committed
80
@end
81 82 83 84 85 86 87

@protocol MLMediaLibrary <NSObject>

@optional
- (void)libraryUpgradeComplete;

@end