From 3111b94792ef981fe3351064b4a036f902eb4d02 Mon Sep 17 00:00:00 2001 From: j Date: Thu, 31 Jan 2019 10:04:01 +0530 Subject: [PATCH] open oml on port defined in config --- ctl | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) diff --git a/ctl b/ctl index c45e82b..3c81e95 100755 --- a/ctl +++ b/ctl @@ -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