Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. ID3v1 or ID3v2 reading by using QFile on Mp3 files

ID3v1 or ID3v2 reading by using QFile on Mp3 files

Scheduled Pinned Locked Moved General and Desktop
mp3ide3ide3v1ide3v2qfile
2 Posts 2 Posters 1.7k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • kybernetesK Offline
    kybernetesK Offline
    kybernetes
    wrote on last edited by
    #1

    Hello,

    İ wanna read mp3 files' ide tags by using Qfile. i read some article about last 128 bytes of mp3 is about ide tags but i couldnt see amy example about it.

    I saw about pragma, taglib, ide3tag etc.. but they are complex and not my wish;

    so than i tried to get some info from mp3 files by using that code

    QStringList sFiles=QFileDialog::getOpenFileNames(this,tr("Add mp3 files..."),"D:/test",
    "Mp3 files (*.mp3)");
    //Check if something is selected
    if (sFiles.isEmpty())
    return;
    //If yes, add them to the list
    foreach (QString sFile,sFiles)
    {
    //setup an item
    QTreeWidgetItem *item=new QTreeWidgetItem(ui->trwLibrary);
    QFileInfo f(sFile);
    item->setText(0,f.fileName());
    item->setText(1,f.filePath());
    item->setText(2,f.bundleName());
    item->setText(3,QString::number(f.size()/1024)+" KB");
    item->setIcon(0,QIcon("icons/library/track.svg"));
    //Add item to list
    ui->trwLibrary->addTopLevelItem(item);
    

    but i doesnt worked, i could only take file name no others and it is not my wish

    i wanna take song name artist genre etc..

    is there anyone can show me a simple way to get these datas from mp3?

    thanks for your ideas.

    best wishes.

    A 1 Reply Last reply
    0
    • kybernetesK kybernetes

      Hello,

      İ wanna read mp3 files' ide tags by using Qfile. i read some article about last 128 bytes of mp3 is about ide tags but i couldnt see amy example about it.

      I saw about pragma, taglib, ide3tag etc.. but they are complex and not my wish;

      so than i tried to get some info from mp3 files by using that code

      QStringList sFiles=QFileDialog::getOpenFileNames(this,tr("Add mp3 files..."),"D:/test",
      "Mp3 files (*.mp3)");
      //Check if something is selected
      if (sFiles.isEmpty())
      return;
      //If yes, add them to the list
      foreach (QString sFile,sFiles)
      {
      //setup an item
      QTreeWidgetItem *item=new QTreeWidgetItem(ui->trwLibrary);
      QFileInfo f(sFile);
      item->setText(0,f.fileName());
      item->setText(1,f.filePath());
      item->setText(2,f.bundleName());
      item->setText(3,QString::number(f.size()/1024)+" KB");
      item->setIcon(0,QIcon("icons/library/track.svg"));
      //Add item to list
      ui->trwLibrary->addTopLevelItem(item);
      

      but i doesnt worked, i could only take file name no others and it is not my wish

      i wanna take song name artist genre etc..

      is there anyone can show me a simple way to get these datas from mp3?

      thanks for your ideas.

      best wishes.

      A Offline
      A Offline
      amahta
      wrote on last edited by
      #2

      @kybernetes You can use a 3rd party library to do this. I suggest taking a look at the guide on how to use id3lib with Qt. Basically it shows you how to add id3lib to your project.

      Thou shalt programme
      http://www.amin-ahmadi.com

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved