def _enclosure(post, lang):
 enclosure = post.meta(u'enclosure', lang)
 if enclosure:
  try:
   length = int((post.meta(u'enclosure_length', lang) or 0))
  except KeyError:
   length = 0
  except ValueError:
   utils.LOGGER.warn(u'Invalid enclosure length for post {0}'.format(post.source_path))
   length = 0
  url = enclosure
  mime = mimetypes.guess_type(url)[0]
  return (url, length, mime)

def _enclosure ( post , lang ) : enclosure = post . meta ( u'enclosure' , lang ) if enclosure : try : length = int ( ( post . meta ( u'enclosure_length' , lang ) or 0 ) ) except KeyError : length = 0 except ValueError : utils . LOGGER . warn ( u'Invalid enclosure length for post {0}' . format ( post . source_path ) ) length = 0 url = enclosure mime = mimetypes . guess_type ( url ) [ 0 ] return ( url , length , mime )
add an enclosure to rss .