Metadata extraction sessions

To extract metadata with libmd, a client must establish a communication session with the library before it can issue commands to read metadata from media files stored on an attached device.

To establish a communication session (or metadata extraction session) with libmd, the client must name a mediastore (device) from which metadata is to be extracted. If desired, the client can then set session parameters to influence the behavior of MDPs. These parameters can be set only once, so the client should set them just after opening a session but before extracting any metadata.

The client can use any open session to send requests to libmd to extract metadata from individual items (media files). In each metadata request, the client must supply the item's path or some device-specific information identifying the item (e.g., a UID on iPods) and must list the desired metadata fields. The client can also request a maximum number of "matches" (i.e., responses returned by different plugins) for metadata fields. Retrieving multiple values for metadata fields lets a client pick the set of values that provide the user with the most complete and accurate media information possible.

Concurrent sessions

Clients can open and extract metadata from as many concurrent libmd sessions as they like. This design lets applications display media information for multiple devices to users. We recommend a limit of one session per mediastore to avoid redundant reads of metadata from the same files.

Obtaining error information

While a session is active, the client can obtain information about the last error that occurred for that session by calling mmmd_error_info(). This function returns error information, including the numeric error code, a string summarizing the error, and an error message. We recommend that your client code check the return values of all API calls. If any value indicates an error, the client can retrieve the error information and use it to help recover.