<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"><head><title>Utils (libmpdclient.Mpd.Utils)</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; Utils</nav><h1>Module <code>Mpd.Utils</code></h1></header><aside><p>Set of helpers for the mpdlibclient library.</p></aside><dl><dt class="spec value" id="val-remove_trailing_new_line"><a href="#val-remove_trailing_new_line" class="anchor"></a><code><span class="keyword">val </span>remove_trailing_new_line : string <span>&#45;&gt;</span> string</code></dt><dd><p>Remove new line char at the end of a string.</p></dd></dl><dl><dt class="spec value" id="val-remove_new_lines"><a href="#val-remove_new_lines" class="anchor"></a><code><span class="keyword">val </span>remove_new_lines : string <span>&#45;&gt;</span> string</code></dt><dd><p>Remove all new line characters in a string.</p></dd></dl><dl><dt class="spec value" id="val-split_lines"><a href="#val-split_lines" class="anchor"></a><code><span class="keyword">val </span>split_lines : string <span>&#45;&gt;</span> string list</code></dt><dd><p>Split multiline string into a list of strings</p></dd></dl><dl><dt class="spec type" id="type-item_id"><a href="#type-item_id" class="anchor"></a><code><span class="keyword">type </span>item_id</code><code><span class="keyword"> = </span></code><table class="variant"><tr id="type-item_id.Simple" class="anchored"><td class="def constructor"><a href="#type-item_id.Simple" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Simple</span><span class="keyword"> of </span>int</code></td></tr><tr id="type-item_id.Num_on_num" class="anchored"><td class="def constructor"><a href="#type-item_id.Num_on_num" class="anchor"></a><code><span class="keyword">| </span></code><code><span class="constructor">Num_on_num</span><span class="keyword"> of </span>int<span class="keyword"> * </span>int</code></td></tr></table></dt><dd><p>Type that can save the id of an element which can be an int or two int</p></dd></dl><dl><dt class="spec value" id="val-num_on_num_parse"><a href="#val-num_on_num_parse" class="anchor"></a><code><span class="keyword">val </span>num_on_num_parse : string <span>&#45;&gt;</span> <a href="index.html#type-item_id">item_id</a></code></dt><dd><p>Split string like &quot;8/14&quot; to 8 and 14, returns (-1, -1) if it fails. * is used in track and disc tab of the song data</p></dd></dl><dl><dt class="spec type" id="type-pair"><a href="#type-pair" class="anchor"></a><code><span class="keyword">type </span>pair</code><code><span class="keyword"> = </span></code><code>{</code><table class="record"><tr id="type-pair.key" class="anchored"><td class="def field"><a href="#type-pair.key" class="anchor"></a><code>key : string;</code></td></tr><tr id="type-pair.value" class="anchored"><td class="def field"><a href="#type-pair.value" class="anchor"></a><code>value : string;</code></td></tr></table><code>}</code></dt><dd><p>Create a type used when splitting a line which has the form key: value . * This type is used by Mpd.Utils.read_key_val.</p></dd></dl><dl><dt class="spec value" id="val-read_key_val"><a href="#val-read_key_val" class="anchor"></a><code><span class="keyword">val </span>read_key_val : string <span>&#45;&gt;</span> <a href="index.html#type-pair">pair</a></code></dt><dd><p>Split a line with the form &quot;k: v&quot; in the value of type pair</p></dd></dl><dl><dt class="spec value" id="val-values_of_pairs"><a href="#val-values_of_pairs" class="anchor"></a><code><span class="keyword">val </span>values_of_pairs : string list <span>&#45;&gt;</span> string list</code></dt><dd><p>Returns all the values of a list of strings that have the key/value form.</p></dd></dl><dl><dt class="spec value" id="val-bool_of_int_str"><a href="#val-bool_of_int_str" class="anchor"></a><code><span class="keyword">val </span>bool_of_int_str : string <span>&#45;&gt;</span> bool</code></dt><dd><p>Get a boolean value from a string number. The string &quot;0&quot; is false while all * other string is true.</p></dd></dl><dl><dt class="spec value" id="val-read_file_paths"><a href="#val-read_file_paths" class="anchor"></a><code><span class="keyword">val </span>read_file_paths : string <span>&#45;&gt;</span> string list</code></dt><dd><p>Get the file path from the ouput of the command &quot;listplaylist name&quot;</p></dd></dl><dl><dt class="spec value" id="val-read_list_playlists"><a href="#val-read_list_playlists" class="anchor"></a><code><span class="keyword">val </span>read_list_playlists : string <span>&#45;&gt;</span> string list</code></dt><dd><p>Get playlists list from output of the command &quot;listplaylists&quot;.</p></dd></dl><dl><dt class="spec exception" id="exception-EMusic_database"><a href="#exception-EMusic_database" class="anchor"></a><code><span class="keyword">exception </span></code><code><span class="exception">EMusic_database</span><span class="keyword"> of </span>string</code></dt></dl><dl><dt class="spec value" id="val-parse_count_response"><a href="#val-parse_count_response" class="anchor"></a><code><span class="keyword">val </span>parse_count_response : string <span>&#45;&gt;</span> string option <span>&#45;&gt;</span> (int<span class="keyword"> * </span>float<span class="keyword"> * </span>string) list</code></dt><dd><p>Get the count list from the Mpd count command.</p></dd></dl><dl><dt class="spec value" id="val-print_data"><a href="#val-print_data" class="anchor"></a><code><span class="keyword">val </span>print_data : string <span>&#45;&gt;</span> unit</code></dt><dt class="spec value" id="val-print_data_lwt"><a href="#val-print_data_lwt" class="anchor"></a><code><span class="keyword">val </span>print_data_lwt : string <span>&#45;&gt;</span> unit Lwt.t</code></dt></dl></div></body></html>