// This file is part of Motion Watch. // Motion Watch is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by // the Free Software Foundation, either version 3 of the License, or // (at your option) any later version. // Motion Watch is distributed in the hope that it will be useful, // but WITHOUT ANY WARRANTY; without even the implied warranty of // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the // GNU General Public License for more details. #include "web.h" void genHTMLul(const string &outputDir, const string &title, shared_t *share) { vector logNames; vector regNames = lsFilesInDir(outputDir); vector dirNames = lsDirsInDir(outputDir); string htmlText = "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "

" + title + "

\n"; if (!dirNames.empty() && !exists(outputDir + "/VIDEO_TS")) { htmlText += "
    \n"; for (auto &&dirName : dirNames) { htmlText += "
  • " + dirName + "
  • \n"; } htmlText += "
\n"; } if (exists(outputDir + "/VIDEO_TS")) { htmlText += "

Motion Events

\n"; } for (auto &®Name : regNames) { if (regName.ends_with("_log.html")) { logNames.push_back(regName); } else if (regName.ends_with(".html") && !regName.ends_with("index.html") && !regName.ends_with("_log_lines.html")) { // regName.substr(0, regName.size() - 5) removes .html auto name = regName.substr(0, regName.size() - 5); htmlText += "\n"; } } if (!logNames.empty()) { htmlText += "

Logs

\n"; htmlText += "
\n"; } htmlText += "\n"; htmlText += ""; ofstream file(string(cleanDir(outputDir) + "/index.html").c_str()); file << htmlText << endl; file.close(); } void genHTMLvid(const string &name) { string htmlText = "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += "\n"; htmlText += ""; ofstream file(string(name + ".html").c_str()); file << htmlText << endl; file.close(); } void genCSS(shared_t *share) { string cssText = "body {\n"; cssText += " background-color: " + share->webBg + ";\n"; cssText += " color: " + share->webTxt + ";\n"; cssText += " font-family: " + share->webFont + ";\n"; cssText += "}\n"; cssText += "a {\n"; cssText += " color: " + share->webTxt + ";\n"; cssText += "}\n"; ofstream file(string(cleanDir(share->webRoot) + "/theme.css").c_str()); file << cssText << endl; file.close(); }