This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Restore collection database

Tags: None
(comma "," separated)
hammerP
Karma
0

Restore collection database

Sat Nov 05, 2005 8:35 pm
Hi,
I\'m changing my computer and I want to transfer my amarok collection database.
On my old computer I had amarok 1.3.2 installed and used it with mysql. On the new computer the files are stored at the same location as on the old one, so there should be some way.

I already tried
oldpc$ mysqldump -uamarok -p amarokdb > dumpfile
and dumpfile seems to contain all my collection.
Then I created an empty database on the new pc with
newpc$ mysql -p -u root
CREATE DATABASE amarokdb;
USE mysql;
GRANT ALL ON amarokdb.* TO amarok@localhost IDENTIFIED BY \'pw\';
FLUSH PRIVILEGES;

Finally I copied the amarok configuration files to the new computer and tried to load the dumpfile with.
newpc$ cat dumpfile | mysql -uamarok -p amarokdb

The result is that amarok has all my files in its collection but without song scores (they are pretty much that what I want to keep).

Thanks in advance
Frido Roose
Registered Member
Posts
21
Karma
0

Re:Restore collection database

Sun Nov 06, 2005 12:09 am
You should make sure your path to your collection is exactly the same as on the other computer.

If you copied the ~/.kde/share/apps/amarok and ~/.kde/share/config/amarokrc together with your database, it should be fine, as long as your collection has the same path. That\'s because a song is identified in the database by the full path to the song, including file name. Thus, renaming files also result in loss of your scores.

Tip: I made a symlink to my collection as /Music. This way, whenever I move my collection, I only have to make sure that symlink exists so my path stays the same and my scores are kept. It\'s a workaround, not a solution. But that won\'t help you much in your case now.
hammerP
Karma
0

Re:Restore collection database

Sun Nov 06, 2005 10:16 am
But I\'m sure the files on the new computer have exactly the same paths.
I however think some of the steps I did were wrong, as haven\'t got any idea about sql and so I didn\'t really know what I was doing.
Is mysqldump the correct way to traverse the database? May I have forgotten anything?
Frido Roose
Registered Member
Posts
21
Karma
0

Re:Restore collection database

Sun Nov 06, 2005 12:34 pm
First I want to make clear that I\'m just an amaroK user, and I didn\'t migrate my collection to another system yet, so I can\'t guarantee anything, I only try to help where possible.

You say your dumpfile seems okay, so I suppose it contains the correct score values in the statistics table.

If you query the statistics table in your new mysql database, how do the scores look like? Are they reset?

I suppose you copied the whole collection first before you started amarok for the first time after the data import?

I didn\'t try this before, but I guess I would do it like this:
1) copy collection to target system using the same path (a change in case somewhere would already make your scores reset)
2) copy amarok configuration files to target system
3) export/import database
4) run amarok on the target system
hammerP
Karma
0

Re:Restore collection database

Sun Nov 06, 2005 7:59 pm
That\'s exactly what I did and for some reason didn\'t work.
Besides while trying the import/export I also lost the database on the old computer.:pinch:
At least now I know what to do when I want to change system the next time - not to change it;)
User avatar
sebr
Moderator
Posts
301
Karma
0

Re:Restore collection database

Mon Nov 07, 2005 1:00 pm
you will need to make sure that you haven\'t started amarok before importing the database backup. When amarok starts, it will create the tables, which will cause the database backup import to fail, if you use cat dump | mysql .... This is because it tries to import them again.

To ensure that your dump contains the scores, read through it and look for the statistics table. You might also want to check that the paths in the tables are set okay.

