mediafile 0.2.3 → 0.2.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f8e6faf1b40a1e84b15b4a1fd5bf385da8a9e123
4
- data.tar.gz: '08bbdbe884efb4bf09c90462bc4866b2d5b99a5c'
3
+ metadata.gz: c1dbbce1323dc0990bbc33da1ec6dafbd36bd119
4
+ data.tar.gz: 50f4d1f802f3bef3dec4b2a4d2afc37d755ad6d7
5
5
  SHA512:
6
- metadata.gz: '0474159529f6dcac8d25e0e55832207a3670cff293a9bfc5ba683a9c8cfdd81a43221e53f41e4ce4170d6bc090ec6f5dd649ffcc08b5788c5110108823a19bee'
7
- data.tar.gz: 231f14386a074edca93dc7a0b053773270bafe915420081cd8bb5a474223e187f5415f4ef39eaf6f39f351b80ad09d925bb7c56629e84c744519fd145b953113
6
+ metadata.gz: 992909477ae50eaa4cba726c48f2472f87ea44beaf87d511048a8363ccb6abd7646779982f46d39cf6a39aa865ffd28367ff116a65cd9f8f827906e027cdcde8
7
+ data.tar.gz: 2d40a4d6cb26d86cb6088d959ae70ccad61e8cbec39c9ddac27ef8664e47d95d91428f85d49358884e8eca5f6f24c0db1e54d8fcd7d78864c8d3bf538a339861
@@ -296,7 +296,7 @@ class MediaFile
296
296
  tag = f.id3v2_tag
297
297
  # Don't overwrite an existing album cover.
298
298
  debug("Checking if the target mp3 file already has a cover.")
299
- return true if tag.frame_list('APIC').find do |p|
299
+ return true if tag && tag.frame_list('APIC').find do |p|
300
300
  p.type == TagLib::ID3v2::AttachedPictureFrame::FrontCover
301
301
  end
302
302
  end
@@ -329,8 +329,10 @@ class MediaFile
329
329
  when :mp3
330
330
  TagLib::MPEG::File.open(@source) do |f|
331
331
  tag = f.id3v2_tag
332
- p = tag.frame_list('APIC').first
333
- p.picture if p
332
+ if tag
333
+ p = tag.frame_list('APIC').first
334
+ p.picture if p
335
+ end
334
336
  end
335
337
  else
336
338
  error "Unsupported file type '#{@type}'. Not adding cover art from '#{@cover}'."
@@ -364,13 +366,15 @@ class MediaFile
364
366
  when :mp3
365
367
  TagLib::MPEG::File.open(file) do |f|
366
368
  tag = f.id3v2_tag
367
- apic = TagLib::ID3v2::AttachedPictureFrame.new
368
- apic.mime_type = 'image/jpeg'
369
- apic.description = 'Cover'
370
- apic.type = TagLib::ID3v2::AttachedPictureFrame::FrontCover
371
- apic.picture = cover_art
372
- tag.add_frame(apic)
373
- f.save
369
+ if tag
370
+ apic = TagLib::ID3v2::AttachedPictureFrame.new
371
+ apic.mime_type = 'image/jpeg'
372
+ apic.description = 'Cover'
373
+ apic.type = TagLib::ID3v2::AttachedPictureFrame::FrontCover
374
+ apic.picture = cover_art
375
+ tag.add_frame(apic)
376
+ f.save
377
+ end
374
378
  end
375
379
  else
376
380
  error "Unsupported file type '#{typ}'. Not adding cover art from '#{@cover}'."
@@ -1,3 +1,3 @@
1
1
  module MediaFile
2
- VERSION = "0.2.3" unless defined?(::MediaFile::VERSION)
2
+ VERSION = "0.2.4" unless defined?(::MediaFile::VERSION)
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mediafile
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Harvey-Smith