Esempio n. 1
0
def del_channel( url):
    url=util.normalize_feed_url( url)

    channels=load_channels( load_items=False)
    keep_channels=[]
    for channel in channels:
        if channel.url == url:
            msg( 'delete', urllib.unquote( channel.url))
        else:
            keep_channels.append( channel)

    if len(keep_channels) < len(channels):
        save_channels( keep_channels)
    else:
        msg('error', _('Could not remove podcast.'))
Esempio n. 2
0
def add_channel( url):
    callback_error=lambda s: msg( 'error', s)

    url=util.normalize_feed_url( url)
    try:
        channel=podcastChannel.get_by_url( url, force_update=True)
        podcastChannel.sync_cache()
    except:
        msg( 'error', _('Could not load feed from URL: %s'), urllib.unquote( url))
        return

    if channel:
        channels=load_channels( load_items=False)
        if channel.url in ( c.url for c in channels ):
            msg( 'error', _('Already added: %s'), urllib.unquote( url))
            return
        channels.append( channel)
        save_channels( channels)
        msg( 'add', urllib.unquote( url))
    else:
        msg('error', _('Could not add podcast.'))