File: connect.ml

package info (click to toggle)
ocaml-cry 1.0.3-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 188 kB
  • sloc: ml: 838; ansic: 106; makefile: 7
file content (26 lines) | stat: -rw-r--r-- 674 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
open Cry

let c = create ()

let connection =
  let mount = Icecast_mount "" in
  let content_type = mpeg in
  let channels = 2 in
  let samplerate = 44100 in
  let bitrate = 128 in
  let protocol = Http Put in
  let audio_info = audio_info ~channels ~samplerate ~bitrate () in
  {
    (connection ~audio_info ~protocol ~mount ~content_type ()) with
    port = 8443;
  }

let () =
  try
    connect c connection;
    if get_icy_cap c then Printf.printf "Icy enabled !\n%!";
    let meta = Hashtbl.create 10 in
    Hashtbl.add meta "artist" "test";
    Hashtbl.add meta "title" "test";
    update_metadata c meta
  with e -> Printf.printf "Error: %s\n%!" (string_of_error e)