Bug 259117

Summary: Do not store play count and score metadata in files
Product: [Applications] amarok Reporter: Tristan Miller <psychonaut>
Component: Collections/LocalAssignee: Amarok Developers <amarok-bugs-dist>
Status: RESOLVED FIXED    
Severity: wishlist CC: alan.ezust, mitchell, ootync, ralf-engels, samuel.brack, stuffcorpse
Priority: NOR    
Version: 2.4-GIT   
Target Milestone: 2.4.0   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 2.4.1
Sentry Crash Report:
Attachments: proposed patch to exclude "rating" from statistics

Description Tristan Miller 2010-12-07 14:10:16 UTC
Version:           2.4-GIT (using KDE 4.5.4) 
OS:                Linux

In recent versions of Amarok, the rating, score, and play count are written to Ogg Vorbis files in the fields FMPS_RATING, FMPS_RATING_AMAROK_SCORE, and FMPS_PLAYCOUNT, respectively.  Storing the rating fulfills the long-outstanding wish described in Bug 139597 (which, curiously, developers seemed quite hostile to and said would not be implemented), at least for Vorbis files.

However, storing the score and play count goes too far IMHO.  Whereas the rating is unlikely to change often, the score and play count are updated every time the file is played.  This causes a nightmare when synchronizing music collections across devices, since every song that was played since the last synchronization will have to be transferred.  This results in a massive waste of time and bandwidth, particularly across slower network connections.  Even intelligent synch programs like rsync must transfer the entire file rather than just the changed portions (owing, I think, to the fact that Vorbis tags are stored at the beginning rather than the end of the file).

So, please continue to store the rating in the Ogg Vorbis metadata, but please stop storing the score and play count, or at least give the user the option of disabling this.

Reproducible: Always
Comment 1 Ralf Engels 2010-12-08 13:12:27 UTC
I don't agree but I still implemented a configuration option that allows you to switch storing of meta data in the file on and off.

The default is off.
Comment 2 Samuel Brack 2010-12-12 15:32:23 UTC
This seems to be a duplicate of bug 259320
Comment 3 Myriam Schweingruber 2010-12-13 00:49:51 UTC
*** Bug 259320 has been marked as a duplicate of this bug. ***
Comment 4 Myriam Schweingruber 2010-12-13 00:50:29 UTC
Confirmed by duplicate
Comment 5 Alan Ezust 2010-12-17 22:11:28 UTC
I would like the option to store only RATINGS but not playcount or score.
I like that there is an option, it's just not fine grained enough yet.
I don't want the file changed whenever I play it. I like the idea of holding playcount and score in the database only.
Comment 6 Ralf Engels 2010-12-20 11:55:12 UTC
I guess we should implement this after the next release.
I only want to have bug fixes in right now.

If you don't want to wait this long you can path it for yourself if you like.
Look at shared/MetaTagLib.cpp and search for config. You should see the code preventing any statistics from being written. 
You can easily patch this to write whatever information you like.
Comment 7 Alan Ezust 2010-12-21 00:05:58 UTC
Created attachment 55118 [details]
proposed patch to exclude "rating" from statistics

this patch changes the definition of the "write statistics back to file" option so that it does not include "rating" but only the play-changing statistics.
Comment 8 Myriam Schweingruber 2010-12-21 11:36:08 UTC
Thank you for the patch, Alan, could you please submit it to http://git.reviewboard.kde.org?
Comment 9 Mark Kretschmann 2011-01-16 13:08:01 UTC
commit ff5644d7058b102b5ae850d1c1ab2096f95f5f1a
branch master
Author: Mark Kretschmann <kretschmann@kde.org>
Date:   Sun Jan 16 13:05:49 2011 +0100

    Do not store track rating as tags in files.
    
    Patch by Alan Ezusti <alan.ezust@gmail.com>.
    
    BUG: 259117

diff --git a/ChangeLog b/ChangeLog
index 57b2fce..9147c4e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,8 @@ VERSION 2.4.1
   FEATURES:
 
   CHANGES:
+    * Do not store track rating as tags in files. Patch by Alan Ezusti
+      <alan.ezust@gmail.com>. (BR 259117)
     * Added missing tooltip for animation settings. Patch by Bhargav Mangipudi
       <bhargav.1191@gmail.com>. (BR 248690)
 
diff --git a/shared/MetaTagLib.cpp b/shared/MetaTagLib.cpp
index 90e2483..c6ec676 100644
--- a/shared/MetaTagLib.cpp
+++ b/shared/MetaTagLib.cpp
@@ -948,7 +948,8 @@ replaceField( TagLib::FileRef fileref, const qint64 &field, const QVariant &valu
                 tValue = Qt4QStringToTString( QString::number( value.toInt() ) );
             }
 