You should find something like this:
[code:1]
INSERT INTO `statistics` VALUES (\'/path/to/file.mp3\',1109725946,1123770672,83,13)
[/code:1]

If you don\'t, then you unfortunately don\'t have a proper backup.
samwyse
Registered Member
Posts
3
Karma
0

Re: Restore collection database

Fri Nov 10, 2006 9:23 am
Should this work also for sqlite? I did some manual defragging (copied all of /home to another drive, then wiped my /home partition with mkfs.ext3 and copied everything back) and my database appears empty now. The symlink in my home-dir pointing to my music is still there and my music is on a partition I didn't change. I'm using Amarok 1.4.3 on Kubuntu 6.10.

e: I looked at collection.db with a hexeditor and it seems to point to directories also with an UUID code. Edgy converted fstab entries to use UUID, but now I actually changed my partition from reiserfs to ext3 and made a "normal" entry for the mountpoint. Maybe I need to mess with the UUID somehow.

Last edited by samwyse on Fri Nov 10, 2006 9:40 am, edited 1 time in total.
samwyse
Registered Member
Posts
3
Karma
0

Re: Restore collection database

Fri Dec 08, 2006 11:22 am
I actually changed every UUID in the db-files to match the new UUID's, but it didn't change anything.
NabLa
Registered Member
Posts
3
Karma
0

Re: Restore collection database

Fri Jan 26, 2007 11:07 am
samwyse wrote:Should this work also for sqlite? I did some manual defragging (copied all of /home to another drive, then wiped my /home partition with mkfs.ext3 and copied everything back) and my database appears empty now. The symlink in my home-dir pointing to my music is still there and my music is on a partition I didn't change. I'm using Amarok 1.4.3 on Kubuntu 6.10.

e: I looked at collection.db with a hexeditor and it seems to point to directories also with an UUID code. Edgy converted fstab entries to use UUID, but now I actually changed my partition from reiserfs to ext3 and made a "normal" entry for the mountpoint. Maybe I need to mess with the UUID somehow.

I am having this exact problem, I had to drop a FAT32 partition containing all my collection and recreated the filesystem as EXT3 this time. Ubuntu complained about UUID being unresolvable so I changed the entry on /etc/fstab to /dev/hda4 instead of UUID=something. Now my collection is pretty much gone... how can I fix this??
User avatar
dangle_wtf
Moderator
Posts
1252
Karma
0

Re: Restore collection database

Sat Jan 27, 2007 11:35 pm
Create a new one. Delete ~/.kde/share/apps/amarok/collection.db and let amarok build it again.

This is by far the easiest way to fix database problems. Granted, you'll lose stats, but they come back with time.


"There are two theories to arguing with women. Neither one works."
.
If men could get pregnant, we'd learn the true meaning of "screaming nancyboy wuss"
NabLa
Registered Member
Posts
3
Karma
0

Re: Restore collection database

Mon Jan 29, 2007 10:16 am
Sorry mate, but losing stats... it's just not a reasonable solution, I have rated around 4000 tracks and all my playlists are built around this rating. Not to mention playlists based on tags, etc. Not being funny here, but that's not the sort of solution that should be expected by such a mature program. Besides, I thought the "file tracking" feature introduced a couple of versions ago was designed to prevent exactly this problem, am I wrong?

I re-created again my collection on MySQL and managed to get all my ratings back from collection.db by exporting the proper table to a csv. Thank god for that!

However, the stats regarding "album inserted on... (date)"... I can't figure out in what part of the database is, so I can update the mysql table with all that data... can anyone throw some light into this?

Cheers guys!
MoriaOrc
Registered Member
Posts
4
Karma
0

Re: Restore collection database

Sat Oct 06, 2007 1:37 am
I'm in a similar situation to those above, I'm migrating to a new computer/install.  Keep in mind I don't know too much about MySQL (although I assure you I'm good at following directions  :biggrin:) when you reply. Except I have one minor problem:

My old computer (the good Amarok install) is being replaced (partly/finally) because it's PSU burned out.  I have access to all the files on the hard-drives, but actually booting the OS would be a major PITA.  Is it "good enough" to grab the files where MySQL stores it's database, or will I need to boot into the OS and make a dump of the database like the topic starter described?  If I need to make a dump, a slightly more detailed description of what needs to be done on the new computer would be appreciated...

Also, I already have a backup of my home folder (including .kde/*/amarok) that I'm planning to move over.  The collection will be in the same place, seeing as it's on a storage drive that will be mounted to the same location.  I just want to make sure I can get all my stats back before I wipe the old OS install.

Thanks in advance...
MoriaOrc
Registered Member
Posts
4
Karma
0

Re: Restore collection database

Sun Oct 07, 2007 12:56 am
Never mind.  I got it all migrated earlier using some major help from the stuff in this thread.  The stuff hammerP posted worked for me, including statistics & stuff.

It was even more trouble then it thought it'd be though (MySQL wasn't ready for the power failure, apperently...), but I found some help else wheres on getting it back up-and-running enough to dump the Amarok database.


Bookmarks



Who is online

Registered users: Bing [Bot], Google [Bot], Yahoo [Bot]