Пример #1
0
int main( int argc, char *argv[])
{
  ID3D_INIT_DOUT();
  ID3D_INIT_WARNING();
  ID3D_INIT_NOTICE();

  ID3_Tag tag;
  ID3_Frame frame;
  
  tag.Link("test-230-compressed.tag");
  tag.Strip(ID3TT_ALL);
  tag.Clear();
  
  frame.SetID(ID3FID_USERTEXT);
  frame.GetField(ID3FN_DESCRIPTION)->Set("compression example");
  frame.GetField(ID3FN_TEXT)->Set("This sample user text frame came from an ID3v2-3.0 tag.  The frame has the 'compression' bit set in it's frame header.  This is the new method for compressing frames, which supercedes the 2.01 Compressed Data Metaframe.");
  frame.SetCompression(true);
  tag.AddFrame(frame);
  
  tag.SetPadding(false);
  tag.SetUnsync(false);
  tag.Update(ID3TT_ID3V2);

  return 0;
}
Пример #2
0
void StripTags(char *file)
{
  ID3_Tag myTag;

  myTag.Link(file);
  myTag.Strip();

  return;
}
Пример #3
0
int main( int argc, char *argv[])
{
  ID3_Tag tag;
  ID3_Frame frame;
  
  tag.Link("test-230-unicode.tag");
  tag.Strip(ID3TT_ALL);
  tag.Clear();
  
  frame.SetID(ID3FID_USERTEXT);
  frame.GetField(ID3FN_DESCRIPTION)->Set("example text frame");
  frame.GetField(ID3FN_TEXT)->Set("This text and the description should be in Unicode.");
  frame.GetField(ID3FN_TEXTENC)->Set(ID3TE_UNICODE);
  tag.AddFrame(frame);
  
  tag.SetPadding(false);
  tag.SetUnsync(false);
  tag.Update(ID3TT_ID3V2);

  return 0;
}
Пример #4
0
int main( int argc, char *argv[])
{
  ID3D_INIT_DOUT();
  ID3D_INIT_WARNING();
  ID3D_INIT_NOTICE();

  ID3_Tag tag;
  ID3_Frame frame;
  
  tag.Link("test-230-picture.tag");
  tag.Strip(ID3TT_ALL);
  tag.Clear();
  
  frame.SetID(ID3FID_TITLE);
  frame.GetField(ID3FN_TEXT)->Set("Aquarium");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_CONTENTGROUP);
  frame.GetField(ID3FN_TEXT)->Set("Short fraction of 'Carnival of the Animals: A Grand Zoological Fantasy'");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_COMPOSER);
  frame.GetField(ID3FN_TEXT)->Set("Camille Saint-Saëns");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_BAND);
  frame.GetField(ID3FN_TEXT)->Set("Slovakia Radio Symphony Orchestra");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_CONDUCTOR);
  frame.GetField(ID3FN_TEXT)->Set("Ondrej Lenárd");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_COPYRIGHT);
  frame.GetField(ID3FN_TEXT)->Set("1996 HNH international Ltd.");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_CONTENTTYPE);
  frame.GetField(ID3FN_TEXT)->Set("(32)");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_INVOLVEDPEOPLE);
  frame.GetField(ID3FN_TEXT)->Add("Producer");
  frame.GetField(ID3FN_TEXT)->Add("Martin Sauer");
  frame.GetField(ID3FN_TEXT)->Add("Piano");
  frame.GetField(ID3FN_TEXT)->Add("Peter Toperczer");
  tag.AddFrame(frame);
  
  frame.SetID(ID3FID_PICTURE);
  frame.GetField(ID3FN_MIMETYPE)->Set("image/jpeg");
  frame.GetField(ID3FN_PICTURETYPE)->Set(11);
  frame.GetField(ID3FN_DESCRIPTION)->Set("B/W picture of Saint-Saëns");
  frame.GetField(ID3FN_DATA)->FromFile("composer.jpg");
  tag.AddFrame(frame);
  
  tag.SetPadding(false);
  tag.SetUnsync(true);
  tag.Update(ID3TT_ID3V2);

  return 0;
}
Пример #5
0
int main( unsigned int argc, char * const argv[])
{
  flags_t ulFlag = ID3TT_ALL;
  gengetopt_args_info args;

  if (cmdline_parser(argc, argv, &args) != 0)
  {
    exit(1);
  }

#if defined ID3_ENABLE_DEBUG
  if (args.warning_flag)
  {
    ID3D_INIT_WARNING();
    ID3D_WARNING ( "warnings turned on" );
  }
  if (args.notice_flag)
  {
    ID3D_INIT_NOTICE();
    ID3D_NOTICE ( "notices turned on" );
  }
#endif

  if (args.v1tag_flag)
  {
    ulFlag = ID3TT_ID3V1;
  }

  if (args.v2tag_flag)
  {
    ulFlag = ID3TT_ID3V2;
  }


  const char* filename = NULL;
  for (size_t i = 0; i < args.inputs_num; ++i)
  {
    filename = args.inputs[i];
    ID3_Tag myTag;
    
    if (args.strip_given)
    {
      cout << "Stripping ";
    }
    else
    {
      cout << "Converting ";
    }
    cout << filename << ": ";
    
    myTag.Clear();
    myTag.Link(filename, ID3TT_ALL);
    myTag.SetPadding(args.padding_flag);
    
    cout << "attempting ";
    DisplayTags(cout, ulFlag);
    luint nTags;
    
    if (args.strip_flag)
    {
      nTags = myTag.Strip(ulFlag);
      cout << ", stripped ";
    }
    else
    {
      nTags = myTag.Update(ulFlag);
      cout << ", converted ";
    }
    
    DisplayTags(cout, nTags);
    cout << endl;
  }
  
  return 0;
}
Пример #6
0
int main( int argc, char *argv[])
{
    ID3_Tag tag;
    ID3_Frame frame;

    if (argc == 2)
    {
        tag.Link(argv[1]);
        cerr << "removed " << RemoveFrame(tag, ID3FID_COMMENT, "") << " descriptionless comment frames" << endl;
        tag.Update();

    }
    else
    {
        tag.Link("test-remove.tag");
        tag.Strip(ID3TT_ALL);
        tag.Clear();

        frame.SetID(ID3FID_TITLE);
        frame.GetField(ID3FN_TEXT)->Set("Test title");
        tag.AddFrame(frame);

        frame.SetID(ID3FID_COMPOSER);
        frame.GetField(ID3FN_TEXT)->Set("Test composer");
        tag.AddFrame(frame);

        frame.SetID(ID3FID_BAND);
        frame.GetField(ID3FN_TEXT)->Set("Test band");
        tag.AddFrame(frame);

        frame.SetID(ID3FID_CONDUCTOR);
        frame.GetField(ID3FN_TEXT)->Set("Test conductor");
        tag.AddFrame(frame);

        frame.SetID(ID3FID_COMMENT);
        frame.GetField(ID3FN_LANGUAGE)->Set("eng");
        frame.GetField(ID3FN_TEXT)->Set("Test comment");
        frame.GetField(ID3FN_DESCRIPTION)->Set("A Description");
        tag.AddFrame(frame);

        frame.SetID(ID3FID_COMMENT);
        frame.GetField(ID3FN_LANGUAGE)->Set("eng");
        frame.GetField(ID3FN_TEXT)->Set("Test comment 2");
        frame.GetField(ID3FN_DESCRIPTION)->Set("");
        tag.AddFrame(frame);

        frame.SetID(ID3FID_COMMENT);
        frame.GetField(ID3FN_LANGUAGE)->Set("eng");
        frame.GetField(ID3FN_TEXT)->Set("ID3v1 comment text?");
        frame.GetField(ID3FN_DESCRIPTION)->Set(STR_V1_COMMENT_DESC);
        tag.AddFrame(frame);

        tag.SetPadding(false);
        tag.Update(ID3TT_ID3V2);

        cerr << "removed " << ID3_RemoveArtists(&tag) << " artist frames" << endl;
        tag.Update();
        cerr << "removed " << ID3_RemoveTitles(&tag) << " title frames" << endl;
        tag.Update();
        cerr << "removed " << RemoveFrame(tag, ID3FID_COMMENT, "") << " descriptionless comment frames" << endl;
        tag.Update();
    }

    return 0;
}