-            if( field == Meta::valRating || field == Meta::valPlaycount )       //tName == "POPM"
+            // POPM gets its information from either Rating (if available) or playcount (if not)
+            if( field == Meta::valRating || field == Meta::valPlaycount )
             {
                 TagLib::ID3v2::PopularimeterFrame* popFrame = 0;
                 if( !tag->frameListMap()[tName].isEmpty() )
@@ -1168,10 +1169,10 @@ Meta::Tag::writeTags( const QString &path, const FieldHash &changes )
     foreach( const qint64 field, changes.keys() )
     {
 #ifndef UTILITIES_BUILD
-        // depending on the configuration we might not want to write back statistics
+
+        // Statistics and scores are updated whenever you play a track, so we have a separate option for that.
         if( !AmarokConfig::writeBackStatistics() &&
             (field == Meta::valScore ||
-             field == Meta::valRating ||
              field == Meta::valFirstPlayed ||
              field == Meta::valLastPlayed ||
              field == Meta::valPlaycount) )
diff --git a/src/dialogs/CollectionSetup.cpp b/src/dialogs/CollectionSetup.cpp
index 0e4839f..ad2562b 100644
--- a/src/dialogs/CollectionSetup.cpp
+++ b/src/dialogs/CollectionSetup.cpp
@@ -144,8 +144,8 @@ CollectionSetup::CollectionSetup( QWidget *parent )
 
     m_recursive->setToolTip( i18n( "If selected, Amarok will read all subfolders." ) );
     m_monitor->setToolTip(   i18n( "If selected, folders will automatically get rescanned\nwhen the content is modified,\ne.g. when a new file was added." ) );
-    m_writeBack->setToolTip( i18n( "Write meta data changes back to the original file.\nYou can also prevent writing back by write protecting the file.\nThis might be a good idea if you are currently\nsharing those files via the internet." ) );
-    m_writeBackStatistics->setToolTip( i18n( "Write changed statistics (e.g. rating or playcount)\nback to the file." ) );
+    m_writeBack->setToolTip( i18n( "Write meta data changes (including 'stars' rating) back to the original file.\nYou can also prevent writing back by write protecting the file.\nThis might be a good idea if you are currently\nsharing those files via the internet." ) );
+    m_writeBackStatistics->setToolTip( i18n( "Write play-changing statistics (e.g. score, lastplayed, playcount)\nas tags back to the file." ) );
     m_writeBackCover->setToolTip( i18n( "Write changed covers back to the file.\nThis will replace existing embedded covers." ) );
     m_charset->setToolTip(   i18n( "If selected, Amarok will use Mozilla's\nCharacter Set Detector to attempt to automatically guess the\ncharacter sets used in ID3 tags." ) );
Comment 10 Ralf Engels 2011-01-17 18:19:20 UTC
I am not sure if people are going to like this.

I had complaints about writing ratings to the file.
On the other hand I think it's fair to always write back the rating as that is explicitly set by the user.
Comment 11 Alan Ezust 2011-01-17 18:28:41 UTC
the changelog entry is not correct for the patch. It is in fact quite confusing.
Also my name is not Ezusti.

The description should be something like this:

Exclude "rating" from play-changing statistics for the option "store statistics to file". "rating" is now stored along with other metadata since it is not changed automatically when the track is played.
Comment 12 Ralf Engels 2011-01-17 18:54:04 UTC
Hi Alan,
I guess Mark was no at his best form when committing the patch.

If you want to make more changes you might want to think about using the 
kde review board. Make sure to use the git review board and not the svn. 
They are different!

Thanks again for the patch.
Ralf

On 01/17/2011 06:28 PM, ext Alan Ezust wrote:
> https://bugs.kde.org/show_bug.cgi?id=259117
>
>
>
>
>
> --- Comment #11 from Alan Ezust<alan ezust gmail com>   2011-01-17 18:28:41 ---
> the changelog entry is not correct for the patch. It is in fact quite
> confusing.
> Also my name is not Ezusti.
>
> The description should be something like this:
>
> Exclude "rating" from play-changing statistics for the option "store statistics
> to file". "rating" is now stored along with other metadata since it is not
> changed automatically when the track is played.
>
Comment 13 o_O_Tync 2011-01-18 03:13:04 UTC
'FIXED'? ehm, I see no new options in 'amarokrc' in 2.4.0

> I am not sure if people are going to like this.
+1: hidden options in a config file are not intuitive.
I believe that the separation of options 'writing-stats/writing-ratings' would be welcomed by most of the users who ever find this feature useful