Packages

An early stage - use at your own risk - module designed to make it easy to grab metadata from both id3v1 and id3v2 mp3s.

Current section

Files

Jump to
musical_elements lib id3v2_parser.ex
Raw

lib/id3v2_parser.ex

defmodule MusicalElements.ID3V2Parser do
def extract_id3_v2(file_path) do
read_file = File.read!(file_path)
tag_frames = ID3v2.frames(read_file)
parse_id3_v2(tag_frames)
end
def parse_id3_v2(tag_frames) do
# album_cover returns an album cover if there is one
%{
title: tag_frames["TIT2"],
artist: tag_frames["TPE1"],
album: tag_frames["TALB"],
album_cover: tag_frames["APIC"]
}
end
end