Hi List.

I'm using liquidsoap 0.9.1 for automatic recordings with out.vorbis.file
in a small studio and since I generate the filenames within liquidsoap but
wanted to process the recorded file afterwards I searched for a method to
find out the filename out.vorbis.file was writing to.

I ended up patching liquidsoap for my needs.  And since it works quite
well I wanted to share my patch.  So here it is.

I'm happy for comments, questions etc.

Regards,

David
diff -ru liquidsoap-0.9.1.orig/src/outputs/file_output.ml 
liquidsoap-0.9.1/src/outputs/file_output.ml
--- liquidsoap-0.9.1.orig/src/outputs/file_output.ml    2009-06-22 
16:38:44.000000000 +0200
+++ liquidsoap-0.9.1/src/outputs/file_output.ml 2009-10-11 15:03:04.000000000 
+0200
@@ -32,6 +32,7 @@
   val mutable fd = None
   val mutable open_date = 0.
   val mutable current_metadata = fun _ -> raise Not_found
+  val mutable actual_file = "no.file"
 
   method set_metadata m = current_metadata <- m
 
@@ -51,6 +52,7 @@
       Utils.mkdir ~perm:dir_perm (Filename.dirname filename) ;
       open_out_gen mode perm filename
     in
+      actual_file <- filename ;
       set_binary_mode_out chan true ;
       open_date <- Unix.gettimeofday () ;
       fd <- Some chan
@@ -91,6 +93,9 @@
   method private on_reset_encoder =
     if reload_on_metadata then need_close <- true
 
+  method get_file =
+    actual_file
+
 end
 
 let proto = [
diff -ru liquidsoap-0.9.1.orig/src/outputs/output.ml 
liquidsoap-0.9.1/src/outputs/output.ml
--- liquidsoap-0.9.1.orig/src/outputs/output.ml 2009-06-22 16:38:44.000000000 
+0200
+++ liquidsoap-0.9.1/src/outputs/output.ml      2009-10-11 14:52:32.000000000 
+0200
@@ -50,6 +50,7 @@
   val mutable stop_output = false       (* Ask for termination *)
 
   method is_active = does_output
+  method get_file = "nofile"
 
   (* Operator startup *)
 
@@ -89,6 +90,8 @@
                ~descr:"Stop output."  ;
     Server.add ~ns "status" (fun _ -> if does_output then "on" else "off") 
                ~descr:"Get status.";
+    Server.add ~ns "file" (fun _ -> self#get_file)
+               ~descr:"Get filename.";
 
     (* Get our source ready *)
     source#get_ready ((self:>operator)::activation) ;
diff -ru liquidsoap-0.9.1.orig/src/outputs/output.mli 
liquidsoap-0.9.1/src/outputs/output.mli
--- liquidsoap-0.9.1.orig/src/outputs/output.mli        2009-06-22 
16:38:44.000000000 +0200
+++ liquidsoap-0.9.1/src/outputs/output.mli     2009-10-11 14:54:43.000000000 
+0200
@@ -35,6 +35,7 @@
   method output : unit
   method private get_frame : Frame.t -> unit
   method abort_track : unit
+  method get_file: string
 
   val mutable start_output : bool
   val mutable stop_output : bool
------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
Savonet-devl mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-devl

Répondre à