Class: TagLib::File
- Inherits:
-
Object
- Object
- TagLib::File
- Defined in:
- lib/taglib.rb,
lib/catori/taglib.rb
Instance Method Summary collapse
- #album ⇒ Object
- #album=(string) ⇒ Object
- #artist ⇒ Object
- #artist=(string) ⇒ Object
- #bitrate ⇒ Object
- #channels ⇒ Object
- #close ⇒ Object
- #comment ⇒ Object
- #comment=(string) ⇒ Object
- #genre ⇒ Object
- #genre=(string) ⇒ Object
-
#initialize(p) ⇒ File
constructor
A new instance of File.
- #length ⇒ Object
- #samplerate ⇒ Object
- #save ⇒ Object
- #title ⇒ Object
- #title=(string) ⇒ Object
- #track ⇒ Object
- #track=(uint) ⇒ Object
- #year ⇒ Object
- #year=(uint) ⇒ Object
Constructor Details
#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 |
Instance Method Details
#album ⇒ Object
136 137 138 |
# File 'lib/taglib.rb', line 136 def album return TagLib.taglib_tag_album(tag) end |
#album=(string) ⇒ Object
140 141 142 |
# File 'lib/taglib.rb', line 140 def album=(string) TagLib.taglib_tag_set_album(tag, string) end |
#artist ⇒ Object
128 129 130 |
# File 'lib/taglib.rb', line 128 def artist return TagLib.taglib_tag_artist(tag) end |
#artist=(string) ⇒ Object
132 133 134 |
# File 'lib/taglib.rb', line 132 def artist=(string) TagLib.taglib_tag_set_artist(tag, string) end |
#bitrate ⇒ Object
180 181 182 |
# File 'lib/taglib.rb', line 180 def bitrate return TagLib.taglib_audioproperties_bitrate(audio) end |
#channels ⇒ Object
188 189 190 |
# File 'lib/taglib.rb', line 188 def channels return TagLib.taglib_audioproperties_channels(audio) end |
#close ⇒ Object
110 111 112 113 114 115 116 117 118 |
# File 'lib/taglib.rb', line 110 def close if @file TagLib.taglib_file_free(@file) end @path = nil @file = nil @tag = nil @audio = nil end |
#comment ⇒ Object
144 145 146 |
# File 'lib/taglib.rb', line 144 def comment return TagLib.taglib_tag_comment(tag) end |
#comment=(string) ⇒ Object
148 149 150 |
# File 'lib/taglib.rb', line 148 def comment=(string) TagLib.taglib_tag_set_comment(tag, string) end |
#genre ⇒ Object
152 153 154 |
# File 'lib/taglib.rb', line 152 def genre return TagLib.taglib_tag_genre(tag) end |
#genre=(string) ⇒ Object
156 157 158 |
# File 'lib/taglib.rb', line 156 def genre=(string) TagLib.taglib_tag_set_genre(tag, string) end |
#length ⇒ Object
176 177 178 |
# File 'lib/taglib.rb', line 176 def length return TagLib.taglib_audioproperties_length(audio) end |
#samplerate ⇒ Object
184 185 186 |
# File 'lib/taglib.rb', line 184 def samplerate return TagLib.taglib_audioproperties_samplerate(audio) end |
#save ⇒ Object
106 107 108 |
# File 'lib/taglib.rb', line 106 def save TagLib.taglib_file_save(@file) end |
#title ⇒ Object
120 121 122 |
# File 'lib/taglib.rb', line 120 def title return TagLib.taglib_tag_title(tag) end |
#title=(string) ⇒ Object
124 125 126 |
# File 'lib/taglib.rb', line 124 def title=(string) TagLib.taglib_tag_set_title(tag, string) end |
#track ⇒ Object
168 169 170 |
# File 'lib/taglib.rb', line 168 def track return TagLib.taglib_tag_track(tag) end |
#track=(uint) ⇒ Object
172 173 174 |
# File 'lib/taglib.rb', line 172 def track=(uint) TagLib.taglib_tag_set_track(tag, uint) end |
#year ⇒ Object
160 161 162 |
# File 'lib/taglib.rb', line 160 def year return TagLib.taglib_tag_year(tag) end |
#year=(uint) ⇒ Object
164 165 166 |
# File 'lib/taglib.rb', line 164 def year=(uint) TagLib.taglib_tag_set_year(tag, uint) end |