mm-sync event types
#include <mmsync/event.h>
typedef enum mmsync_event_type { MMSYNC_EVENT_NONE = 0, MMSYNC_EVENT_MS_1PASSCOMPLETE, MMSYNC_EVENT_MS_SYNCCOMPLETE, MMSYNC_EVENT_MS_UPDATE, MMSYNC_EVENT_SHUTDOWN, MMSYNC_EVENT_SHUTDOWN_COMPLETED, MMSYNC_EVENT_MS_SYNCFIRSTFID, MMSYNC_EVENT_SYNC_ERROR, MMSYNC_EVENT_SYNCABORTED, MMSYNC_EVENT_SYNC_SKIPPED, MMSYNC_EVENT_MS_SYNC_STARTED, MMSYNC_EVENT_MS_2PASSCOMPLETE, MMSYNC_EVENT_MS_3PASSCOMPLETE, MMSYNC_EVENT_MS_SYNC_PENDING, MMSYNC_EVENT_MS_SYNC_FOLDER_STARTED, MMSYNC_EVENT_MS_SYNC_FOLDER_COMPLETE, MMSYNC_EVENT_MS_SYNC_PRIORITY_FOLDER_STARTED, MMSYNC_EVENT_MS_SYNC_PRIORITY_FOLDER_COMPLETE, MMSYNC_EVENT_MS_SYNC_FOLDER_CONTENTS_COMPLETE, MMSYNC_EVENT_MS_SYNC_FIRST_EXISTING_FID, MMSYNC_EVENT_BUFFER_TOO_SMALL, MMSYNC_EVENT_MS_SYNC_FOLDER_TRIM_COMPLETE, MMSYNC_EVENT_DB_RESET, MMSYNC_EVENT_PLAYLIST_ENTRIES_UPDATE, } mmsync_event_type_t;
Indicates there are no events in the client's queue. This event is returned if the client calls mm_sync_events_get() when no events have occurred.
Delivered when: Never delivered.
Event data: None.
DB tables updated: None (event is not related to database updates).
The files pass of synchronization is complete.
The files pass updates the files, folders, and playlists tables with all files (tracks and playlists) found on the device. Items that used to exist but are no longer on the device are removed. The mediastore_metadata table is also updated with the synchronizer used, the device's mountpoint, and the completion time of the files pass (in the last_sync and syncflags fields). No metadata has been gathered at this point.
Delivered when: The files pass completes.
Event data: The mmsync_sync_data_t structure, which contains:
DB tables updated: files, folders, playlists, and mediastore_metadata.
The synchronization of the mediastore is complete. All tables are as accurate as possible.
Delivered when: All synchronization passes are complete for the mediastore for which the synchronization was requested.
Event data: The mmsync_sync_data_t structure, which contains:
DB tables updated: files, folders, playlists, playlist_entries, audio_metadata (if necessary), video_metadata (if necessary), photo_metadata (if necessary), genres (if necessary), artists (if necessary), albums (if necessary), and mediastores.
Database content related to a mediastore has been updated.
Delivered when: The mm-sync service has written new data to the database. This event tells the client which mediastore the changes are associated with and provides the client with information on the source of the changes.
An event of this type is delivered following each change in the synchronization pass flag settings, for each operation ID associated with a specific mediastore.
Event data: The mmsync_ms_update_data_t structure, which contains:
DB tables updated: Depends on which synchronization pass (if any) changed the database.
Database changed outside of synchronization (i.e., flags == 0): files.
Files pass (flags == MMSYNC_SYNC_OPTION_PASS_FILES): files, folders, playlists, and mediastore_metadata.
Metadata pass (flags == MMSYNC_SYNC_OPTION_PASS_METADATA): files, folders, audio_metadata (if necessary), video_metadata (if necessary), photo_metadata (if necessary), genres (if necessary), artists (if necessary), albums (if necessary), and mediastore_metadata.
Playlist pass (flags == MMSYNC_SYNC_OPTION_PASS_PLAYLISTS): files, folders, playlists, playlist_entries, and mediastore_metadata.
Description: A client requested the mm-sync service to shut down. This event informs other clients about the shutdown request.
Delivered when: Immediately after receiving the request to shut down but before the shutdown process begins.
Event data: None.
DB tables updated: None (event is not related to database updates).
The mm-sync service has finished its shutdown process (following a shutdown request) and is no longer active. The service must be terminated and restarted to synchronize mediastores again.
Delivered when: The shutdown process is complete and playback and synchronization have stopped.
Event data: None.
DB tables updated: None (event is not related to database updates).
During the files pass, the first new file that's playable by mm-sync was found. This event is delivered so clients can start playback as soon as possible.
Delivered when: The first new playable file has been found and placed in the library, just after the file entries marked for deletion were removed from the database. This event is delivered during full, recursive synchronizations as well as directed synchronizations. When this event is emitted, the receiver knows that all database items are valid.
Event data: The mmsync_first_fid_data_t structure, which contains:
DB tables updated: files and folders.
An error occurred during synchronization.
Delivered when: Various synchronization errors will cause this event to be generated; the event data indicates the exact cause.
Event data: The mmsync_sync_error_t structure, which contains:
DB tables updated: Depends on the error type.
The synchronization on the mediastore was aborted before completing. This happens when the device is removed, the synchronization is cancelled by the user, or there's a serious failure.
Delivered when: The synchronization is stopped on the mediastore before completing successfully.
Event data: The mmsync_sync_data_t structure, which contains:
DB tables updated: None (event is not related to database updates).
The synchronization wasn't started automatically on a mediastore. The user can request a manual synchronization.
Delivered when: A mediastore is inserted and a manual synchronization can be requested.
Event data: None.
DB Tables Updated: mediastores.
The synchronization has begun on a mediastore.
Delivered when: The synchronization starts on a mediastore.
Event data: The mmsync_sync_data_t structure, which contains:
DB Tables Updated: mediastores.
The metadata pass of synchronization is complete.
The metadata pass updates only some metadata tables, based on the type of media files being synchronized. The files table is updated to show that all metadata describing the media content is now accurate. The mediastore_metadata table is updated to reflect the completion time of the metadata pass (in the last_sync and syncflags fields).
Delivered when: The metadata pass completes.
Event data: The mmsync_sync_data_t structure, which contains:
DB tables updated: audio_metadata, video_metadata, photo_metadata, genres, artists, albums, and mediastore_metadata.
The playlist pass of synchronization is complete.
Information on device playlists is now accurate in the database. The mediastore_metadata table is updated to reflect the completion time of the playlist pass (in the last_sync and syncflags fields).
Delivered when: The playlist pass completes.
Event data: The mmsync_sync_data_t structure, which contains:
DB tables updated: files, folders, playlists, playlist_entries, and mediastore_metadata.
A synchronization was requested for a mediastore but the operation was put on the pending (waiting) list because no synchronization threads were available.
Delivered when: After the mediastores table is updated but there are no synchronization threads available to continue synchronizing the mediastore.
Event data: The mmsync_sync_data_t structure, which contains:
DB tables updated: mediastores.
A folder has started synchronization.
Delivered when: The synchronization of a folder has started. On the files pass, this event is emitted after the folder has been inserted into the database. On the metadata pass, it's emitted just before the folder contents go through the metadata pass.
Event data: The mmsync_folder_sync_data_t structure, which contains:
DB tables updated: folders.
All files in a folder have been synchronized and the subfolders in the folder have been enumerated.
Delivered when: The nonrecursive synchronization of a folder has completed.
Event data: The mmsync_folder_sync_data_t structure, which contains:
The structure also contains pass-specific information, as follows:
Files pass: The number of file, folder, and playlist entries added to the database.
Metadata pass: The number of files for which the metadata was changed. The number of folders and playlists marked as changed is always 0. The timestamp field stores the value of the last_sync column in the folders table.
Playlist pass: The number of playlists synchronized.
DB tables updated: folders.
A priority folder has started synchronization.
Delivered when: The synchronization of a priority folder has started.
Event data: The mmsync_folder_sync_data_t structure, which contains:
DB tables updated: folders.
A priority folder has completed synchronization.
Delivered when: The synchronization of a priority folder, which must be nonrecursive, has completed.
Event data: The mmsync_folder_sync_data_t structure, which contains:
DB tables updated: folders.
The synchronization of all subfolders in a folder is complete.
Delivered when: The recursive synchronization of a folder has completed. This event isn't emitted for a nonrecursive synchronization of a folder.
Event data: The mmsync_folder_sync_data_t structure, which contains:
DB tables updated: folders.
During the files pass, the first existing file that's playable by mm-sync was found. This event is delivered so clients can start playback as soon as possible.
Delivered when: The first playable file that's already in the library was found on the mediastore. This event is delivered during full, recursive synchronizations as well as directed synchronizations.
Event data: The mmsync_first_fid_data_t structure, which contains:
DB tables updated: None.
The event buffer on the client side is too small to fetch events from mm-sync.
Delivered when: A client requests an event but doesn't have enough room to hold it.
Event data: The mmsync_event_queue_size_t structure, which contains:
DB tables updated: None.
All database entries no longer in a folder have been deleted from the database.
Delivered when: During the files pass, if a folder is found to have been previously synchronized, this event is emitted after all the items determined to have been removed from the folder have been deleted from the database.
After this event, users know that any database items shown as being in the folder are valid.
Event data: The mmsync_folder_sync_data_t structure, which contains:
DB tables updated: files, folders, playlists, and playlist_entries.
All file, metadata, and playlist information has been cleared from the database.
Delivered when: During synchronization, when an Apple device instructs mm-sync to delete all database contents.
Event data: The mmsync_reset_sync_data_t structure, which contains:
DB tables updated: files, playlists, playlist_data, mediastore_metadata, audio_metadata, video_metadata, ipod_metadata, genres, artists, and albums.
The number of playlist entries queried for updates has reached the configured limit on how many can be queried before an event notification is sent. If any playlist entries were updated in the database, the MMSYNC_EVENT_MS_UPDATE event is also sent.
Delivered when: After the nth query for a playlist entry update has been issued, where n is defined in the mm-sync configuration file.
Event data: The mmsync_pl_entries_sync_data_t structure, which contains:
DB tables updated: playlist_entries.