Bug 265539 - Wrong AFT values prevent tracks from being added to collection
Summary: Wrong AFT values prevent tracks from being added to collection
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Applications
Component: Collections/Local (show other bugs)
Version: 2.4.0
Platform: Ubuntu Linux
: NOR normal
Target Milestone: 2.4.1
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-02-05 18:58 UTC by Hagai Kariti
Modified: 2012-08-19 16:42 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.4.1
Sentry Crash Report:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hagai Kariti 2011-02-05 18:58:55 UTC
Version:           2.4.0 (using KDE 4.6.0) 
OS:                Linux

When adding tracks via the 'Move to collection' feature, amarok will add AFT information as a url to the old file (i.e. before the renaming and moving to the collection directory) instead of a unique hash. This can cause problems with large paths, as the uniqueid column in the urls table is only 128 chars long, and thus can fail the INSERT query if tracks which have the same first 128 characters in their paths are being added to the collection.

Reproducible: Always

Steps to Reproduce:
Add tracks with the 'move to folder' feature, then check the uniqueid column in the urls table of amarok's db.

Actual Results:  
A value in the form of amarok-sqltrackuid://file:///path/to/track/before/adding/to/collection/cut/me/at/128/chars/track.mp3

Expected Results:  
A value such as amarok-sqltrackuid://b30f7b0ea771a044edc07f66984a45aa should appear in the uniqueid column.   

Manually removing the AFT data from the file and updating the collection seem to partially fix this problem. Tracks that were previously missing are in the db, but the AFT metadata is not rewritten to the file.
Comment 1 Bastiaan Hovestreydt 2011-02-22 20:56:55 UTC
I have exactly the same problem.
As a workaround I use the amarokcollectionscanner to find the files with malformed IDs (grep -A1 "<uniqueid>file") and then use amarok_afttagger to write new IDs into them.
The problem with this is, that all statistics and labels of those files are lost in the process. This is manageable for new files, but I had to reset the IDs of a view older files, too and had to relabel them again.
Comment 2 Jeff Mitchell 2011-02-23 15:16:47 UTC
The new collection scanner doesn't properly handle unique IDs and AFT in any sane fashion. If you like/rely on that functionality you should probably revert to 2.3.
Comment 3 Ralf Engels 2011-02-24 11:40:52 UTC
Hi,
that's not what's happening. 

Some linux taggers are adding the full path as a unique id to the file (which is a good ID because it's guaranteed to be unique)

However 2.4 beta has a problem that it accepted all unique id tags and did not check the length of the ids.
Both issues are fixed.

Hagi,
please check if you have 2.4 final. Last time I checked 2.4 final as tagged in git does not have this problem. It will only accept amarok and musicbrainz tags and verify the format of both (also the length)

And Jeff,
stop spreading FUD
Comment 4 Jeff Mitchell 2011-02-24 14:03:53 UTC
(In reply to comment #3)
> Hi,
> that's not what's happening. 
> 
> Some linux taggers are adding the full path as a unique id to the file (which
> is a good ID because it's guaranteed to be unique)

That's a terrible "unique" ID. If they're not constantly updated with their current path values the moment that you access them, you can easily risk duplication.

> However 2.4 beta has a problem that it accepted all unique id tags and did not
> check the length of the ids.
> Both issues are fixed.

The poster stated that they are using 2.4.0.

> And Jeff,
> stop spreading FUD

I don't think you know what that means.
Comment 5 Bastiaan Hovestreydt 2011-02-24 14:43:57 UTC
(In reply to comment #3)
> Hagi,
> please check if you have 2.4 final. Last time I checked 2.4 final as tagged in
> git does not have this problem. It will only accept amarok and musicbrainz tags
> and verify the format of both (also the length)

I too use 2.4.0 and this version definitely does write the file path as ID to the file. I'm not sure if it happens with the "Move to Collection" action (can't test it right now), but I could always reproduce the usage of the file path as ID upon tagging files in Amarok before adding them to the collection (using Amaroks file browser). The unique ID is written at the same time as the ID3 tags.
Comment 6 Ralf Engels 2011-02-24 18:08:36 UTC
I just looked at the code and Hagi is right.
We are really setting the file name as the uid internally. But only by chance.
It happens when you use Amarok to move a file to the collection (via the file browser).

I am just preparing a fix.

For now you can use the amarok_afttagger to write the unique ids to the tracks.
Comment 7 Myriam Schweingruber 2011-02-27 11:00:54 UTC
Fixed by this commit:

Git commit 4bc99da26f491ed2ae5c3a494abbaa2444813500 by Ralf Engels.
Committed on 25/02/2011 at 18:48.
Pushed by rengels into branch 'master'.

Fix problem moving tracks from collections to SqlCollection