Esempio n. 1
0
void Tags::ImportID3(wxString fileName)
{
#ifdef USE_ID3LIB
    ID3_Tag tag((char *) fileName.c_str());

    mTitle = ID3_GetTitle(&tag);
    mArtist = ID3_GetArtist(&tag);
    mAlbum = ID3_GetAlbum(&tag);
    mTrackNum = ID3_GetTrackNum(&tag);
    mYear = ID3_GetYear(&tag);
    mGenre = ID3_GetGenreNum(&tag);
    mComments = ID3_GetComment(&tag);
#endif // USE_ID3LIB
}
Esempio n. 2
0
void Tag::parse() {
  char *str;

  if ((str = ID3_GetArtist(&tag)) != NULL)
    artist = str;

  if ((str = ID3_GetAlbum(&tag)) != NULL)
    album = str;

  if ((str = ID3_GetTitle(&tag)) != NULL)
    title = str;

  if ((str = ID3_GetGenre(&tag)) != NULL)
    genre = str;

  /*
  if (ID3_HasPicture(&tag)) {
    char picPath[1024] = "pic.tmp";

    ID3_Frame* frame = NULL;
    frame = tag.Find(ID3FID_PICTURE);
    if (frame != NULL)
    {
      ID3_Field* myField = frame->GetField(ID3FN_DATA);
      if (myField != NULL)
      {
	myField->ToFile(picPath);
	qWarning("writing file: %s (size=%d)",picPath, myField->Size());
      }
    }

    //    ID3_GetPictureData(&tag, picPath);
    //    picture.load(picPath);
    //    qWarning("loaded picture: %dx%d", picture.width(), picture.height());
  }
  */
}
Esempio n. 3
0
void MainWindow::on_pushButton_clicked()
{
    QString fileName = QFileDialog::getOpenFileName(this, tr("Open file"), "", tr("Audio Files (*.mp3);"));
    flag = false;
    if (fileName.isEmpty() == false) {
        myTag.Link(fileName.toStdString().c_str());

        ui->tableWidget->setItem(0, 0, new QTableWidgetItem(QString::fromLocal8Bit(ID3_GetTitle(&myTag))));
        ui->tableWidget->setItem(0, 1, new QTableWidgetItem(QString::fromLocal8Bit(ID3_GetArtist(&myTag))));
        ui->tableWidget->setItem(0, 2, new QTableWidgetItem(QString::fromLocal8Bit(ID3_GetAlbum(&myTag))));
        ui->tableWidget->setItem(0, 3, new QTableWidgetItem(QString::fromLocal8Bit(ID3_GetYear(&myTag))));
        ui->tableWidget->setItem(0, 4, new QTableWidgetItem(QString::fromLocal8Bit(ID3_GetGenre(&myTag))));

        const Mp3_Headerinfo* mp3info;
        mp3info = myTag.GetMp3HeaderInfo();
        if (mp3info) {
            ui->tableWidget->setItem(0, 5, new QTableWidgetItem(QString::number(mp3info->bitrate/1000) + " KBps"));
            ui->tableWidget->setItem(0, 6, new QTableWidgetItem(QString::number(mp3info->frequency/1000) + " KHz"));
            ui->tableWidget->setItem(0, 7, new QTableWidgetItem(QString::number(mp3info->time/60) + " min " + QString::number(mp3info->time%60) + " s"));
        }
        flag = true;
    }

}