Permalink
Browse files

added mpg123 for the linux side of things

  • Loading branch information...
rosshettel committed Sep 25, 2012
1 parent fef1c99 commit a53d9beb51ebf199bf0d3f93bc92f8d395e268f7
Showing with 10 additions and 5 deletions.
  1. +8 −3 24time.sh
  2. +2 −2 readme.md
View
@@ -1,11 +1,16 @@
#! /bin/bash
+PLAYER="afplay"
+
+# check if we're on a mac or linux box
+if [[ `uname` == "Linux" ]]; then
+ PLAYER="mpg123"
+fi
+
#set the directory to the folder the script resides in
DIRECTORY=$(cd `dirname $0` && pwd)
# get the hour number, convert to base 10
let hourNum=10#`date "+%H"`
-#echo $DIRECTORY/$hourNum
-
-afplay $DIRECTORY/sounds/$hourNum.mp3
+$PLAYER $DIRECTORY/sounds/$hourNum.mp3
View
@@ -12,9 +12,9 @@ Note that this means it will make noise for ALL of the 24 hours in a day, so don
Compatailibity
--------------
-Since **24 Clock** uses cron to run on each hour, this means it is ~~Linux and~~ Mac friendly. Sorry Windows people.
+Since **24 Clock** uses cron to run on each hour, this means it is Linux and Mac friendly. Sorry Windows people.
-*afplay is Mac specific, so this is Mac only for now while I find a suitable alternative*
+*Since Linux doesn't have `afplay`, the script uses `mpg123` instead, either make sure you have that installed or change it to whichever player you have. The Linux side of things are untested. Thanks to [criswell](http://www.reddit.com/r/commandline/comments/10gksa/my_hourly_chime_script_that_plays_the_following/c6dawjf?context=2).*
Installation

0 comments on commit a53d9be

Please sign in to comment.