Bug 159663 - amarok sqlite database contains invalid path of the files
Summary: amarok sqlite database contains invalid path of the files
Status: RESOLVED WORKSFORME
Alias: None
Product: amarok
Classification: Applications
Component: general (show other bugs)
Version: 1.4.8
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Amarok Developers
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-03-21 19:52 UTC by babil
Modified: 2008-03-27 12:19 UTC (History)
0 users

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description babil 2008-03-21 19:52:59 UTC
Version:           1.4.8 (using KDE 3.5.8)
Installed from:    Ubuntu Packages
OS:                Linux

I dumped my database with the following dcop command :
dcop amarok collection query 'SELECT * FROM tags' > collection.txt

For one of the many lines in the dumped file, the path looks like this:

./home/babil/my music/02 - Yaatri - Jonmechi Tai.mp3

Strangely, the path starts with a "." dot which is incorrect.

I have added only "/home/babil/my music/" directory to my collection by doing Settings > Configure Amarok > Collection. So, it should add the full qualified path of the songs in the sqlite database, instead of incorrectly trying to make it a relative path.

I've tried deleting collection.db and recreating the database. The bug is reproducible.

I discovered this bug while debugging the "EmbedCover" script. Apparently the script fails to pull down the artist/album from the tag as the path is set in correctly.

I had to patch the script by adding a false "./" in the beginning while retrieving the sqlite entry for album/artist by dcop and again stripping out the "./" before calling addimage2mp3.rb
Comment 1 Mark Kretschmann 2008-03-21 20:56:20 UTC
This is a normal side effect of the "Dynamic Collection" system; you can read up on it in our wiki.
Comment 2 babil 2008-03-25 13:41:51 UTC
Hi, thanks for the quick reply. Is there any way to avoid the initial dot or to stop the "Dynamic Collection". I tried adding the new entry in a new section called [Collection]. But amarok is still creating database entries with the intial dot.
Comment 4 babil 2008-03-26 02:50:45 UTC
This is my amarokrc, I read that up already & did try adding DynamicCollection=false" to "[Collcetion]" section as I mentioned in my previous message. Then recreated the database with a Rescan. Doesn't help. Amarok is still creating database entries with a dot.

========================
[BrowserBar]
CurrentPane=CollectionBrowser
MagnatuneBrowser=false
MediaBrowser=false
Width=386

[Collection]
DynamicCollection=false

[Collection Browser]
Category1=2
Category2=1
========================
Comment 5 Mark Kretschmann 2008-03-26 09:08:31 UTC
Try to delete the db file.
Comment 6 babil 2008-03-26 15:03:39 UTC
Did that. Deleted the following files from $HOME/.kde/share/apps/amarok/

* collection.db
* collection_scan.files
* collection_scan.log

then "Tools > Rescan Collection". Didn't help.

Comment 7 Mark Kretschmann 2008-03-27 10:14:52 UTC
Then I don't know. Come to our IRC channel and try talking to maxx_k; he's the author of the dynamic collection feature.
Comment 8 Maximilian Kossick 2008-03-27 10:25:48 UTC
Amarok will always put the dot in front of the url. But there are
three dcop methods to operate on those urls. They are aprt of the
collection interface, and are called deviceid, relativePath, and
absolutePath
you can convert from amarok's internal representation of urls to an
absolute path using absolutePath.
to convert an absolute Path to the values that you'll find in the
database, call deviceId with the absolute Path as argument,
and relativePath with the absolutePath as argument.
Comment 9 babil 2008-03-27 12:19:14 UTC
got it ::

deviceid = `dcop amarok collection deviceId '#{file}'`.chomp()
dcopfile = `dcop amarok collection absolutePath "#{deviceid}" "#{file}"`.chomp()

Thanks a lot Maximilian.