extragear/multimedia/amarok

Jeff Mitchell kde-dev at emailgoeshere.com
Mon Jul 24 23:45:02 UTC 2006


On Monday 24 July 2006 17:08, Alexandre Oliveira wrote:
> On 7/24/06, Martin Aumueller <aumueller at uni-koeln.de> wrote:
> > Why not just store the unique id in the database?
>
> Well, it is stored in the database, but this only changes the
> question: Why not just read it from the database?
> We should only try to read the id from the file for urls that are not
> "known", shouldn't we?

There are a couple reasons for the slowness.

The first is that when loading items to the playlist, setUniqueId is called 
multiple times per item.  I'm talking like 5-6 times, and each time the 
metadata needs to be read again (more on that in a minute).  I tried at one 
point to figure out the reason; a lot of it seems to have to do with default 
copy constructors or some such thing.  It didn't seem to make sense as we 
have a copy constructor defined for MetaBundles (although not PlaylistItem), 
but I was never very successful at figuring out what was going on.  I haven't 
looked at it since as I've been on travel and working odd hours.  But if we 
could cut the number of setUniqueId calls down it would help things greatly.

Complicating the matter, however, is that in some places a single MetaBundle 
is filled in with values from the database.  This is the case when you drag 
items from the collectionbrowser to the playlist.  A single MetaBundle is 
created, populated with values from the database, then copied to a list of 
MetaBundles to pass to the playlist for addition.  At one point I tried 
telling setUniqueId to only read from the file if there was no uniqueid 
currently defined; the result of this was that all the items in the playlist 
ended up with the same uniqueid, causing havoc if it had to be used to find a 
new url.  So you can't necessarily just look at a MetaBundle and not run 
setUniqueId if there is already a UID there.

However, this is a valid issue and I will think on it.  I have to do some 
thinking and some code tracing to tell whether or not filling in the 
MetaBundle value from the database if the url exists there is going to cause 
problems or not.  I'd like to say it is a good idea and will work beautifully 
(I think so), but give me a bit of time to look into it.

--Jeff



More information about the Amarok mailing list