#include "common.h"
#include <stdlib.h>
{
printf(
"Track ID: %u\n", track->
item_id);
if (track->
title != NULL)
printf(
" Title: %s\n", track->
title);
printf(
" Artist: %s\n", track->
artist);
if (track->
genre != NULL)
printf(
" Genre: %s\n", track->
genre);
printf(
" Composer: %s\n", track->
composer);
if (track->
album != NULL)
printf(
" Album: %s\n", track->
album);
printf(
" Date: %s\n", track->
date);
printf(
" Origfilename: %s\n", track->
filename);
printf(
" Duration: %d milliseconds\n", track->
duration);
#ifdef __WIN32__
printf(
" File size %I64u bytes\n", track->
filesize);
#else
printf(
" File size %llu bytes\n", (
long long unsigned int) track->
filesize);
#endif
printf(
" Sample rate: %u Hz\n", track->
samplerate);
}
printf(
" Number of channels: %u\n", track->
nochannels);
}
printf(
" WAVE fourCC code: 0x%08X\n", track->
wavecodec);
}
printf(
" Bitrate: %u bits/s\n", track->
bitrate);
}
printf(" Bitrate type: Constant\n");
printf(" Bitrate type: Variable (VBR)\n");
printf(" Bitrate type: Free\n");
} else {
printf(" Bitrate type: Unknown/Erroneous value\n");
}
}
printf(
" User rating: %u (out of 100)\n", track->
rating);
}
printf(
" Use count: %u times\n", track->
usecount);
}
}
static void
{
storageid,
leaf);
if (files == NULL) {
} else {
file = files;
while (file != NULL) {
if (file->
filetype == LIBMTP_FILETYPE_FOLDER) {
dump_tracks(device, storageid, file->
item_id);
dump_trackinfo(track);
}
tmp = file;
}
}
}
int main (int argc, char **argv)
{
int numrawdevices;
int i;
fprintf(stdout, "Attempting to connect device(s)\n");
switch(err)
{
case LIBMTP_ERROR_NO_DEVICE_ATTACHED:
fprintf(stdout, "mtp-tracks: No Devices have been found\n");
return 0;
case LIBMTP_ERROR_CONNECTING:
fprintf(stderr, "mtp-tracks: There has been an error connecting. Exit\n");
return 1;
case LIBMTP_ERROR_MEMORY_ALLOCATION:
fprintf(stderr, "mtp-tracks: Memory Allocation Error. Exit\n");
return 1;
case LIBMTP_ERROR_GENERAL:
default:
fprintf(stderr, "mtp-tracks: Unknown error, please report "
"this to the libmtp developers\n");
return 1;
case LIBMTP_ERROR_NONE:
fprintf(stdout, "mtp-tracks: Successfully connected\n");
fflush(stdout);
break;
}
for (i = 0; i < numrawdevices; i++) {
char *friendlyname;
if (device == NULL) {
fprintf(stderr, "Unable to open raw device %d\n", i);
continue;
}
if (friendlyname == NULL) {
printf("Friendly name: (NULL)\n");
} else {
printf("Friendly name: %s\n", friendlyname);
free(friendlyname);
}
for (storage = device->
storage; storage != 0; storage = storage->
next) {
dump_tracks(device, storage->
id, 0);
}
}
printf("OK.\n");
exit (0);
}