def parse_header(self):
        self.f.seek(0)
        data = self.f.read(ID3V2_FILE_HEADER_LENGTH)
        if len(data) != ID3V2_FILE_HEADER_LENGTH:
            raise ID3HeaderInvalidException("ID3 tag header is incomplete")
        
        self.tag = {}
        self.frames = []
        id3, ver, flags, rawsize = struct.unpack("!3sHB4s", data)
        
        if id3 != "ID3":
            raise ID3HeaderInvalidException("ID3v2 header not found")

        self.tag["size"] = unsyncsafe(rawsize)
        # NOTE: size  = excluding header + footer
        version = '2.%d' % (ver >> 8)
        if version not in self.supported:
            raise ID3NotImplementedException("version %s not supported" % \
                                             version)
        else:
            self.version = version
            
        if self.version in ('2.4', '2.3'):
            for flagname, bit in ID3V2_3_TAG_HEADER_FLAGS:
                self.tag[flagname] = (flags >> bit) & 0x01
        elif self.version == '2.2':
            for flagname, bit in ID3V2_2_TAG_HEADER_FLAGS:
                self.tag[flagname] = (flags >> bit) & 0x01

        if self.tag.has_key("ext") and self.tag["ext"]:
            self.parse_ext_header()
    
        debug(self.tag)
        
    # ---------------------------------------------------------
Serialize the dictionary, and write it to C{self._destinations}.
dataset/ETHPy150Open Ciantic/pytagger/tagger/id3v2.py/ID3v2.parse_header--crossover with--dataset/ETHPy150Open ClusterHQ/eliot/eliot/_output.py/Logger.write