Commit 37dd47fa authored by Pierre's avatar Pierre

Fix build.

parent 1fb6e7a8
......@@ -269,5 +269,5 @@ return result;
}
return(nodePool);
}
@dynamic nodePool;
@end
......@@ -35,6 +35,6 @@
//- (id)initWithLibXmlParserContext:(xmlParserCtxtPtr)inContext options:(NSUInteger)inOptions error:(NSError **)outError;
- (NSMutableSet *)nodePool;
//- (NSMutableSet *)nodePool;
@end
......@@ -26,6 +26,7 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
#endif
- (NSManagedObjectContext *)managedObjectContext;
- (void)startUpdateDB;
- (NSString *)databaseFolderPath;
@end
@implementation MLMediaLibrary
......@@ -153,9 +154,10 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
- (Show *)tvShowWithName:(NSString *)name
{
NSFetchRequest *request = [self fetchRequestForEntity:@"Show"];
[request setPredicate:[NSPredicate predicateWithFormat:@"name LIKE %@", name]];
[request setPredicate:[NSPredicate predicateWithFormat:@"name == %@", name]];
NSArray *dbResults = [[self managedObjectContext] executeFetchRequest:request error:nil];
NSAssert(dbResults, @"Can't execute fetch request");
if ([dbResults count] <= 0)
return nil;
......@@ -343,6 +345,9 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
episode.shouldBeDisplayed = [NSNumber numberWithBool:YES];
[episode addFilesObject:file];
// The rest of the meta data will be fetched using the Show
file.hasFetchedInfo = [NSNumber numberWithBool:YES];
}
......@@ -370,12 +375,9 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
- (void)fetchMetaDataForFile:(File *)file
{
NSNumber *yes = [NSNumber numberWithBool:YES];
NSDictionary *tvShowEpisodeInfo = [MLTitleDecrapifier tvShowEpisodeInfoFromString:file.title];
if (tvShowEpisodeInfo) {
[self addTVShowEpisodeWithInfo:tvShowEpisodeInfo andFile:file];
file.hasFetchedInfo = yes;
return;
}
......@@ -410,15 +412,17 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
- (void)addFilePath:(NSString *)filePath
{
NSLog(@"Adding %@", filePath);
NSString *url = [NSURL fileURLWithPath:filePath];
NSURL *url = [NSURL fileURLWithPath:filePath];
NSDictionary *attributes = [[NSFileManager defaultManager] attributesOfItemAtPath:filePath error:nil];
NSString *title = [filePath lastPathComponent];
#if !TARGET_OS_IPHONE
NSDate *openedDate = nil; // FIXME kMDItemLastUsedDate
NSDate *modifiedDate = nil; // FIXME [result valueForAttribute:@"kMDItemFSContentChangeDate"];
#endif
NSNumber *size = [attributes objectForKey:NSFileSize]; // FIXME [result valueForAttribute:@"kMDItemFSSize"];
File *file = [self createObjectForEntity:@"File"];
file.url = [url description];
file.url = [url absoluteString];
// Yes, this is a negative number. VLCTime nicely display negative time
// with "XX minutes remaining". And we are using this facility.
......@@ -431,10 +435,13 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
file.remainingTime = [NSNumber numberWithDouble:0];
file.unread = yes;
#if !TARGET_OS_IPHONE
if ([openedDate isGreaterThan:modifiedDate]) {
file.playCount = [NSNumber numberWithDouble:1];
file.unread = no;
}
#endif
file.title = [MLTitleDecrapifier decrapify:[title stringByDeletingPathExtension]];
if ([size longLongValue] < 150000000) /* 150 MB */
......@@ -454,9 +461,10 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
// Prepare a fetch request for all items
for (NSString *path in filepaths) {
NSURL *url = [NSURL fileURLWithPath:path];
NSString *urlDescription = [url description];
[fetchPredicates addObject:[NSPredicate predicateWithFormat:@"url == %@", urlDescription]];
[urlToObject setObject:url forKey:urlDescription];
NSString *urlString = [url absoluteString];
[fetchPredicates addObject:[NSPredicate predicateWithFormat:@"url == %@", urlString]];
[urlToObject setObject:path forKey:urlString];
}
NSFetchRequest *request = [self fetchRequestForEntity:@"File"];
......@@ -469,10 +477,11 @@ static NSString *kLastTVDBUpdateServerTime = @"MLLastTVDBUpdateServerTime";
NSMutableArray *filePathsToAdd = [NSMutableArray arrayWithArray:filepaths];
// Remove objects that are already in db.
for (NSManagedObjectContext *dbResult in dbResults) {
NSString *url = [dbResult valueForKey:@"url"];
[filePathsToAdd removeObject:[urlToObject objectForKey:url]];
NSString *urlString = [dbResult valueForKey:@"url"];
[filePathsToAdd removeObject:[urlToObject objectForKey:urlString]];
}
// Add only the newly added items
......
......@@ -12,6 +12,10 @@
#import "MLURLConnection.h"
@interface MLTVShowEpisodesInfoGrabber ()
#if !HAVE_BLOCK
<MLURLConnectionDelegate>
#endif
@property (readwrite, retain) NSDictionary *results;
@property (readwrite, retain) NSArray *episodesResults;
......
......@@ -44,6 +44,7 @@
@protocol MLTVShowInfoGrabberDelegate <NSObject>
@optional
- (void)tvShowInfoGrabber:(MLTVShowInfoGrabber *)grabber didFailWithError:(NSError *)error;
@required
- (void)tvShowInfoGrabberDidFinishGrabbing:(MLTVShowInfoGrabber *)grabber;
......
......@@ -67,7 +67,6 @@ static NSNumber *gServerTime = nil;
}
[gServerTime release];
[gLastFetch release];
NSData *data = connection.data;
NSXMLDocument *xmlDoc = [[NSXMLDocument alloc] initWithData:connection.data options:0 error:nil];
NSNumber *serverTime = [[xmlDoc rootElement] numberValueForXPath:@"./Time"];
......
......@@ -255,7 +255,7 @@
<dict>
<key>PBXSmartGroupTreeModuleColumnWidthsKey</key>
<array>
<real>185</real>
<real>253</real>
</array>
<key>PBXSmartGroupTreeModuleColumnsKey_v4</key>
<array>
......@@ -278,13 +278,13 @@
<key>PBXSmartGroupTreeModuleOutlineStateSelectionKey</key>
<array>
<array>
<integer>10</integer>
<integer>1</integer>
<integer>16</integer>
<integer>13</integer>
<integer>0</integer>
</array>
</array>
<key>PBXSmartGroupTreeModuleOutlineStateVisibleRectKey</key>
<string>{{0, 3}, {185, 680}}</string>
<string>{{0, 76}, {253, 680}}</string>
</dict>
<key>PBXTopSmartGroupGIDs</key>
<array/>
......@@ -294,19 +294,19 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {202, 698}}</string>
<string>{{0, 0}, {270, 698}}</string>
<key>GroupTreeTableConfiguration</key>
<array>
<string>MainColumn</string>
<real>185</real>
<real>253</real>
</array>
<key>RubberWindowFrame</key>
<string>45 39 1228 739 0 0 1280 778 </string>
<string>-3 39 1228 739 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXSmartGroupTreeModule</string>
<key>Proportion</key>
<string>202pt</string>
<string>270pt</string>
</dict>
<dict>
<key>Dock</key>
......@@ -319,7 +319,7 @@
<key>PBXProjectModuleGUID</key>
<string>636E9D9511ED3F12002FE8A9</string>
<key>PBXProjectModuleLabel</key>
<string>MLTVShowInfoGrabber.m</string>
<string>MLMediaLibrary.m</string>
<key>PBXSplitModuleInNavigatorKey</key>
<dict>
<key>Split0</key>
......@@ -327,11 +327,11 @@
<key>PBXProjectModuleGUID</key>
<string>636E9D9611ED3F12002FE8A9</string>
<key>PBXProjectModuleLabel</key>
<string>MLTVShowInfoGrabber.m</string>
<string>MLMediaLibrary.m</string>
<key>_historyCapacity</key>
<integer>0</integer>
<key>bookmark</key>
<string>631869F511EE7B6E00AB038D</string>
<string>63186B3A11EFA0A800AB038D</string>
<key>history</key>
<array>
<string>636E9E9F11EE0130002FE8A9</string>
......@@ -339,13 +339,10 @@
<string>63D0CA8111EE118300A2801F</string>
<string>63D0CAD211EE12EE00A2801F</string>
<string>63D0CB4011EE160D00A2801F</string>
<string>6318658A11EE2BA100AB038D</string>
<string>631865A111EE2EA800AB038D</string>
<string>631865A311EE2EA800AB038D</string>
<string>631865B811EE328400AB038D</string>
<string>6318677F11EE528900AB038D</string>
<string>631867B411EE611500AB038D</string>
<string>631867B511EE611500AB038D</string>
<string>631867B711EE611500AB038D</string>
<string>631867F611EE63BF00AB038D</string>
<string>6318694711EE762900AB038D</string>
......@@ -362,17 +359,19 @@
<string>6318695311EE762900AB038D</string>
<string>6318695411EE762900AB038D</string>
<string>6318695511EE762900AB038D</string>
<string>6318695611EE762900AB038D</string>
<string>6318695711EE762900AB038D</string>
<string>6318695811EE762900AB038D</string>
<string>6318695A11EE762900AB038D</string>
<string>6318695C11EE762900AB038D</string>
<string>6318695D11EE762900AB038D</string>
<string>6318695E11EE762900AB038D</string>
<string>631869F111EE7B6E00AB038D</string>
<string>631869F211EE7B6E00AB038D</string>
<string>631869F311EE7B6E00AB038D</string>
<string>631869F411EE7B6E00AB038D</string>
<string>63186AE211EF9F0300AB038D</string>
<string>63186AE311EF9F0300AB038D</string>
<string>63186AE411EF9F0300AB038D</string>
<string>63186AE511EF9F0300AB038D</string>
<string>63186AE611EF9F0300AB038D</string>
<string>63186AE711EF9F0300AB038D</string>
<string>63186AE811EF9F0300AB038D</string>
<string>63186AE911EF9F0300AB038D</string>
<string>63186AEA11EF9F0300AB038D</string>
<string>63186AEB11EF9F0300AB038D</string>
<string>63186AEC11EF9F0300AB038D</string>
<string>63186AEE11EF9F0300AB038D</string>
</array>
</dict>
<key>SplitCount</key>
......@@ -386,18 +385,18 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{0, 0}, {1021, 479}}</string>
<string>{{0, 0}, {953, 693}}</string>
<key>RubberWindowFrame</key>
<string>45 39 1228 739 0 0 1280 778 </string>
<string>-3 39 1228 739 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXNavigatorGroup</string>
<key>Proportion</key>
<string>479pt</string>
<string>693pt</string>
</dict>
<dict>
<key>Proportion</key>
<string>214pt</string>
<string>0pt</string>
<key>Tabs</key>
<array>
<dict>
......@@ -427,9 +426,9 @@
<key>GeometryConfiguration</key>
<dict>
<key>Frame</key>
<string>{{10, 27}, {1021, 187}}</string>
<string>{{10, 27}, {953, -27}}</string>
<key>RubberWindowFrame</key>
<string>45 39 1228 739 0 0 1280 778 </string>
<string>-3 39 1228 739 0 0 1280 778 </string>
</dict>
<key>Module</key>
<string>PBXProjectFindModule</string>
......@@ -476,7 +475,7 @@
</dict>
</array>
<key>Proportion</key>
<string>1021pt</string>
<string>953pt</string>
</dict>
</array>
<key>Name</key>
......@@ -692,7 +691,7 @@
<string>/Users/steg/Sources/applidium/MediaLibraryKit/MobileMediaLibraryKit.xcodeproj</string>
</array>
<key>WindowString</key>
<string>45 39 1228 739 0 0 1280 778 </string>
<string>-3 39 1228 739 0 0 1280 778 </string>
<key>WindowToolsV3</key>
<array>
<dict>
......
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