open oml on port defined in config

This commit is contained in:
j 2019-01-31 10:04:01 +05:30
parent f8d226a3de
commit 3111b94792

24
ctl
View file

@ -155,6 +155,22 @@ if [ "$1" == "restart" ]; then
exit $? exit $?
fi fi
fi fi
function get_port() {
port=$(grep '"port"' "${BASE}/data/server.json" | cut -f2 -d: | cut -f1 -d, | xargs)
return $port
}
function open_linux() {
port=$(get_port)
if [ -e /usr/bin/gio ]; then
gio open "file://${BASE}/openmedialibrary/static/html/load.html#$port"
else
xdg-open "file://${BASE}/openmedialibrary/static/html/load.html#$port"
fi
}
if [ "$1" == "open" ]; then if [ "$1" == "open" ]; then
if [ $SYSTEM == "Darwin" ]; then if [ $SYSTEM == "Darwin" ]; then
open "/Applications/Open Media Library.app" open "/Applications/Open Media Library.app"
@ -162,19 +178,17 @@ if [ "$1" == "open" ]; then
if [ $SYSTEM == "Linux" ]; then if [ $SYSTEM == "Linux" ]; then
if [ -e "$PID" ]; then if [ -e "$PID" ]; then
if ps -p `cat "$PID"` > /dev/null; then if ps -p `cat "$PID"` > /dev/null; then
if [ -e /usr/bin/gio ]; then open_linux
gio open "file://${BASE}/openmedialibrary/static/html/load.html"
else
xdg-open "file://${BASE}/openmedialibrary/static/html/load.html"
fi
else else
#$PYTHON "${NAME}/oml/gtkstatus.py" $@ #$PYTHON "${NAME}/oml/gtkstatus.py" $@
#exit $? #exit $?
open_linux
"$0" start & "$0" start &
fi fi
else else
#$PYTHON "$NAME/oml/gtkstatus.py" $@ #$PYTHON "$NAME/oml/gtkstatus.py" $@
#exit $? #exit $?
open_linux
"$0" start & "$0" start &
fi fi
fi fi