Commit 686ea0f9 authored by Tobias's avatar Tobias

use CS_ENABELED define and check for TARGET_OS_WATCH

parent 213b787c
...@@ -26,10 +26,11 @@ ...@@ -26,10 +26,11 @@
*****************************************************************************/ *****************************************************************************/
#import <CoreData/CoreData.h> #import <CoreData/CoreData.h>
#if TARGET_OS_IPHONE #if CS_ENABLED
#ifndef MLKIT_READONLY_TARGET
#import <CoreSpotlight/CoreSpotlight.h> #import <CoreSpotlight/CoreSpotlight.h>
#endif #endif
#if TARGET_OS_IPHONE
@class UIImage;
#endif #endif
@class MLShowEpisode; @class MLShowEpisode;
...@@ -87,9 +88,10 @@ extern NSString *const MLFileThumbnailWasUpdated; ...@@ -87,9 +88,10 @@ extern NSString *const MLFileThumbnailWasUpdated;
@property (nonatomic, strong) NSString *genre; @property (nonatomic, strong) NSString *genre;
@property (nonatomic, strong) MLAlbumTrack *albumTrack; @property (nonatomic, strong) MLAlbumTrack *albumTrack;
@property (nonatomic, strong) NSString *thumbnailName; @property (nonatomic, strong) NSString *thumbnailName;
#if TARGET_OS_IPHONE
- (void)setComputedThumbnailScaledForDevice:(UIImage *)thumbnail; - (void)setComputedThumbnailScaledForDevice:(UIImage *)thumbnail;
@property (nonatomic, strong) UIImage *computedThumbnail; @property (nonatomic, strong) UIImage *computedThumbnail;
#endif
@property (nonatomic, assign) BOOL isSafe; @property (nonatomic, assign) BOOL isSafe;
@property (nonatomic, assign) BOOL isBeingParsed; @property (nonatomic, assign) BOOL isBeingParsed;
@property (nonatomic, assign) BOOL thumbnailTimeouted; @property (nonatomic, assign) BOOL thumbnailTimeouted;
...@@ -127,12 +129,10 @@ extern NSString *const MLFileThumbnailWasUpdated; ...@@ -127,12 +129,10 @@ extern NSString *const MLFileThumbnailWasUpdated;
- (size_t)fileSizeInBytes; - (size_t)fileSizeInBytes;
#if TARGET_OS_IPHONE #if CS_ENABLED
#ifndef MLKIT_READONLY_TARGET
- (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet; - (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet;
- (void)updateCoreSpotlightEntry; - (void)updateCoreSpotlightEntry;
#endif #endif
#endif
@end @end
......
...@@ -20,6 +20,9 @@ ...@@ -20,6 +20,9 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA. * Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
*****************************************************************************/ *****************************************************************************/
#define CS_ENABLED TARGET_OS_IPHONE && !TARGET_OS_WATCH && !MLKIT_READONLY_TARGET
#import <MediaLibraryKit/MLFile.h> #import <MediaLibraryKit/MLFile.h>
#import <MediaLibraryKit/MLLabel.h> #import <MediaLibraryKit/MLLabel.h>
#import <MediaLibraryKit/MLMediaLibrary.h> #import <MediaLibraryKit/MLMediaLibrary.h>
......
...@@ -40,8 +40,10 @@ ...@@ -40,8 +40,10 @@
#import <UIKit/UIKit.h> #import <UIKit/UIKit.h>
#ifndef MLKIT_READONLY_TARGET #ifndef MLKIT_READONLY_TARGET
#if !TARGET_OS_WATCH
#import <MobileVLCKit/MobileVLCKit.h> #import <MobileVLCKit/MobileVLCKit.h>
#endif #endif
#endif
#else #else
#define HAVE_BLOCK 1 #define HAVE_BLOCK 1
......
...@@ -415,8 +415,7 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated"; ...@@ -415,8 +415,7 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated";
return [fileSize unsignedLongLongValue]; return [fileSize unsignedLongLongValue];
} }
#if TARGET_OS_IPHONE #if CS_ENABLED
#ifndef MLKIT_READONLY_TARGET
- (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet - (CSSearchableItemAttributeSet *)coreSpotlightAttributeSet
{ {
if (!SYSTEM_RUNS_IOS9) if (!SYSTEM_RUNS_IOS9)
...@@ -497,6 +496,5 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated"; ...@@ -497,6 +496,5 @@ NSString *const MLFileThumbnailWasUpdated = @"MLFileThumbnailWasUpdated";
} }
} }
#endif #endif
#endif
@end @end
...@@ -296,7 +296,7 @@ ...@@ -296,7 +296,7 @@
@catch (NSException *exception) { @catch (NSException *exception) {
APLog(@"failed to set that we fetch info for the file"); APLog(@"failed to set that we fetch info for the file");
} }
#if TARGET_OS_IPHONE #if CS_ENABLED
[file updateCoreSpotlightEntry]; [file updateCoreSpotlightEntry];
#endif #endif
......
...@@ -39,11 +39,9 @@ ...@@ -39,11 +39,9 @@
#import "MLMediaLibrary+Migration.h" #import "MLMediaLibrary+Migration.h"
#import <sys/sysctl.h> // for sysctlbyname #import <sys/sysctl.h> // for sysctlbyname
#if TARGET_OS_IPHONE #if CS_ENABLED
#ifndef MLKIT_READONLY_TARGET
#import <CoreSpotlight/CoreSpotlight.h> #import <CoreSpotlight/CoreSpotlight.h>
#endif #endif
#endif
#if HAVE_BLOCK #if HAVE_BLOCK
#import "MLMovieInfoGrabber.h" #import "MLMovieInfoGrabber.h"
...@@ -185,7 +183,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles"; ...@@ -185,7 +183,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
if (_managedObjectModel) if (_managedObjectModel)
return _managedObjectModel; return _managedObjectModel;
NSString *path = [[NSBundle mainBundle] pathForResource:@"MediaLibrary" ofType:@"momd"]; NSString *path = [[NSBundle bundleForClass:self.class] pathForResource:@"MediaLibrary" ofType:@"momd"];
NSURL *momURL = [NSURL fileURLWithPath:path]; NSURL *momURL = [NSURL fileURLWithPath:path];
_managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:momURL]; _managedObjectModel = [[NSManagedObjectModel alloc] initWithContentsOfURL:momURL];
...@@ -848,7 +846,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles"; ...@@ -848,7 +846,7 @@ static NSString *kDecrapifyTitles = @"MLDecrapifyTitles";
[show removeEpisode:file.showEpisode]; [show removeEpisode:file.showEpisode];
} }
} }
#if TARGET_OS_IPHONE #if CS_ENABLED
NSString *thumbPath = [file thumbnailPath]; NSString *thumbPath = [file thumbnailPath];
bool thumbExists = [fileManager fileExistsAtPath:thumbPath]; bool thumbExists = [fileManager fileExistsAtPath:thumbPath];
if (thumbExists) if (thumbExists)
......
...@@ -134,7 +134,7 @@ ...@@ -134,7 +134,7 @@
UIImage *thumbnailImage = [UIImage imageWithCGImage:thumbnail]; UIImage *thumbnailImage = [UIImage imageWithCGImage:thumbnail];
if (thumbnailImage) { if (thumbnailImage) {
file.computedThumbnail = [UIImage imageWithCGImage:thumbnail]; file.computedThumbnail = [UIImage imageWithCGImage:thumbnail];
#if TARGET_OS_IPHONE #if CS_ENABLED
[file updateCoreSpotlightEntry]; [file updateCoreSpotlightEntry];
#endif #endif
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment