Metadata in kioslaves

Jeff Mitchell kde-dev at emailgoeshere.com
Wed Jul 18 17:07:31 BST 2007


After discussion with Kevin Ottens and some fellow Amarok developers, 
I'm working on a Portable Media Player kioslave that uses Solid to 
detect and load the appropriate backend, providing a generic and 
standardized interface to music on a variety of devices.  However, there 
is a need for some advanced functionality that the kioslave API does not 
provide.  Mostly this is in terms of retrieving special data from 
players (such as a play count for each song or podcasts that have been 
listened to).

The metadata functions seem like they could be used for this using 
specific keywords.  For example, doing a queryMetaData on a Job with the 
key "Statistics" could cause statistic data to be returned.  Doing a 
setMetaData with a key:value pair could perform special functions on a 
device, so that when the slave has setMetaData called with specific 
keys, it can call some library-specific function.

Because these queries and library calls would happen at known times, 
throughput isn't too much of an issue (since simply copying files back 
and forth would be handled by basic functions of the slave).  So I was 
thinking that returning XML in the QString that is returned by 
queryMetaData would be fine.  This is much more robust than defining 
some sort of arbitrary method that would break anything using it 
whenever it was changed if the scheme was found to be lacking; using XML 
unsupported keys could simply be ignored.  So using XML would make it 
far more likely that this one-does-it-all kioslave approach would work.

So, the questions:
1) KIO::Job::queryMetaData says "(Valid when first data is received 
and/or slave is finished)"  Does this imply that I cannot, at any given 
point, simply call queryMetaData with a specific key?  
KIO::SlaveBase::metaData doesn't mention any such restriction.  If there 
are restrictions on when queryMetaData could be called, what exactly are 
they?  Because for what I'm doing I don't see the relevance to data() or 
finished().  Likewise are there any restrictions for when I could call 
setMetaData, for my use-case?
2) Kevin thought it best to ask on this list regarding using XML as 
proposed above because of possible performance limitations.  I don't 
think it will be problematic due to the known nature of when this would 
occur (plugging in a device and then having a progress bar while 
informing the user "Please wait while we sync metadata" is an acceptable 
scenario IMHO).
3) Any other comments?

Thanks,
Jeff




More information about the kde-core-devel mailing list