From b598ed10405c8716d7117bffa5edf078c459eda2 Mon Sep 17 00:00:00 2001 From: Reto Kromer Date: Fri, 25 Aug 2017 15:15:04 +0200 Subject: [PATCH 1/4] check if connected to the web --- scripts/ffmprovisr | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ffmprovisr b/scripts/ffmprovisr index 7452bc0..ed07092 100755 --- a/scripts/ffmprovisr +++ b/scripts/ffmprovisr @@ -7,7 +7,7 @@ if [[ "$(uname -s)" = "Darwin" ]] ; then 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/' fi if [ -n "${default_browser}" ] ; then @@ -19,7 +19,7 @@ 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/' fi xdg-open "${ffmprovisr_path}" From 9bae51d6a4ff57175db6343a17ba3580ba7dd7b2 Mon Sep 17 00:00:00 2001 From: Reto Kromer Date: Fri, 25 Aug 2017 15:17:38 +0200 Subject: [PATCH 2/4] delete space --- scripts/ffmprovisr | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ffmprovisr b/scripts/ffmprovisr index ed07092..d0972a5 100755 --- a/scripts/ffmprovisr +++ b/scripts/ffmprovisr @@ -7,7 +7,7 @@ if [[ "$(uname -s)" = "Darwin" ]] ; then if [ -d /usr/local/Cellar/ffmprovisr ] ; then ffmprovisr_path=$(find /usr/local/Cellar/ffmprovisr -iname 'index.html' | sort -M | tail -n1) fi - if ping -c 1 amiaopensource.github.io >/dev/null 2>&1 ; then + if ping -c 1 amiaopensource.github.io >/dev/null 2>&1 ; then ffmprovisr_path='https://amiaopensource.github.io/ffmprovisr/' fi if [ -n "${default_browser}" ] ; then From 22fa09470bb31a3ff723e3224e7134450454d9a9 Mon Sep 17 00:00:00 2001 From: Reto Kromer Date: Fri, 25 Aug 2017 15:53:28 +0200 Subject: [PATCH 3/4] new version --- scripts/ffmprovisr | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/scripts/ffmprovisr b/scripts/ffmprovisr index d0972a5..bc21bda 100755 --- a/scripts/ffmprovisr +++ b/scripts/ffmprovisr @@ -4,11 +4,10 @@ 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 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 +15,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 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 From 9c871d760a448d66fa7e8f93af5754f6b331fb8c Mon Sep 17 00:00:00 2001 From: Reto Kromer Date: Fri, 25 Aug 2017 16:25:40 +0200 Subject: [PATCH 4/4] better description --- scripts/ffmprovisr | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/scripts/ffmprovisr b/scripts/ffmprovisr index bc21bda..08f6495 100755 --- a/scripts/ffmprovisr +++ b/scripts/ffmprovisr @@ -1,6 +1,7 @@ #!/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)