Inspect: permit packing given scenario and images into a exu file
This commit is contained in:
parent
6f74e380a4
commit
89a207bd34
|
@ -1147,6 +1147,7 @@ static const Ecore_Getopt optdesc = {
|
|||
ECORE_GETOPT_STORE_TRUE('C', "compare", "Compare given files (images files or objects eet files)."),
|
||||
ECORE_GETOPT_STORE_TRUE(0, "show-only-diffs", "Show only differences during comparison."),
|
||||
ECORE_GETOPT_STORE_TRUE(0, "stabilize", "Stabilize after the given shot number in --shot."),
|
||||
ECORE_GETOPT_STORE_TRUE(0, "pack", "Pack the given input files (scenario and images) into the given output."),
|
||||
ECORE_GETOPT_STORE_STR('o', "output", "Output."),
|
||||
ECORE_GETOPT_STORE_USHORT('s', "shot", "Select a specific shot (1 = 1st shot...)."),
|
||||
|
||||
|
@ -1170,6 +1171,7 @@ main(int argc, char *argv[])
|
|||
Eina_Bool write_file = EINA_FALSE;
|
||||
Eina_Bool want_quit, clean = EINA_FALSE, list_get = EINA_FALSE, compare_files = EINA_FALSE;
|
||||
Eina_Bool stabilize = EINA_FALSE, show_only_diffs = EINA_FALSE, gui_needed = EINA_TRUE;
|
||||
Eina_Bool pack = EINA_FALSE;
|
||||
|
||||
Ecore_Getopt_Value values[] = {
|
||||
ECORE_GETOPT_VALUE_USHORT(delay),
|
||||
|
@ -1178,6 +1180,7 @@ main(int argc, char *argv[])
|
|||
ECORE_GETOPT_VALUE_BOOL(compare_files),
|
||||
ECORE_GETOPT_VALUE_BOOL(show_only_diffs),
|
||||
ECORE_GETOPT_VALUE_BOOL(stabilize),
|
||||
ECORE_GETOPT_VALUE_BOOL(pack),
|
||||
ECORE_GETOPT_VALUE_STR(output),
|
||||
ECORE_GETOPT_VALUE_USHORT(shot),
|
||||
|
||||
|
@ -1204,7 +1207,7 @@ main(int argc, char *argv[])
|
|||
{
|
||||
goto end;
|
||||
}
|
||||
if ((clean || delay || shot || list_get || stabilize) && args == argc)
|
||||
if ((clean || delay || shot || list_get || stabilize || pack) && args == argc)
|
||||
{
|
||||
fprintf(stderr, "Expected scenario (.rec/.exu) as the last argument.\n");
|
||||
ecore_getopt_help(stderr, &optdesc);
|
||||
|
@ -1243,12 +1246,15 @@ main(int argc, char *argv[])
|
|||
}
|
||||
_show_only_diffs = show_only_diffs;
|
||||
|
||||
if (clean || delay || list_get || stabilize)
|
||||
if (clean || delay || list_get || stabilize || pack)
|
||||
{
|
||||
const char *src_file = NULL;
|
||||
src_file = argv[args];
|
||||
int arg;
|
||||
Eina_List *images = NULL;
|
||||
gui_needed = EINA_FALSE;
|
||||
if (!ext) ext = strrchr(src_file, '.');
|
||||
for (arg = args; arg < argc; arg++)
|
||||
{
|
||||
const char *src_file = argv[arg];
|
||||
ext = strrchr(src_file, '.');
|
||||
if (!ext)
|
||||
{
|
||||
fprintf(stderr, "Extension required\n");
|
||||
|
@ -1256,18 +1262,48 @@ main(int argc, char *argv[])
|
|||
}
|
||||
if (!strcmp(ext, ".exu"))
|
||||
{
|
||||
unit = exactness_unit_file_read(src_file);
|
||||
if (!unit) unit = exactness_unit_file_read(src_file);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s - scenario already provided\n", src_file);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(ext, ".rec"))
|
||||
{
|
||||
unit = legacy_rec_file_read(src_file);
|
||||
if (!unit) unit = legacy_rec_file_read(src_file);
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "%s - scenario already provided\n", src_file);
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
else if (!strcmp(ext, ".png"))
|
||||
{
|
||||
Exactness_Image *ex_img = _image_read(src_file);
|
||||
if (!ex_img)
|
||||
{
|
||||
fprintf(stderr, "Issue while reading %s\n", src_file);
|
||||
goto end;
|
||||
}
|
||||
images = eina_list_append(images, ex_img);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(stderr, "Correct extension (.exu/.rec) required\n");
|
||||
fprintf(stderr, "Correct extension (.exu/.rec/.png) required\n");
|
||||
goto end;
|
||||
}
|
||||
}
|
||||
if (unit)
|
||||
{
|
||||
Exactness_Image *ex_img;
|
||||
EINA_LIST_FREE(images, ex_img)
|
||||
{
|
||||
unit->imgs = eina_list_append(unit->imgs, ex_img);
|
||||
unit->nb_shots++;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
int arg;
|
||||
|
@ -1353,6 +1389,8 @@ main(int argc, char *argv[])
|
|||
}
|
||||
}
|
||||
|
||||
if (pack) write_file = EINA_TRUE;
|
||||
|
||||
if (list_get)
|
||||
{
|
||||
Exactness_Action *act;
|
||||
|
|
Loading…
Reference in New Issue