~ubuntu-branches/ubuntu/wily/gnomad2/wily

« back to all changes in this revision

Viewing changes to src/filesystem.c

  • Committer: Bazaar Package Importer
  • Author(s): martin f. krafft
  • Date: 2006-10-07 17:54:56 UTC
  • mfrom: (1.1.4 upstream) (2.1.1 etch)
  • Revision ID: james.westby@ubuntu.com-20061007175456-o2l26brr97j7ex6c
Tags: 2.8.8-1.1
* Non-maintainer upload.
* Use $(CURDIR) instead of $(PWD) in debian/rules (closes: #390390).
* Added version to debhelper build-dependency to match debian/compat.

Show diffs side-by-side

added added

removed removed

Lines of Context:
244
244
        int i;
245
245
 
246
246
        if (!anyfile) {
 
247
          /* Must be more atleast one byte */
 
248
          if (size == 0)
 
249
            continue;
 
250
          /* Must have sane filename */
247
251
          if (strlen(dir_entry->d_name) < 4)
248
252
            continue;
249
253
          strcpy(tmp_codec, dir_entry->d_name+strlen(dir_entry->d_name)-3);
251
255
          /* Only display valid files */
252
256
          if (g_ascii_strcasecmp(tmp,"mp3") &&
253
257
              g_ascii_strcasecmp(tmp,"wav") &&
254
 
              g_ascii_strcasecmp(tmp,"wma")) {
 
258
              g_ascii_strcasecmp(tmp,"wma")
 
259
#ifdef HAVE_LIBMTP
 
260
              // Additional music codecs supported by libmtp
 
261
              &&
 
262
              g_ascii_strcasecmp(tmp,"ogg") &&
 
263
              g_ascii_strcasecmp(tmp,"mp4")
 
264
#endif
 
265
              ) {
255
266
            g_free(tmp);
256
267
            continue;
257
268
          }
314
325
    gchar *tmp;
315
326
    guint size;
316
327
    gint i;
 
328
    gchar fileext[5];
317
329
    
318
330
    meta = new_metadata_t();
319
331
    /* Full path -> ID column */
344
356
      gtk_label_set_text(GTK_LABEL(args->label), tmp);
345
357
      gdk_threads_leave();
346
358
    }
 
359
    /* Find codec/file extension first */
 
360
    if (strlen(meta->path) > 5) {
 
361
      gchar *tmp = meta->path;
 
362
 
 
363
      // Accept 3 or 4 character extensions
 
364
      if (tmp[strlen(tmp)-4] == '.') {
 
365
        strcpy(fileext, tmp+strlen(tmp)-3);
 
366
      } else if (tmp[strlen(tmp)-5] == '.') {
 
367
        strcpy(fileext, tmp+strlen(tmp)-4);
 
368
      }
 
369
      // Uppercase it.
 
370
      g_strup(fileext);
 
371
      meta->codec = g_strdup(fileext);
 
372
    }
347
373
    if (listtype == HDDATA_LIST) {
348
 
      /* For data files, provide basic data only 
349
 
       * nothing additional is needed.
 
374
      /* 
 
375
       * For data files, provide basic data nothing additional is needed.
 
376
       * The file extension will be used to map the apropriate transfer
 
377
       * type later.
350
378
       */
351
379
    } else {
352
380
      /* For music files, fill in row by using libid3tag and friends */
353
381
      if (meta->size != 0) {
354
 
        /* Find codec first */
355
 
        static gchar codec[4];
356
 
        
357
 
        strcpy(codec, meta->path+strlen(meta->path)-3);
358
 
        g_strup(codec);
359
 
        meta->codec = g_strdup(codec);
360
382
        if (!strcmp(meta->codec,"MP3")) {
361
383
          /* Gets the ID3 tag if any */
362
384
          if (gnomad_debug != 0) {
381
403
        if (!strcmp(meta->codec,"WMA")) {
382
404
          get_tag_for_wmafile(meta);
383
405
        }
 
406
#ifdef HAVE_LIBMTP
 
407
        // Implement getting track metadata for ogg and mp4 here.
 
408
        if (!strcmp(meta->codec,"OGG")) {
 
409
        }
 
410
        if (!strcmp(meta->codec,"MP4")) {
 
411
        }
 
412
#endif
384
413
        /* 
385
414
         * Gather additional information from the path and file name
386
415
         * if this preference is set.