2017-10-19 00:24:35 +00:00
|
|
|
using GLib;
|
|
|
|
using Pluie;
|
|
|
|
|
|
|
|
int main (string[] argv)
|
|
|
|
{
|
|
|
|
var p = new PrayTime ("@DATA_PATH@", "@INSTALL_PATH@", "@VERSION@");
|
|
|
|
|
|
|
|
if (argv.length > 1) {
|
|
|
|
|
|
|
|
switch (argv[1]) {
|
|
|
|
|
|
|
|
case "cron" :
|
|
|
|
p.init_cron ();
|
|
|
|
break;
|
|
|
|
|
2017-10-28 01:59:37 +00:00
|
|
|
case "version" :
|
|
|
|
stdout.printf ("@VERSION@");
|
2017-10-19 00:24:35 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case "play" :
|
|
|
|
if (argv.length > 2) {
|
|
|
|
p.play_adhan (argv[2]);
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
stderr.printf ("missing pray parameter\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
break;
|
2017-10-28 01:59:37 +00:00
|
|
|
|
|
|
|
default :
|
|
|
|
string usage = """%s%s%s usage :
|
|
|
|
%s# update user crontab
|
|
|
|
# before installing please check config file
|
|
|
|
# @DATA_PATH@/praytime.ini%s
|
|
|
|
praytime %scron%s
|
|
|
|
# display program version%s
|
|
|
|
praytime %sversion%s
|
|
|
|
# play adhan (Fajr, Dhuhr, Asr, Maghrib, Isha)%s
|
|
|
|
praytime %splay %sPRAYER_NAME%s
|
|
|
|
# display prayer timings%s
|
|
|
|
praytime%s
|
|
|
|
""";
|
|
|
|
stderr.printf (
|
|
|
|
usage,
|
|
|
|
PrayTime.COLOR1,
|
|
|
|
PrayTime.HEADER,
|
|
|
|
PrayTime.COLOR6,
|
|
|
|
PrayTime.COLOR5,
|
|
|
|
PrayTime.COLOR3,
|
|
|
|
PrayTime.COLOR1,
|
|
|
|
PrayTime.COLOR5,
|
|
|
|
PrayTime.COLOR3,
|
|
|
|
PrayTime.COLOR1,
|
|
|
|
PrayTime.COLOR5,
|
|
|
|
PrayTime.COLOR3,
|
|
|
|
PrayTime.COLOR1,
|
|
|
|
PrayTime.COLOR4,
|
|
|
|
PrayTime.COLOR5,
|
|
|
|
PrayTime.COLOR3,
|
|
|
|
PrayTime.COLOR_OFF
|
|
|
|
);
|
|
|
|
break;
|
2017-10-19 00:24:35 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
else {
|
|
|
|
p.infos ();
|
|
|
|
}
|
|
|
|
stdout.printf ("\n");
|
|
|
|
return 0;
|
|
|
|
}
|