Bug 64086

Summary: juk tag information guessing from filename should treat underscore like space
Product: [Applications] juk Reporter: Moritz Moeller-Herrmann <moritz-kdebugs>
Component: generalAssignee: Scott Wheeler <wheeler>
Status: RESOLVED FIXED    
Severity: wishlist    
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:
Attachments: Patch for JuK's tag guesser

Description Moritz Moeller-Herrmann 2003-09-11 17:04:22 UTC
Version:            (using KDE 3.1.9)
Compiler:          gcc version 3.3.2 20030831 (Debian prerelease)
OS:          Linux (i686) release 2.4.21-xfs

I have many files with underscore for spaces and the juk default tag guessing mechanism does not treat these like spaces. I guess this would raise the recognition rate a lot.

Is the internet guessing supposed to work BTW? Do I need some extra libs or anything? How does it work?
Comment 1 Frerich Raabe 2003-09-15 07:19:25 UTC
Created attachment 2462 [details]
Patch for JuK's tag guesser

To be applied from within kdemultimedia/juk, i.e.:

$ cd ~/src/kde/kdemultimedia/juk
$ patch < ~/tagguesser.diff
$ make && make install
Comment 2 Scott Wheeler 2004-02-15 20:47:14 UTC
CVS commit by wheeler: 

Patch from Frerich to fix #64086 -- treat underscores like spaces for the
tag guesser...

CCMAIL:64086-done@bugs.kde.org


  M +8 -8      tagguesser.cpp   1.21


--- kdemultimedia/juk/tagguesser.cpp  #1.20:1.21
@@ -93,9 +93,9 @@ QString FileNameScheme::composeRegExp(co
         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]+)");
+        substitutions[ 'c' ] = cfg->readEntry("Comment regexp", "([\\w\\s_]+)");
     }
 
@@ -188,9 +188,9 @@ void TagGuesser::guess(const QString &ab
         const FileNameScheme schema(*it);
         if(schema.matches(absFileName)) {
-            m_title = capitalizeWords(schema.title());
-            m_artist = capitalizeWords(schema.artist());
-            m_album = capitalizeWords(schema.album());
+            m_title = capitalizeWords(schema.title().replace('_', " "));
+            m_artist = capitalizeWords(schema.artist().replace('_', " "));
+            m_album = capitalizeWords(schema.album().replace('_', " "));
             m_track = schema.track();
-            m_comment = schema.comment();
+            m_comment = schema.comment().replace('_', " ");
             break;
         }