def _get_metadata_from_filename_by_regex(filename, metadata_regexp, unslugify_titles, lang):
 match = re.match(metadata_regexp, filename)
 meta = {}
 if match:
  for (key, value) in match.groupdict().items():
   k = key.lower().strip()
   if ((k == u'title') and unslugify_titles):
    meta[k] = unslugify(value, lang, discard_numbers=False)
   else:
    meta[k] = value
 return meta

def _get_metadata_from_filename_by_regex ( filename , metadata_regexp , unslugify_titles , lang ) : match = re . match ( metadata_regexp , filename ) meta = { } if match : for ( key , value ) in match . groupdict ( ) . items ( ) : k = key . lower ( ) . strip ( ) if ( ( k == u'title' ) and unslugify_titles ) : meta [ k ] = unslugify ( value , lang , discard_numbers = False ) else : meta [ k ] = value return meta
try to reed the metadata from the filename based on the given re .