Bug in Sql Registry?

Casey Link unnamedrambler at gmail.com
Sun Apr 4 22:01:24 CEST 2010


Ok, so I've discovered some erroneous behavior with SqlCollection's
registry system.


I have a collection folder which I use for testing amarok, so I only
enable this folder when I want to do testing. When I enable this
folder I do a full rescan.

(enable/disabling done in Amarok Collection folder config)

When I'm done testing I disable this folder.

Later, when I try to browse that directory via the FileBrowser,
CollectionManager is determining that the tracks belong to
SqlCollection, because SqlCollection::trackForUrl() is finding them in
its registry.

It follows the path:

SqlCollection::trackForUrl( const KUrl &url )
SqlRegistry::getTrack( const QString &url )
SqlTrack::getTrack( int deviceid, const QString &rpath,
Collections::SqlCollection *collection )

In this method (the last one listed), it performs an sql query where
it gets the result (sample):

BEGIN: static Meta::TrackPtr Meta::SqlTrack::getTrack(int, const
QString&, Collections::SqlCollection*)
amarok:      result ("-1", "./home/ramblurr/Downloads/mp3/yet/Adam
Freedman - Best Laid Plans (Gone Wrong)/Adam Freedman - Best Laid
Plans (Gone Wrong)/01-Truly Blind.mp3",
"amarok-sqltrackuid://6d994d5ce0b7ef608c34bf4cad4bfd1c", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "", "",
"", "", "", "", "", "", "", "", "", "", "", "")

Hence, it returns an SqlTrack with EMPTY tags (see
http://imagebin.ca/view/2NljMyn.html), when really.. I want
SqlCollection::trackForUrl to return null, so I can get a
MetaFile::Track().

What it comes down to is the registry isn't deleting tracks from
itself when their corresponding folders are removed. There might be
good reason for this, but can we check that before returning an
SqlTrack it is contained in the current sqlcollection's folders?
i.e.:
foreach ( folder, SqlCollectionFolders {
if( SqlTrack->path.contains( folder)
  return SqlTrack
}
return 0

Casey


More information about the Amarok-devel mailing list