'Parse movie name. Populates name, year, quality and proper_count attributes'

def parse(self, data=None):

    self.reset()
    if (data is None):
        data = self.data
    data = re.sub(u'^\\[(.*?)\\](.*)', u'\\2    \\1', data)
    for char in u'[]()_,.':
        data = data.replace(char, u'    ')
    if (data.find(u'    ') == (-1)):
        data = data.replace(u'-', u'    ')
    self.remove_words(data, self.remove)
    data = self.strip_spaces(data)
    parts = data.split(u'    ')
    cut_part = 256
    all_caps = True
    for (part_pos, part) in enumerate(parts):
        cut = False
        if (part_pos < 1):
            continue
        num = str_to_int(part)
        if (num is not None):
            if (1930 < num <= datetime.now().year):
                if (self.year_pos == cut_part):
                    cut_part = part_pos
                self.year = num
                self.year_pos = part_pos
                cut = True
        if (not part.isupper()):
            all_caps = False
        if ((len(part) > 3) and part.isupper() and part.isalpha() and (not all_caps)):
            cut = True
        if (part.lower() in self.cutoffs):
            cut = True
        if (part.lower() in self.propers):
            if ((part.lower() not in [u'real', u'final']) or self.year):
                self.proper_count += 1
                cut = True
        if (cut and (parts.index(part) < cut_part)):
            cut_part = part_pos
    if (cut_part != 256):
        log.debug(u'parts:    %s,    cut    is:    %s', parts, parts[cut_part])
    abs_cut = len(u'    '.join(parts[:cut_part]))
    log.debug(u'after    parts    check,    cut    data    would    be:    `%s`    abs_cut:    %i', data[:abs_cut], abs_cut)
    quality = qualities.Quality(data)
    if quality:
        self.quality = quality
        dp = diff_pos(data, quality.clean_text)
        if (dp is not None):
            log.debug(u'quality    start:    %s', dp)
            if (dp < abs_cut):
                log.debug(u'quality    cut    is    even    shorter')
                abs_cut = dp
    data = data[:abs_cut].strip()
    log.debug(u'data    cut    to    `%s`    -    this    will    be    the    name', data)
    self.name = data
