Add object detection, tracking, mobile notifications, and search to any security camera.
almost there i think, missing last segment
rorycleare624aee371e0
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.mindex 7d3e76e..5e633f8 100644--- a/clearcam/FileServer.m+++ b/clearcam/FileServer.m@@ -107,9 +107,6 @@NSInteger start = startParam ? [startParam integerValue] : 0;- NSLog(@"START PARAM = %ld", (long)start);- NSLog(@"DATE PARAM = %@", dateParam);-if (!dateParam || !self.segmentsDict[dateParam]) {// Check for segments.txt file in the folder for the given date and timeNSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex 5dc5e16..b3c164e 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -303,7 +303,7 @@ NSMutableDictionary *classColorMap;// Use self.current_file_timestamp to get the date and hour without minutes and secondsNSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];[dateFormatter setDateFormat:@"yyyy-MM-dd_HH"];- NSString *dateFolderName = [dateFormatter stringFromDate:self.current_file_timestamp];+ NSString *dateFolderName = [dateFormatter stringFromDate:self.last_file_timestamp];// Get the documents directoryNSString *documentsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject];@@ -322,7 +322,8 @@ NSMutableDictionary *classColorMap;NSString *segmentsFilePath = [segmentsDirectory stringByAppendingPathComponent:@"segments.txt"];NSCalendar *calendar = [NSCalendar currentCalendar];- NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour fromDate:self.last_file_timestamp];+ NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour fromDate:self.last_file_timestamp]; //todo, this the first segment?+ //NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour fromDate:self.current_file_timestamp]; //this fucking breaks itNSDate *midnight = [calendar dateFromComponents:components];NSString *dateKey = [NSString stringWithFormat:@"%04ld-%02ld-%02ld_%02ld", (long)components.year, (long)components.month, (long)components.day, (long)components.hour];@@ -348,8 +349,9 @@ NSMutableDictionary *classColorMap;NSTimeInterval timeStamp = [self.last_file_timestamp timeIntervalSinceDate:midnight];segmentEntry[@"timeStamp"] = @(timeStamp);}-+[self saveSegmentEntry:segmentEntry toFile:segmentsFilePath]; // Not used yet+ NSLog(@"adding %@ to date %@ in dict",segmentEntry,dateKey);[self.fileServer.segmentsDict[dateKey] addObject:segmentEntry];self.last_file_duration = time;