On 2013-03-05 12:09, Chuck wrote: > I'm curious about using configuration files. Can someone tell me > how they are used? I'm writing a podcast catcher and would like > to set up some default configurations, e.g. directory, etc Other > than default directory, what are some of the things that are put in > a configuration file?
Just looking at my hpodder config file, you can have all sorts of things in here. You might have a root folder, but then each feed could be configured to a particular sub-folder. You might have a cache location you download to, and only move them to the final destination after they've downloaded completely. You might have some check more frequently than others. You might have it execute an external utility (such as id3v2) to transform various ID3 information based on information in the feed. If you're downloading in multiple threads, you might have specify the number of threads it can use. If you are using "curl" under the covers, you might limit the transfer-rate so it doesn't suck up your bandwidth. If you display anything, you might allow for suppressing the display, formatting that display, or controlling whether it uses color. If you track download errors, you might specify how many failures constitute a "don't bother retrying this item" or how many days/hours you need to wait until you actually retry. You can even have it act as your data-store for holding the URLs to the RSS feeds, perhaps a readable name (to override what's in the feed), along with formatting. So a more complex .ini might look something like [general] root=/home/chuck/Music/Podcasts cache=/tmp/podchuck threads=4 rate=50k color=auto [feed "http://feeds.5by5.tv/webahead"] display-name=The Web Ahead" location=%(root)s/WebAhead/$FILENAME transform=id3v2 -a "WebAhead" -t "$EPTITLE" "$FILENAME" [feed "http://www.radiolab.org/feeds/podcast"] location=/path/to/someplace/else/$FILENAME transform=id3v2 -a "Radio Lab" -t "$EPTITLE" "$FILENAME" -tkc -- http://mail.python.org/mailman/listinfo/python-list