mirror of
https://github.com/C5H12O5/syno-videoinfo-plugin.git
synced 2025-08-16 17:12:14 +00:00
Show version number in configuration page
This commit is contained in:
@ -6,9 +6,9 @@ import sys
|
|||||||
from http.server import HTTPServer
|
from http.server import HTTPServer
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
|
_basedir = Path(__file__).resolve().parent
|
||||||
_host = "0.0.0.0"
|
_host = "0.0.0.0"
|
||||||
_port = 5125
|
_port = 5125
|
||||||
_basedir = Path(__file__).resolve().parent
|
|
||||||
|
|
||||||
# initialize the templates
|
# initialize the templates
|
||||||
with open(_basedir / "templates/config.html", "r", encoding="utf-8") as html:
|
with open(_basedir / "templates/config.html", "r", encoding="utf-8") as html:
|
||||||
@ -40,10 +40,11 @@ def render_index(saved=None):
|
|||||||
source["priority"] = saved_conf["priority"]
|
source["priority"] = saved_conf["priority"]
|
||||||
source_html += _source_tmpl.substitute(source)
|
source_html += _source_tmpl.substitute(source)
|
||||||
|
|
||||||
return _index_tmpl.substitute(sources=source_html)
|
return _index_tmpl.substitute(sources=source_html, version=plugin_version())
|
||||||
|
|
||||||
|
|
||||||
def render_config(site, site_conf, saved_conf):
|
def render_config(site, site_conf, saved_conf):
|
||||||
|
"""Render the configuration for a site."""
|
||||||
config_html = ""
|
config_html = ""
|
||||||
config = site_conf.get("config")
|
config = site_conf.get("config")
|
||||||
if config is not None:
|
if config is not None:
|
||||||
@ -82,6 +83,16 @@ def load_sites():
|
|||||||
return dict(sorted(sites.items(), key=lambda x: x[0]))
|
return dict(sorted(sites.items(), key=lambda x: x[0]))
|
||||||
|
|
||||||
|
|
||||||
|
def plugin_version():
|
||||||
|
"""Get the plugin version from the directory name."""
|
||||||
|
dir_name = _basedir.parent.name
|
||||||
|
if "-" in dir_name:
|
||||||
|
version = dir_name.split("-")[-1]
|
||||||
|
if version != "plugin":
|
||||||
|
return f"v{version}"
|
||||||
|
return ""
|
||||||
|
|
||||||
|
|
||||||
# initialize the index page
|
# initialize the index page
|
||||||
_index_html = render_index()
|
_index_html = render_index()
|
||||||
|
|
||||||
|
@ -44,6 +44,7 @@
|
|||||||
<ul class="collapsible">
|
<ul class="collapsible">
|
||||||
${sources}
|
${sources}
|
||||||
</ul>
|
</ul>
|
||||||
|
<h5 class="right-align">${version}</h5>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
4
run.sh
4
run.sh
@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
BASEDIR=$(dirname $0)
|
BASEDIR=$(dirname $0)
|
||||||
ARGV=""
|
ARGV=""
|
||||||
|
PORT=5125
|
||||||
|
|
||||||
escape()
|
escape()
|
||||||
{
|
{
|
||||||
@ -16,8 +17,7 @@ while [ $i -le $# ]; do
|
|||||||
i=`expr $i + 1`
|
i=`expr $i + 1`
|
||||||
done
|
done
|
||||||
|
|
||||||
port=5125
|
if ! netstat -tuln | grep ":$PORT" >/dev/null; then
|
||||||
if ! netstat -tuln | grep ":$port" >/dev/null; then
|
|
||||||
nohup /usr/bin/env python3 "$BASEDIR"/configserver/serve.py > /dev/null 2>&1 &
|
nohup /usr/bin/env python3 "$BASEDIR"/configserver/serve.py > /dev/null 2>&1 &
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user