Bug 223502

Summary: Comments from ogg vorbis files containing newlines are not read out
Product: [Applications] amarok Reporter: Tobias Leupold <tl>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: normal CC: mitchell, tl
Priority: NOR    
Version: 2.3.1   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 2.3.2
Sentry Crash Report:

Description Tobias Leupold 2010-01-19 23:32:58 UTC
Version:           2.2.2 (using KDE 4.3.4)
OS:                Linux
Installed from:    Gentoo Packages

it seems that Amarok 2.2.2 does not read out comments from ogg vorbis files if they contain newlines. Most of my collection is added to the database correctly, e. g. when displaying the metadata for the following file:

tobias@skoni ~ $ vorbiscomment "/home/tobias/Musik/Alben/Ignite/2001 A Place Called Home/02. Veteran.ogg"
ALBUM=A Place Called Home
ALBUMARTISTSORT=Ignite
ARTIST=Ignite
ARTISTSORT=Ignite
ASIN=B00004T1FR
BARCODE=743218260421
CATALOGNUMBER=74321 82604 2
DATE=2001
DESCRIPTION=ripped from original CD
FORMAT=CD
LABEL=TVT Records
LANGUAGE=eng
MUSICBRAINZ_ALBUMARTISTID=4d9fb84a-8104-48c1-aa16-21f53c9053cc
MUSICBRAINZ_ALBUMID=17fd4e76-d99d-4ef5-8d22-15cd8815e690
MUSICBRAINZ_ARTISTID=4d9fb84a-8104-48c1-aa16-21f53c9053cc
MUSICBRAINZ_TRACKID=26de77fd-1f09-4e3d-af10-ec016cdd0c98
RELEASECOUNTRY=DE
RELEASESTATUS=official
RELEASETYPE=album
REPLAYGAIN_TRACK_GAIN=-8.16 dB
REPLAYGAIN_TRACK_PEAK=1.01766515
SCRIPT=Latn
TITLE=Veteran
TOTALTRACKS=16
TRACKNUMBER=2

"ripped from original CD" is displayed as a comment. Looking at the following one:

tobias@skoni ~ $ vorbiscomment "/home/tobias/Musik/Alben/Eläkeläiset/2000 Humppa-Akatemia/CD2 (Jälki-Istunto)/16. Humppaleka.ogg"
ALBUM=Humppa-Akatemia (disc 2: Jälki-Istunto)
ALBUMARTISTSORT=Eläkeläiset
ARTIST=Eläkeläiset
ARTISTSORT=Eläkeläiset
ASIN=B0001Z530Q
BARCODE=6418457004528
CATALOGNUMBER=TWINCD 50
DATE=2000
DESCRIPTION=ripped from original CD
cover of Viva Las Vegas by Elvis Presley
FORMAT=CD
LABEL=Stupido Twins Records
LANGUAGE=fin
MUSICBRAINZ_ALBUMARTISTID=09c8218d-454a-489f-b500-80b305f79917
MUSICBRAINZ_ALBUMID=bdf39948-4050-448e-ae7f-0e0691d52f19
MUSICBRAINZ_ARTISTID=09c8218d-454a-489f-b500-80b305f79917
MUSICBRAINZ_TRACKID=a95430be-696d-4bbf-857a-b01708a7b61f
RELEASECOUNTRY=FI
RELEASESTATUS=official
RELEASETYPE=compilation
REPLAYGAIN_TRACK_GAIN=-7.47 dB
REPLAYGAIN_TRACK_PEAK=1.10183263
SCRIPT=Latn
TITLE=Humppaleka
TOTALTRACKS=27
TRACKNUMBER=16

