misc: show info from audio tag if possible
This commit is contained in:
parent
35778d97bf
commit
60c25e1473
|
@ -121,6 +121,21 @@ void MainWindow::setAudioPropertyInfoForDisplay(int sampleRate, int bitrate, int
|
||||||
ui->propLabel->setToolTip(tooltipStrs.join('\n'));
|
ui->propLabel->setToolTip(tooltipStrs.join('\n'));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MainWindow::setAudioMetadataForDisplay(QString title, QString artist, QString album)
|
||||||
|
{
|
||||||
|
Q_UNUSED(album);
|
||||||
|
|
||||||
|
if (!title.isEmpty()) {
|
||||||
|
if (!artist.isEmpty()) {
|
||||||
|
ui->titleLabel->setText(QString("%1 - %2").arg(artist, title));
|
||||||
|
} else if (!album.isEmpty()) {
|
||||||
|
ui->titleLabel->setText(QString("%1 - %2").arg(artist, album));
|
||||||
|
} else {
|
||||||
|
ui->titleLabel->setText(QString("%1").arg(artist));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void MainWindow::localSocketPlayAudioFiles(QVariant audioFilesVariant)
|
void MainWindow::localSocketPlayAudioFiles(QVariant audioFilesVariant)
|
||||||
{
|
{
|
||||||
QStringList urlStrList = audioFilesVariant.toStringList();
|
QStringList urlStrList = audioFilesVariant.toStringList();
|
||||||
|
@ -417,11 +432,19 @@ void MainWindow::initConnections()
|
||||||
suffix = suffix.toUpper();
|
suffix = suffix.toUpper();
|
||||||
|
|
||||||
TagLib::FileRef fileRef(filePath.toLocal8Bit().data());
|
TagLib::FileRef fileRef(filePath.toLocal8Bit().data());
|
||||||
if(!fileRef.isNull() && fileRef.audioProperties()) {
|
|
||||||
|
if (!fileRef.isNull() && fileRef.audioProperties()) {
|
||||||
TagLib::AudioProperties *prop = fileRef.audioProperties();
|
TagLib::AudioProperties *prop = fileRef.audioProperties();
|
||||||
setAudioPropertyInfoForDisplay(prop->sampleRate(), prop->bitrate(), prop->channels(), suffix);
|
setAudioPropertyInfoForDisplay(prop->sampleRate(), prop->bitrate(), prop->channels(), suffix);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!fileRef.isNull() && fileRef.tag()) {
|
||||||
|
TagLib::Tag * tag = fileRef.tag();
|
||||||
|
setAudioMetadataForDisplay(QString::fromStdString(tag->title().to8Bit(true)),
|
||||||
|
QString::fromStdString(tag->artist().to8Bit(true)),
|
||||||
|
QString::fromStdString(tag->album().to8Bit(true)));
|
||||||
|
}
|
||||||
|
|
||||||
using namespace spID3;
|
using namespace spID3;
|
||||||
using namespace spFLAC;
|
using namespace spFLAC;
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,7 @@ public:
|
||||||
void commandlinePlayAudioFiles(QStringList audioFiles);
|
void commandlinePlayAudioFiles(QStringList audioFiles);
|
||||||
void loadPlaylistBySingleLocalFile(const QString &path);
|
void loadPlaylistBySingleLocalFile(const QString &path);
|
||||||
void setAudioPropertyInfoForDisplay(int sampleRate, int bitrate, int channelCount, QString audioExt);
|
void setAudioPropertyInfoForDisplay(int sampleRate, int bitrate, int channelCount, QString audioExt);
|
||||||
|
void setAudioMetadataForDisplay(QString title, QString artist, QString album);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
void localSocketPlayAudioFiles(QVariant audioFilesVariant);
|
void localSocketPlayAudioFiles(QVariant audioFilesVariant);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user