File: dump.ml

package info (click to toggle)
ocaml-metadata 0.3.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 592 kB
  • sloc: ml: 1,770; makefile: 31; sh: 5
file content (24 lines) | stat: -rw-r--r-- 679 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
let () =
  let fname = ref "" in
  let format = ref "id3v2" in
  let outfile = ref None in
  Arg.parse
    [
      ("-f", Arg.Set_string format, "File format.");
      ( "-o",
        Arg.String (fun s -> outfile := Some s),
        "Output file (default is standard output)." );
    ]
    (fun f -> fname := f)
    "dump [options] file";
  let dump =
    match !format with
      | "id3v2" -> Metadata.ID3v2.dump_file
      | _ -> failwith "Unknown format."
  in
  let fname = !fname in
  if fname = "" then (
    Printf.eprintf "Please enter a filename.\n%!";
    exit 1);
  let oc = match !outfile with Some f -> open_out f | None -> stdout in
  output_string oc (dump fname)