3 * Example program to check if a certain track exists on the device.
5 * Copyright (C) 2006 The libmtp development team.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
26 static void usage (void)
28 fprintf(stderr, "trexist <trackid>\n");
31 int main (int argc, char **argv)
33 LIBMTP_mtpdevice_t *device;
37 fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n");
45 // Sanity check song ID
46 id = strtoul(argv[1], &endptr, 10);
48 fprintf(stderr, "illegal value %s\n", argv[1]);
51 fprintf(stderr, "bad song id %u\n", id);
56 device = LIBMTP_Get_First_Device();
58 printf("No devices. Connect/replug device and try again.\n");
62 printf("%s\n", LIBMTP_Track_Exists(device, id) ? "Yes" : "No");
64 LIBMTP_Release_Device(device);