IPP Software Navigation Tools IPP Links Communication Pan-STARRS Links

Ignore:
Timestamp:
Mar 21, 2006, 5:17:21 PM (20 years ago)
Author:
jhoblitt
Message:

partial implementation of pzsearch -copydone

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ippTools/src/pztoolConfig.c

    r6659 r6670  
    4545        "indicate that an image file has been downloaded", "");
    4646
    47     // -pending search
    48     /*
    49     psMetadata *pendingArgs = psMetadataAlloc();
    50     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_id",  0,
     47    // -copydone search
     48    psMetadata *copydoneArgs = psMetadataAlloc();
     49    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-exp_id",  0,
    5150        "define exposure ID", "");
    52     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-inst",  0,
    53         "define camera of interest", "");
    54     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-telescope",  0,
    55         "define camera of interest", "");
    56     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-exp_type",  0,
     51    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class",  0,
    5752        "define class", "");
    58     psMetadataAddStr(pendingArgs, PS_LIST_TAIL, "-class",  0,
    59         "define class", "");
    60     */
     53    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-class_id",  0,
     54        "define class_id", "");
     55    psMetadataAddStr(copydoneArgs, PS_LIST_TAIL, "-suri",  0,
     56        "define storage uri", "");
    6157
    6258    bool argErr = false;
     
    7369        printf("Usage: %s <mode> [<options>]\n\n", argv[0]);
    7470        printf(" <mode> : -seen | -pending | -copydone\n\n");
    75         /*
    76         fprintf (stdout, "-pending ");
    77         psArgumentHelp(pendingArgs);
    78         fprintf (stdout, "-update ");
    79         psArgumentHelp(updateArgs);
    80         */
     71        fprintf (stdout, "-copydone ");
     72        psArgumentHelp(copydoneArgs);
    8173        psFree(args);
    82         /*
    83         psFree(pendingArgs);
    84         psFree(updateArgs);
    85         */
     74        psFree(copydoneArgs);
    8675        exit(EXIT_FAILURE);
    8776    }
     77
     78    psFree(copydoneArgs);
    8879
    8980    // XXX why is "" being returned when -[foo] isn't specified?
     
    9384    }
    9485
    95     /*
    96     switch (config->mode) {
    97         bool status;
    98         case PX_MODE_PENDING:
    99             // -exp_id
    100             config->exp_id = psMetadataLookupStr(&status, args, "-exp_id");
    101             psMemIncrRefCounter(config->exp_id);
    102             EMPTY_TO_NULL_STRING(config->exp_id);
    103             // -inst
    104             config->camera_name = psMetadataLookupStr(&status, args, "-inst");
    105             psMemIncrRefCounter(config->camera_name);
    106             EMPTY_TO_NULL_STRING(config->camera_name);
    107             // -telescope
    108             config->camera_name = psMetadataLookupStr(&status, args,
    109                 "-telescope");
    110             psMemIncrRefCounter(config->telescope);
    111             EMPTY_TO_NULL_STRING(config->telescope);
    112             // -exp_type
    113             config->class = psMetadataLookupStr(&status, args, "-exp_type");
    114             psMemIncrRefCounter(config->exp_type);
    115             EMPTY_TO_NULL_STRING(config->exp_type);
    116             // -class
    117             config->class = psMetadataLookupStr(&status, args, "-class");
    118             psMemIncrRefCounter(config->class);
    119             EMPTY_TO_NULL_STRING(config->class);
    120             break;
    121         case PX_MODE_UPDATE:
    122             // -exp_id
    123             config->exp_id = psMetadataLookupStr(&status, args, "-exp_id");
    124             psMemIncrRefCounter(config->exp_id);
    125             EMPTY_TO_NULL_STRING(config->exp_id);
    126             // -filter
    127             config->filter = psMetadataLookupStr(&status, args, "-filter");
    128             psMemIncrRefCounter(config->filter);
    129             EMPTY_TO_NULL_STRING(config->filter);
     86    config->args = args;
    13087
    131             break;
    132         default:
    133             psAbort(argv[0], "invalid option (this should not happen)");
    134     }
    135     */
    136 
    137     psFree(args);
    138     /*
    139     psFree(pendingArgs);
    140     psFree(updateArgs);
    141     */
    142 
    143 
     88if (config->mode == PX_MODE_COPYDONE) {
    14489    psMetadata *where = psMetadataAlloc();
    14590
    146     /*
    147     if (config->camera_name != NULL) {
    148         if (!psMetadataAddStr(where, PS_LIST_TAIL, "camera", 0, "==",
    149             config->camera_name)) {
    150             psError(PS_ERR_UNKNOWN, false, "failed to add item camera");
     91    bool status;
     92    psString str;
     93    if ((str = psMetadataLookupStr(&status, args, "-exp_id"))) {
     94        if (!psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==", str)) {
     95            psError(PS_ERR_UNKNOWN, false, "failed to add item exp_id");
    15196            psFree(where);
    15297            return NULL;
    15398        }
    15499    }
    155     if (config->filter != NULL) {
    156         psMetadataAddStr(where, PS_LIST_TAIL, "filter", 0, "==",
    157             config->filter);
     100    if ((str = psMetadataLookupStr(&status, args, "-class"))) {
     101        if (!psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==", str)) {
     102            psError(PS_ERR_UNKNOWN, false, "failed to add item class");
     103            psFree(where);
     104            return NULL;
     105        }
    158106    }
    159     if (config->exp_id != NULL) {
    160         psMetadataAddStr(where, PS_LIST_TAIL, "exp_id", 0, "==",
    161             config->exp_id);
     107    if ((str = psMetadataLookupStr(&status, args, "-class_id"))) {
     108        if (!psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==", str)) {
     109            psError(PS_ERR_UNKNOWN, false, "failed to add item class_id");
     110            psFree(where);
     111            return NULL;
     112        }
    162113    }
    163     if (config->class != NULL) {
    164         psMetadataAddStr(where, PS_LIST_TAIL, "class", 0, "==",
    165             config->class);
    166     }
    167     if (config->class_id != NULL) {
    168         psMetadataAddStr(where, PS_LIST_TAIL, "class_id", 0, "==",
    169              config->class_id);
    170     }
    171     */
    172 
    173     /*
    174     // psMetadataConfig does not support times yet
    175     if (!psTimeIsZero(config->start) && !psTimeIsZero(config->stop)) {
    176         psMetadataAddTime (where, PS_LIST_TAIL, "TIME_START", 0, "<", config->stop);
    177         psMetadataAddTime (where, PS_LIST_TAIL, "TIME_STOP", 0, ">", config->start);
    178     }
    179     */
    180114
    181115    if (where->list->n < 1) {
     
    183117        where = NULL;
    184118    }
    185 
    186119    config->where = where;
    187 
    188 
    189     // add the input and output images to the args list
    190     //psMetadataAddStr (args, PS_LIST_TAIL, "-output", 0, "Name of the output image", argv[1]);
     120}
    191121
    192122    // define Database handle, if used
Note: See TracChangeset for help on using the changeset viewer.