Bug 281283 - Tags are not stored in music files
Summary: Tags are not stored in music files
Status: RESOLVED FIXED
Alias: None
Product: amarok
Classification: Unclassified
Component: Metadata Editing and Reading (show other bugs)
Version: 2.4.3
Platform: Ubuntu Packages Linux
: NOR minor (vote)
Target Milestone: 2.5
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-09-03 19:07 UTC by prasadae
Modified: 2011-11-01 13:16 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 2.5


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description prasadae 2011-09-03 19:07:43 UTC
Version:           2.4.3 (using KDE 4.7.0) 
OS:                Linux

I have a collection of mostly MP3 files when I edit the tag of files and save, things are fine, and the next time I restart amarok, all edits are up-to-date.

But once I delete the $HOME/.kde or $HOME/.kde4 directory and restart amarok (Re-scans the collection), the files do not show up with the updated tags. 

Reproducible: Didn't try

Steps to Reproduce:
1. Edit a MP3's tag file (Change artist or title).
2. Close Amarok.
3. delete the $HOME/.kde or $HOME/.kde4 directory 
4. restart amarok

Actual Results:  
The updated tags are not seen, only the original tag values are seen

Expected Results:  
The tags must be current to the latest update.

This could be a duplicate of: 167184 & 167200 But those were raised on really old versions thus this could possibly be a different issue or an issue with my version of TagLib.
Comment 1 Myriam Schweingruber 2011-09-03 19:47:43 UTC
Why would you remove that folder in the first place? I understand if you remove one configuration file or the Amarok database, but all the $HOME/.kde/ folder? That removes all settings of KDE and its applications.

Anyway, just to make sure: you do have writing permissions in the folder where these tracks are located, don't you?
Comment 2 prasadae 2011-09-03 19:57:34 UTC
Yeah, just deleting the database is sufficient not the entire .kde dir.

I confirmed by doing the following:
chmod a+rw $HOME/Music # My music directory.
open amarok, edit a file (one of my music files is missing the "Artist" tag, so I added the correct artist to it).
now, exited amarok, and deleted:
~/.kde/share/apps/amarok/mysqle

restarted Amarok, and initiated a re-scan 

The music file in question does not show up with the updated "Artist" Tag.
Comment 3 prasadae 2011-09-03 19:59:37 UTC
Oops, sorry 
chmod a+rw -R $HOME/Music
Comment 4 Myriam Schweingruber 2011-09-03 21:38:18 UTC
Thank you for the feedback.
Comment 5 prasadae 2011-09-04 03:42:18 UTC
New developments.
I wrote a small code using taglib (C as I am not that good with C++ :-) ):
printf("Artist = \"%s\"\n", taglib_tag_artist(taglib_file_tag(taglib_file_new(argv[1]))));

./a.out  ~/Music/King\ Crimson/Thrak/10-Radio\ II.mp3 
Artist = "King Crimson"

But when I look at Amarok's collection:
The Tag Artist is: "0"
But the tag: "Album Artist" correctly is "King Crimson"

I believe that this is more or less to do with the collection scanner than saving tags.
Comment 6 Sergey Ivanov 2011-09-17 17:13:24 UTC
Could you try to look metadata of this track from File collection? What version of taglib is used? Tbh, I can't reproduce It here.
Comment 7 prasadae 2011-10-27 01:51:15 UTC
My taglib version is: 1.7-1

Here are my detailed steps of all the things I have tried;
Music/King Crimson/Thrak/10-Radio II.mp3

Title: Radio II
Artist: 0
Composer: King Crimson
Album: THRAK

Changed it to:

Title: Radio II
Artist: King Crimson
Composer: King Crimson
Album: THRAK

Restarted amarok, and I see that the tags are present.

ls -l 10-Radio\ II.mp3 
-rw-rw-rw- 1 <snip> 10-Radio II.mp3

shutdown amarok
deleted .kde/share/apps/amarok/mysqle

started amarok, tools->update collection

tags of the file is back to
Title: Radio II
Artist: 0
Composer: King Crimson
Album: THRAK

shutdown amarok
deleted .kde/share/apps/amarok/mysqle

