ruby-audioinfo 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/History.txt +5 -0
  2. data/lib/audioinfo.rb +20 -11
  3. metadata +2 -2
data/History.txt CHANGED
@@ -1,3 +1,8 @@
1
+ === 0.1.4 / 2008-07-04
2
+
3
+ * charset correctly set when commiting MP3 tags too
4
+ * file is written only if tags have really changed
5
+
1
6
  === 0.1.3 / 2008-07-03
2
7
 
3
8
  * #tracknum= added
data/lib/audioinfo.rb CHANGED
@@ -30,7 +30,7 @@ class AudioInfo
30
30
 
31
31
  SUPPORTED_EXTENSIONS = %w{mp3 ogg mpc wma mp4 aac m4a flac}
32
32
 
33
- VERSION = "0.1.3"
33
+ VERSION = "0.1.4"
34
34
 
35
35
  attr_reader :path, :extension, :musicbrainz_infos, :tracknum, :bitrate, :vbr
36
36
  attr_reader :artist, :album, :title, :length, :date
@@ -183,26 +183,35 @@ class AudioInfo
183
183
 
184
184
  # set the title of the file
185
185
  def title=(v)
186
- @needs_commit = true
187
- @title = v
186
+ if @title != v
187
+ @needs_commit = true
188
+ @title = v
189
+ end
188
190
  end
189
191
 
190
192
  # set the artist of the file
191
193
  def artist=(v)
192
- @needs_commit = true
193
- @artist = v
194
+ if @artist != v
195
+ @needs_commit = true
196
+ @artist = v
197
+ end
194
198
  end
195
199
 
196
200
  # set the album of the file
197
201
  def album=(v)
198
- @needs_commit = true
199
- @album = v
202
+ if @album != v
203
+ @needs_commit = true
204
+ @album = v
205
+ end
200
206
  end
201
207
 
202
208
  # set the track number of the file
203
209
  def tracknum=(v)
204
- @needs_commit = true
205
- @tracknum = v.to_i
210
+ v = v.to_i
211
+ if @tracknum != v
212
+ @needs_commit = true
213
+ @tracknum = v
214
+ end
206
215
  end
207
216
 
208
217
  # hash-like access to tag
@@ -220,14 +229,14 @@ class AudioInfo
220
229
  if @needs_commit
221
230
  case @info
222
231
  when Mp3Info
223
- Mp3Info.open(@path) do |info|
232
+ Mp3Info.open(@path, :encoding => @encoding) do |info|
224
233
  info.tag.artist = @artist
225
234
  info.tag.title = @title
226
235
  info.tag.album = @album
227
236
  info.tag.tracknum = @tracknum
228
237
  end
229
238
  when OggInfo
230
- OggInfo.open(@path, "utf-8") do |ogg|
239
+ OggInfo.open(@path, @encoding) do |ogg|
231
240
  { "artist" => @artist,
232
241
  "album" => @album,
233
242
  "title" => @title,
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-audioinfo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Guillaume Pierronnet
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2008-07-03 00:00:00 +02:00
12
+ date: 2008-07-04 00:00:00 +02:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency