class ID3_ALBUM_PICTURE

(source code)

Description

Id3 album picture

note
	description: "Id3 album picture"

	author: "Finnian Reilly"
	copyright: "Copyright (c) 2001-2022 Finnian Reilly"
	contact: "finnian at eiffel hyphen loop dot com"

	license: "MIT license (See: en.wikipedia.org/wiki/MIT_License)"
	date: "2022-11-15 19:56:05 GMT (Tuesday 15th November 2022)"
	revision: "12"

class
	ID3_ALBUM_PICTURE

inherit
	ANY
		redefine
			default_create
		end

	EL_MODULE_CHECKSUM
		rename
			checksum as Mod_checksum
		end

	EL_MODULE_FILE

create
	default_create, make, make_from_file

feature {NONE} -- Initialization

	default_create
		do
			create data.make (0)
			create description.make_empty
			mime_type := "image/jpeg"
		end

	make (a_data: like data; a_description, a_mime_type: STRING)
		do
			data := a_data; description := a_description; mime_type := a_mime_type
			checksum := Mod_checksum.data (data)
		end

	make_from_file (a_file_path: FILE_PATH; a_description: like description)
		do
			mime_type := a_file_path.extension.as_lower
			if mime_type.is_equal ("jpg") then
				mime_type := "jpeg"
			end
			mime_type.prepend_string_general ("image/")
			make (File.data (a_file_path), a_description, mime_type)
		end

feature -- Access

	data: MANAGED_POINTER

	description: ZSTRING

	checksum: NATURAL

	mime_type: STRING

feature -- Element change

	set_description (a_description: like description)
		do
			description := a_description
		end

end