Add object detection, tracking, mobile notifications, and search to any security camera.
try days now
roryclear39141dfdc4bf
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.mindex ab1b0e3..96ded87 100644--- a/clearcam/ViewController.m+++ b/clearcam/ViewController.m@@ -111,7 +111,7 @@ NSMutableDictionary *classColorMap;- (void)startNewRecording {NSDateFormatter *formatter = [[NSDateFormatter alloc] init];- [formatter setDateFormat:@"yyyy-MM-dd_HH"];+ [formatter setDateFormat:@"yyyy-MM-dd"];NSString *hourFolderName = [formatter stringFromDate:[NSDate date]];[formatter setDateFormat:@"yyyy-MM-dd_HH:mm:ss:SSS"];@@ -302,7 +302,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"];+ [dateFormatter setDateFormat:@"yyyy-MM-dd"];NSString *dateFolderName = [dateFormatter stringFromDate:self.last_file_timestamp];// Get the documents directory@@ -322,10 +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]; //todo, this the first segment?- //NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour fromDate:self.current_file_timestamp]; //this fucking breaks it- NSDate *midnight = [calendar dateFromComponents:components];- NSString *dateKey = [NSString stringWithFormat:@"%04ld-%02ld-%02ld_%02ld", (long)components.year, (long)components.month, (long)components.day, (long)components.hour];+ NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay | NSCalendarUnitHour fromDate:self.last_file_timestamp];+ NSString *dateKey = [NSString stringWithFormat:@"%04ld-%02ld-%02ld", (long)components.year, (long)components.month, (long)components.day];if (!self.fileServer.segmentsDict[dateKey]) {self.fileServer.segmentsDict[dateKey] = [NSMutableArray array];@@ -346,6 +344,9 @@ NSMutableDictionary *classColorMap;NSMutableArray *segmentsForDate = self.fileServer.segmentsDict[dateKey];if (segmentsForDate.count == 0) {+ NSCalendar *calendar = [NSCalendar currentCalendar];+ NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:self.last_file_timestamp];+ NSDate *midnight = [calendar dateFromComponents:components];NSTimeInterval timeStamp = [self.last_file_timestamp timeIntervalSinceDate:midnight];segmentEntry[@"timeStamp"] = @(timeStamp);}diff --git a/clearcam/player.html b/clearcam/player.htmlindex 7037f70..b9980ff 100644--- a/clearcam/player.html+++ b/clearcam/player.html@@ -283,8 +283,7 @@const year = date.getFullYear();const month = String(date.getMonth() + 1).padStart(2, '0');const day = String(date.getDate()).padStart(2, '0');- const hour = String(date.getHours()).padStart(2, '0');- return `${year}-${month}-${day}_${hour}`;+ return `${year}-${month}-${day}`;}async function fetchSegments() {