Compare commits

...

3 Commits
v0.27 ... v0.28

Author SHA1 Message Date
Devaev Maxim
ab437d402b Bump version: 0.27 → 0.28 2018-11-03 05:28:45 +03:00
Devaev Maxim
79d9214084 refactoring 2018-11-03 05:28:16 +03:00
Devaev Maxim
b5db16e1ba static html generator 2018-11-03 05:26:29 +03:00
10 changed files with 132 additions and 6 deletions

View File

@@ -1,7 +1,7 @@
[bumpversion]
commit = True
tag = True
current_version = 0.27
current_version = 0.28
parse = (?P<major>\d+)\.(?P<minor>\d+)(\.(?P<patch>\d+)(\-(?P<release>[a-z]+))?)?
serialize =
{major}.{minor}

View File

@@ -29,7 +29,8 @@ install: $(PROG)
regen:
tools/make-jpg-h.py src/data/blank.jpg src/data/blank.h BLANK 640 480
tools/make-jpeg-h.py src/data/blank.jpeg 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)

View File

@@ -3,7 +3,7 @@
pkgname=ustreamer
pkgver=0.27
pkgver=0.28
pkgrel=1
pkgdesc="Lightweight and fast MJPG-HTTP streamer"
url="https://github.com/pi-kvm/ustreamer"

View File

@@ -21,4 +21,4 @@
#pragma once
#define VERSION "0.27"
#define VERSION "0.28"

View File

@@ -685,4 +685,4 @@ const unsigned char BLANK_JPG_DATA[] = {
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0,
0x0, 0x0, 0x0, 0x7, 0xff, 0xd9
};
};

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -26,11 +26,13 @@
const char *HTML_INDEX_PAGE = " \
<!DOCTYPE html> \
\
<html> \
<head> \
<meta charset=\"utf-8\"> \
<title>uStreamer</title> \
</head> \
\
<body> \
<h3>&micro;Streamer v" VERSION "</h3> \
<hr> \

46
src/data/index.html Normal file
View File

@@ -0,0 +1,46 @@
<!DOCTYPE html>
<html>
<head>
<meta charset=\"utf-8\">
<title>uStreamer</title>
</head>
<body>
<h3>&micro;Streamer v%VERSION%</h3>
<hr>
<ul>
<li>
<a href=\"/ping\"><b>/ping</b></a><br>
Get JSON structure with state of the server.
</li>
<br>
<li>
<a href=\"/snapshot\"><b>/snapshot</b></a><br>
Get a current actual image from server.
</li>
<br>
<li>
<a href=\"/stream\"><b>/stream</b></a><br>
Get a live stream. Query params:<br>
<br>
<ul>
<li>
<i>extra_headers=1</i><br>
Add X-UStreamer-* headers to /stream handle (like on <a href=\"/snapshot\">/snapshot</a>).
</li>
<br>
<li>
<i>advance_headers=1</i><br>
Enable workaround for Chromium/Blink
<a href=\"https://bugs.chromium.org/p/chromium/issues/detail?id=527446\">Bug #527446</a>.
</li>
</ul>
</li>
<br>
</ul>
<br>
<hr>
<a href=\"https://github.com/pi-kvm/ustreamer\">Sources &amp; docs</a>
</body>
</html>

77
tools/make-html-h.py Executable file
View File

@@ -0,0 +1,77 @@
#!/usr/bin/env python3
#============================================================================#
# #
# uStreamer - Lightweight and fast MJPG-HTTP streamer. #
# #
# Copyright (C) 2018 Maxim Devaev <mdevaev@gmail.com> #
# #
# 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 <https://www.gnu.org/licenses/>. #
# #
#============================================================================#
import sys
import textwrap
# =====
def main():
assert len(sys.argv) == 4, "%s <src> <dest> <name>" % (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 <mdevaev@gmail.com> #
# #
# 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 <https://www.gnu.org/licenses/>. #
# #
*****************************************************************************/
#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()

View File

@@ -45,7 +45,7 @@ def main():
rows[-1].append(hex(ch))
text = ",\n\t".join(", ".join(row) for row in rows)
text = "const unsigned char %s_JPG_DATA[] = {\n\t%s\n};" % (prefix, text)
text = "const unsigned char %s_JPG_DATA[] = {\n\t%s\n};\n" % (prefix, text)
text = "const unsigned long %s_JPG_SIZE = %d;\n\n" % (prefix, len(jpg_data)) + text
text = "const unsigned %s_JPG_HEIGHT = %d;\n\n" % (prefix, height) + text
text = "const unsigned %s_JPG_WIDTH = %d;\n" % (prefix, width) + text