[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Added some changes to ireminder



--- Begin Message ---
as-salamu alaykom,

	Here's what I added to ireminder:
	1. Playing an azan when it is time for salah.
	2. Displaying the notification string in X
	
	attached is the diff from the latest stable release.

was-salamu alaykom.


--- End Message ---
--- /usr/local/bin/ireminder	2005-10-27 08:06:37.000000000 +0200
+++ ireminder	2005-11-06 23:01:03.651252424 +0200
@@ -246,6 +246,19 @@
     {
 	print "\n";
     }
+
+		# (aelmahmoudy): also display message in X if possible
+		if ( $ENV{DISPLAY} && (fork() == 0) )
+		{
+			(my $dummy, $string) = split (/\]/, $string, 2);
+		  exec ("wish << EOF
+wm title . ireminder
+label .l -text \"$string\"
+button .b -text OK -command exit
+pack .l .b
+EOF");
+		}
+		
 }
 
 ##
@@ -458,6 +471,7 @@
 	}
 	#default
 	$str		= "for Salat Al-$name";
+		if (defined $opt{azan}) { &play_azan(); } # (aelmahmoudy): only at salat time
     }
 
     &display("$ID $event_struct{$in_name} - Time NOW $str !!");
@@ -468,7 +482,15 @@
 	sleep(1);
     }
 }
-
+##
+# Play an azan file (aelmahmoudy)
+sub play_azan
+{
+	my $playfile = $opt{azan} || "/usr/share/sounds/azan.wav";
+	my $playcmd = "mplayer -really-quiet -noconsolecontrols $playfile >& /dev/null";
+	
+	if(fork() == 0) { exec($playcmd); exit; }
+}
 ##
 # Play a sound file (if possible) else gimme a beep :-)
 sub play_sound
@@ -488,6 +510,7 @@
 |Usage: $in_script [-ipraytime path]
        $in_spaces [-skip event_name]
        $in_spaces [-reminder minutes]
+       $in_spaces [-azan [audio_file]]
        $in_spaces [-inplace]
        $in_spaces [-help]
 |;
@@ -508,6 +531,7 @@
     [-ipraytime path]   : Specify the executable path to program
     [-skip event_name]  : Specify name of prayer/event to skip (list ok)
     [-reminder minutes] : Specify prior to how many minutes to remind (list ok)
+    [-azan [audio_file]]: Specify to sound an azan, also can specify an audio file to play for azan
     [-inplace]          : Specify to print output in-place (without scrolling)
     [-help]             : Produce this help screen
 
@@ -524,6 +548,7 @@
 		"ipraytime=s",	# specify the binary ipraytime executable
 		"skip=s@",	# array'ed list of skip events
 		"reminder=s@",	# array'ed list of reminder times (minutes)
+		"azan:s", # (aelmahmoudy)
 		"inplace",	# specify to print in-place outputs (no scroll)
 		"help",		# print a brief help screen
 		) || ( $? = 257, &usage(1, "$ID ERROR - Invalid argument\n") );