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
1 changed files with 19 additions and 5 deletions

24
ctl
View File

@ -155,6 +155,22 @@ if [ "$1" == "restart" ]; then
exit $?
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 [ $SYSTEM == "Darwin" ]; then
open "/Applications/Open Media Library.app"
@ -162,19 +178,17 @@ if [ "$1" == "open" ]; then
if [ $SYSTEM == "Linux" ]; then
if [ -e "$PID" ]; then
if ps -p `cat "$PID"` > /dev/null; then
if [ -e /usr/bin/gio ]; then
gio open "file://${BASE}/openmedialibrary/static/html/load.html"
else
xdg-open "file://${BASE}/openmedialibrary/static/html/load.html"
fi
open_linux
else
#$PYTHON "${NAME}/oml/gtkstatus.py" $@
#exit $?
open_linux
"$0" start &
fi
else
#$PYTHON "$NAME/oml/gtkstatus.py" $@
#exit $?
open_linux
"$0" start &
fi
fi