<commit_before>open Printf ;;
open Sdl ;;
open Sdlcdrom ;;

(* init the SDL library *)
init [`CDROM];; (*  init_with_auto_clean();; *)

(* Get the number of cdrom drives *)
let numbers_of_drives = get_num_drives ();;

printf "Drives available: %d\n" numbers_of_drives ;;

for id = 0 to (numbers_of_drives - 1 ) do

  printf "Drive %d:  \"%s\"\n" id (drive_name id);
  let cdrom = cd_open id
  in  
  let cdrom_state = cd_status cdrom
  in 
  let flag_track = ref 0
  in let s = 
      match cdrom_state with 
	  CD_TRAYEMPTY -> 
	    "tray empty" 
	| CD_STOPPED -> 
	    "stopped"
	| CD_PLAYING -> 
	    flag_track := 1 ;
	    "playing"
	| CD_PAUSED -> 
	    flag_track := 1 ;
	    "paused"
	| _ -> 
	    "error state" 
  in
      printf "Drive %d status: %s\n" id s ;
    if (!flag_track == 1) 
    then
      let current_track = (cd_current_track cdrom)
      and (m,s) = (cd_track_current_time cdrom)
      in
	printf "Currently playing track %d, %2d:%2d\n" 
	  (track_get_number current_track) m s;
    cd_close cdrom 
done 
<commit_msg>CHANGE: cdrom API (introduced cdrom_info type)<commit_after>open Printf ;;
open Sdl ;;
open Sdlcdrom ;;

(* init the SDL library *)
let _ =
  init ~auto_clean:true [`CDROM];; 

(* Get the number of cdrom drives *)
let numbers_of_drives = get_num_drives ();;

let _ =
  printf "Drives available: %d\n" numbers_of_drives ;

  for id = 0 to (numbers_of_drives - 1 ) do

    printf "Drive %d:  \"%s\"\n" id (drive_name id);
    let cdrom = cd_open id in  
    let cdrom_state = cd_status cdrom in 
    let flag_track = ref 0 in 
    let s = 
      match cdrom_state with 
	CD_TRAYEMPTY -> 
	  "tray empty" 
      | CD_STOPPED -> 
	  "stopped"
      | CD_PLAYING -> 
	  flag_track := 1 ;
	  "playing"
      | CD_PAUSED -> 
	  flag_track := 1 ;
	  "paused"
    in
    printf "Drive %d status: %s\n" id s ;
    if !flag_track = 1
    then
      let info = cd_info cdrom in
      let (m, s, _) = msf_of_frames info.curr_frame in
      printf "Currently playing track %d, %2d:%2d\n" 
	info.curr_track m s ;
      cd_close cdrom 
  done 
{'fraction_non_alphanumeric': 0.11460348162475822, 'fraction_numerical': 0.007736943907156673, 'mean_word_length': 2.530716723549488, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5247956', 'n_tokens_mistral': 867, 'n_tokens_neox': 780, 'n_words': 226}