diff --git a/Makefile b/Makefile index a9bd6af..f66e277 100644 --- a/Makefile +++ b/Makefile @@ -30,6 +30,7 @@ install: $(PROG) regen: tools/make-jpg-h.py src/data/blank.jpg src/data/blank.h BLANK 640 480 + tools/make-html-h.py src/data/index.html src/data/html_index.h HTML_INDEX_PAGE $(PROG): $(OBJECTS) diff --git a/src/data/html_index.h b/src/data/html_index.h index 69e5c0f..25c18b9 100644 --- a/src/data/html_index.h +++ b/src/data/html_index.h @@ -26,11 +26,13 @@ const char *HTML_INDEX_PAGE = " \ \ + \ \ \ \ uStreamer \ \ + \ \

µStreamer v" VERSION "

\
\ diff --git a/src/data/index.html b/src/data/index.html new file mode 100644 index 0000000..16e6c58 --- /dev/null +++ b/src/data/index.html @@ -0,0 +1,46 @@ + + + + + + uStreamer + + + +

µStreamer v%VERSION%

+
+ +
+
+ Sources & docs + + diff --git a/tools/make-html-h.py b/tools/make-html-h.py new file mode 100755 index 0000000..3efdce4 --- /dev/null +++ b/tools/make-html-h.py @@ -0,0 +1,77 @@ +#!/usr/bin/env python3 +#============================================================================# +# # +# uStreamer - Lightweight and fast MJPG-HTTP streamer. # +# # +# Copyright (C) 2018 Maxim Devaev # +# # +# This program 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. # +# # +# This program 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. # +# # +# You should have received a copy of the GNU General Public License # +# along with this program. If not, see . # +# # +#============================================================================# + + +import sys +import textwrap + + +# ===== +def main(): + assert len(sys.argv) == 4, "%s " % (sys.argv[0]) + + src = sys.argv[1] + dest = sys.argv[2] + name = sys.argv[3] + + with open(src, "r") as html_file: + text = html_file.read() + + text = text.strip() + text = text.replace("%VERSION%", "\" VERSION \"") + text = textwrap.indent(text, "\t", (lambda line: True)) + text = "\n".join(("%s \\" if line.strip() else "%s\\") % (line) for line in text.split("\n")) + text = "const char *%s = \" \\\n%s\n\";\n" % (name, text) + text = textwrap.dedent(""" + /***************************************************************************** + # uStreamer - Lightweight and fast MJPG-HTTP streamer. # + # # + # Copyright (C) 2018 Maxim Devaev # + # # + # This program 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. # + # # + # This program 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. # + # # + # You should have received a copy of the GNU General Public License # + # along with this program. If not, see . # + # # + *****************************************************************************/ + + + #pragma once + + #include "../config.h" + """).strip() + "\n\n\n" + text + + with open(dest, "w") as h_file: + h_file.write(text) + + +# ===== +if __name__ == "__main__": + main()