mediafile 0.2.3 → 0.2.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/mediafile/mediafile.rb +14 -10
- data/lib/mediafile/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c1dbbce1323dc0990bbc33da1ec6dafbd36bd119
|
4
|
+
data.tar.gz: 50f4d1f802f3bef3dec4b2a4d2afc37d755ad6d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 992909477ae50eaa4cba726c48f2472f87ea44beaf87d511048a8363ccb6abd7646779982f46d39cf6a39aa865ffd28367ff116a65cd9f8f827906e027cdcde8
|
7
|
+
data.tar.gz: 2d40a4d6cb26d86cb6088d959ae70ccad61e8cbec39c9ddac27ef8664e47d95d91428f85d49358884e8eca5f6f24c0db1e54d8fcd7d78864c8d3bf538a339861
|
data/lib/mediafile/mediafile.rb
CHANGED
@@ -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
|
-
|
333
|
-
|
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
|
-
|
368
|
-
|
369
|
-
|
370
|
-
|
371
|
-
|
372
|
-
|
373
|
-
|
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}'."
|
data/lib/mediafile/version.rb
CHANGED