Method: TagLib::File#initialize

Defined in:
lib/taglib.rb,
lib/catori/taglib.rb

#initialize(p) ⇒ File

Returns a new instance of File.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
# File 'lib/taglib.rb', line 83

def initialize(p)
	@path = p
	if not @path
		raise BadPath.new
	end

	mahoro = Mahoro.new
	mahoro.flags = Mahoro::NONE
	mime = mahoro.file(@path)
	type = taglibForMime(mime)

	if type
		@file = TagLib.taglib_file_new_type(@path, type)
	else
		@file = TagLib.taglib_file_new(@path)
	end

	if not @file
		@path = nil
		raise BadFile.new
	end
end