2002-02-10 Lutz M�ller <lutz@users.sourceforge.net>
* frontends/command-line/actions.[c,h]:
* frontends/command-line/main.c: Implement --show-info.
git-svn-id: https://svn.code.sf.net/p/gphoto/code/trunk/libgphoto2@4123 67ed7778-7388-44ab-90cf-0a291f65f57c
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2002-02-10 Lutz Müller <lutz@users.sourceforge.net>
|
||||
|
||||
* frontends/command-line/actions.[c,h]:
|
||||
* frontends/command-line/main.c: Implement --show-info.
|
||||
|
||||
2002-02-09 Fredrik <fredrik@krixor.xy.org>
|
||||
|
||||
* frontends/command-line/foreach.c: Fix bug where new
|
||||
|
||||
@@ -128,6 +128,82 @@ list_files_action (const char *folder)
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int
|
||||
print_info_action (const char *folder, const char *filename)
|
||||
{
|
||||
CameraFileInfo info;
|
||||
|
||||
CR (gp_camera_file_get_info (glob_camera, folder, filename, &info,
|
||||
glob_context));
|
||||
|
||||
printf (_("Information on file '%s' (folder '%s'):\n"),
|
||||
filename, folder);
|
||||
printf (_("File:\n"));
|
||||
if (info.file.fields == GP_FILE_INFO_NONE)
|
||||
printf (_(" None available.\n"));
|
||||
else {
|
||||
if (info.file.fields & GP_FILE_INFO_NAME)
|
||||
printf (_(" Name: '%s'\n"), info.file.name);
|
||||
if (info.file.fields & GP_FILE_INFO_TYPE)
|
||||
printf (_(" Mime type: '%s'\n"), info.file.type);
|
||||
if (info.file.fields & GP_FILE_INFO_SIZE)
|
||||
printf (_(" Size: %i byte(s)\n"), info.file.size);
|
||||
if (info.file.fields & GP_FILE_INFO_WIDTH)
|
||||
printf (_(" Width: %i pixel(s)\n"), info.file.width);
|
||||
if (info.file.fields & GP_FILE_INFO_HEIGHT)
|
||||
printf (_(" Height: %i pixel(s)\n"), info.file.height);
|
||||
if (info.file.fields & GP_FILE_INFO_STATUS)
|
||||
printf (_(" Downloaded: %s\n"),
|
||||
(info.file.status == GP_FILE_STATUS_DOWNLOADED) ? _("yes") : _("no"));
|
||||
if (info.file.fields & GP_FILE_INFO_PERMISSIONS) {
|
||||
printf (_(" Permissions: "));
|
||||
if ((info.file.permissions & GP_FILE_PERM_READ) &&
|
||||
(info.file.permissions & GP_FILE_PERM_DELETE))
|
||||
printf (_("read/delete"));
|
||||
else if (info.file.permissions & GP_FILE_PERM_READ)
|
||||
printf (_("read"));
|
||||
else if (info.file.permissions & GP_FILE_PERM_DELETE)
|
||||
printf (_("delete"));
|
||||
else
|
||||
printf (_("none"));
|
||||
printf ("\n");
|
||||
}
|
||||
if (info.file.fields & GP_FILE_INFO_MTIME)
|
||||
printf (_(" Time: %s"),
|
||||
asctime (localtime (&info.file.mtime)));
|
||||
}
|
||||
printf (_("Thumbnail:\n"));
|
||||
if (info.preview.fields == GP_FILE_INFO_NONE)
|
||||
printf (_(" None available.\n"));
|
||||
else {
|
||||
if (info.preview.fields & GP_FILE_INFO_TYPE)
|
||||
printf (_(" Mime type: '%s'\n"), info.preview.type);
|
||||
if (info.preview.fields & GP_FILE_INFO_SIZE)
|
||||
printf (_(" Size: %i byte(s)\n"), info.preview.size);
|
||||
if (info.preview.fields & GP_FILE_INFO_WIDTH)
|
||||
printf (_(" Width: %i pixel(s)\n"), info.preview.width);
|
||||
if (info.preview.fields & GP_FILE_INFO_HEIGHT)
|
||||
printf (_(" Height: %i pixel(s)\n"), info.preview.height);
|
||||
if (info.preview.fields & GP_FILE_INFO_STATUS)
|
||||
printf (_(" Downloaded: %s\n"),
|
||||
(info.preview.status == GP_FILE_STATUS_DOWNLOADED) ? _("yes") : _("no"));
|
||||
}
|
||||
printf (_("Audio data:\n"));
|
||||
if (info.audio.fields == GP_FILE_INFO_NONE)
|
||||
printf (_(" None available.\n"));
|
||||
else {
|
||||
if (info.audio.fields & GP_FILE_INFO_TYPE)
|
||||
printf (_(" Mime type: '%s'\n"), info.audio.type);
|
||||
if (info.audio.fields & GP_FILE_INFO_SIZE)
|
||||
printf (_(" Size: %i byte(s)\n"), info.audio.size);
|
||||
if (info.audio.fields & GP_FILE_INFO_STATUS)
|
||||
printf (_(" Downloaded: %s\n"),
|
||||
(info.audio.status == GP_FILE_STATUS_DOWNLOADED) ? _("yes") : _("no"));
|
||||
}
|
||||
|
||||
return (GP_OK);
|
||||
}
|
||||
|
||||
int
|
||||
print_file_action (const char *folder, const char *filename)
|
||||
{
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
typedef int FileAction (const char *folder, const char *filename);
|
||||
int print_file_action (const char *folder, const char *filename);
|
||||
int print_exif_action (const char *folder, const char *filename);
|
||||
int print_info_action (const char *folder, const char *filename);
|
||||
int save_file_action (const char *folder, const char *filename);
|
||||
int save_thumbnail_action (const char *folder, const char *filename);
|
||||
int save_raw_action (const char *folder, const char *filename);
|
||||
|
||||
@@ -109,6 +109,7 @@ OPTION_CALLBACK(config);
|
||||
#ifdef HAVE_EXIF
|
||||
OPTION_CALLBACK(show_exif);
|
||||
#endif
|
||||
OPTION_CALLBACK(show_info);
|
||||
OPTION_CALLBACK(help);
|
||||
OPTION_CALLBACK(version);
|
||||
OPTION_CALLBACK(shell);
|
||||
@@ -218,6 +219,7 @@ Option option[] = {
|
||||
#ifdef HAVE_EXIF
|
||||
{"", "show-exif", "range", N_("Show EXIF information"), show_exif, 0},
|
||||
#endif
|
||||
{"", "show-info", "range", N_("Show info"), show_info, 0},
|
||||
{"", "summary", "", N_("Summary of camera status"), summary, 0},
|
||||
{"", "manual", "", N_("Camera driver manual"), manual, 0},
|
||||
{"", "about", "", N_("About the camera driver"), about, 0},
|
||||
@@ -676,6 +678,21 @@ OPTION_CALLBACK(config)
|
||||
}
|
||||
#endif
|
||||
|
||||
OPTION_CALLBACK(show_info)
|
||||
{
|
||||
CR (set_globals ());
|
||||
|
||||
/*
|
||||
* If the user specified the file directly (and not a range),
|
||||
* directly dump info.
|
||||
*/
|
||||
if (strchr (arg, '.'))
|
||||
return (print_info_action (glob_folder, arg));
|
||||
|
||||
return (for_each_file_in_range (glob_folder, print_info_action,
|
||||
glob_flags, arg));
|
||||
}
|
||||
|
||||
#ifdef HAVE_EXIF
|
||||
OPTION_CALLBACK(show_exif)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user