2017-05-05 17:37:50 +02:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
2017-08-25 16:25:40 +02:00
|
|
|
# This allows to open the online version of the ffmprovisr, when the computer is
|
|
|
|
# connected to the Web, and the local version otherwise.
|
2017-05-13 07:04:10 +02:00
|
|
|
|
2017-07-08 11:19:09 +02:00
|
|
|
if [[ "$(uname -s)" = "Darwin" ]] ; then
|
2017-05-09 17:45:28 +02:00
|
|
|
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)
|
2017-08-25 15:17:38 +02:00
|
|
|
if ping -c 1 amiaopensource.github.io >/dev/null 2>&1 ; then
|
2017-05-05 17:37:50 +02:00
|
|
|
ffmprovisr_path='https://amiaopensource.github.io/ffmprovisr/'
|
2017-08-25 15:53:28 +02:00
|
|
|
else
|
|
|
|
ffmprovisr_path=$(find /usr/local/Cellar/ffmprovisr -iname 'index.html' | sort -M | tail -n1)
|
2017-05-05 17:37:50 +02:00
|
|
|
fi
|
2017-05-09 17:45:28 +02:00
|
|
|
if [ -n "${default_browser}" ] ; then
|
|
|
|
open -b "${default_browser}" "${ffmprovisr_path}"
|
|
|
|
else
|
|
|
|
open "${ffmprovisr_path}"
|
|
|
|
fi
|
2017-07-08 11:19:09 +02:00
|
|
|
elif [[ "$(uname -s)" = "Linux" ]] ; then
|
2017-08-25 15:15:04 +02:00
|
|
|
if ping -c 1 amiaopensource.github.io >/dev/null 2>&1 ; then
|
2017-05-05 17:37:50 +02:00
|
|
|
ffmprovisr_path='https://amiaopensource.github.io/ffmprovisr/'
|
2017-08-25 15:53:28 +02:00
|
|
|
else
|
|
|
|
ffmprovisr_path=$(find ~/.linuxbrew/Cellar/ffmprovisr -iname 'index.html' | sort -M | tail -n1)
|
2017-05-05 17:37:50 +02:00
|
|
|
fi
|
|
|
|
xdg-open "${ffmprovisr_path}"
|
2017-10-09 15:12:39 +02:00
|
|
|
else
|
|
|
|
echo "Please locate the 'ffmprovisr' folder, and open the 'index.html' file in a browser."
|
2017-05-05 17:37:50 +02:00
|
|
|
fi
|