Package Peapod :: Module peapod :: Class peapodConf
[show private | hide private]
[frames | no frames]

Class peapodConf


Class to manage the configuration for peapod.  Handles command-line
arguments, configuration file options and hardcoded defaults.  Options may
be global or specific to a known feed.

The configuration file is stored as an xml file.  If one is not present, a
default can be created.

Use :

config = peapodConf()
print config.defaults["savepath"]
for feed in config.feedlist:
    print feed[""]
    print feed["url"]
    print feed["options"]["savepath"]

Method Summary
  __init__(self)
  create_default_config(self)
Creates a default configuration file in ~/.peapod/peapod.xml, which provides a sample podcast subscription.
  get_text(self, nodelist)
Extract text from the xml tags read in.
  parse_commandline(self)
Check for commandline arguments.
  process_options(self, element, opt)
Extract value from an option element.

Class Variable Summary
dict defaults = {'verbose': 0, 'ipodpath': '/media/ipod', 'te...
dict feedlist = {}
int parsed = 0                                                                     

Method Details

create_default_config(self)

Creates a default configuration file in ~/.peapod/peapod.xml, which provides a sample podcast subscription.

get_text(self, nodelist)

Extract text from the xml tags read in. Data type is not known at this point.

parse_commandline(self)

Check for commandline arguments. Uses getopt for argument processing long and short style options.

process_options(self, element, opt)

Extract value from an option element. Data type is assumed from the string content. Extracted values are inserted into opt as dictionary elements.

Class Variable Details

defaults

Type:
dict
Value:
{'addnew': 0,
 'bandwidth': 0,
 'bittorrent': 1,
 'catchup': 0,
 'copynew': 0,
 'dryrun': 0,
 'export': 0,
 'forgetnew': 0,
...                                                                    

feedlist

Type:
dict
Value:
{}                                                                     

parsed

Type:
int
Value:
0                                                                     

Generated by Epydoc 2.1 on Sun Aug 12 06:40:33 2007 http://epydoc.sf.net