Autoformated code
This commit is contained in:
parent
d3a28a40ed
commit
0ff11ee2e0
@ -17,15 +17,6 @@
|
|||||||
|
|
||||||
#include "tagreader.h"
|
#include "tagreader.h"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QDateTime>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QTextCodec>
|
|
||||||
#include <QUrl>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
#include <aifffile.h>
|
#include <aifffile.h>
|
||||||
#include <apefile.h>
|
#include <apefile.h>
|
||||||
#include <asffile.h>
|
#include <asffile.h>
|
||||||
@ -39,6 +30,14 @@
|
|||||||
#include <mpcfile.h>
|
#include <mpcfile.h>
|
||||||
#include <mpegfile.h>
|
#include <mpegfile.h>
|
||||||
#include <oggfile.h>
|
#include <oggfile.h>
|
||||||
|
|
||||||
|
#include <QCoreApplication>
|
||||||
|
#include <QDateTime>
|
||||||
|
#include <QFileInfo>
|
||||||
|
#include <QTextCodec>
|
||||||
|
#include <QUrl>
|
||||||
|
#include <QVector>
|
||||||
|
#include <memory>
|
||||||
#ifdef TAGLIB_HAS_OPUS
|
#ifdef TAGLIB_HAS_OPUS
|
||||||
#include <opusfile.h>
|
#include <opusfile.h>
|
||||||
#endif
|
#endif
|
||||||
@ -46,6 +45,7 @@
|
|||||||
#include <oggflacfile.h>
|
#include <oggflacfile.h>
|
||||||
#include <popularimeterframe.h>
|
#include <popularimeterframe.h>
|
||||||
#include <speexfile.h>
|
#include <speexfile.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <tag.h>
|
#include <tag.h>
|
||||||
#include <tdebuglistener.h>
|
#include <tdebuglistener.h>
|
||||||
#include <textidentificationframe.h>
|
#include <textidentificationframe.h>
|
||||||
@ -56,8 +56,6 @@
|
|||||||
#include <wavfile.h>
|
#include <wavfile.h>
|
||||||
#include <wavpackfile.h>
|
#include <wavpackfile.h>
|
||||||
|
|
||||||
#include <sys/stat.h>
|
|
||||||
|
|
||||||
#include "core/logging.h"
|
#include "core/logging.h"
|
||||||
#include "core/messagehandler.h"
|
#include "core/messagehandler.h"
|
||||||
#include "core/timeconstants.h"
|
#include "core/timeconstants.h"
|
||||||
@ -96,7 +94,7 @@ class TagReaderDebugListener : public TagLib::DebugListener {
|
|||||||
TagLib::setDebugListener(this);
|
TagLib::setDebugListener(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void printMessage(const TagLib::String &msg) override {
|
virtual void printMessage(const TagLib::String& msg) override {
|
||||||
// Remove trailing newline.
|
// Remove trailing newline.
|
||||||
qLog(Debug).noquote() << TStringToQString(msg).trimmed();
|
qLog(Debug).noquote() << TStringToQString(msg).trimmed();
|
||||||
}
|
}
|
||||||
@ -137,7 +135,7 @@ QString WithoutExtension(const QString& s) {
|
|||||||
return s.left(i);
|
return s.left(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
QString ReplaceUnderscoresWithSpaces(const QString &s) {
|
QString ReplaceUnderscoresWithSpaces(const QString& s) {
|
||||||
QString ret(s);
|
QString ret(s);
|
||||||
ret.replace('_', ' ');
|
ret.replace('_', ' ');
|
||||||
return ret;
|
return ret;
|
||||||
@ -145,7 +143,7 @@ QString ReplaceUnderscoresWithSpaces(const QString &s) {
|
|||||||
|
|
||||||
} // namespace
|
} // namespace
|
||||||
|
|
||||||
void TagReader::GuessArtistAndTitle(pb::tagreader::SongMetadata *song) const {
|
void TagReader::GuessArtistAndTitle(pb::tagreader::SongMetadata* song) const {
|
||||||
QString artist = QString::fromStdString(song->artist());
|
QString artist = QString::fromStdString(song->artist());
|
||||||
QString title = QString::fromStdString(song->title());
|
QString title = QString::fromStdString(song->title());
|
||||||
const QString bn = QString::fromStdString(song->basefilename());
|
const QString bn = QString::fromStdString(song->basefilename());
|
||||||
@ -156,8 +154,7 @@ void TagReader::GuessArtistAndTitle(pb::tagreader::SongMetadata *song) const {
|
|||||||
if (rx.indexIn(bn) >= 0) {
|
if (rx.indexIn(bn) >= 0) {
|
||||||
artist = rx.cap(1);
|
artist = rx.cap(1);
|
||||||
title = rx.cap(2);
|
title = rx.cap(2);
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
title = WithoutExtension(bn);
|
title = WithoutExtension(bn);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -165,11 +162,16 @@ void TagReader::GuessArtistAndTitle(pb::tagreader::SongMetadata *song) const {
|
|||||||
title = ReplaceUnderscoresWithSpaces(title);
|
title = ReplaceUnderscoresWithSpaces(title);
|
||||||
artist = artist.trimmed();
|
artist = artist.trimmed();
|
||||||
title = title.trimmed();
|
title = title.trimmed();
|
||||||
if (!artist.isEmpty()) { song->set_artist(artist.toUtf8().data()); }
|
if (!artist.isEmpty()) {
|
||||||
if (!title.isEmpty()) { song->set_title(title.toUtf8().data()); }
|
song->set_artist(artist.toUtf8().data());
|
||||||
|
}
|
||||||
|
if (!title.isEmpty()) {
|
||||||
|
song->set_title(title.toUtf8().data());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TagReader::GuessAlbum(const QFileInfo &info, pb::tagreader::SongMetadata *song) const {
|
void TagReader::GuessAlbum(const QFileInfo& info,
|
||||||
|
pb::tagreader::SongMetadata* song) const {
|
||||||
QString album = QString::fromStdString(song->album());
|
QString album = QString::fromStdString(song->album());
|
||||||
if (!album.isEmpty()) return;
|
if (!album.isEmpty()) return;
|
||||||
const QString strDir = info.absoluteDir().absolutePath();
|
const QString strDir = info.absoluteDir().absolutePath();
|
||||||
@ -186,8 +188,7 @@ void TagReader::GuessAlbum(const QFileInfo &info, pb::tagreader::SongMetadata *s
|
|||||||
}
|
}
|
||||||
|
|
||||||
TagReader::TagReader()
|
TagReader::TagReader()
|
||||||
: factory_(new TagLibFileRefFactory),
|
: factory_(new TagLibFileRefFactory), kEmbeddedCover("(embedded)") {}
|
||||||
kEmbeddedCover("(embedded)") {}
|
|
||||||
|
|
||||||
void TagReader::ReadFile(const QString& filename,
|
void TagReader::ReadFile(const QString& filename,
|
||||||
pb::tagreader::SongMetadata* song) const {
|
pb::tagreader::SongMetadata* song) const {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user