>>>>> Michael Amster <[EMAIL PROTECTED]> writes:

> This is exactly what I want.  I have been using EasyTag.  I will see if it
> supports TSOP and TSOA.  What platform does MusicBrainz run on (I am Linux at
> home)?

I also use EasyTag on linux (FC3) and it does not support the sort
tags.  I have been using id3lib's command line utilities to set the
sort tags, and even then I had to do a little hacking.. here's a patch
against id3lib-3.8.3 if you're interested:

--- examples/demo_info.cpp	Sat Mar  1 19:23:00 2003
+++ ../../id3lib-3.8.3/examples/demo_info.cpp	Sat Jan  1 23:05:12 2005
@@ -103,6 +103,9 @@
       case ID3FID_ISRC:
       case ID3FID_ENCODERSETTINGS:
       case ID3FID_YEAR:
+      case ID3FID_PERFORMERSORTORDER:
+      case ID3FID_ALBUMSORTORDER:
+      case ID3FID_TITLESORTORDER:
       {
         char *sText = ID3_GetString(frame, ID3FN_TEXT);
         cout << sText << endl;
--- examples/demo_tag.cpp	Sat Mar  1 19:23:00 2003
+++ ../../id3lib-3.8.3/examples/demo_tag.cpp	Sat Jan  1 22:52:25 2005
@@ -46,6 +46,49 @@
     os << "v2";
 }
 
+size_t ID3_RemoveTextField(ID3_Tag *tag, ID3_FrameID fid)
+{
+  size_t num_removed = 0;
+  ID3_Frame *frame = NULL;
+
+  if (NULL == tag)
+  {
+    return num_removed;
+  }
+
+  while ((frame = tag->Find(fid)))
+  {
+    frame = tag->RemoveFrame(frame);
+    delete frame;
+    num_removed++;
+  }
+
+  return num_removed;
+}
+
+ID3_Frame* ID3_AddTextField(ID3_Tag *tag, ID3_FrameID fid, const char *text, bool replace)
+{
+  ID3_Frame* frame = NULL;
+  if (NULL != tag && NULL != text && strlen(text) > 0)
+  {
+    if (replace)
+    {
+      ID3_RemoveTextField(tag, fid);
+    }
+    if (replace || tag->Find(fid) == NULL)
+    {
+      frame = new ID3_Frame(fid);
+      if (frame)
+      {
+        frame->GetField(ID3FN_TEXT)->Set(text);
+        tag->AttachFrame(frame);
+      }
+    }
+  }
+
+  return frame;
+}
+
 int main( unsigned int argc, char * const argv[])
 {
   int ulFlag = ID3TT_ID3;
@@ -87,6 +130,10 @@
     *sComment = "",
     *sYear    = "",
     *sDesc    = "";
+  const char
+    *sArtistSort = "",
+    *sAlbumSort  = "",
+    *sTitleSort  = "";
   unsigned short
     nYear     = 0,
     nTrack    = 0,
@@ -109,6 +156,21 @@
     sTitle = args.song_arg;
     cout << "+++ Song    = " << sTitle << endl;
   }
