Skip to content

Add object detection, tracking, mobile notifications, and search to any security camera.

remove some logs

roryclear3e506a12f39f
diff --git a/clearcam/Email.m b/clearcam/Email.m
index 5a3bb4e..0becf35 100644
--- a/clearcam/Email.m
+++ b/clearcam/Email.m
@@ -111,7 +111,6 @@
NSLog(@"Error: %@", error.localizedDescription);
} else {
NSString *responseString = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
- NSLog(@"Server Response: %@", responseString);
}
}];
[task resume];
diff --git a/clearcam/FileServer.m b/clearcam/FileServer.m
index aca43ac..148d77c 100644
--- a/clearcam/FileServer.m
+++ b/clearcam/FileServer.m
@@ -63,8 +63,6 @@
if (!success) {
NSLog(@"Failed to delete %@: %@", file, error.localizedDescription);
- } else {
- NSLog(@"Deleted: %@", file);
}
}
[self deleteAllDayEntitiesAndEventsInContext:self.context];
@@ -229,9 +227,6 @@
processedSegments = fetchedSegments;
}];
- NSLog(@"Fetched and processed %lu segments (start=%ld) for date %@",
- (unsigned long)processedSegments.count, (long)start, dateParam);
-
return processedSegments;
}
- (NSArray *)fetchFramesWithURLsFromCoreDataForDateParam:(NSString *)dateParam
@@ -267,10 +262,7 @@
NSOrderedSet *segments = [dayEntity valueForKey:@"segments"];
// Slice the segments based on the 'start' parameter to avoid fetching everything
- if (start >= segments.count) {
- NSLog(@"Start index out of range (%ld/%lu)", (long)start, (unsigned long)segments.count);
- return;
- }
+ if (start >= segments.count) return;
copiedSegments = [[segments array] subarrayWithRange:NSMakeRange(start, segments.count - start)];
}];
@@ -319,10 +311,6 @@
[framesWithURLs addObject:frameDict];
}
}
-
- NSLog(@"Fetched and processed %lu frames with URLs (start=%ld) for date %@",
- (unsigned long)framesWithURLs.count, (long)start, dateParam);
-
return framesWithURLs;
}
@@ -405,8 +393,6 @@
}
if ([filePath hasPrefix:@"get-devices"]) {
- NSLog(@"get-devices??");
-
// Respond immediately with cached list
@synchronized (self.scanner.cachedOpenPorts) {
[self sendJson200:self.scanner.cachedOpenPorts toClient:clientSocket];
@@ -648,7 +634,6 @@
}
fclose(mergedFile);
- NSLog(@"✅ Merged video sent successfully.");
}
@@ -718,8 +703,6 @@
if ([[NSFileManager defaultManager] fileExistsAtPath:imageFilePath]) {
if (![[NSFileManager defaultManager] removeItemAtPath:imageFilePath error:&error] || [[NSFileManager defaultManager] removeItemAtPath:imageFilePathSmall error:&error]) {
NSLog(@"Failed to delete image: %@", error.localizedDescription);
- } else {
- NSLog(@"Image deleted at path: %@", imageFilePath);
}
}
@@ -941,9 +924,6 @@
framesForURL = [tempFrames copy];
}];
-
- NSLog(@"Fetched and processed %lu frames for URL %@", (unsigned long)framesForURL.count, url);
-
return framesForURL;
}
@@ -988,11 +968,8 @@
[exportSession exportAsynchronouslyWithCompletionHandler:^{
if (exportSession.status == AVAssetExportSessionStatusCompleted) {
- NSLog(@"✅ Export successful: %@", outputPath);
if (![[NSFileManager defaultManager] fileExistsAtPath:outputPath]) {
NSLog(@"❌ File not found in Documents: %@", outputPath);
- } else {
- NSLog(@"✅ File successfully saved at: %@", outputPath);
}
completion(outputPath, nil);
diff --git a/clearcam/PortScanner.m b/clearcam/PortScanner.m
index 6e23728..74fd9b7 100644
--- a/clearcam/PortScanner.m
+++ b/clearcam/PortScanner.m
@@ -24,7 +24,6 @@
[self.cachedOpenPorts removeAllObjects];
[self.cachedOpenPorts addObjectsFromArray:openPorts];
}
- NSLog(@"Cache updated with open ports: %@", self.cachedOpenPorts);
}];
});
}
@@ -134,7 +133,6 @@
}
NSArray<NSString *> *ipList = [self getIPRangeFromIP:ipInfo[@"ip"] subnetMask:ipInfo[@"subnet"]];
- NSLog(@"Scanning %lu IPs for open port %d...", (unsigned long)ipList.count, port);
dispatch_group_t scanGroup = dispatch_group_create();
@@ -143,7 +141,6 @@
dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), ^{
if ([self isPortOpen:ip port:port]) {
@synchronized(self) {
- NSLog(@"[+] Open port %d found at %@", port, ip);
[foundIPs addObject:ip];
}
}
@@ -152,7 +149,6 @@
}
dispatch_group_wait(scanGroup, DISPATCH_TIME_FOREVER);
- NSLog(@"Scan complete. Found %lu open ports.", (unsigned long)foundIPs.count);
if (completion) {
completion([foundIPs copy]);
}
@@ -172,7 +168,6 @@
// Check device IP first
if (deviceIP && [self isAppRunningAtIP:deviceIP port:port]) {
[foundIPs addObject:deviceIP];
- NSLog(@"[+] App instance found at device IP: %@", deviceIP);
}
NSArray<NSString *> *ipList = [self getIPRangeFromIP:ipInfo[@"ip"] subnetMask:ipInfo[@"subnet"]];
@@ -198,7 +193,6 @@
// Then verify if it's our app
if ([self isAppRunningAtIP:ip port:port]) {
@synchronized(self) {
- NSLog(@"[+] App instance found at %@", ip);
[foundIPs addObject:ip];
}
}
@@ -212,7 +206,6 @@
}
dispatch_group_notify(scanGroup, dispatch_get_main_queue(), ^{
- NSLog(@"Scan complete. Found %lu app instances.", (unsigned long)foundIPs.count);
if (completion) {
completion([foundIPs copy]);
}
diff --git a/clearcam/ViewController.m b/clearcam/ViewController.m
index 8d79ae6..13f6a52 100644
--- a/clearcam/ViewController.m
+++ b/clearcam/ViewController.m
@@ -257,8 +257,6 @@ NSMutableDictionary *classColorMap;
AVVideoHeightKey: @(videoHeight),
AVVideoScalingModeKey: AVVideoScalingModeResizeAspectFill
};
- } else {
- NSLog(@"Device doesn't support H265");
}
self.videoWriterInput = [AVAssetWriterInput assetWriterInputWithMediaType:AVMediaTypeVideo outputSettings:videoSettings];
@@ -450,7 +448,6 @@ NSMutableDictionary *classColorMap;
}
- (void)openSettings {
- NSLog(@"Settings button tapped");
if(self.recordPressed) [self toggleRecording];
[self.captureSession stopRunning];
SettingsViewController *settingsVC = [[SettingsViewController alloc] init];
@@ -508,10 +505,6 @@ NSMutableDictionary *classColorMap;
self.isRecording = NO;
[self.videoWriterInput markAsFinished];
-
- [self.assetWriter finishWritingWithCompletionHandler:^{
- NSLog(@"Recording stopped.");
- }];
}
@@ -521,9 +514,13 @@ NSMutableDictionary *classColorMap;
return;
}
+ NSString *segmentsDirectory = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:self.dayFolderName];
+ [[NSFileManager defaultManager] createDirectoryAtPath:segmentsDirectory withIntermediateDirectories:YES attributes:nil error:nil];
+ NSCalendar *calendar = [NSCalendar currentCalendar];
+
dispatch_async(self.finishRecordingQueue, ^{
while (self.isProcessingCoreData) {
- [NSThread sleepForTimeInterval:0.01];
+ [NSThread sleepForTimeInterval:0.001];
}
self.isProcessingCoreData = YES;
self.isRecording = NO;
@@ -534,13 +531,7 @@ NSMutableDictionary *classColorMap;
AVAsset *asset = [AVAsset assetWithURL:self.assetWriter.outputURL];
CMTime time = asset.duration;
-
- NSString *segmentsDirectory = [[NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) firstObject] stringByAppendingPathComponent:self.dayFolderName];
- [[NSFileManager defaultManager] createDirectoryAtPath:segmentsDirectory withIntermediateDirectories:YES attributes:nil error:nil];
-
NSString *segmentURL = [NSString stringWithFormat:@"%@/%@", [[self.assetWriter.outputURL URLByDeletingLastPathComponent] lastPathComponent], self.assetWriter.outputURL.lastPathComponent];
-
- NSCalendar *calendar = [NSCalendar currentCalendar];
NSDateComponents *components = [calendar components:NSCalendarUnitYear | NSCalendarUnitMonth | NSCalendarUnitDay fromDate:self.current_file_timestamp];
NSTimeInterval timeStamp = [self.current_file_timestamp timeIntervalSinceDate:[calendar dateFromComponents:components]];
@@ -548,7 +539,6 @@ NSMutableDictionary *classColorMap;
// Save background context
NSError *error = nil;
if ([self.backgroundContext save:&error]) {
- NSLog(@"Segment saved successfully under DayEntity with date %@", self.dayFolderName);
// Save parent context only if necessary
NSError *parentError = nil;
if (![self.fileServer.context save:&parentError]) {
@@ -716,7 +706,6 @@ NSMutableDictionary *classColorMap;
for (NSInteger dayIndex = lastDeletedDayIndex; dayIndex < dayEntities.count; dayIndex++) {
NSManagedObject *dayEntity = dayEntities[dayIndex];
- NSLog(@"Checking DayEntity: %@", [dayEntity valueForKey:@"date"]);
NSArray *segments = [[dayEntity valueForKey:@"segments"] allObjects];
@@ -738,19 +727,13 @@ NSMutableDictionary *classColorMap;
}
double segmentSecondsSinceMidnight = segmentTimeStampNumber.doubleValue;
- NSLog(@"Checking segment: %@ (Seconds since midnight: %.2f)", segmentURL, segmentSecondsSinceMidnight);
-
// Check if the segment is within ±60 seconds of any event timestamp
BOOL shouldSkipDeletion = NO;
for (NSNumber *eventTimestamp in eventTimestamps) {
double eventSecondsSinceMidnight = eventTimestamp.doubleValue;
double timeDifference = fabs(segmentSecondsSinceMidnight - eventSecondsSinceMidnight);
-
- NSLog(@"Comparing with event time: %.2f sec (Difference: %.2f sec)", eventSecondsSinceMidnight, timeDifference);
-
if (timeDifference <= 60) { // Within one minute
shouldSkipDeletion = YES;
- NSLog(@"Skipping deletion for segment at %.2f sec because it is close to an event time!", segmentSecondsSinceMidnight);
break;
}
}
@@ -759,15 +742,12 @@ NSMutableDictionary *classColorMap;
continue;
}
- NSLog(@"\tChecking Segment: %@", segmentURL);
-
@try {
NSString *filePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).firstObject stringByAppendingPathComponent:segmentURL];
NSError *deleteError = nil;
if ([[NSFileManager defaultManager] fileExistsAtPath:filePath]) {
if ([[NSFileManager defaultManager] removeItemAtPath:filePath error:&deleteError]) {
- NSLog(@"\tDeleted %@", segmentURL);
// Keep the segmentEntity but clear all but URL (blank)
[segmentEntity setValue:@"" forKey:@"url"];
[segmentEntity setValue:nil forKey:@"frames"];
@@ -778,8 +758,6 @@ NSMutableDictionary *classColorMap;
NSError *saveError = nil;
if (![context save:&saveError]) {
NSLog(@"Failed to update segment entity: %@", saveError.localizedDescription);
- } else {
- NSLog(@"Successfully cleared segment entity data.");
}
deletedFile = YES;
@@ -816,8 +794,7 @@ NSMutableDictionary *classColorMap;
NSLog(@"Exception in ensureFreeDiskSpace: %@", exception.reason);
return YES;
}
-
- NSLog(@"Free space = %f MB", (double)[[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemFreeSize] unsignedLongLongValue] / (1024.0 * 1024.0));
+ //NSLog(@"Free space = %f MB", (double)[[[[NSFileManager defaultManager] attributesOfFileSystemForPath:NSHomeDirectory() error:nil] objectForKey:NSFileSystemFreeSize] unsignedLongLongValue] / (1024.0 * 1024.0));
return YES;
}