00001 #include "common.h"
00002
00003 static void dump_fileinfo(LIBMTP_file_t *file)
00004 {
00005 printf("File ID: %d\n", file->item_id);
00006 if (file->filename != NULL)
00007 printf(" Filename: %s\n", file->filename);
00008
00009
00010 if (file->filesize == (uint32_t) -1) {
00011 printf(" None. (abstract file, size = -1)\n");
00012 } else {
00013 printf(" File size %llu (0x%08X) bytes\n", file->filesize, file->filesize);
00014 }
00015 printf(" Parent ID: %d\n", file->parent_id);
00016 printf(" Filetype: %s\n", LIBMTP_Get_Filetype_Description(file->filetype));
00017 }
00018
00019 int main (int argc, char **argv)
00020 {
00021 LIBMTP_mtpdevice_t *device;
00022 LIBMTP_file_t *files;
00023
00024 LIBMTP_Init();
00025 device = LIBMTP_Get_First_Device();
00026 if (device == NULL) {
00027 printf("No devices.\n");
00028 exit (0);
00029 }
00030
00031
00032 files = LIBMTP_Get_Filelisting(device);
00033 if (files == NULL) {
00034 printf("No files.\n");
00035 } else {
00036 LIBMTP_file_t *file, *tmp;
00037 file = files;
00038 while (file != NULL) {
00039 dump_fileinfo(file);
00040 tmp = file;
00041 file = file->next;
00042 LIBMTP_destroy_file_t(tmp);
00043 }
00044 }
00045
00046 LIBMTP_Release_Device(device);
00047 printf("OK.\n");
00048 exit (0);
00049 }
00050