~ubuntu-branches/ubuntu/precise/libmtp/precise-proposed

« back to all changes in this revision

Viewing changes to examples/newplaylist.c

  • Committer: Bazaar Package Importer
  • Author(s): Alessio Treglia
  • Date: 2010-02-04 16:34:58 UTC
  • mto: (16.1.5 sid) (0.2.1 upstream)
  • mto: This revision was merged to the branch mainline in revision 26.
  • Revision ID: james.westby@ubuntu.com-20100204163458-pegywpiiisrzx72w
Tags: upstream-1.0.2
ImportĀ upstreamĀ versionĀ 1.0.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
#include <errno.h>
29
29
 
30
30
static void usage(void) {
31
 
  printf("Usage: newplaylist -i <fileid/trackid> -n <playlistname>\n");
 
31
  printf("Usage: newplaylist -i <fileid/trackid> -n <playlistname> -s <storage_id> -p <parent_id>\n");
32
32
  exit(0);
33
33
}
34
34
 
42
42
  uint32_t *tmp = NULL;
43
43
  char *playlistname = NULL;
44
44
  char *rest;
 
45
  uint32_t storageid = 0;
 
46
  uint32_t parentid = 0;
45
47
 
46
48
  fprintf(stdout, "libmtp version: " LIBMTP_VERSION_STRING "\n\n");
47
49
 
48
 
  while ( (opt = getopt(argc, argv, "hn:i:")) != -1 ) {
 
50
  while ( (opt = getopt(argc, argv, "hn:i:s:p:")) != -1 ) {
49
51
    switch (opt) {
50
52
    case 'h':
51
53
      usage();
61
63
    case 'n':
62
64
      playlistname = strdup(optarg);
63
65
      break;
 
66
    case 's':
 
67
      storageid = (uint32_t) strtoul(optarg, NULL, 0);
 
68
          break;
 
69
    case 'p':
 
70
      parentid = (uint32_t) strtoul(optarg, NULL, 0);
 
71
          break;
64
72
    default:
65
73
      usage();
66
74
    }
90
98
  playlist->name = playlistname;
91
99
  playlist->no_tracks = idcount;
92
100
  playlist->tracks = ids;
93
 
  playlist->parent_id = 0;
94
 
  playlist->storage_id = 0;
 
101
  playlist->parent_id = parentid;
 
102
  playlist->storage_id = storageid;
95
103
  int ret = LIBMTP_Create_New_Playlist(device,playlist);
96
104
  if (ret != 0) {
97
105
    printf("Couldn't create playlist object\n");