+  if (args.artistsort_given)
+  {
+    sArtistSort = args.artistsort_arg;
+    cout << "+++ ArtistSort  = " << sArtistSort << endl;
+  }
+  if (args.albumsort_given)
+  {
+    sAlbumSort = args.albumsort_arg;
+    cout << "+++ AlbumSort   = " << sAlbumSort << endl;
+  }
+  if (args.songsort_given)
+  {
+    sTitleSort = args.songsort_arg;
+    cout << "+++ SongSort    = " << sTitleSort << endl;
+  }
   if (args.year_given)
   {
     sYear = args.year_arg;
@@ -170,6 +232,18 @@
     {
       ID3_AddTitle(&myTag, sTitle, true);
     }
+    if (args.artistsort_given)
+    {
+      ID3_AddTextField(&myTag, ID3FID_PERFORMERSORTORDER, sArtistSort, true);
+    }
+    if (args.albumsort_given)
+    {
+      ID3_AddTextField(&myTag, ID3FID_ALBUMSORTORDER, sAlbumSort, true);
+    }
+    if (args.songsort_given)
+    {
+      ID3_AddTextField(&myTag, ID3FID_TITLESORTORDER, sTitleSort, true);
+    }
     if (args.year_given)
     {
       ID3_AddYear(&myTag, sYear, true);
--- examples/demo_tag_options.c	Sat Mar  1 19:23:00 2003
+++ ../../id3lib-3.8.3/examples/demo_tag_options.c	Thu Jan  6 09:33:40 2005
@@ -48,21 +48,24 @@
 {
   print_version ();
   printf ("Usage: %s [OPTIONS]... [FILES]...\n\
-   -h         --help            Print help and exit\n\
-   -V         --version         Print version and exit\n\
-   -1         --v1tag           Render only the id3v1 tag (default=off)\n\
-   -2         --v2tag           Render only the id3v2 tag (default=off)\n\
-   -aSTRING   --artist=STRING   Set the artist information\n\
-   -ASTRING   --album=STRING    Set the album title information\n\
-   -sSTRING   --song=STRING     Set the title information\n\
-   -cSTRING   --comment=STRING  Set the comment information\n\
-   -CSTRING   --desc=STRING     Set the comment description\n\
-   -ySTRING   --year=STRING     Set the year\n\
-   -tSTRING   --track=STRING    Set the track number\n\
-   -TSTRING   --total=STRING    Set the total number of tracks\n\
-   -gSHORT    --genre=SHORT     Set the genre\n\
-   -w         --warning         Turn on warnings (for debugging) (default=off)\n\
-   -n         --notice          Turn on notices (for debugging) (default=off)\n\
+   -h         --help               Print help and exit\n\
+   -V         --version            Print version and exit\n\
+   -1         --v1tag              Render only the id3v1 tag (default=off)\n\
+   -2         --v2tag              Render only the id3v2 tag (default=off)\n\
+   -aSTRING   --artist=STRING      Set the artist information\n\
+   -ASTRING   --album=STRING       Set the album title information\n\
+   -sSTRING   --song=STRING        Set the title information\n\
+   -cSTRING   --comment=STRING     Set the comment information\n\
+   -CSTRING   --desc=STRING        Set the comment description\n\
+   -ySTRING   --year=STRING        Set the year\n\
+   -tSTRING   --track=STRING       Set the track number\n\
+   -TSTRING   --total=STRING       Set the total number of tracks\n\
+   -gSHORT    --genre=SHORT        Set the genre\n\
+              --artistsort=STRING  Set the artist sort information\n\
+              --albumsort=STRING   Set the album title sort information\n\
+              --songsort=STRING    Set the title sort information\n\
+   -w         --warning            Turn on warnings (for debugging) (default=off)\n\
+   -n         --notice             Turn on notices (for debugging) (default=off)\n\
 ", GGO_PACKAGE);
 }
 
@@ -102,6 +105,9 @@
   args_info->track_given = 0 ;
   args_info->total_given = 0 ;
   args_info->genre_given = 0 ;
+  args_info->artistsort_given = 0 ;
+  args_info->albumsort_given = 0 ;
+  args_info->songsort_given = 0 ;
   args_info->warning_given = 0 ;
   args_info->notice_given = 0 ;
 
@@ -117,6 +123,9 @@
   args_info->year_arg = NULL; \
   args_info->track_arg = NULL; \
   args_info->total_arg = NULL; \
+  args_info->artistsort_arg = NULL; \
+  args_info->albumsort_arg = NULL; \
+  args_info->songsort_arg = NULL; \
   args_info->warning_flag = 0;\
   args_info->notice_flag = 0;\
 }
@@ -143,6 +152,9 @@
         { "track",	1, NULL, 't' },
         { "total",	1, NULL, 'T' },
         { "genre",	1, NULL, 'g' },
+        { "artistsort",	1, NULL, 1001 },
+        { "albumsort",	1, NULL, 1002 },
+        { "songsort",	1, NULL, 1003 },
         { "warning",	0, NULL, 'w' },
         { "notice",	0, NULL, 'n' },
         { NULL,	0, NULL, 0 }
@@ -280,6 +292,42 @@
           args_info->genre_arg = (short)atoi (optarg);
           break;
 
+        case 1001:	/* Set the artist sort information.  */
+          if (args_info->artistsort_given)
+            {
+              fprintf (stderr, "%s: `--artistsort' option given more than once\n", GGO_PACKAGE);
+              clear_args ();
+              print_help ();
+              exit (1);
+            }
+          args_info->artistsort_given = 1;
+          args_info->artistsort_arg = gengetopt_strdup (optarg);
+          break;
+
+        case 1002:	/* Set the album title sort information.  */
+          if (args_info->albumsort_given)
+            {
+              fprintf (stderr, "%s: `--albumsort' option given more than once\n", GGO_PACKAGE);
+              clear_args ();
+              print_help ();
+              exit (1);
+            }
+          args_info->albumsort_given = 1;
+          args_info->albumsort_arg = gengetopt_strdup (optarg);
+          break;
+
+        case 1003:	/* Set the title sort information.  */
+          if (args_info->songsort_given)
+            {
+              fprintf (stderr, "%s: `--songsort' option given more than once\n", GGO_PACKAGE);
+              clear_args ();
+              print_help ();
+              exit (1);
+            }
+          args_info->songsort_given = 1;
+          args_info->songsort_arg = gengetopt_strdup (optarg);
+          break;
+
         case 'w':	/* Turn on warnings (for debugging).  */
           args_info->warning_flag = !(args_info->warning_flag);
           break;
--- examples/demo_tag_options.h	Sat Mar  1 19:23:00 2003
+++ ../../id3lib-3.8.3/examples/demo_tag_options.h	Sat Jan  1 22:41:48 2005
@@ -40,6 +40,13 @@
   int warning_given ;	/* Whether warning was given.  */
   int notice_given ;	/* Whether notice was given.  */
 
+  char * artistsort_arg;/* Set the artist sort information.  */
+  char * albumsort_arg;	/* Set the album title sort information.  */
+  char * songsort_arg;	/* Set the title sort information.  */
+  int artistsort_given ;/* Whether artist sort was given.  */
+  int albumsort_given ;	/* Whether album sort was given.  */
+  int songsort_given ;	/* Whether song sort was given.  */
+
   char **inputs ; /* unamed options */
   unsigned inputs_num ; /* unamed options number */
 } ;
--- src/field.cpp	Sat Mar  1 19:23:00 2003
+++ ../../id3lib-3.8.3/src/field.cpp	Sat Jan  1 23:01:31 2005
@@ -823,6 +823,11 @@
   {ID3FID_WWWUSER,           "WXX", "WXXX", false, false, ID3FD_UserURL,       "User defined URL link"},
   {ID3FID_METACRYPTO,        "CRM", ""    , false, false, ID3FD_Unimplemented, "Encrypted meta frame"},
   {ID3FID_METACOMPRESSION,   "CDM", ""    , false, false, ID3FD_CDM,           "Compressed data meta frame"},
+  /**/
+  {ID3FID_PERFORMERSORTORDER, "",   "TSOP", false, false, ID3FD_Text,          "Performer sort"},
+  {ID3FID_ALBUMSORTORDER,     "",   "TSOA", false, false, ID3FD_Text,          "Album sort"},
+  {ID3FID_TITLESORTORDER,     "",   "TSOT", false, false, ID3FD_Text,          "Title sort"},
+  /**/
   {ID3FID_NOFRAME}
 };
 
_______________________________________________
Discuss mailing list
[email protected]
http://lists.slimdevices.com/lists/listinfo/discuss

Reply via email to