extragear/multimedia/amarok/src
Jeff Mitchell
kde-dev at emailgoeshere.com
Tue Aug 15 20:41:43 UTC 2006
An FYI for anyone wanting to hook into ATF's signals: although ATF's
code has (since revision 572388) been updated to work with dynamic
collection, the QString urls emitted from the signals use full
absolute paths as obtained by bundle()->url().path(). This is on
purpose because many/most of the things that would use it are
operating on KURLs, so it makes creating those faster and easier. If
you want to hook into them in a dynamic collection way you'll have do
so something like the following snippet:
CollectionDB::atfMigrateStatisticsUrl( const QString& /*oldUrl*/,
const QString& newUrl, const QString& uniqueid )
{
int deviceid = MountPointManager::instance()->getIdForUrl( newUrl );
QString rpath = MountPointManager::instance()->getRelativePath(
deviceid, newUrl );
...
Also a quick note about below: ATF should be able to update stats
successfully, and does so in my testing, but that code was definitely
broken from when dynamic collections were merged until revision
572388; it should work now. People's uids/stats may be out of sync
from beforehand, however, so the below is probably a good idea as a
sanity check by the MountPointManager.
--Jeff
Quoting Maximilian Kossick <maximilian.kossick at googlemail.com>:
> SVN commit 573339 by mkossick:
>
> can't rely on ATF to update the statistics table if the deviceid for
> a file changed.
> ATF is working on the absolute paths, and MountPointManager can
> build the correct absolute
> path even if the deviceid is not correct anymore.
>
> M +1 -1 mountpointmanager.cpp
>
>
> --- trunk/extragear/multimedia/amarok/src/mountpointmanager.cpp
> #573338:573339
> @@ -486,7 +486,7 @@
> CollectionDB *collDB = CollectionDB::instance();
> QStringList urls = collDB->query( "SELECT s.deviceid,s.url "
> "FROM statistics AS s LEFT
> JOIN tags AS t ON s.deviceid = t.deviceid AND s.url = t.url "
> - "WHERE t.url IS NULL AND
> s.deviceid != -2 AND s.uniqueid IS NULL;" );
> + "WHERE t.url IS NULL AND
> s.deviceid != -2;" );
> debug() << "Trying to update " << urls.count() / 2 << "
> statistics rows" << endl;
> foreach( urls )
> {
>
More information about the Amarok
mailing list