summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2018-10-10 00:51:08 +0300
committerDevaev Maxim <[email protected]>2018-10-10 00:51:08 +0300
commit95bc1536b23a17637188108a581a1b47bdd23daa (patch)
tree5bc804a3dbaf4bf19c67e82e1e59aba3fdc76470
parenta449b39c52392d0d8b043934a15792f21d54e06d (diff)
show streamer version
-rw-r--r--kvmd/server.py21
-rw-r--r--kvmd/streamer.py13
-rw-r--r--web/index.html8
-rw-r--r--web/js/session.js9
4 files changed, 26 insertions, 25 deletions
diff --git a/kvmd/server.py b/kvmd/server.py
index f0dd7aed..d48191ab 100644
--- a/kvmd/server.py
+++ b/kvmd/server.py
@@ -1,8 +1,6 @@
import os
import signal
import asyncio
-import platform
-import functools
import json
import time
@@ -33,17 +31,6 @@ from .logging import get_logger
__version__ = "0.78"
-def _get_system_info() -> Dict[str, Dict[str, str]]:
- return {
- "version": {
- "platform": platform.platform(),
- "python": platform.python_version(),
- "kvmd": __version__,
- },
- }
-
-
# =====
def _system_task(method: Callable) -> Callable:
async def wrap(self: "Server") -> None:
@@ -170,7 +157,13 @@ class Server: # pylint: disable=too-many-instance-attributes
# ===== INFO
async def __info_handler(self, _: aiohttp.web.Request) -> aiohttp.web.Response:
- return _json(_get_system_info())
+ return _json({
+ "version": {
+ "kvmd": __version__,
+ "streamer": await self.__streamer.get_version(),
+ },
+ "streamer": self.__streamer.get_app(),
+ })
# ===== WEBSOCKET
diff --git a/kvmd/streamer.py b/kvmd/streamer.py
index 8a23c715..f4c49bf2 100644
--- a/kvmd/streamer.py
+++ b/kvmd/streamer.py
@@ -1,3 +1,4 @@
+import os
import asyncio
import asyncio.subprocess
@@ -64,6 +65,18 @@ class Streamer: # pylint: disable=too-many-instance-attributes
"quality": self.__quality,
}
+ def get_app(self) -> str:
+ return os.path.basename(self.__cmd[0])
+
+ async def get_version(self) -> str:
+ proc = await asyncio.create_subprocess_exec(
+ *[self.__cmd[0], "--version"],
+ stdout=asyncio.subprocess.PIPE,
+ stderr=asyncio.subprocess.DEVNULL,
+ )
+ (stdout, _) = await proc.communicate()
+ return stdout.decode(errors="ignore").strip()
+
async def cleanup(self) -> None:
if self.is_running():
await self.stop()
diff --git a/web/index.html b/web/index.html
index 86b64f3b..6b9979bb 100644
--- a/web/index.html
+++ b/web/index.html
@@ -541,12 +541,8 @@
<td id="about-version-kvmd" class="version"></td>
</tr>
<tr>
- <td>Python:</td>
- <td id="about-version-python" class="version"></td>
- </tr>
- <tr>
- <td>Platform:</td>
- <td id="about-version-platform" class="version"></td>
+ <td>Streamer:</td>
+ <td id="about-version-streamer" class="version"></td>
</tr>
</table>
<p>
diff --git a/web/js/session.js b/web/js/session.js
index 19df05cc..dcc968c7 100644
--- a/web/js/session.js
+++ b/web/js/session.js
@@ -20,11 +20,10 @@ function Session(atx, hid, msd) {
var http = tools.makeRequest("GET", "/kvmd/info", function() {
if (http.readyState === 4) {
if (http.status === 200) {
- var version = JSON.parse(http.responseText).result.version;
- $("kvmd-version").innerHTML = "kvmd " + version.kvmd;
- $("about-version-kvmd").innerHTML = version.kvmd;
- $("about-version-python").innerHTML = version.python;
- $("about-version-platform").innerHTML = version.platform;
+ var info = JSON.parse(http.responseText).result;
+ $("kvmd-version").innerHTML = "Web-UI " + info.version.kvmd;
+ $("about-version-kvmd").innerHTML = info.version.kvmd;
+ $("about-version-streamer").innerHTML = info.version.streamer + " (" + info.streamer + ")";
} else {
setTimeout(__loadKvmdVersion, 1000);
}