提交 61bccc25 authored 作者: blu's avatar blu

new feature entropy filter to ignore gray frame without iframe

上级 5c329844
...@@ -4,5 +4,6 @@ ...@@ -4,5 +4,6 @@
"files.associations": { "files.associations": {
"chrono": "cpp", "chrono": "cpp",
"optional": "cpp" "optional": "cpp"
} },
"C_Cpp.errorSquiggles": "Disabled"
} }
\ No newline at end of file
...@@ -208,6 +208,27 @@ namespace LVDB { ...@@ -208,6 +208,27 @@ namespace LVDB {
int clearDB(string fileName) { int clearDB(string fileName) {
return 0; return 0;
} }
vector<string> getKeys(string fileName) {
DB* pdb = NULL;
if(fileName.empty()) {
fileName = LVDB_FILE_GENERAL;
}
vector<string> vec;
int ret = 0;
ret = _getDB(fileName, &pdb);
if(ret < 0) {
//
}else{
Iterator* it = pdb->NewIterator(leveldb::ReadOptions());
for (it->SeekToFirst(); it->Valid(); it->Next()) {
vec.push_back(it->key().ToString());
}
delete it;
delete pdb;
}
return vec;
}
int getValue(string &value, string key, string fileName, cb_verify_str cb) { int getValue(string &value, string key, string fileName, cb_verify_str cb) {
int ret = 0; int ret = 0;
......
...@@ -159,14 +159,18 @@ class HttpSrv{ ...@@ -159,14 +159,18 @@ class HttpSrv{
if(sn.empty()||module.empty()){ if(sn.empty()||module.empty()){
throw StrException("no para sn/module"); throw StrException("no para sn/module");
} }
string modname = module.substr(0,4);
if(modname == "evml") {
modname = "evml:" + module.substr(4, module.size());
}else{
modname = module;
}
string key = sn + ":" + modname; string key, modname;
if(module == "evmgr") {
key = sn;
}else {
if(modname == "evml") {
modname = "evml:" + module.substr(4, module.size());
}else{
modname = module;
}
key = sn + ":" + modname;
}
if(this->configMap.count(key) == 0){ if(this->configMap.count(key) == 0){
// //
...@@ -181,7 +185,7 @@ class HttpSrv{ ...@@ -181,7 +185,7 @@ class HttpSrv{
// TODO: calc md5 // TODO: calc md5
int r; int r;
ret["code"] = 0; ret["code"] = 0;
ret["msg"] = "ok"; ret["msg"] = "all ready exist";
string dk = this->configMap[key]; string dk = this->configMap[key];
json data; json data;
r = LVDB::getLocalConfig(data, dk); r = LVDB::getLocalConfig(data, dk);
...@@ -230,7 +234,7 @@ class HttpSrv{ ...@@ -230,7 +234,7 @@ class HttpSrv{
if(!key.empty()) { if(!key.empty()) {
json config; json config;
int iret = LVDB::getLocalConfig(config, key); int iret = LVDB::getLocalConfig(config, this->configMap[key]);
if(iret < 0) { if(iret < 0) {
ret["code"] = 1; ret["code"] = 1;
ret["msg"] = "evcloud failed to get config with k, v:" + key + " " + this->configMap[key].get<string>(); ret["msg"] = "evcloud failed to get config with k, v:" + key + " " + this->configMap[key].get<string>();
...@@ -257,6 +261,26 @@ class HttpSrv{ ...@@ -257,6 +261,26 @@ class HttpSrv{
}); });
svr.Get("/keys", [](const Request& req, Response& res){
string fileName = req.get_param_value("filename");
auto v = LVDB::getKeys(fileName);
json ret = v;
res.set_content(ret.dump(), "text/json");
});
svr.Get("/value", [](const Request& req, Response& res){
string key = req.get_param_value("key");
string filename = req.get_param_value("filename");
json j;
int ret = LVDB::getValue(j, key, filename);
if(ret < 0) {
j["code"] = 1;
}else{
j["code"] = 0;
}
res.set_content(j.dump(), "text/json");
});
svr.listen("0.0.0.0", 8089); svr.listen("0.0.0.0", 8089);
} }
......
...@@ -34,6 +34,8 @@ namespace LVDB { ...@@ -34,6 +34,8 @@ namespace LVDB {
json * findConfigModule(json &config, string sn, string moduleName, int iid); json * findConfigModule(json &config, string sn, string moduleName, int iid);
// //
int delValue(string key, string fileName); int delValue(string key, string fileName);
//
vector<string> getKeys(string fileName = "");
// sn, updatetime, boottime // sn, updatetime, boottime
int setSn(json &info,string fileName=LVDB_FILE_GENERAL); int setSn(json &info,string fileName=LVDB_FILE_GENERAL);
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论