Changeset 7145

Show
Ignore:
Timestamp:
02/09/10 00:03:29 (7 months ago)
Author:
dbaelde
Message:

Two more builtins for manipulating sources: is_ready and remaining.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/liquidsoap/src/lang/lang_builtins.ml

    r7110 r7145  
    11161116 
    11171117let () = 
     1118  add_builtin "source.is_ready" ~cat:Liq 
     1119    ~descr:"Indicate if a source is ready to stream, or currently streaming." 
     1120    [ "", Lang.source_t (Lang.univ_t 1), None, None ] Lang.bool_t 
     1121    (fun p -> Lang.bool (Lang.to_source (List.assoc "" p))#is_ready) 
     1122 
     1123let () = 
     1124  add_builtin "source.remaining" ~cat:Liq 
     1125    ~descr:"Estimation of remaining time in the current track." 
     1126    [ "", Lang.source_t (Lang.univ_t 1), None, None ] Lang.float_t 
     1127    (fun p -> 
     1128       let r = (Lang.to_source (List.assoc "" p))#remaining in 
     1129       let f = if r = -1 then infinity else Frame.seconds_of_master r in 
     1130         Lang.float f) 
     1131 
     1132let () = 
    11181133  add_builtin "request.create.raw" ~cat:Liq 
    11191134    ~descr:"Create a raw request, i.e. for files that should not be decoded \