Best approach to create a media library



  • Hello,

    I started a project some days ago in order to challenge myself on what I have learned about Qt until here. I aim to build a music player that also provide a library interface to browse music by title, album, artist, genre, etc. But I have some problems constructing the music library.

    • I don't know if I should use a database manager like SQL to store the music library.
      Since I want the loading process to be as fast as possible I thought I should store information like album list and artist list in and external file. To do this I would create specific lists like the following and save them. I wonder however if a database wouldn't be better. What do you think about?
    QList<Album> albums; //List of all albums
    
    class Album
    {
        ...
        QString name;
        QStringList musicPaths;
        ...
    }
    
    • I wonder if the Qt Multimedia module is a good choice to read metadata.
      I find that Qt Multimedia only provide access to metadata through a QMediaObject. In my case I must fist set the media to the QMediaPlayer and use de method metadata() to retrieve the metadata. But I want to be able to read the metadata directly from the a the file when supplying the music library. What would you suggest me?

    Thank you for your advices and suggestions.


  • Lifetime Qt Champion

    Hi

    • I don't know if I should use a database manager like SQL to store the music library.

    Well using a dbms gives easy way to sort / select from the data with no extra coding.
    And if this is also a challenge, i would recommend using sqlite for the data.
    However, if you have not used Qt view / models yet. maybe its a bit involved.
    But very useful to learn about though. and you can get to play with
    http://doc.qt.io/qt-5/qsqlrelationaltablemodel.html also.

    • I wonder if the Qt Multimedia module is a good choice to read metadata.
      Well if you wish for more direct access, then maybe a tag lib might work better
      http://taglib.org/.


  • @mrjj Many thanks mrjj for your answer. I'll make more researches about SQLite and Taglib.