"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/taglibplugin.cpp" between
krename-4.0.9.tar.gz and krename-4.90.90.tar.gz

About: KRename is a batch file-renamer (KDE).

taglibplugin.cpp  (krename-4.0.9):taglibplugin.cpp  (krename-4.90.90)
skipping to change at line 26 skipping to change at line 26
***************************************************************************/ ***************************************************************************/
#include "taglibplugin.h" #include "taglibplugin.h"
#include <taglib/taglib.h> #include <taglib/taglib.h>
#include <taglib/fileref.h> #include <taglib/fileref.h>
#include <taglib/tfile.h> #include <taglib/tfile.h>
#include <taglib/tstring.h> #include <taglib/tstring.h>
#include <taglib/tag.h> #include <taglib/tag.h>
#include <klocale.h> #include <KLocalizedString>
#include "batchrenamer.h" #include "batchrenamer.h"
TagLibPlugin::TagLibPlugin( PluginLoader* loader ) TagLibPlugin::TagLibPlugin(PluginLoader *loader)
: FilePlugin( loader ) : FilePlugin(loader)
{ {
this->addSupportedToken("tagTitle"); this->addSupportedToken("tagTitle");
this->addSupportedToken("tagArtist"); this->addSupportedToken("tagArtist");
this->addSupportedToken("tagAlbum"); this->addSupportedToken("tagAlbum");
this->addSupportedToken("tagComment"); this->addSupportedToken("tagComment");
this->addSupportedToken("tagGenre"); this->addSupportedToken("tagGenre");
this->addSupportedToken("tagYear"); this->addSupportedToken("tagYear");
this->addSupportedToken("tagTrack"); this->addSupportedToken("tagTrack");
m_help.append( "[tagTitle];;" + i18n("Insert the title of a track") ); m_help.append("[tagTitle];;" + i18n("Insert the title of a track"));
m_help.append( "[tagArtist];;" + i18n("Insert the artist of a track") ); m_help.append("[tagArtist];;" + i18n("Insert the artist of a track"));
m_help.append( "[tagAlbum];;" + i18n("Insert the album of a track") ); m_help.append("[tagAlbum];;" + i18n("Insert the album of a track"));
m_help.append( "[tagComment];;" + i18n("Insert the comment of a track") ); m_help.append("[tagComment];;" + i18n("Insert the comment of a track"));
m_help.append( "[tagGenre];;" + i18n("Insert the genre of a track") ); m_help.append("[tagGenre];;" + i18n("Insert the genre of a track"));
m_help.append( "[tagYear];;" + i18n("Insert the year of a track") ); m_help.append("[tagYear];;" + i18n("Insert the year of a track"));
m_help.append( "[tagTrack];;" + i18n("Insert the number of a track") ); m_help.append("[tagTrack];;" + i18n("Insert the number of a track"));
m_help.append( "[##tagTrack];;" + i18n("Insert the number of a track formatt m_help.append("[##tagTrack];;" + i18n("Insert the number of a track formatte
ed with a leading 0") ); d with a leading 0"));
m_name = i18n("TagLib (MP3/Ogg) Plugin"); m_name = i18n("TagLib (MP3/Ogg) Plugin");
m_comment = i18n("<qt>This plugin supports reading tags for " m_comment = i18n("<qt>This plugin supports reading tags for "
"MP3, Ogg Vorbis, FLAC, MPC, Speex WavPack " "MP3, Ogg Vorbis, FLAC, MPC, Speex WavPack "
"and TrueAudio files.</qt>"); "and TrueAudio files.</qt>");
m_icon = "audio-x-generic"; m_icon = "audio-x-generic";
} }
QString TagLibPlugin::processFile( BatchRenamer* b, int index, const QString & f ilenameOrToken, EPluginType ) QString TagLibPlugin::processFile(BatchRenamer *b, int index, const QString &fil enameOrToken, EPluginType)
{ {
QString token( filenameOrToken.toLower() ); QString token(filenameOrToken.toLower());
QString filename = (*b->files())[index].srcUrl().path(); QString filename = (*b->files())[index].srcUrl().path();
TagLib::FileRef g( TagLib::FileName(filename.toUtf8().data()) ); TagLib::FileRef g(TagLib::FileName(filename.toUtf8().data()));
TagLib::String result; TagLib::String result;
if( g.isNull() ) if (g.isNull()) {
return QString(""); return QString("");
}
if( token == "tagtitle" ) if (token == "tagtitle") {
result = g.tag()->title(); result = g.tag()->title();
else if( token == "tagartist" ) } else if (token == "tagartist") {
result = g.tag()->artist(); result = g.tag()->artist();
else if( token == "tagalbum" ) } else if (token == "tagalbum") {
result = g.tag()->album(); result = g.tag()->album();
else if( token == "tagcomment" ) } else if (token == "tagcomment") {
result = g.tag()->comment(); result = g.tag()->comment();
else if( token == "taggenre" ) } else if (token == "taggenre") {
result = g.tag()->genre(); result = g.tag()->genre();
else if( token == "tagyear" ) { } else if (token == "tagyear") {
unsigned int year = g.tag()->year(); unsigned int year = g.tag()->year();
return QString::number( year ); return QString::number(year);
} else if( token == "tagtrack" ) { } else if (token == "tagtrack") {
unsigned int track = g.tag()->track(); unsigned int track = g.tag()->track();
return QString::number( track ); return QString::number(track);
} }
return TStringToQString( result ); return TStringToQString(result);
} }
 End of changes. 17 change blocks. 
29 lines changed or deleted 30 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)