#include <QApplication>#include <phonon>#include <QtGui>// ----------------------------------------------------------------------int main(int argc, char** argv){ QApplication app(argc, argv); app.setApplicationName("SimplePlayer"); Phonon::MediaObject media; Phonon::AudioOutput ao(Phonon::MusicCategory); Phonon::createPath(&media, &ao); QObject::connect(&media, SIGNAL(finished()), &app, SLOT(quit())); media.setCurrentSource(Phonon::MediaSource("music/Morcheeba.ogg")); QStringList MetaData = media.metaData("ARTIST"); MetaData = media.metaData("ALBUM"); MetaData = media.metaData("TITLE"); MetaData = media.metaData("DATE"); QLabel lbl(MetaData.join(" ")); lbl.show(); media.play(); return app.exec();}
#include <QApplication>#include <phonon>#include <QtGui>#include <QtCore/QtDebug>// ----------------------------------------------------------------------int main(int argc, char** argv){ QApplication app(argc, argv); app.setApplicationName("SimplePlayer"); Phonon::MediaObject media; Phonon::AudioOutput ao(Phonon::MusicCategory); Phonon::createPath(&media, &ao); QObject::connect(&media, SIGNAL(finished()), &app, SLOT(quit())); QObject::connect(&media, SIGNAL(metaDataChanged()), &app, SLOT(quit())); media.setCurrentSource(Phonon::MediaSource(app.arguments()[1])); app.exec(); QStringList MetaData = media.metaData(Phonon::ArtistMetaData); MetaData << media.metaData(Phonon::AlbumMetaData); MetaData << media.metaData(Phonon::TitleMetaData); MetaData << media.metaData(Phonon::DateMetaData); qDebug() << MetaData; media.play();return app.exec();}
if (song.metaData("TITLE").isEmpty()) *str+="null/"; else *str+=song.metaData("TITLE").at(0)+"/"; //название *str+= QString::number(min)+":"+ QString::number(sec)+"/"; //длительность дорожки if (song.metaData("ARTIST").isEmpty()) *str+="null/"; else *str+=song.metaData("ARTIST").at(0)+"/"; // исполнитель if (song.metaData("ALBUM").isEmpty()) *str+="null/"; else *str+=song.metaData("ALBUM").at(0)+"/"; //альбом if (song.metaData("GENRE").isEmpty()) *str+="null/"; else *str+=song.metaData("GENRE").at(0)+"/"; //жанр