summaryrefslogtreecommitdiffstats
path: root/clerk_updater
diff options
context:
space:
mode:
authorRasmus Steinke <rasi@xssn.at>2015-02-15 13:34:15 +0100
committerRasmus Steinke <rasi@xssn.at>2015-02-15 13:34:15 +0100
commit4f7eaa19c96bf73ffda5425ffef47a1d151f9e3f (patch)
tree8817058728ce07ab9d6c7e5a43ee7868e23aa17d /clerk_updater
parent70ddf23530aa2f1926034e24a833db02d8b8c1b1 (diff)
parent33cea162671a4461faff0636517bef918224b5de (diff)
downloadperl-app-clerk-4f7eaa19c96bf73ffda5425ffef47a1d151f9e3f.tar.gz
perl-app-clerk-4f7eaa19c96bf73ffda5425ffef47a1d151f9e3f.tar.xz
Merge pull request #2 from rafi/feature/osx
Several adjustments for OSX support
Diffstat (limited to 'clerk_updater')
-rwxr-xr-xclerk_updater22
1 files changed, 16 insertions, 6 deletions
diff --git a/clerk_updater b/clerk_updater
index b872736..cb19b1f 100755
--- a/clerk_updater
+++ b/clerk_updater
@@ -3,22 +3,32 @@
# create cached album list
source $HOME/.config/clerk/config
-new_db="$(mpc stats | grep Updated | sed 's/ //g')"
+# Use GNU coreutils on OSX
+sed=$([[ "$OSTYPE" == "darwin"* ]] && echo 'gsed' || echo 'sed')
+
+notify()
+{
+ if [[ "$OSTYPE" == "darwin"* ]]; then
+ say "Updating clerk caches"
+ else
+ notify-send "clerk" "Creating caches"
+ fi
+}
+
+new_db="$(mpc stats | grep Updated | $sed 's/ //g')"
if [[ "$change_db" == "$new_db" ]]; then
if [[ -f $HOME/.config/clerk/album.cache && -f $HOME/.config/clerk/tracks.cache && -f $HOME/.config/clerk/last.cache ]]; then
:
else
- notify-send "clerk" "Creating caches"
+ notify
export seperator="$seperator"; mppc albumcache
export seperator="$seperator"; mppc trackcache
export seperator="$seperator"; mppc lastcache
fi
else
- notify-send "clerk" "Updating caches"
- sed -i "s/change_db=".*"/change_db=""$new_db""/" $HOME/.config/clerk/config
+ notify
+ $sed -i "s/change_db=".*"/change_db=""$new_db""/" $HOME/.config/clerk/config
export seperator="$seperator"; mppc albumcache
export seperator="$seperator"; mppc trackcache
export seperator="$seperator"; mppc lastcache
-
fi
-