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 }
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; } }