gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r3406 - in Extractor: . src/include src/main src/plugins


From: grothoff
Subject: [GNUnet-SVN] r3406 - in Extractor: . src/include src/main src/plugins
Date: Sat, 16 Sep 2006 11:20:53 -0700 (PDT)

Author: grothoff
Date: 2006-09-16 11:20:48 -0700 (Sat, 16 Sep 2006)
New Revision: 3406

Modified:
   Extractor/ChangeLog
   Extractor/configure.ac
   Extractor/src/include/extractor.h
   Extractor/src/main/extract.c
   Extractor/src/main/extractor.c
   Extractor/src/plugins/id3v23extractor.c
   Extractor/src/plugins/id3v24extractor.c
   Extractor/src/plugins/id3v2extractor.c
   Extractor/src/plugins/mp3extractor.c
Log:
fx

Modified: Extractor/ChangeLog
===================================================================
--- Extractor/ChangeLog 2006-09-16 02:54:36 UTC (rev 3405)
+++ Extractor/ChangeLog 2006-09-16 18:20:48 UTC (rev 3406)
@@ -1,3 +1,7 @@
+Sat Sep 16 12:36:42 MDT 2006
+       Added support for various additional tags to ID3v2 extractors.
+       Now (again) trimming whitespace at the end of ID3v1 tags.
+
 Wed Sep  6 13:38:55 PDT 2006
        Added tIME support to PNG extractor.  Bugfixes in PDF extractors.
        Made libextractor relocateable (plugin path no longer hardwired

Modified: Extractor/configure.ac
===================================================================
--- Extractor/configure.ac      2006-09-16 02:54:36 UTC (rev 3405)
+++ Extractor/configure.ac      2006-09-16 18:20:48 UTC (rev 3406)
@@ -1,8 +1,8 @@
 # Process this file with autoconf to produce a configure script.
 AC_PREREQ(2.57)
-AC_INIT([libextractor], [0.5.15], address@hidden)
+AC_INIT([libextractor], [0.5.15a], address@hidden)
 AC_REVISION($Revision: 1.67 $)
-AM_INIT_AUTOMAKE([libextractor], [0.5.15])
+AM_INIT_AUTOMAKE([libextractor], [0.5.15a])
 AM_CONFIG_HEADER(src/include/config.h)
 
 AH_TOP([#define _GNU_SOURCE  1])

Modified: Extractor/src/include/extractor.h
===================================================================
--- Extractor/src/include/extractor.h   2006-09-16 02:54:36 UTC (rev 3405)
+++ Extractor/src/include/extractor.h   2006-09-16 18:20:48 UTC (rev 3406)
@@ -168,6 +168,19 @@
   EXTRACTOR_INFORMATION = 112,
   EXTRACTOR_FULL_NAME = 113,
   EXTRACTOR_CHAPTER = 114,
+  EXTRACTOR_YEAR = 115,
+
+  EXTRACTOR_LINK = 116,
+  EXTRACTOR_MUSIC_CD_IDENTIFIER = 117,
+  EXTRACTOR_PLAY_COUNTER = 118,
+  EXTRACTOR_POPULARITY_METER = 119,
+  EXTRACTOR_CONTENT_TYPE = 120,
+  EXTRACTOR_ENCODED_BY = 121,
+  EXTRACTOR_TIME = 122,
+  EXTRACTOR_MUSICIAN_CREDITS_LIST = 123,
+  EXTRACTOR_MOOD = 124,
+
+
 } EXTRACTOR_KeywordType;
 
 /**

Modified: Extractor/src/main/extract.c
===================================================================
--- Extractor/src/main/extract.c        2006-09-16 02:54:36 UTC (rev 3405)
+++ Extractor/src/main/extract.c        2006-09-16 18:20:48 UTC (rev 3406)
@@ -1,6 +1,6 @@
 /*
      This file is part of libextractor.
-     (C) 2002, 2003, 2004, 2005 Vidyut Samanta and Christian Grothoff
+     (C) 2002, 2003, 2004, 2005, 2006 Vidyut Samanta and Christian Grothoff
 
      libextractor is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -594,39 +594,34 @@
     extractors = EXTRACTOR_addLibraryLast(extractors,
                                          "libextractor_split");
 
-  if (verbose == YES)
-    {
-      /* print list of all used extractors */
-    }
   /* extract keywords */
   if ( bibtex == YES )
     fprintf(stdout,
            _("%% BiBTeX file\n"));
-  for (i = optind; i < argc; i++)
-    {
-      errno = 0;
-      keywords = EXTRACTOR_getKeywords (extractors, argv[i]);
-      if (0 != errno) {
-       if (verbose == YES) {
-         fprintf(stderr, 
-                 "%s: %s: %s\n",
-                 argv[0], argv[i], strerror(errno));
-       }
-       ret = 1;
-       continue;
+  for (i = optind; i < argc; i++) {
+    errno = 0;
+    keywords = EXTRACTOR_getKeywords (extractors, argv[i]);
+    if (0 != errno) {
+      if (verbose == YES) {
+       fprintf(stderr, 
+               "%s: %s: %s\n",
+               argv[0], argv[i], strerror(errno));
       }
-      if (duplicates != -1 || bibtex == YES)
-       keywords = EXTRACTOR_removeDuplicateKeywords (keywords, duplicates);
-      if (verbose == YES && bibtex == NO)
-       printf (_("Keywords for file %s:\n"), argv[i]);
-      if (bibtex == YES)
-       printSelectedKeywordsBibtex (stdout, keywords, print, argv[i]);
-      else
-       printSelectedKeywords (stdout, keywords, print, verbose);
-      if (verbose == YES && bibtex == NO)
-       printf ("\n");
-      EXTRACTOR_freeKeywords (keywords);
+      ret = 1;
+      continue;
     }
+    if ( (duplicates != -1) || (bibtex == YES))
+      keywords = EXTRACTOR_removeDuplicateKeywords (keywords, duplicates);
+    if (verbose == YES && bibtex == NO)
+      printf (_("Keywords for file %s:\n"), argv[i]);
+    if (bibtex == YES)
+      printSelectedKeywordsBibtex (stdout, keywords, print, argv[i]);
+    else
+      printSelectedKeywords (stdout, keywords, print, verbose);
+    if (verbose == YES && bibtex == NO)
+      printf ("\n");
+    EXTRACTOR_freeKeywords (keywords);
+  }
   free (print);
   EXTRACTOR_removeAll (extractors);
 

Modified: Extractor/src/main/extractor.c
===================================================================
--- Extractor/src/main/extractor.c      2006-09-16 02:54:36 UTC (rev 3405)
+++ Extractor/src/main/extractor.c      2006-09-16 18:20:48 UTC (rev 3406)
@@ -1,6 +1,6 @@
 /*
      This file is part of libextractor.
-     (C) 2002, 2003, 2004, 2005 Vidyut Samanta and Christian Grothoff
+     (C) 2002, 2003, 2004, 2005, 2006 Vidyut Samanta and Christian Grothoff
 
      libextractor is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -151,16 +151,26 @@
   gettext_noop("editing cycles"),
   gettext_noop("scale"),
   gettext_noop("manager"),
-  gettext_noop(/* movie director */"director"),
+  gettext_noop(/* movie director */"director"), /* 110 */
   gettext_noop("duration"),
   gettext_noop("information"),
   gettext_noop("full name"),
   gettext_noop("chapter"),
+  gettext_noop("year"), /* 115 */
+  gettext_noop("link"),
+  gettext_noop("music CD identifier"),
+  gettext_noop("play counter"),
+  gettext_noop("popularity meter"),
+  gettext_noop("content type"), /* 120 */
+  gettext_noop("encoded by"),
+  gettext_noop("time"),
+  gettext_noop("musician credits list"),
+  gettext_noop("mood"),
   NULL,
 };
 
 /* the number of keyword types (for bounds-checking) */
-#define HIGHEST_TYPE_NUMBER 115
+#define HIGHEST_TYPE_NUMBER 125
 
 #ifdef HAVE_LIBOGG
 #if HAVE_VORBIS
@@ -1236,11 +1246,11 @@
        }
       if (pos == NULL)
        break;
