|
|
|
@ -44,6 +44,9 @@
|
|
|
|
|
#include <tqdir.h>
|
|
|
|
|
#include <tqwhatsthis.h>
|
|
|
|
|
|
|
|
|
|
#define TStringToTQString(s) TQString::fromUtf8((s).toCString(true))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
using Tellico::Import::AudioFileImporter;
|
|
|
|
|
|
|
|
|
|
AudioFileImporter::AudioFileImporter(const KURL& url_) : Tellico::Import::Importer(url_)
|
|
|
|
@ -148,7 +151,7 @@ Tellico::Data::CollPtr AudioFileImporter::collection() {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TagLib::Tag* tag = f.tag();
|
|
|
|
|
TQString album = TQString(TStringToQString(tag->album())).stripWhiteSpace();
|
|
|
|
|
TQString album = TStringToTQString(tag->album()).stripWhiteSpace();
|
|
|
|
|
if(album.isEmpty()) {
|
|
|
|
|
// can't do anything since tellico entries are by album
|
|
|
|
|
kdWarning() << "Skipping: no album listed for " << *it << endl;
|
|
|
|
@ -182,7 +185,7 @@ Tellico::Data::CollPtr AudioFileImporter::collection() {
|
|
|
|
|
}
|
|
|
|
|
// album entries use the album name as the title
|
|
|
|
|
entry->setField(title, album);
|
|
|
|
|
TQString a = TQString(TStringToQString(tag->artist())).stripWhiteSpace();
|
|
|
|
|
TQString a = TStringToTQString(tag->artist()).stripWhiteSpace();
|
|
|
|
|
if(!a.isEmpty()) {
|
|
|
|
|
if(exists && entry->field(artist).lower() != a.lower()) {
|
|
|
|
|
various = true;
|
|
|
|
@ -195,7 +198,7 @@ Tellico::Data::CollPtr AudioFileImporter::collection() {
|
|
|
|
|
entry->setField(year, TQString::number(tag->year()));
|
|
|
|
|
}
|
|
|
|
|
if(!tag->genre().isEmpty()) {
|
|
|
|
|
entry->setField(genre, TQString(TStringToQString(tag->genre())).stripWhiteSpace());
|
|
|
|
|
entry->setField(genre, TStringToTQString(tag->genre()).stripWhiteSpace());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(!tag->title().isEmpty()) {
|
|
|
|
@ -228,7 +231,7 @@ Tellico::Data::CollPtr AudioFileImporter::collection() {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if(trackNum > 0) {
|
|
|
|
|
TQString t = TQString(TStringToQString(tag->title())).stripWhiteSpace();
|
|
|
|
|
TQString t = TStringToTQString(tag->title()).stripWhiteSpace();
|
|
|
|
|
t += "::" + a;
|
|
|
|
|
const int len = f.audioProperties()->length();
|
|
|
|
|
if(len > 0) {
|
|
|
|
@ -255,9 +258,9 @@ Tellico::Data::CollPtr AudioFileImporter::collection() {
|
|
|
|
|
c += TQString::fromLatin1("<br/>");
|
|
|
|
|
}
|
|
|
|
|
if(!tag->title().isEmpty()) {
|
|
|
|
|
c += TQString::fromLatin1("<em>") + TQString(TStringToQString(tag->title())).stripWhiteSpace() + TQString::fromLatin1("</em> - ");
|
|
|
|
|
c += TQString::fromLatin1("<em>") + TStringToTQString(tag->title()).stripWhiteSpace() + TQString::fromLatin1("</em> - ");
|
|
|
|
|
}
|
|
|
|
|
c += TQString(TStringToQString(tag->comment().stripWhiteSpace())).stripWhiteSpace();
|
|
|
|
|
c += TStringToTQString(tag->comment().stripWhiteSpace()).stripWhiteSpace();
|
|
|
|
|
entry->setField(comments, c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -392,15 +395,15 @@ int AudioFileImporter::discNumber(const TagLib::FileRef& ref_) const {
|
|
|
|
|
TQString disc;
|
|
|
|
|
if(TagLib::MPEG::File* file = dynamic_cast<TagLib::MPEG::File*>(ref_.file())) {
|
|
|
|
|
if(file->ID3v2Tag() && !file->ID3v2Tag()->frameListMap()["TPOS"].isEmpty()) {
|
|
|
|
|
disc = TQString(TStringToQString(file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString())).stripWhiteSpace();
|
|
|
|
|
disc = TStringToTQString(file->ID3v2Tag()->frameListMap()["TPOS"].front()->toString()).stripWhiteSpace();
|
|
|
|
|
}
|
|
|
|
|
} else if(TagLib::Ogg::Vorbis::File* file = dynamic_cast<TagLib::Ogg::Vorbis::File*>(ref_.file())) {
|
|
|
|
|
if(file->tag() && !file->tag()->fieldListMap()["DISCNUMBER"].isEmpty()) {
|
|
|
|
|
disc = TQString(TStringToQString(file->tag()->fieldListMap()["DISCNUMBER"].front())).stripWhiteSpace();
|
|
|
|
|
disc = TStringToTQString(file->tag()->fieldListMap()["DISCNUMBER"].front()).stripWhiteSpace();
|
|
|
|
|
}
|
|
|
|
|
} else if(TagLib::FLAC::File* file = dynamic_cast<TagLib::FLAC::File*>(ref_.file())) {
|
|
|
|
|
if(file->xiphComment() && !file->xiphComment()->fieldListMap()["DISCNUMBER"].isEmpty()) {
|
|
|
|
|
disc = TQString(TStringToQString(file->xiphComment()->fieldListMap()["DISCNUMBER"].front())).stripWhiteSpace();
|
|
|
|
|
disc = TStringToTQString(file->xiphComment()->fieldListMap()["DISCNUMBER"].front()).stripWhiteSpace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|