no comment is displayed. The comment tags have been set with Amarok 1.4.
Comment 1 Tobias Leupold 2010-03-21 14:23:03 UTC
Still the same with Amarok 2.3.0.
Comment 2 Tobias Leupold 2010-05-03 21:56:21 UTC
Tested with Amarok 2.3.0.90: When the same comments are re-added by Amarok, they are also shown correctly afterwards.
Comment 3 Myriam Schweingruber 2010-08-24 23:56:52 UTC
Is this still valid for Amarok 2.3. or 2.3.2 beta?
Comment 4 Tobias Leupold 2010-08-25 07:06:53 UTC
Perhaps, this is actually an Amarok 1.4 issue; since I re-added all tags with newlines with Amarok 2.3.0.90, they are shown correctly. In the moment, I use Amarok 2.3.1.

I can't reproduce this with an older Amarok version, as Gentoo does not provide KDE 3 support anymore and I can't install Amarok 1.4.x (at least not with the official packages).
Comment 5 Myriam Schweingruber 2010-08-25 13:15:46 UTC
No problem, we don't track bugs from 1.4 anymore anyway, it's unmaintained since 2 years already. Closing as fixed.
Comment 6 Tobias Leupold 2010-09-08 00:13:45 UTC
I just managed to reproduce this bug with Amarok 2.3.1. I changed from embedded MySQL to an external MySQL server and the comments with newlines are gone again. Perhaps this is a database issue?
Comment 7 Myriam Schweingruber 2010-09-08 13:53:26 UTC
Could you please make sure it is not just a caching issue by the collection browser? Do a full rescan, then restart Amarok and check if that helps.
Comment 8 Tobias Leupold 2010-09-08 14:46:32 UTC
After a full rescan and a restart, nothing changes, the comments don't show up (and as before, only those comments which contain newlines).
Comment 9 Myriam Schweingruber 2010-09-08 16:10:15 UTC
Thank you for the feedback.
Comment 10 Jeff Mitchell 2010-09-09 16:16:06 UTC
Hi,

Could you send me the file you are seeing this problem with so I can test?

mitchell
kde
org

Thanks!
Comment 11 Tobias Leupold 2010-09-09 17:17:41 UTC
I just sent you one example file.
Comment 12 Jeff Mitchell 2010-09-09 19:53:08 UTC
commit 3329be723725c522512a4e3f17401ab3205a67da
Author: Jeff Mitchell <mitchell@kde.org>
Date:   Thu Sep 9 13:54:46 2010 -0400

    Remove stripping of nonprintable characters in the scanner. This causes problems with things like embedded comments and lyrics that have newlines or tabs. Keep the check for qchars that lack categorization.
    
    BUG: 223502

diff --git a/ChangeLog b/ChangeLog
index 4225d83..2acb016 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,8 @@ VERSION 2.3.2
     * Use system date/time format for default name when saving user playlists.
 
   BUGFIXES:
+    * Comments embedded in files that contained newlines or tabs could be
+      skipped entirely. (BR 223502)
     * The equalizer dialog did not discard changes when clicking "Cancel".
       Patch by Anton Gritsay <anton@angri.ru>. (BR 242730)
     * The Last.fm service did not work without KWallet. (BR 235861)
diff --git a/utilities/collectionscanner/CollectionScanner.cpp b/utilities/collectionscanner/CollectionScanner.cpp
index cbe55a1..a9d6755 100644
--- a/utilities/collectionscanner/CollectionScanner.cpp
+++ b/utilities/collectionscanner/CollectionScanner.cpp
@@ -826,17 +826,17 @@ CollectionScanner::writeElement( const QString &name, const AttributeHash &attri
         // Because of this we skip attributes containing characters not belonging to any category.
         const QString data = escape( it.value() );
         const unsigned len = data.length();
-        bool nonPrint = false;
+        bool noCategory = false;
         for( unsigned i = 0; i < len; i++ )
         {
-            if( !data[i].isPrint() || ( data[i].category() == QChar::NoCategory ) )
+            if( data[i].category() == QChar::NoCategory )
             {
-                nonPrint = true;
+                noCategory = true;
                 break;
             }
         }
 
-        if( nonPrint )
+        if( noCategory )
             continue;
 
         element.setAttribute( it.key(), it.value() );