<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Music_database (libmpdclient.Mpd.Music_database)</title><link rel="stylesheet" href="../../odoc.css"/><meta charset="utf-8"/><meta name="viewport" content="width=device-width,initial-scale=1.0"/><script src="../../../highlight.pack.js"></script><script>hljs.initHighlightingOnLoad();</script></head><body><div class="content"><header><nav><a href="../index.html">Up</a> – <a href="../../index.html">libmpdclient</a> &#x00BB; <a href="../index.html">Mpd</a> &#x00BB; Music_database</nav><h1>Module <code>Mpd.Music_database</code></h1></header><aside><p>Music_database module: regroups data base related commands.</p></aside><dl><dt class="spec value" id="val-find"><a href="#val-find" class="anchor"></a><code><span class="keyword">val </span>find : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> (<a href="../Tags/index.html#type-search_tags">Tags.search_tags</a><span class="keyword"> * </span>string) list <span>&#45;&gt;</span> ?&#8288;sort:<a href="../Tags/index.html#type-t">Tags.t</a> <span>&#45;&gt;</span> ?&#8288;window:(int<span class="keyword"> * </span>int) <span>&#45;&gt;</span> unit <span>&#45;&gt;</span> (<a href="../Song/index.html#type-t">Song.t</a> list, <a href="../Protocol/index.html#type-ack_error">Protocol.ack_error</a><span class="keyword"> * </span>int<span class="keyword"> * </span>string<span class="keyword"> * </span>string) Stdlib.result</code></dt><dd><p>Find songs in the db that match exactly the a list of pairs (tag, exact_pattern). The exact_pattern is a string and the tah can be any tag supported by MPD, or one of the special parameters:</p><ul><li>any checks all tag values</li><li>file checks the full path (relative to the music directory)</li><li>base restricts the search to songs in the given directory (also relative to the music directory)</li><li>modified-since compares the file's time stamp with the given value (ISO 8601 or UNIX time stamp)</li></ul></dd></dl><dl><dt class="spec value" id="val-findadd"><a href="#val-findadd" class="anchor"></a><code><span class="keyword">val </span>findadd : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> (<a href="../Tags/index.html#type-search_tags">Tags.search_tags</a><span class="keyword"> * </span>string) list <span>&#45;&gt;</span> <a href="../Protocol/index.html#type-response">Protocol.response</a></code></dt><dd><p>Find songs in the db that and adds them to current playlist. Parameters have the same meaning as for find.</p></dd></dl><dl><dt class="spec value" id="val-search"><a href="#val-search" class="anchor"></a><code><span class="keyword">val </span>search : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> (<a href="../Tags/index.html#type-search_tags">Tags.search_tags</a><span class="keyword"> * </span>string) list <span>&#45;&gt;</span> ?&#8288;sort:<a href="../Tags/index.html#type-t">Tags.t</a> <span>&#45;&gt;</span> ?&#8288;window:(int<span class="keyword"> * </span>int) <span>&#45;&gt;</span> unit <span>&#45;&gt;</span> (<a href="../Song/index.html#type-t">Song.t</a> list, <a href="../Protocol/index.html#type-ack_error">Protocol.ack_error</a><span class="keyword"> * </span>int<span class="keyword"> * </span>string<span class="keyword"> * </span>string) Stdlib.result</code></dt><dd><p>Search for any song that contains WHAT. Parameters have the same meaning as for find, except that search is not case sensitive.</p></dd></dl><dl><dt class="spec value" id="val-searchadd"><a href="#val-searchadd" class="anchor"></a><code><span class="keyword">val </span>searchadd : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> (<a href="../Tags/index.html#type-search_tags">Tags.search_tags</a><span class="keyword"> * </span>string) list <span>&#45;&gt;</span> <a href="../Protocol/index.html#type-response">Protocol.response</a></code></dt><dd><p>Search for any song that contains WHAT in tag TYPE and adds them to current playlist. Parameters have the same meaning as for findadd, except that search is not case sensitive.</p></dd></dl><dl><dt class="spec value" id="val-searchaddpl"><a href="#val-searchaddpl" class="anchor"></a><code><span class="keyword">val </span>searchaddpl : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> string <span>&#45;&gt;</span> (<a href="../Tags/index.html#type-search_tags">Tags.search_tags</a><span class="keyword"> * </span>string) list <span>&#45;&gt;</span> <a href="../Protocol/index.html#type-response">Protocol.response</a></code></dt><dd><p>Search for any song that contains WHAT in tag TYPE and adds them to the playlist named NAME. If a playlist by that name doesn't exist it is created. Parameters have the same meaning as for find, except that search is not case sensitive.</p></dd></dl><dl><dt class="spec type" id="type-song_count"><a href="#type-song_count" class="anchor"></a><code><span class="keyword">type </span>song_count</code><code><span class="keyword"> = </span></code><code>{</code><table class="record"><tr id="type-song_count.songs" class="anchored"><td class="def field"><a href="#type-song_count.songs" class="anchor"></a><code>songs : int;</code></td></tr><tr id="type-song_count.playtime" class="anchored"><td class="def field"><a href="#type-song_count.playtime" class="anchor"></a><code>playtime : float;</code></td></tr><tr id="type-song_count.misc" class="anchored"><td class="def field"><a href="#type-song_count.misc" class="anchor"></a><code>misc : string;</code></td></tr></table><code>}</code></dt><dd><p>basic type for the response of the count command.</p></dd></dl><dl><dt class="spec value" id="val-count"><a href="#val-count" class="anchor"></a><code><span class="keyword">val </span>count : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> (<a href="../Tags/index.html#type-t">Tags.t</a><span class="keyword"> * </span>string) list <span>&#45;&gt;</span> ?&#8288;group:<a href="../Tags/index.html#type-t">Tags.t</a> <span>&#45;&gt;</span> unit <span>&#45;&gt;</span> (<a href="index.html#type-song_count">song_count</a> list, string) Stdlib.result</code></dt><dd><p>Get a count of songs with filters. For examples: count group artist will return for each artist the number of sons, the total playtime and the name of the artist in misc. Counts the number of songs and their total playtime in the db matching TAG exactly. The group keyword may be used to group the results by a tag. The following prints per-artist counts: count group artist count genre metal date 2016 group artist</p></dd></dl><dl><dt class="spec value" id="val-list"><a href="#val-list" class="anchor"></a><code><span class="keyword">val </span>list : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> <a href="../Tags/index.html#type-t">Tags.t</a> <span>&#45;&gt;</span> (<a href="../Tags/index.html#type-t">Tags.t</a><span class="keyword"> * </span>string) list <span>&#45;&gt;</span> (string list, string) Stdlib.result</code></dt><dd><p>Get a list based on some filer. For example &quot;list album artist &quot;Elvis Presley&quot;&quot; will return a list of the album names of Elvis Presley that exists in the music database.</p></dd></dl><dl><dt class="spec value" id="val-update"><a href="#val-update" class="anchor"></a><code><span class="keyword">val </span>update : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> string option <span>&#45;&gt;</span> <a href="../Protocol/index.html#type-response">Protocol.response</a></code></dt><dd><p>Updates the music database: find new files, remove deleted files, update modified files. URI is a particular directory or song/file to update. If you do not specify it, everything is updated. Prints &quot;updating_db: JOBID&quot; where JOBID is a positive number identifying the update job. You can read the current job id in the status response.</p></dd></dl><dl><dt class="spec value" id="val-rescan"><a href="#val-rescan" class="anchor"></a><code><span class="keyword">val </span>rescan : <a href="../Client/index.html#type-t">Client.t</a> <span>&#45;&gt;</span> string option <span>&#45;&gt;</span> <a href="../Protocol/index.html#type-response">Protocol.response</a></code></dt><dd><p>Same as update, but also rescans unmodified files.</p></dd></dl></div></body></html>