Based on user actions, a media application might need to interrupt a synchronization to immediately synchronize the metadata
for a particular folder. This priority folder synchronization reduces the time for making specific media content
available for viewing or playing.
Suppose your application displays folder information in a mediastore file browser and the user selects a different folder to
view or play tracks from but a synchronization is still ongoing. In this case, you should do a priority synchronization of
the newly selected folder, to display its metadata and make its media files playable ahead of the files in other folders.
To start a priority folder synchronization, call
mm_sync_control() or run the
sync_control command with the following extended option settings:
- The action key is set to priority_folder_set.
- Either the folderid or folder_path key is set to refer to the folder that you want
to synchronize immediately. You can look up the folderid in the folders table.
If you use folder_path, you must provide a relative path within the mediastore's filesystem
(e.g., / refers to the root directory).
When it receives such a request, mm-sync interrupts the active synchronization on the mediastore
on which the priority folder is stored, synchronizes the metadata from that folder, then resumes the original synchronization.
The priority folder feature has the following behavior:
- Requests to synchronize the current folder are silently ignored.
- Priority synchronizations can't be recursive; only the priority folder (and not its subfolders) is synchronized before the
original synchronization resumes.
- Priority synchronizations can be done only on mediastores with synchronizations already in progress,
because the invocation command requires a valid operation ID.
- The priority folder is synchronized with the same passes enabled for the original synchronization.
- Priority synchronization requests are queued, so if a second request is sent before the first requested priority
synchronization completes, the second priority folder gets synchronized, then the first folder, and then the original
synchronization resumes.