'Convert older tags into an ID3v2.4 tag.
This updates old ID3v2 frames to ID3v2.4 ones (e.g. TYER to
TDRC). If you intend to save tags, you must call this function
at some point; it is called by default when loading the tag.'

def update_to_v24(self):

    self.__update_common()
    try:
        date = text_type(self.get('TYER', ''))
        if date.strip(u'\x00'):
            self.pop('TYER')
            dat = text_type(self.get('TDAT', ''))
            if dat.strip('\x00'):
                self.pop('TDAT')
                date = ('%s-%s-%s' % (date, dat[2:], dat[:2]))
                time = text_type(self.get('TIME', ''))
                if time.strip('\x00'):
                    self.pop('TIME')
                    date += ('T%s:%s:00' % (time[:2], time[2:]))
            if ('TDRC' not in self):
                self.add(TDRC(encoding=0, text=date))
    except UnicodeDecodeError:
        pass
    if ('TORY' in self):
        f = self.pop('TORY')
        if ('TDOR' not in self):
            try:
                self.add(TDOR(encoding=0, text=str(f)))
            except UnicodeDecodeError:
                pass
    if ('IPLS' in self):
        f = self.pop('IPLS')
        if ('TIPL' not in self):
            self.add(TIPL(encoding=f.encoding, people=f.people))
    for key in ['RVAD', 'EQUA', 'TRDA', 'TSIZ', 'TDAT', 'TIME']:
        if (key in self):
            del self[key]
    for f in self.getall('CHAP'):
        f.sub_frames.update_to_v24()
    for f in self.getall('CTOC'):
        f.sub_frames.update_to_v24()
