["http://slashdot.org/slashdot.rdf", 20*60], 
                    ["http://www.heise.de/newsticker/heise.rdf", 25*60], 
                    ["http://xmlhack.com/rss10.php", 30*60], 
                    ["http://freshmeat.net/backend/fm.rdf", 35*60]]
    else:
        data_dir = "file://" + System.getProperty("user.dir") + "/data/"
        chl_urls = [[data_dir + "linuxjournal.rss", 1*60], 
                    [data_dir + "salon_use.rdf", 2*60], 
                    [data_dir + "heise.rdf", 3*60], 
                    [data_dir + "slashdot.rdf", 4*60], 
                    [data_dir + "xmlhack-1.0.xml", 5*60]]

    # create channel registry
    builder = ChannelBuilder()
    reg = ChannelRegistry(builder)
        
    # add channels to registry and populate news items
    observer = SimpleChannelObserver()
    for chl_url in chl_urls:
        c = reg.addChannel(URL(chl_url[0]), chl_url[1], 1)
        c.addObserver(observer)

    # finally show the whole thing
    main_frame = MainFrame(reg.getChannels())
    main_frame.pack()
    main_frame.setVisible(1)
    
    # autosave task
    t = AutosaveThread(reg)
    t.start()
from java.lang import Thread
from java.net import URL
from java.util import Date
from de.nava.informa.impl.basic import ChannelBuilder
from de.nava.informa.utils import ChannelRegistry

builder = ChannelBuilder()
reg = ChannelRegistry(builder)

# url_xmlhack = "http://xmlhack.com/rss10.php"
# url_xmlhack = URL("http://localhost/rss/xmlhack-1.0.xml")
url_xmlhack = URL("http://localhost/rss/xmlhack-0.91.xml")
# update channel which should be updated every 30 seconds
reg.addChannel(url_xmlhack, 30, 1)
print "first time parsed in at ", Date()
for channel in reg.getChannels():
    print "channel:", channel
    for item in channel.getItems():
        print "  -", item

# sleep 100 seconds
Thread.currentThread().sleep(100 * 1000)

print "--- after updating"
for channel in reg.getChannels():
    print "channel:", channel
    for item in channel.getItems():
        print "  -", item

# offically deregister
# reg.removeChannel(channel)
# create channel registry
builder = ChannelBuilder()
reg = ChannelRegistry(builder)

# register channels (which should be updated every 15-35 minutes)
c = {}
c[1] = reg.addChannel(URL("http://www.newsforge.com/newsforge.rss"), 15 * 60,
                      1)
c[2] = reg.addChannel(URL("http://slashdot.org/slashdot.rdf"), 20 * 60, 1)
c[3] = reg.addChannel(URL("http://www.heise.de/newsticker/heise.rdf"), 25 * 60,
                      1)
c[4] = reg.addChannel(URL("http://xmlhack.com/rss10.php"), 30 * 60, 1)
c[5] = reg.addChannel(URL("http://freshmeat.net/backend/fm.rdf"), 35 * 60, 1)

# create a simple observer which watches out for new items
o = SimpleChannelObserver()
for idx in c.keys():
    c[idx].addObserver(o)

# sleep 4 hours (let the updating threads work)
Thread.currentThread().sleep(4 * 60 * 60 * 1000)

# the end.
print "--- finished observing"
for channel in reg.getChannels():
    print
    print "channel:", channel
    for item in channel.getItems():
        print "  -", item
                    ["http://slashdot.org/slashdot.rdf", 20 * 60],
                    ["http://www.heise.de/newsticker/heise.rdf", 25 * 60],
                    ["http://xmlhack.com/rss10.php", 30 * 60],
                    ["http://freshmeat.net/backend/fm.rdf", 35 * 60]]
    else:
        data_dir = "file://" + System.getProperty("user.dir") + "/data/"
        chl_urls = [[data_dir + "linuxjournal.rss", 1 * 60],
                    [data_dir + "salon_use.rdf", 2 * 60],
                    [data_dir + "heise.rdf", 3 * 60],
                    [data_dir + "slashdot.rdf", 4 * 60],
                    [data_dir + "xmlhack-1.0.xml", 5 * 60]]

    # create channel registry
    builder = ChannelBuilder()
    reg = ChannelRegistry(builder)

    # add channels to registry and populate news items
    observer = SimpleChannelObserver()
    for chl_url in chl_urls:
        c = reg.addChannel(URL(chl_url[0]), chl_url[1], 1)
        c.addObserver(observer)

    # finally show the whole thing
    main_frame = MainFrame(reg.getChannels())
    main_frame.pack()
    main_frame.setVisible(1)

    # autosave task
    t = AutosaveThread(reg)
    t.start()