|
Packit Service |
a2ae7a |
(*
|
|
Packit Service |
a2ae7a |
Module: Channels
|
|
Packit Service |
a2ae7a |
Parses channels.conf files
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
Author: Raphael Pinson <raphink@gmail.com>
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Reference
|
|
Packit Service |
a2ae7a |
See http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: License
|
|
Packit Service |
a2ae7a |
This file is licenced under the LGPL v2+, like the rest of Augeas.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Lens Usage
|
|
Packit Service |
a2ae7a |
To be documented
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Configuration files
|
|
Packit Service |
a2ae7a |
This lens applies to channels.conf files.
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
About: Examples
|
|
Packit Service |
a2ae7a |
The <Test_Channels> file contains various examples and tests.
|
|
Packit Service |
a2ae7a |
*)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
module Channels =
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: USEFUL PRIMITIVES
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: eol *)
|
|
Packit Service |
a2ae7a |
let eol = Util.eol
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: comment *)
|
|
Packit Service |
a2ae7a |
let comment = Util.comment_generic /;[ \t]*/ "; "
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: equal *)
|
|
Packit Service |
a2ae7a |
let equal = Sep.equal
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: colon *)
|
|
Packit Service |
a2ae7a |
let colon = Sep.colon
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: comma *)
|
|
Packit Service |
a2ae7a |
let comma = Sep.comma
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: semicol *)
|
|
Packit Service |
a2ae7a |
let semicol = Util.del_str ";"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: plus *)
|
|
Packit Service |
a2ae7a |
let plus = Util.del_str "+"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: arroba *)
|
|
Packit Service |
a2ae7a |
let arroba = Util.del_str "@"
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: no_colon *)
|
|
Packit Service |
a2ae7a |
let no_colon = /[^: \t\n][^:\n]*[^: \t\n]|[^:\n]/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: no_semicolon *)
|
|
Packit Service |
a2ae7a |
let no_semicolon = /[^;\n]+/
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: FUNCTIONS
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: field
|
|
Packit Service |
a2ae7a |
A generic field *)
|
|
Packit Service |
a2ae7a |
let field (name:string) (sto:regexp) = [ label name . store sto ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: field_no_colon
|
|
Packit Service |
a2ae7a |
A <field> storing <no_colon> *)
|
|
Packit Service |
a2ae7a |
let field_no_colon (name:string) = field name no_colon
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: field_int
|
|
Packit Service |
a2ae7a |
A <field> storing <Rx.integer> *)
|
|
Packit Service |
a2ae7a |
let field_int (name:string) = field name Rx.integer
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: field_word
|
|
Packit Service |
a2ae7a |
A <field> storing <Rx.word> *)
|
|
Packit Service |
a2ae7a |
let field_word (name:string) = field name Rx.word
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(************************************************************************
|
|
Packit Service |
a2ae7a |
* Group: ENTRIES
|
|
Packit Service |
a2ae7a |
*************************************************************************)
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: vpid *)
|
|
Packit Service |
a2ae7a |
let vpid =
|
|
Packit Service |
a2ae7a |
let codec =
|
|
Packit Service |
a2ae7a |
[ equal . label "codec" . store Rx.integer ]
|
|
Packit Service |
a2ae7a |
in let vpid_entry (lbl:string) =
|
|
Packit Service |
a2ae7a |
[ label lbl . store Rx.integer . codec? ]
|
|
Packit Service |
a2ae7a |
in vpid_entry "vpid"
|
|
Packit Service |
a2ae7a |
. ( plus . vpid_entry "vpid_pcr" )?
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: langs *)
|
|
Packit Service |
a2ae7a |
let langs =
|
|
Packit Service |
a2ae7a |
let lang =
|
|
Packit Service |
a2ae7a |
[ label "lang" . store Rx.word ]
|
|
Packit Service |
a2ae7a |
in Build.opt_list lang plus
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: apid *)
|
|
Packit Service |
a2ae7a |
let apid =
|
|
Packit Service |
a2ae7a |
let codec =
|
|
Packit Service |
a2ae7a |
[ arroba . label "codec" . store Rx.integer ]
|
|
Packit Service |
a2ae7a |
in let options =
|
|
Packit Service |
a2ae7a |
equal . ( (langs . codec?) | codec )
|
|
Packit Service |
a2ae7a |
in let apid_entry (lbl:string) =
|
|
Packit Service |
a2ae7a |
[ label lbl . store Rx.integer . options? ]
|
|
Packit Service |
a2ae7a |
in Build.opt_list (apid_entry "apid") comma
|
|
Packit Service |
a2ae7a |
. ( semicol
|
|
Packit Service |
a2ae7a |
. Build.opt_list (apid_entry "apid_dolby") comma )?
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: tpid *)
|
|
Packit Service |
a2ae7a |
let tpid =
|
|
Packit Service |
a2ae7a |
let tpid_bylang =
|
|
Packit Service |
a2ae7a |
[ label "tpid_bylang" . store Rx.integer
|
|
Packit Service |
a2ae7a |
. (equal . langs)? ]
|
|
Packit Service |
a2ae7a |
in field_int "tpid"
|
|
Packit Service |
a2ae7a |
. ( semicol . Build.opt_list tpid_bylang comma )?
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: caid *)
|
|
Packit Service |
a2ae7a |
let caid =
|
|
Packit Service |
a2ae7a |
let caid_entry =
|
|
Packit Service |
a2ae7a |
[ label "caid" . store Rx.word ]
|
|
Packit Service |
a2ae7a |
in Build.opt_list caid_entry comma
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry *)
|
|
Packit Service |
a2ae7a |
let entry = [ label "entry" . store no_semicolon
|
|
Packit Service |
a2ae7a |
. (semicol . field_no_colon "provider")? . colon
|
|
Packit Service |
a2ae7a |
. field_int "frequency" . colon
|
|
Packit Service |
a2ae7a |
. field_word "parameter" . colon
|
|
Packit Service |
a2ae7a |
. field_word "signal_source" . colon
|
|
Packit Service |
a2ae7a |
. field_int "symbol_rate" . colon
|
|
Packit Service |
a2ae7a |
. vpid . colon
|
|
Packit Service |
a2ae7a |
. apid . colon
|
|
Packit Service |
a2ae7a |
. tpid . colon
|
|
Packit Service |
a2ae7a |
. caid . colon
|
|
Packit Service |
a2ae7a |
. field_int "sid" . colon
|
|
Packit Service |
a2ae7a |
. field_int "nid" . colon
|
|
Packit Service |
a2ae7a |
. field_int "tid" . colon
|
|
Packit Service |
a2ae7a |
. field_int "rid" . eol ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: entry_or_comment *)
|
|
Packit Service |
a2ae7a |
let entry_or_comment = entry | comment
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: group *)
|
|
Packit Service |
a2ae7a |
let group =
|
|
Packit Service |
a2ae7a |
[ Util.del_str ":" . label "group"
|
|
Packit Service |
a2ae7a |
. store no_colon . eol
|
|
Packit Service |
a2ae7a |
. entry_or_comment* ]
|
|
Packit Service |
a2ae7a |
|
|
Packit Service |
a2ae7a |
(* View: lns *)
|
|
Packit Service |
a2ae7a |
let lns = entry_or_comment* . group*
|