Example #1
0
        def extract_track_data(file_path):
            """Returns the actual MP3 data from a file, without tags

            Args:
                file_path: string path to the music file.

            Returns:
                A byte array of the track MP3 data
            """
            with open(file_path, "rb") as f:
                v1_tag_size = ID3v1.calculate_tag_size(f)
                v2_tag_size = ID3v2.calculate_tag_size(f)
                track_data = f.read()
                if v2_tag_size > 0:
                    track_data = track_data[v1_tag_size:-v2_tag_size]
                else:
                    track_data = track_data[v1_tag_size:]
                return track_data