def isMediaFile(filename):
 if re.search(u'(^|[\\W_])(?<!shomin.)(sample\\d*)[\\W_]', filename, re.I):
  return False
 if re.search(u'^RARBG\\.(\\w+\\.)?(mp4|avi|txt)$', filename, re.I):
  return False
 if filename.startswith(u'._'):
  return False
 sepFile = filename.rpartition(u'.')
 if re.search(u'extras?$', sepFile[0], re.I):
  return False
 if (sepFile[2].lower() in mediaExtensions):
  return True
 else:
  return False

def isMediaFile ( filename ) : if re . search ( u'(^|[\\W_])(?<!shomin.)(sample\\d*)[\\W_]' , filename , re . I ) : return False if re . search ( u'^RARBG\\.(\\w+\\.)?(mp4|avi|txt)$' , filename , re . I ) : return False if filename . startswith ( u'._' ) : return False sepFile = filename . rpartition ( u'.' ) if re . search ( u'extras?$' , sepFile [ 0 ] , re . I ) : return False if ( sepFile [ 2 ] . lower ( ) in mediaExtensions ) : return True else : return False
check if named file may contain media .