...
 
Commits (16)
This diff is collapsed.
......@@ -33,20 +33,16 @@
// FIXME
#define HAVE_BLOCK 0
#define NSXMLDocument CXMLDocument
#define NSXMLNode CXMLNode
#import "TouchXML.h"
#import <UIKit/UIKit.h>
#import <MobileVLCKit/MobileVLCKit.h>
#else
#define HAVE_BLOCK 1
#import <VLCKit/VLCKit.h>
#import "NSXMLNode_Additions.h"
#endif
#import "NSXMLNode_Additions.h"
#import "UIImage+MLKit.h"
#ifndef NDEBUG
......
Version 2.5.5
-------------
* Stability improvements
Version 2.5.4
-------------
* Stability improvements
Version 2.5.3
-------------
* Stability improvements
Version 2.5.2
-------------
* Smaller library size by increased dead code stripping
* Added new target to create a read-only variant which
does not depend on VLCKit
Version 2.5.1
-------------
Added Public APIs:
......
......@@ -49,6 +49,8 @@
+ (MLAlbum *)albumWithName:(NSString *)name
{
NSFetchRequest *request = [[MLMediaLibrary sharedMediaLibrary] fetchRequestForEntity:@"Album"];
if (!request)
return nil;
[request setPredicate:[NSPredicate predicateWithFormat:@"name == %@", name]];
NSManagedObjectContext *moc = [[MLMediaLibrary sharedMediaLibrary] managedObjectContext];
......@@ -100,11 +102,16 @@
NSMutableSet *tracks = [self mutableSetValueForKey:@"tracks"];
[tracks removeObject:track];
@try {
[tracks removeObject:track];
[self willChangeValueForKey:@"tracks"];
[self setValue:tracks forKey:@"tracks"];
[self didChangeValueForKey:@"tracks"];
[self willChangeValueForKey:@"tracks"];
[self setValue:tracks forKey:@"tracks"];
[self didChangeValueForKey:@"tracks"];
}
@catch (NSException *exception) {
NSLog(@"removing track failed");
}
}
- (void)removeTrackWithNumber:(NSNumber *)trackNumber
......
......@@ -27,7 +27,8 @@
- (NSString *)relativePathForFullPath:(NSString *)fullPath
{
NSArray *components = [fullPath componentsSeparatedByString:@"Documents"];
return [components.lastObject stringByRemovingPercentEncoding];
// Note: stringByRemovingPercentEncoding is iOS 7+ only
return [components.lastObject stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
}
@end
......@@ -34,6 +34,43 @@
#import <CommonCrypto/CommonDigest.h> // for MD5
#import "MLThumbnailerQueue.h"
#ifdef MLKIT_READONLY_TARGET
@implementation MLFileParserQueue
+ (MLFileParserQueue *)sharedFileParserQueue
{
static MLFileParserQueue *shared = nil;
if (!shared) {
shared = [[MLFileParserQueue alloc] init];
}
return shared;
}
- (void)addFile:(MLFile *)file
{
}
- (void)setHighPriorityForFile:(MLFile *)file
{
}
- (void)setDefaultPriorityForFile:(MLFile *)file
{
}
- (void)stop
{
}
- (void)resume
{
}
@end
#else
@interface MLFileParserQueue ()
{
NSDictionary *_fileDescriptionToOperation;
......@@ -105,7 +142,7 @@
_parsing = NO;
[_timeOutTimer invalidate];
APLog(@"Parsed %@ - %lu tracks", media, [[_media tracksInformation] count]);
APLog(@"Parsed %@ - %lu tracks", media, (unsigned long)[[_media tracksInformation] count]);
if (_media.delegate != self)
return;
......@@ -165,27 +202,38 @@
MLAlbum *album = nil;
BOOL wasCreated = NO;
MLAlbumTrack *track = [MLAlbumTrack trackWithAlbumName:albumName
trackNumber:@([trackNumber integerValue])
trackName:title
createIfNeeded:YES
wasCreated:&wasCreated];
if (track) {
album = track.album;
track.title = title ? title : @"";
track.artist = artist ? artist : @"";
track.genre = genre ? genre : @"";
album.releaseYear = releaseYear ? releaseYear : @"";
if (!track.title || [track.title isEqualToString:@""])
track.title = [MLTitleDecrapifier decrapify:file.title];
[track addFilesObject:file];
file.albumTrack = track;
@try {
MLAlbumTrack *track = [MLAlbumTrack trackWithAlbumName:albumName
trackNumber:@([trackNumber integerValue])
trackName:title
createIfNeeded:YES
wasCreated:&wasCreated];
if (track) {
album = track.album;
track.title = title ? title : @"";
track.artist = artist ? artist : @"";
track.genre = genre ? genre : @"";
album.releaseYear = releaseYear ? releaseYear : @"";
if (!track.title || [track.title isEqualToString:@""])
track.title = [MLTitleDecrapifier decrapify:file.title];
[track addFilesObject:file];
file.albumTrack = track;
}
}
@catch (NSException *exception) {
APLog(@"album track creation failed");
}
}
file.type = kMLFileTypeAudio;
@try {
file.type = kMLFileTypeAudio;
}
@catch (NSException *exception) {
APLog(@"file type setting failed");
}
APLog(@"'%@' is an audio file, fetching artwork", file.title);
NSString *artist, *albumName, *title;
BOOL skipOperation = NO;
......@@ -204,31 +252,40 @@
NSDictionary *poorMansContentInfo = [MLTitleDecrapifier audioContentInfoFromFile:file];
if (poorMansContentInfo)
title = poorMansContentInfo[VLCMetaInformationTitle];
file.title = title;
@try {
file.title = title;
}
@catch (NSException *exception) {
APLog(@"file title setting failed");
}
}
if (!skipOperation) {
NSString *artworkPath = [self artworkPathForMediaItemWithTitle:title Artist:artist andAlbumName:albumName];
if ([[NSFileManager defaultManager] fileExistsAtPath:artworkPath]) {
file.computedThumbnail = [UIImage scaleImage:[UIImage imageWithContentsOfFile:artworkPath]
toFitRect:(CGRect){CGPointZero, [UIImage preferredThumbnailSizeForDevice]}];
@try {
NSString *artworkPath = [self artworkPathForMediaItemWithTitle:title Artist:artist andAlbumName:albumName];
if ([[NSFileManager defaultManager] fileExistsAtPath:artworkPath]) {
file.computedThumbnail = [UIImage scaleImage:[UIImage imageWithContentsOfFile:artworkPath]
toFitRect:(CGRect){CGPointZero, [UIImage preferredThumbnailSizeForDevice]}];
}
if (file.computedThumbnail == nil)
file.albumTrack.containsArtwork = NO;
}
@catch (NSException *exception) {
APLog(@"file thumbnail setting failed");
}
if (file.computedThumbnail == nil)
file.albumTrack.containsArtwork = NO;
}
} else {
MLMediaLibrary *sharedLibrary = [MLMediaLibrary sharedMediaLibrary];
[sharedLibrary computeThumbnailForFile:file];
[sharedLibrary fetchMetaDataForFile:file];
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:file.url.absoluteString error:nil];
NSNumber *size = attributes[NSFileSize]; // FIXME [result valueForAttribute:@"kMDItemFSSize"];
if ([size longLongValue] < 150000000) /* 150 MB */
file.type = kMLFileTypeClip;
else
file.type = kMLFileTypeMovie;
}
file.hasFetchedInfo = @(YES);
@try {
file.hasFetchedInfo = @(YES);
}
@catch (NSException *exception) {
APLog(@"failed to set that we fetch info for the file");
}
[self endParsing];
}
......@@ -351,3 +408,5 @@ static inline NSString *hashFromFile(MLFile *file)
}
@end
#endif
This diff is collapsed.
......@@ -50,6 +50,8 @@
+ (MLShow *)showWithName:(NSString *)name
{
NSFetchRequest *request = [[MLMediaLibrary sharedMediaLibrary] fetchRequestForEntity:@"Show"];
if (!request)
return nil;
[request setPredicate:[NSPredicate predicateWithFormat:@"name == %@", name]];
NSManagedObjectContext *moc = [[MLMediaLibrary sharedMediaLibrary] managedObjectContext];
......
......@@ -30,6 +30,43 @@
#import "MLMediaLibrary.h"
#import "MLFileParserQueue.h"
#ifdef MLKIT_READONLY_TARGET
@implementation MLThumbnailerQueue
+ (MLThumbnailerQueue *)sharedThumbnailerQueue
{
static MLThumbnailerQueue *shared = nil;
if (!shared) {
shared = [[MLThumbnailerQueue alloc] init];
}
return shared;
}
- (void)addFile:(MLFile *)file
{
}
- (void)setHighPriorityForFile:(MLFile *)file
{
}
- (void)setDefaultPriorityForFile:(MLFile *)file
{
}
- (void)stop
{
}
- (void)resume
{
}
@end
#else
@interface ThumbnailOperation : NSOperation <VLCMediaThumbnailerDelegate>
{
MLFile *_file;
......@@ -200,3 +237,5 @@ static inline NSString *hashFromFile(MLFile *file)
}
@end
#endif
......@@ -26,9 +26,40 @@
#import "MLTitleDecrapifier.h"
#ifdef MLKIT_READONLY_TARGET
@implementation MLTitleDecrapifier
+ (NSString *)decrapify:(NSString *)string;
{
return @"";
}
+ (BOOL)isTVShowEpisodeTitle:(NSString *)string
{
return NO;
}
+ (NSDictionary *)tvShowEpisodeInfoFromString:(NSString *)string
{
return @{};
}
+ (NSDictionary *)audioContentInfoFromFile:(MLFile *)file
{
return @{};
}
@end
#else
@implementation MLTitleDecrapifier
+ (NSString *)decrapify:(NSString *)string
{
if (string == nil)
return nil;
static NSArray *ignoredWords = nil;
if (!ignoredWords)
ignoredWords = [[NSArray alloc] initWithObjects:
......@@ -237,7 +268,12 @@ returnThings:
} else
title = [self decrapify:title];
return @{VLCMetaInformationTitle: title};
if (title != nil)
return @{VLCMetaInformationTitle: title};
return @{};
}
@end
#endif