~jack/msrss

1b76c0d99d0967369cf07e5e7c99f34c29c03821 — Jack Kelly 8 years ago 80e7990
Simplify conditionals.
1 files changed, 16 insertions(+), 13 deletions(-)

M msrss.in
M msrss.in => msrss.in +16 -13
@@ 236,26 236,29 @@ if __name__ == '__main__':
    items = merge_items(feeds)

    description = args.description
    if description is None and len(feeds) == 1:
        description = feeds[0].feed.get('description')
    if description is None:
        urls = list(args.feeds)
        if args.labelled_feeds is not None:
            urls.extend( url for _, url in args.labelled_feeds )
        urls.sort()
        description = 'Feed generated from: [' + ', '.join(urls) + ']'
        if len(feeds) == 1:
            description = feeds[0].feed.get('description')
        else:
            urls = list(args.feeds)
            if args.labelled_feeds is not None:
                urls.extend( url for _, url in args.labelled_feeds )
            urls.sort()
            description = 'Feed generated from: [' + ', '.join(urls) + ']'

    link = args.link
    if link is None and len(feeds) == 1:
        link = feeds[0].feed.get('link')
    if link is None:
        link = 'http://www.example.com'
        if len(feeds) == 1:
            link = feeds[0].feed.get('link')
        else:
            link = 'http://www.example.com'

    title = args.title
    if title is None and len(feeds) == 1:
        title = feeds[0].feed.get('title')
    if title is None:
        title = 'Unitled Feed'
        if len(feeds) == 1:
            title = feeds[0].feed.get('title')
        else:
            title = 'Unitled Feed'

    pubdate = rfc2822(max([time.gmtime(0)]
                          + [ feed.updated_parsed for feed in feeds ]))