Enlightenment CVS committal
Author : gilbertt
Project : misc
Module : camE
Dir : misc/camE
Modified Files:
AUTHORS webcam.c
Log Message:
Patch from Birger Nissen <[EMAIL PROTECTED]> to enable single shot mode (camE
-s to just grab a single shot then exit, suitable for running from cron).
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/AUTHORS,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- AUTHORS 25 Jun 2003 08:22:38 -0000 1.10
+++ AUTHORS 1 Oct 2003 10:30:25 -0000 1.11
@@ -20,6 +20,7 @@
Birger Nissen <[EMAIL PROTECTED]>
archive subdirs
+ single shot option
Abel Mui�o <[EMAIL PROTECTED]>
optionally delete before move when uploading via FTP
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/webcam.c,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -3 -r1.66 -r1.67
--- webcam.c 25 Jun 2003 08:25:12 -0000 1.66
+++ webcam.c 1 Oct 2003 10:30:25 -0000 1.67
@@ -1107,6 +1107,7 @@
printf("usage: camE [OPTION]\n");
printf(" -c FILE Use config file FILE\n");
printf(" -f Don't fork to background\n");
+ printf(" -s Single shot\n");
printf(" -h -v This message\n");
exit(0);
}
@@ -1186,10 +1187,11 @@
FILE *fp;
int ch;
int dont_fork = 0;
+ int single_shot = 0;
int offline_done = 1;
char *config_file = NULL;
- while ((ch = getopt(argc, argv, "c:fhv")) != EOF) {
+ while ((ch = getopt(argc, argv, "c:fshv")) != EOF) {
switch (ch) {
case 'c':
config_file = strdup(optarg);
@@ -1197,6 +1199,9 @@
case 'f':
dont_fork = 1;
break;
+ case 's':
+ single_shot = 1;
+ break;
case 'h':
usage();
break;
@@ -1210,7 +1215,7 @@
}
}
- if (!dont_fork) {
+ if (!dont_fork && !single_shot) {
/* fork and die */
if ((childpid = fork()) < 0) {
fprintf(stderr, "fork (%s)\n", strerror(errno));
@@ -1457,7 +1462,7 @@
grab_init();
/* go! */
- for (;;) {
+ do {
just_shot = 0;
upload_successful = 1;
end_shot = 0;
@@ -1547,23 +1552,26 @@
offline_done = do_upload(offline_image);
log("OFFLINE\n");
}
- new_delay = grab_delay;
- if (just_shot && upload_successful) {
- end_shot = end_shot - start_shot;
- if (bw_percent < 100)
- bw_res_change(end_shot);
- if (delay_correct && end_shot) {
- new_delay -= end_shot;
- if (new_delay < 0)
- new_delay = 0;
- log("Sleeping %d secs (corrected)\n", new_delay);
- } else {
- log("Sleeping %d secs\n", grab_delay);
+
+ if (!single_shot) {
+ new_delay = grab_delay;
+ if (just_shot && upload_successful) {
+ end_shot = end_shot - start_shot;
+ if (bw_percent < 100)
+ bw_res_change(end_shot);
+ if (delay_correct && end_shot) {
+ new_delay -= end_shot;
+ if (new_delay < 0)
+ new_delay = 0;
+ log("Sleeping %d secs (corrected)\n", new_delay);
+ } else {
+ log("Sleeping %d secs\n", grab_delay);
+ }
}
+ if (upload_successful && (new_delay > 0))
+ sleep(new_delay);
}
- if (upload_successful && (new_delay > 0))
- sleep(new_delay);
- }
+ } while(!single_shot);
return 0;
}
-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs