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