-      if ((0 == strcmp (pos->keyword, keyword)) &&
-         ((pos->keywordType == type) ||
-          (((options & EXTRACTOR_DUPLICATES_TYPELESS) > 0)) ||
-          (((options & EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN) > 0) &&
-           (pos->keywordType == EXTRACTOR_UNKNOWN))))
+      if ( (0 == strcmp (pos->keyword, keyword)) &&
+          ( (pos->keywordType == type) ||
+            (((options & EXTRACTOR_DUPLICATES_TYPELESS) > 0)) ||
+            ( ((options & EXTRACTOR_DUPLICATES_REMOVE_UNKNOWN) > 0) &&
+              (pos->keywordType == EXTRACTOR_UNKNOWN)) ) )
        {
          /* remove! */
          if (prev == NULL)
@@ -1269,16 +1279,18 @@
  */
 EXTRACTOR_KeywordList *
 EXTRACTOR_removeDuplicateKeywords (EXTRACTOR_KeywordList * list,
-                                  const unsigned int options)
-{
+                                  const unsigned int options) {
   EXTRACTOR_KeywordList *pos;
 
   pos = list;
-  while (pos != NULL)
-    {
-      removeKeyword (pos->keyword, pos->keywordType, options, &list, pos);
-      pos = pos->next;
-    }
+  while (pos != NULL) {
+    removeKeyword(pos->keyword, 
+                 pos->keywordType,
+                 options, 
+                 &list,
+                 pos);
+    pos = pos->next;
+  }
   return list;
 }
 
@@ -1288,8 +1300,7 @@
  * @return a list of keywords without duplicates
  */
 EXTRACTOR_KeywordList *
-EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list)
-{
+EXTRACTOR_removeEmptyKeywords (EXTRACTOR_KeywordList * list) {
   EXTRACTOR_KeywordList * pos;
   EXTRACTOR_KeywordList * last;
 

Modified: Extractor/src/plugins/id3v23extractor.c
===================================================================
--- Extractor/src/plugins/id3v23extractor.c     2006-09-16 02:54:36 UTC (rev 
3405)
+++ Extractor/src/plugins/id3v23extractor.c     2006-09-16 18:20:48 UTC (rev 
3406)
@@ -1,6 +1,6 @@
 /*
      This file is part of libextractor.
-     (C) 2002, 2003, 2004 Vidyut Samanta and Christian Grothoff
+     (C) 2002, 2003, 2004, 2006 Vidyut Samanta and Christian Grothoff
 
      libextractor is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -55,11 +55,16 @@
 
 static Matches tmap[] = {
   { "COMM", EXTRACTOR_COMMENT },
+  { "IPLS", EXTRACTOR_CONTRIBUTOR },
+  { "LINK", EXTRACTOR_LINK },
+  { "MCDI", EXTRACTOR_MUSIC_CD_IDENTIFIER },
+  { "PCNT", EXTRACTOR_PLAY_COUNTER },
+  { "POPM", EXTRACTOR_POPULARITY_METER },
   { "TCOP", EXTRACTOR_COPYRIGHT },
   { "TDAT", EXTRACTOR_DATE },
-  { "TCON", EXTRACTOR_GENRE },
+  { "TCON", EXTRACTOR_CONTENT_TYPE },
   { "TIT1", EXTRACTOR_GENRE },
-  { "TENC", EXTRACTOR_PRODUCER },
+  { "TENC", EXTRACTOR_ENCODED_BY },
   { "TEXT", EXTRACTOR_LYRICS },
   { "TOLY", EXTRACTOR_CONTRIBUTOR },
   { "TOPE", EXTRACTOR_CONTRIBUTOR },
@@ -70,7 +75,7 @@
   { "TPE4", EXTRACTOR_INTERPRET },
   { "TMED", EXTRACTOR_MEDIA_TYPE },
   { "TCOM", EXTRACTOR_CREATOR },
-  { "TIME", EXTRACTOR_DATE },
+  { "TIME", EXTRACTOR_TIME },
   { "TOFN", EXTRACTOR_FILENAME },
   { "TOPE", EXTRACTOR_ARTIST },
   { "TPUB", EXTRACTOR_PUBLISHER },
@@ -80,6 +85,8 @@
   { "TOAL", EXTRACTOR_ALBUM },
   { "TALB", EXTRACTOR_ALBUM },
   { "TLAN", EXTRACTOR_LANGUAGE },
+  { "TYER", EXTRACTOR_YEAR },
+  { "TLEN", EXTRACTOR_DURATION },
   { "TIT2", EXTRACTOR_TITLE },
   { "TIT3", EXTRACTOR_DESCRIPTION },
   { "WCOM", EXTRACTOR_RELEASE },

Modified: Extractor/src/plugins/id3v24extractor.c
===================================================================
--- Extractor/src/plugins/id3v24extractor.c     2006-09-16 02:54:36 UTC (rev 
3405)
+++ Extractor/src/plugins/id3v24extractor.c     2006-09-16 18:20:48 UTC (rev 
3406)
@@ -1,6 +1,6 @@
 /*
      This file is part of libextractor.
-     (C) 2002, 2003, 2004 Vidyut Samanta and Christian Grothoff
+     (C) 2002, 2003, 2004, 2006 Vidyut Samanta and Christian Grothoff
 
      libextractor is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -56,11 +56,19 @@
 
 static Matches tmap[] = {
   { "COMM", EXTRACTOR_COMMENT },
+  { "IPLS", EXTRACTOR_CONTRIBUTOR },
+  { "TIPL", EXTRACTOR_CONTRIBUTOR },
+  { "TMOO", EXTRACTOR_MOOD },
+  { "TMCL", EXTRACTOR_MUSICIAN_CREDITS_LIST },
+  { "LINK", EXTRACTOR_LINK },
+  { "MCDI", EXTRACTOR_MUSIC_CD_IDENTIFIER },
+  { "PCNT", EXTRACTOR_PLAY_COUNTER },
+  { "POPM", EXTRACTOR_POPULARITY_METER },
   { "TCOP", EXTRACTOR_COPYRIGHT },
   { "TDRC", EXTRACTOR_DATE },
   { "TCON", EXTRACTOR_GENRE },
   { "TIT1", EXTRACTOR_GENRE },
-  { "TENC", EXTRACTOR_PRODUCER },
+  { "TENC", EXTRACTOR_ENCODED_BY },
   { "TEXT", EXTRACTOR_LYRICS },
   { "TOLY", EXTRACTOR_CONTRIBUTOR },
   { "TOPE", EXTRACTOR_CONTRIBUTOR },
@@ -69,6 +77,7 @@
   { "TPE2", EXTRACTOR_ARTIST },
   { "TPE3", EXTRACTOR_CONDUCTOR },
   { "TPE4", EXTRACTOR_INTERPRET },
+  { "TIME", EXTRACTOR_TIME },
   { "TMED", EXTRACTOR_MEDIA_TYPE },
   { "TCOM", EXTRACTOR_CREATOR },
   { "TOFN", EXTRACTOR_FILENAME },
@@ -77,6 +86,7 @@
   { "TRSN", EXTRACTOR_SOURCE },
   { "TRSO", EXTRACTOR_CREATED_FOR },
   { "TSRC", EXTRACTOR_RESOURCE_IDENTIFIER },
+  { "TYER", EXTRACTOR_YEAR },
   { "TOAL", EXTRACTOR_ALBUM },
   { "TALB", EXTRACTOR_ALBUM },
   { "TLAN", EXTRACTOR_LANGUAGE },

Modified: Extractor/src/plugins/id3v2extractor.c
===================================================================
--- Extractor/src/plugins/id3v2extractor.c      2006-09-16 02:54:36 UTC (rev 
3405)
+++ Extractor/src/plugins/id3v2extractor.c      2006-09-16 18:20:48 UTC (rev 
3406)
@@ -1,6 +1,6 @@
 /*
      This file is part of libextractor.
-     (C) 2002, 2003, 2004 Vidyut Samanta and Christian Grothoff
+     (C) 2002, 2003, 2004, 2006 Vidyut Samanta and Christian Grothoff
 
      libextractor is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published

Modified: Extractor/src/plugins/mp3extractor.c
===================================================================
--- Extractor/src/plugins/mp3extractor.c        2006-09-16 02:54:36 UTC (rev 
3405)
+++ Extractor/src/plugins/mp3extractor.c        2006-09-16 18:20:48 UTC (rev 
3406)
@@ -1,6 +1,6 @@
 /*
      This file is part of libextractor.
-     (C) 2002, 2003, 2004 Vidyut Samanta and Christian Grothoff
+     (C) 2002, 2003, 2004, 2006 Vidyut Samanta and Christian Grothoff
 
      libextractor is free software; you can redistribute it and/or modify
      it under the terms of the GNU General Public License as published
@@ -243,6 +243,12 @@
 #define SYSERR     1
 #define INVALID_ID3 2
 
+static void trim(char * k) {
+  while ( (strlen(k) > 0) &&
+         (isspace(k[strlen(k)-1])) )
+    k[strlen(k)-1] = '\0';
+}
+
 static int get_id3(const char * data,
                   size_t size,
                   id3tag * id3) {
@@ -261,22 +267,27 @@
   id3->title = convertToUtf8(pos,
                             30,
                             "ISO-8859-1"); 
+  trim(id3->title);
   pos += 30;
   id3->artist = convertToUtf8(pos,
                              30,
                              "ISO-8859-1"); 
+  trim(id3->artist);
   pos += 30;
   id3->album = convertToUtf8(pos,
                              30,
                              "ISO-8859-1");
+  trim(id3->album);
   pos += 30;
   id3->year = convertToUtf8(pos,
                            4,
                            "ISO-8859-1"); 
+  trim(id3->year);
   pos += 4;
   id3->comment = convertToUtf8(pos,
                               30,
                               "ISO-8859-1");
+  trim(id3->comment);
   pos += 30;
   id3->genre = "";
   if (pos[0] < GENRE_NAME_COUNT)
@@ -289,9 +300,8 @@
 addkword(EXTRACTOR_KeywordList *oldhead,
         const char * phrase,
         EXTRACTOR_KeywordType type) {
-
    EXTRACTOR_KeywordList * keyword;
-
+   
    keyword = malloc(sizeof(EXTRACTOR_KeywordList));
    keyword->next = oldhead;
    keyword->keyword = strdup(phrase);
@@ -460,10 +470,10 @@
   if (strlen(info.album) > 0)
     klist = addkword(klist, info.album, EXTRACTOR_ALBUM);
   if (strlen(info.year) > 0)
-    klist = addkword(klist, info.year, EXTRACTOR_DATE);
+    klist = addkword(klist, info.year, EXTRACTOR_YEAR);
   if (strlen(info.genre) > 0)
     klist = addkword(klist, info.genre, EXTRACTOR_GENRE);
-  if (strlen(info.genre) > 0)
+  if (strlen(info.comment) > 0)
     klist = addkword(klist, info.comment, EXTRACTOR_COMMENT);
 
 





reply via email to

[Prev in Thread] Current Thread [Next in Thread]