Enlightenment CVS committal

Author  : titan
Project : e17
Module  : proto

Dir     : e17/proto/ephoto/src/bin


Modified Files:
        ephoto.c 


Log Message:
Add some more command options!

===================================================================
RCS file: /cvs/e/e17/proto/ephoto/src/bin/ephoto.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- ephoto.c    28 Jan 2007 13:37:18 -0000      1.9
+++ ephoto.c    29 Jan 2007 09:51:24 -0000      1.10
@@ -4,6 +4,7 @@
 {
        char *album, *name, *description, *path, input[2];
        int i;
+       Ecore_List *albums, *images;
        sqlite3 *db;
 
        /*Check to make sure EWL is accessible*/
@@ -27,6 +28,9 @@
                               "                                arg1 = name of 
album to add image to\n"
                               "                                arg2 = 
descriptive name for image\n"
                               "                                arg3 = path to 
the image\n"
+                              " --list-albums          -       List Albums\n"
+                              " --list-images %%s      -       List Images in 
Album\n"
+                              "                                arg1 = name of 
album to list images from\n"
                               " --remove-album %%s     -       Removes Album\n"
                               "                                arg1 = name of 
album\n"
                               " --remove-image %%s %%s -       Removes Image\n"
@@ -34,10 +38,12 @@
                               "                                arg2 = path of 
the image to be removed\n");
                        printf("Short Commands: \n"
                               " -h                     -       This Screen\n"
-                              " -a     %%s %%s         -       Adds Album\n"
-                              " -i     %%s %%s %%s     -       Adds Image\n"
-                              " -ra    %%s             -       Removes Album\n"
-                              " -ri    %%s %%s         -       Removes 
Image\n");
+                              " -a %%s %%s             -       Adds Album\n"
+                              " -i %%s %%s %%s         -       Adds Image\n"
+                              " -la                    -       List Albums\n"
+                              " -li %%s                        -       List 
Images in Album\n"
+                              " -ra %%s                        -       Removes 
Album\n"
+                              " -ri %%s %%s            -       Removes 
Image\n");
                        return 0;
                }
                if(!strcmp(argv[i], "--add-album") || !strcmp(argv[i], "-a"))
@@ -112,6 +118,41 @@
                        }
                        else printf("Image was not added\n");
 
+                       return 0;
+               }
+               if(!strcmp(argv[i], "--list-albums") || !strcmp(argv[i], "-la"))
+               {
+                       db = ephoto_db_init();
+                       albums = ecore_list_new();
+                       albums = ephoto_db_list_albums(db);
+                       ephoto_db_close(db);
+                       while(!ecore_list_is_empty(albums))
+                       {
+                               album = ecore_list_remove_first(albums);
+                               printf("%s\n", album);
+                       }
+                       ecore_list_destroy(albums);
+
+                       return 0;
+               }
+               if(!strcmp(argv[i], "--list-images") || !strcmp(argv[i], "-li"))
+               {
+                       i++;
+                       if(argv[i]) album = argv[i];
+                       else
+                       {
+                               printf("Please specify the album to list images 
from\n");
+                               return 1;
+                       }
+                       
+                       db = ephoto_db_init();
+                       images = ephoto_db_list_images(db, album);
+                       ephoto_db_close(db);
+                       while(!ecore_list_is_empty(images))
+                       {
+                               path = ecore_list_remove_first(images);
+                               printf("%s\n", path);
+                       }
                        return 0;
                }
                if(!strcmp(argv[i], "--remove-album") || !strcmp(argv[i], 
"-ra"))



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys - and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to