• R/O
  • HTTP
  • SSH
  • HTTPS

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

news4 - RSS aggrigation system


File Info

Rev. 35706daeb11067ffac8035502714bda9c6752ef0
크기 579 bytes
Time 2013-04-26 04:09:15
Author hylom
Log Message

fix: crash when RSS item is invalid

Content

#!/usr/bin/python

from config import config as config, target_rss as target_rss
import ConfigParser
import sys

def main():
    config = ConfigParser.SafeConfigParser()
    for item in target_rss:
        config.add_section(item["name"])
        config.set(item["name"], 'source', item["url"])
        config.set(item["name"], 'url', item["source_url"])
        if 'filter' in item:
            filters = ",".join(item["filter"])
            config.set(item["name"], 'filters', filters)
    config.write(sys.stdout)

if __name__ == '__main__':
    main()