Channels

Parses channels.conf files

Author: Raphael Pinson rap.nosp@m.hink@gmai.nosp@m.l.com

Summary
ChannelsParses channels.conf files
ReferenceSee http://linuxtv.org/vdrwiki/index.php/Syntax_of_channels.conf
LicenseThis file is licenced under the LGPL v2+, like the rest of Augeas.
Lens UsageTo be documented
Configuration filesThis lens applies to channels.conf files.
ExamplesThe Test_Channels file contains various examples and tests.
USEFUL PRIMITIVES
eol
comment
equal
colon
comma
semicol
plus
arroba
no_colon
no_semicolon
FUNCTIONS
fieldA generic field
field_no_colonA field storing no_colon
field_intA field storing Rx.integer
field_wordA field storing Rx.word
ENTRIES
vpid
langs
apid
tpid
caid
entry
entry_or_comment
group
lns

License

This file is licenced under the LGPL v2+, like the rest of Augeas.

Lens Usage

To be documented

Configuration files

This lens applies to channels.conf files.

Examples

The Test_Channels file contains various examples and tests.

USEFUL PRIMITIVES

eol

let eol = Util.eol

comment

let comment = Util.comment_generic /;[ \t]*/ "; "

equal

let equal = Sep.equal

colon

let colon = Sep.colon

comma

let comma = Sep.comma

semicol

let semicol = Util.del_str ";"

plus

let plus = Util.del_str "+"

arroba

let arroba = Util.del_str "@"

no_colon

let no_colon = /[^: \t\n][^:\n]*[^: \t\n]|[^:\n]/

no_semicolon

let no_semicolon = /[^;\n]+/

FUNCTIONS

field

let field (name:string) (sto:regexp) = [ label name . store sto ]

A generic field

field_no_colon

let field_no_colon (name:string) = field name no_colon

A field storing no_colon

field_int

let field_int (name:string) = field name Rx.integer

A field storing Rx.integer

field_word

let field_word (name:string) = field name Rx.word

A field storing Rx.word

ENTRIES

vpid

let vpid = let codec = [ equal . label "codec" . store Rx.integer ] in let vpid_entry (lbl:string) = [ label lbl . store Rx.integer . codec? ] in vpid_entry "vpid" . ( plus . vpid_entry "vpid_pcr" )?

langs

let langs = let lang = [ label "lang" . store Rx.word ] in Build.opt_list lang plus

apid

let apid = let codec = [ arroba . label "codec" . store Rx.integer ] in let options = equal . ( (langs . codec?) | codec ) in let apid_entry (lbl:string) = [ label lbl . store Rx.integer . options? ] in Build.opt_list (apid_entry "apid") comma . ( semicol . Build.opt_list (apid_entry "apid_dolby") comma )?

tpid

let tpid = let tpid_bylang = [ label "tpid_bylang" . store Rx.integer . (equal . langs)? ] in field_int "tpid" . ( semicol . Build.opt_list tpid_bylang comma )?

caid

let caid = let caid_entry = [ label "caid" . store Rx.word ] in Build.opt_list caid_entry comma

entry

let entry = [ label "entry" . store no_semicolon . (semicol . field_no_colon "provider")? . colon . field_int "frequency" . colon . field_word "parameter" . colon . field_word "signal_source" . colon . field_int "symbol_rate" . colon . vpid . colon . apid . colon . tpid . colon . caid . colon . field_int "sid" . colon . field_int "nid" . colon . field_int "tid" . colon . field_int "rid" . eol ]

entry_or_comment

let entry_or_comment = entry | comment

group

let group = [ Util.del_str ":" . label "group" . store no_colon . eol . entry_or_comment* ]

lns

let lns = entry_or_comment* . group*
Provides unit tests and examples for the Channels lens.
let eol = Util.eol
let comment = Util.comment_generic /;[ \t]*/ "; "
let equal = Sep.equal
let colon = Sep.colon
let comma = Sep.comma
let semicol = Util.del_str ";"
let plus = Util.del_str "+"
let arroba = Util.del_str "@"
let no_colon = /[^: \t\n][^:\n]*[^: \t\n]|[^:\n]/
let no_semicolon = /[^;\n]+/
let field (name:string) (sto:regexp) = [ label name . store sto ]
A generic field
let field_no_colon (name:string) = field name no_colon
A field storing no_colon
let field_int (name:string) = field name Rx.integer
A field storing Rx.integer
let integer = /[0-9]+/
One or more digits
let field_word (name:string) = field name Rx.word
A field storing Rx.word
let word = /[A-Za-z0-9_.-]+/
An alphanumeric string
let vpid = let codec = [ equal . label "codec" . store Rx.integer ] in let vpid_entry (lbl:string) = [ label lbl . store Rx.integer . codec? ] in vpid_entry "vpid" . ( plus . vpid_entry "vpid_pcr" )?
let langs = let lang = [ label "lang" . store Rx.word ] in Build.opt_list lang plus
let apid = let codec = [ arroba . label "codec" . store Rx.integer ] in let options = equal . ( (langs . codec?) | codec ) in let apid_entry (lbl:string) = [ label lbl . store Rx.integer . options? ] in Build.opt_list (apid_entry "apid") comma . ( semicol . Build.opt_list (apid_entry "apid_dolby") comma )?
let tpid = let tpid_bylang = [ label "tpid_bylang" . store Rx.integer . (equal . langs)? ] in field_int "tpid" . ( semicol . Build.opt_list tpid_bylang comma )?
let caid = let caid_entry = [ label "caid" . store Rx.word ] in Build.opt_list caid_entry comma
let entry = [ label "entry" . store no_semicolon . (semicol . field_no_colon "provider")? . colon . field_int "frequency" . colon . field_word "parameter" . colon . field_word "signal_source" . colon . field_int "symbol_rate" . colon . vpid . colon . apid . colon . tpid . colon . caid . colon . field_int "sid" . colon . field_int "nid" . colon . field_int "tid" . colon . field_int "rid" . eol ]
let entry_or_comment = entry | comment
let group = [ Util.del_str ":" . label "group" . store no_colon . eol . entry_or_comment* ]
let lns = entry_or_comment* . group*
Close