Now, I converted id3v1 tag to id3v2 tag and then deleted the id3v1 tag
id3v2 --convert 10-Radio\ II.mp3
id3v2 --delete-v1 10-Radio\ II.mp3 

Now start amarok, and rescan the collection. Now the tags for the collection is:
Title: Radio II
Artist: 0
Composer: ""
Album artist: 0
Album: THRAK

Which I changed to the correct fields and saved it.
Restarting amarok, I see that the changes are present.

shutdown amarok
deleted .kde/share/apps/amarok/mysqle
start amarok and rescan collection

The tags are back to 

Title: Radio II
Artist: 0
Composer: King Crimson
Album: THRAK

But as posted earlier I still see the correct tags if I use taglib to view them directly.

If you can give me your email address (Or email me on amithash AT gmail DOT com,
I can email you the problem-some mp3 track. 

PS: The reason I did the id3v2 step is because I had a hunch that this was something to do with id3v1 vs id3v2. 
PS: This does not happen to 99.999% of my tracks. Just a few. I have no clue whats up with them :-)
Comment 8 prasadae 2011-10-27 02:13:44 UTC
From kid3 Here is the full information about the track:
ID3v1.1
Title: ""
Artist: "King Crimson"
Album: "THRAK"
Comment: ""
Date: "1995"
Track Number: "11"
Genre: "Other"

ID3v2.4.0
Title: ""
Artist: "King Crimson"
Album: "THRAK"
Comment: ""
Date: "1995"
Track Number: "11"
Genre: "Other"
Album Artist: "King Crimson"
Unknown: "0"

I feel that the "Unknown" Tag is causing some problems as thats the value getting used as "Artist".
Comment 9 prasadae 2011-10-27 02:59:26 UTC
Found the real issue. 

I deleted both id3v1 and id3v2 tags using the tool id3v2.
Then I manually edited the track using kid3 and then the track stuck. 

Then I restored the track (Of course I had backed it up! :-) and instead of editing it through kid3, I did it using amarok (Remove db, rescan collection, edit the offending track's id, save, exit, delete db, start amarok,  observe):
the ID was restored to the wrong values.

When viewed using kid3, I see that the 1.1 and 2.4.0 tag version have magically appeared.
Comment 10 prasadae 2011-10-27 03:08:51 UTC
Proper reproduction steps at last.
(I tried it with a functional mp3)

Take an mp3, strip its tags using the tool id3v2:
id3v2 --delete-v1 track.mp3
id3v2 --delete-v2 track.mp3

Now, delete the amarok collection, and start amarok and rescan the collection.

Edit the track and add the correct values. 
save.
exit amarok, delete the db, start amarok and rescan the collection.
Observe the saved tags -- it is weird.
Comment 11 Myriam Schweingruber 2011-10-27 17:35:43 UTC
This is a cornercase, since once a database is created it is not supposed to be erased again. Updates to newer versions are automatic. I use the same database since several versions back.
Changed importance, subscribing Ralf.
Comment 12 Sergey Ivanov 2011-10-29 07:43:40 UTC
Hi, sorry for making you wait so long (dumn job eats all my time). Could you please mail me this file on 123kash at gmail, I'll try to find out what's going wrong.
Comment 13 Myriam Schweingruber 2011-10-29 11:20:02 UTC
Setting status correctly.
Comment 14 Sergey Ivanov 2011-10-29 13:20:10 UTC
Aha, found It. Your file is ok. The only thing you need to reproduce it: empty Artist tag and set Album Artist, - in this case amarok use Album Artist tag as Artist, It was done since some programs uses TPE2 (Album Artist) frame to store Artist data. I don't know is It good or bad, since It's not a bug, but feature. :)
Comment 15 Sergey Ivanov 2011-10-30 15:06:00 UTC
Git commit 04f622a8f174f5394b798d0299e95afbb015bfa6 by Sergey Ivanov.
Committed on 30/10/2011 at 16:01.
Pushed by ivanov into branch 'master'.

Do not use Album Artist as Artist for files without Artist metadata.
BUG: 281283

M  +1    -0    ChangeLog
M  +3    -2    src/core-impl/meta/file/File_p.h

http://commits.kde.org/amarok/04f622a8f174f5394b798d0299e95afbb015bfa6