mirror of
https://github.com/amiaopensource/ffmprovisr.git
synced 2024-12-25 03:08:20 +01:00
Merge pull request #225 (check if connected to the web)
This commit is contained in:
commit
3374812782
@ -1,14 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
# This allows to open ffmprovisr locally from the terminal.
|
||||
# This allows to open the online version of the ffmprovisr, when the computer is
|
||||
# connected to the Web, and the local version otherwise.
|
||||
|
||||
if [[ "$(uname -s)" = "Darwin" ]] ; then
|
||||
default_browser=$(plutil -convert json ~/Library/Preferences/com.apple.LaunchServices/com.apple.launchservices.secure.plist -r -o - | grep https -b1 | tail -n1 | cut -d'"' -f4)
|
||||
if [ -d /usr/local/Cellar/ffmprovisr ] ; then
|
||||
ffmprovisr_path=$(find /usr/local/Cellar/ffmprovisr -iname 'index.html' | sort -M | tail -n1)
|
||||
fi
|
||||
if [ -z "${ffmprovisr_path}" ] ; then
|
||||
if ping -c 1 amiaopensource.github.io >/dev/null 2>&1 ; then
|
||||
ffmprovisr_path='https://amiaopensource.github.io/ffmprovisr/'
|
||||
else
|
||||
ffmprovisr_path=$(find /usr/local/Cellar/ffmprovisr -iname 'index.html' | sort -M | tail -n1)
|
||||
fi
|
||||
if [ -n "${default_browser}" ] ; then
|
||||
open -b "${default_browser}" "${ffmprovisr_path}"
|
||||
@ -16,11 +16,10 @@ if [[ "$(uname -s)" = "Darwin" ]] ; then
|
||||
open "${ffmprovisr_path}"
|
||||
fi
|
||||
elif [[ "$(uname -s)" = "Linux" ]] ; then
|
||||
if [ -d ~/.linuxbrew/Cellar/ffmprovisr ] ; then
|
||||
ffmprovisr_path=$(find ~/.linuxbrew/Cellar/ffmprovisr -iname 'index.html' | sort -M | tail -n1)
|
||||
fi
|
||||
if [ -z "${ffmprovisr_path}" ] ; then
|
||||
if ping -c 1 amiaopensource.github.io >/dev/null 2>&1 ; then
|
||||
ffmprovisr_path='https://amiaopensource.github.io/ffmprovisr/'
|
||||
else
|
||||
ffmprovisr_path=$(find ~/.linuxbrew/Cellar/ffmprovisr -iname 'index.html' | sort -M | tail -n1)
|
||||
fi
|
||||
xdg-open "${ffmprovisr_path}"
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user