"""Warns about large files"""

def handle_url(bot, user, channel, url, msg):

    if channel == "#wow": return

    # inform about large files (over 5MB)
    size = getUrl(url).getSize()
    contentType = getUrl(url).getHeaders()['content-type']
    if not size: return
    
    size = size / 1024
    
    if size > 5:
        bot.say(channel, "File size: %s MB - Content-Type: %s" % (size, contentType))

"""Warns about large files"""

def handle_url(bot, user, channel, url, msg):

    if channel == "#wow": return

    # inform about large files (over 5MB)
    size = getUrl(url).getSize()
    headers = getUrl(url).getHeaders()['content-type']
    if 'content-type' in headers:
        contentType = headers['content-type']
    else:
        contentType = "Unknown"
    if not size: return
    
    size = size / 1024
    
    if size > 5:
        bot.say(channel, "File size: %s MB - Content-Type: %s" % (size, contentType))

Handle cases where the server doesn't return content-type
Handle cases where the server doesn't return content-type


git-svn-id: 056f9092885898c4775d98c479d2d33d00273e45@120 dda364a1-ef19-0410-af65-756c83048fb2
