Package ewa :: Module rules
[show private | hide private]
[frames | no frames]

Module ewa.rules

a rule system for ewa, used to determine what files should appear before or after a main mp3 file in a composite mp3.

Rules are callables that take a single "filename" parameter and return None or a generator that yields mp3 filenames (or equivalent designations) in sequence.

A RuleList is a rule with a list of subrules, optionally with a condition (matched against the filename). When the RuleList is called, if the condition does not exist, or if it matches, each subrule is called on the filename until one returns something, which is the return value.

Rules can be marshalled to and from JSON, and from (but currently not to) the ewa rule configuration format implemented in ewa.ruleparser.
Classes
And  
CurrentTimeMatch returns true if the current time falls within a datetime range
DefaultRule this may be useful as the last rule in a rule-list; it yields the filename passed and nothing else
FileRule  
FileTimeMatch returns true if a date encoded in a string falls within a date range
GlobMatcher  
MatchRule  
Not  
Or  
RegexMatcher  
RuleList  
_jsonable  
_template  
OriginalName  

Function Summary
  extract_datetime(target, regex, format)
  from_json(json)
  GlobMatchRule(pattern, pre, post, casesensitive)
  RegexRule(pattern, pre, post, flags)
  to_json(data)
  _parse_ewaconf(filename)
  from_jsondata(data)
  to_jsondata(obj)

Variable Summary
dict _json_registry = {'And': <class 'ewa.rules.And'>, 'Match...

Variable Details

_json_registry

Type:
dict
Value:
{'And': <class 'ewa.rules.And'>,
 'CurrentTimeMatch': <class 'ewa.rules.CurrentTimeMatch'>,
 'DefaultRule': <class 'ewa.rules.DefaultRule'>,
 'FileTimeMatch': <class 'ewa.rules.FileTimeMatch'>,
 'GlobMatcher': <class 'ewa.rules.GlobMatcher'>,
 'MatchRule': <class 'ewa.rules.MatchRule'>,
 'Not': <class 'ewa.rules.Not'>,
 'Or': <class 'ewa.rules.Or'>,
...                                                                    

Generated by Epydoc 2.1 on Wed Jan 3 10:13:56 2007 http://epydoc.sf.net