-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFaceSync.cpp
More file actions
45 lines (36 loc) · 1.24 KB
/
FaceSync.cpp
File metadata and controls
45 lines (36 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//
// Created by Matthew Hambrecht on 1/6/24.
//
#include "include/device/Display.h"
#include "include/device/Config.h"
#include <fstream>
#include <vector>
#include <string>
#include <regex>
int main() {
// Variables
Display display;
Config config;
std::fstream cameras;
std::smatch key;
std::smatch value;
CCTV stream;
cameras.open(config.returnConfig()["cameras"], std::ios::in); // Read file
std::string streamData;
while(getline(cameras, streamData)){
if (std::regex_search(streamData, key, std::regex(".*::"))) {
// Regex for kv pairs
std::regex_search(streamData, key, std::regex("([^:]+)::"));
std::regex_search(streamData, value, std::regex("::\\s*(.*)"));
stream = CCTV(key[1], value[1]);
std::cout << "\e[1;92m[FaceSync]\033[0m " << "Connecting to " << "\e[1;37m" << value[1] << "\033[0m" << ". Please wait...\n";
display.addDisplay(stream);
} else { // Avoid bad addresses
throw std::runtime_error("[Error] Invalid camera file format"
"... (ex. name::address)");
}
}
cameras.close(); // Close the file object.
display.openDisplay();
return 0;
}