Depending on user actions, your client application may need to interrupt a synchronization in progress and begin synchronizing a new folder.
The priority folder synchronization feature helps you reduce the time required for making media content from a certain folder available for viewing or playing.
Suppose your application must display up-to-date folder information in a mediastore file browser and, during a synchronization, the user selects a different folder to view or play tracks from.
In this case, you should do a priority synchronization of the newly selected folder.
This action displays the folder's metadata and makes the folder's media files playable ahead of 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 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 mediastore's root directory).
When it receives such a request, mm-sync interrupts any synchronization in progress on the same device on which the priority folder is stored
and synchronizes the priority folder's contents before resuming 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 a mediastore currently being synchronized, because the invocation command requires a valid operation ID.
- The synchronization passes done for the priority folder are the same as those requested in the original synchronization.
- New priority synchronization requests preempt any priority synchronization in progress, meaning the second priority folder gets synchronized, then the first folder (whose synchronization was interrupted)
gets synchronized, and then the original synchronization resumes.
- Priority synchronization requests are queued, so if a second request is sent before the synchronization for the first request is started, the second priority folder gets synchronized, then the first folder,
and then the original synchronization resumes.