Commit 9fb8b867 authored by Frerich Raabe's avatar Frerich Raabe

- Accept "." in the album, artist and title fields

svn path=/trunk/kdemultimedia/juk/; revision=288290
parent d47bbc63
......@@ -46,8 +46,12 @@ FileNameScheme::FileNameScheme(const QString &s)
bool FileNameScheme::matches(const QString &fileName) const
{
if ( m_regExp.exactMatch( fileName ) ) qDebug( "'%s' matches", m_regExp.pattern().latin1() );
return m_regExp.exactMatch(fileName);
/* Strip extension ('.mp3') because '.' may be part of a title, and thus
* does not work as a separator.
*/
QString stripped = fileName;
stripped.truncate(stripped.findRev('.'));
return m_regExp.exactMatch(stripped);
}
QString FileNameScheme::title() const
......@@ -93,9 +97,9 @@ QString FileNameScheme::composeRegExp(const QString &s) const
{
KConfigGroupSaver saver(cfg, "TagGuesser");
substitutions[ 't' ] = cfg->readEntry("Title regexp", "([\\w\\s'&_,]+)");
substitutions[ 'a' ] = cfg->readEntry("Artist regexp", "([\\w\\s'&_,]+)");
substitutions[ 'A' ] = cfg->readEntry("Album regexp", "([\\w\\s'&_,]+)");
substitutions[ 't' ] = cfg->readEntry("Title regexp", "([\\w\\s'&_,\\.]+)");
substitutions[ 'a' ] = cfg->readEntry("Artist regexp", "([\\w\\s'&_,\\.]+)");
substitutions[ 'A' ] = cfg->readEntry("Album regexp", "([\\w\\s'&_,\\.]+)");
substitutions[ 'T' ] = cfg->readEntry("Track regexp", "(\\d+)");
substitutions[ 'c' ] = cfg->readEntry("Comment regexp", "([\\w\\s_]+)");
}
......
......@@ -94,6 +94,8 @@ int main( int argc, char **argv )
"Block Rockin' Beats", "Chemical Brothers", "01", QString::null, "Dig Your Own Hole");
check( QDir::homeDirPath() + "/[01] Randy - Religion, religion.mp3",
"Religion, Religion", "Randy", "01", QString::null, QString::null );
check( QDir::homeDirPath() + "/(3) Mr. Doe - Punk.mp3",
"Punk", "Mr. Doe", "3", QString::null, QString::null );
cout << "All OK" << endl;
return 0;
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment