Enlightenment CVS committal

Author  : gilbertt
Project : misc
Module  : camE

Dir     : misc/camE


Modified Files:
        AUTHORS Makefile example.camErc example.camErc.ssh webcam.c 


Log Message:
Patch from Nathan Poznick <[EMAIL PROTECTED]> which implements an
upload_every option, too allow you to archive more shots than you upload.


===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/AUTHORS,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- AUTHORS     10 Jun 2003 09:30:19 -0000      1.9
+++ AUTHORS     25 Jun 2003 08:22:38 -0000      1.10
@@ -23,3 +23,6 @@
 
 Abel Muiņo <[EMAIL PROTECTED]>
       optionally delete before move when uploading via FTP
+
+Nathan Poznick <[EMAIL PROTECTED]>
+      upload_every option
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/Makefile,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- Makefile    16 May 2001 22:45:34 -0000      1.8
+++ Makefile    25 Jun 2003 08:22:38 -0000      1.9
@@ -7,7 +7,7 @@
 mandir=$(ROOT)${prefix}/man
 
 CC=gcc
-CFLAGS=-O3 -g -Wall -I$(srcdir)/.. -I.. -D_GNU_SOURCE `giblib-config --cflags` -lcurl
+CFLAGS=-O3 -g -Wall -I$(srcdir)/.. -I.. -D_GNU_SOURCE `giblib-config --cflags`
 
 INSTALL=/usr/bin/install -c
 INSTALL_PROGRAM=${INSTALL}
@@ -23,7 +23,7 @@
 all build: $(PROGS)
 
 camE: $(OBJS)
-       $(CC) $(CFLAGS) -o $@ $(OBJS) `giblib-config --libs`
+       $(CC) $(CFLAGS) -o $@ $(OBJS) `giblib-config --libs` -lcurl
 
 install: all
        $(INSTALL_DIR) $(bindir)
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/example.camErc,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- example.camErc      10 Jun 2003 09:30:19 -0000      1.24
+++ example.camErc      25 Jun 2003 08:22:38 -0000      1.25
@@ -23,9 +23,15 @@
 # Some servers require us to explicitly delete the previous image
 # In that case, enable this option
 delete_first = 0
+# Determines how many shots are taken before an image is uploaded.
+# (1 == every picture is uploaded, 10 would be every 10th image)
+# (Defaults to 1 if not present)
+upload_every = 1
 
 # you can set ftp->do to 0 above and use scp instead - you still need
 # the dir, file and tmp settings in the ftp section for this to work.
+# scp also honors the upload_every setting from the ftp section, and
+# will also default to a value of 1 if not present.
 
 [scp]
 # target = [EMAIL PROTECTED]
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/example.camErc.ssh,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -3 -r1.8 -r1.9
--- example.camErc.ssh  7 Feb 2003 12:33:07 -0000       1.8
+++ example.camErc.ssh  25 Jun 2003 08:22:38 -0000      1.9
@@ -4,6 +4,7 @@
 file = webcam.jpg
 tmp  = uploading.jpg
 do = 0
+upload_every = 1
 
 [scp]
 target = [EMAIL PROTECTED]
===================================================================
RCS file: /cvsroot/enlightenment/misc/camE/webcam.c,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -3 -r1.64 -r1.65
--- webcam.c    23 Jun 2003 12:24:26 -0000      1.64
+++ webcam.c    25 Jun 2003 08:22:38 -0000      1.65
@@ -53,6 +53,7 @@
 pid_t childpid = 0;
 int ftp_passive = 1;
 int ftp_do = 1;
+int ftp_upload_every = 1; /* default to upload every shot */
 int ftp_keepalive = 1;
 int ftp_delete_first = 0;
 char *scp_target = NULL;
@@ -1115,8 +1116,11 @@
 {
   struct stat st;
   int upload_successful = 1;
+  static int shot_counter = 0;
+
+  shot_counter++;
 
-  if (ftp_do) {
+  if (ftp_do && (shot_counter >= ftp_upload_every)) {
     if ((upload_blockfile && (stat(upload_blockfile, &st) == -1))
         || !upload_blockfile) {
       log("*** uploading via ftp\n");
@@ -1128,7 +1132,8 @@
         log("post upload action done\n");
       }
     }
-  } else if (scp_target) {
+    shot_counter = 0;
+  } else if (scp_target && (shot_counter >= ftp_upload_every)) {
     char target_buf[2048];
     char cmd_buf[4096];
     char *scp_args[] = { "scp", "-BCq", NULL, NULL, NULL };
@@ -1159,6 +1164,7 @@
         }
       }
     }
+    shot_counter = 0;
   }
   return upload_successful;
 }
@@ -1218,6 +1224,8 @@
     cfg_parse_file(config_file);
   } else {
     sprintf(filename, "%s/%s", getenv("HOME"), ".camErc");
+    memset(filename, '\0', sizeof(filename));
+    snprintf(filename, sizeof(filename)-1, "%s/%s", getenv("HOME"), ".camErc");
     cfg_parse_file(filename);
   }
 
@@ -1239,6 +1247,8 @@
     ftp_debug = i;
   if (-1 != (i = cfg_get_int("ftp", "do")))
     ftp_do = i;
+  if (-1 != (i = cfg_get_int("ftp", "upload_every")))
+    ftp_upload_every = i;
   if (-1 != (i = cfg_get_int("ftp", "keepalive")))
     ftp_keepalive = i;
   if (-1 != (i = cfg_get_int("ftp", "timeout")))




-------------------------------------------------------
This SF.Net email is sponsored by: INetU
Attention Web Developers & Consultants: Become An INetU Hosting Partner.
Refer Dedicated Servers. We Manage Them. You Get 10% Monthly Commission!
INetU Dedicated Managed Hosting http://www.inetu.net/partner/index.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to