Start a synchronization
#include <mmsync/mmsyncclient.h>
int mm_sync_start( mmsync_hdl_t *hdl, const char *db, const char *mountpoint, const char *syncpath, uint32_t options, const strm_dict_t *extended_options )
Key | Value | Description |
---|---|---|
use_synchronizer | "mss_name" (a supported synchronizer, as a string in quotes; e.g., "dvdaudio") | Use the specified synchronizer if it supports the current operation; otherwise, do nothing. |
force_synchronizer | "mss_name" (a supported synchronizer, as a string in quotes; e.g., "dvdvideo") | Force the use of the specified synchronizer, whether or not it supports the current operation. |
dynamic_folder | enable | disable | Enable or disable the dynamic setting for the folder specified in syncpath. The fids for files in this folder will remain constant while this setting is enabled. The setting is nonrecursive, so the only files affected are those in the top-level folder given in syncpath; files in subfolders aren't affected. For information on how this setting impacts synchronization, see "Maintaining constant IDs for updated files and playlists". |
metadata_keys | The metadata fields to be read, as name-value pairs separated by semi-colons: md_title_name=Poltergeist;md_title_genre=Horror; md_title_album=UnleashTheDemons;md_title_artist=Mr_X |
Retrieve only the listed metadata fields. This setting affects only directed synchronizations in which dynamic_folder is enabled. When you define metadata_keys, the libmd library isn't used for metadata extraction; instead, mm-sync sets the metadata fields to the values listed in this option. Note that you must provide values for each field that you list. |
Start synchronizing the media content contained in syncpath. This path is relative within the filesystem of the mediastore located at mountpoint. The media content is synchronized to the database with the device path in db. The mm-sync process synchronizes content in a dedicated thread, so this function call returns before the synchronization starts.
All path arguments must contain valid locations in a locally accessible filesystem. The syncpath argument is flexible, allowing you to specify these scopes:
When the synchronization path refers to a folder, you must terminate it with a slash (/). To make mm-sync look in subfolders, set the MMSYNC_OPTION_RECURSIVE flag in options. When the path is an individual file, you must set both the MMSYNC_OPTION_PASS_FILES and MMSYNC_OPTION_PASS_METADATA flags for media files and set the MMSYNC_OPTION_PASS_PLAYLISTS flag for playlists.
Some mediastores don't support synchronizations of specific folders or files. For these mediastores, you must synchronize all their content by specifying a path of "/".
Values greater than 0 refer to the synchronization operation ID, on success. -1 is returned on failure.