The mm-sync service synchronizes media information in three passes known as the files, metadata, and playlist passes. The default behavior is to perform all three passes but you can perform any subset of them by setting the right flags in the synchronization request.
Pass | Media type | Tables updated |
---|---|---|
Files | All | files, folders, playlists, mediastore_metadata |
Metadata | Audio | audio_metadata, genres, artists, albums, mediastore_metadata |
Video | video_metadata, genres, artists, mediastore_metadata | |
Photo | photo_metadata, mediastore_metadata | |
Playlist | All | files, folders, playlists, playlist_entries, mediastore_metadata |
The files pass retrieves basic file information and updates the files, folders, and playlists table entries for all media files and playlists found on the mediastore. In this pass, mm-sync removes entries for any files, folders, or playlists that are no longer on the mediastore. For deleted playlists, mm-sync also removes their playlist entries.
No metadata has been gathered yet, but the file information obtained lets you begin playing media.
The metadata pass retrieves metadata associated with the files on the mediastore. Metadata can include running time, display details, artist name, and other creation and playback information. The table entries that get updated depend on the media types of the files for which metadata is synchronized.
In the database schema definition file, you can change the tables that hold the metadata for different file types. The default schema splits the metadata for audio, video, and photo files into the audio_metadata, video_metadata, and photo_metadata tables but you could define more or fewer tables, depending on the file types and media information that you want to support.
After this pass is finished, the metadata is accurate for all mediastore files being synchronized and you can display this information to the user.
The playlist pass converts playlist entries into ordered lists of file IDs, which are stored in the playlist_entries table.
In this pass, mm-sync tries to match the filename in each playlist entry with a filename in the database. For playlists found in media-based filesystems, mm-sync searches for up to 100 database matches of each filename, then associates the playlist entry with the database file that is the best match.
If a playlist entry refers to a file no longer on the mediastore, mm-sync doesn't delete the entry but instead sets its file ID (fid) to 0. To delete entries that refer to nonexistent files, you must remove the names of those files from the playlists on the mediastore and run the playlist pass again.
When this pass has completed, you can display and use playlists.