id3_tags 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/id3_tags +11 -0
- data/lib/id3_tags/m4a.rb +130 -0
- data/lib/id3_tags/mp3.rb +142 -0
- data/lib/id3_tags/version.rb +1 -1
- data/lib/id3_tags.rb +36 -147
- metadata +28 -44
- data/.gitignore +0 -16
- data/.rspec +0 -1
- data/Gemfile +0 -6
- data/HISTORY.md +0 -1
- data/Rakefile +0 -12
- data/TODO.md +0 -2
- data/doc/Id3Tags.html +0 -495
- data/doc/_index.html +0 -110
- data/doc/class_list.html +0 -53
- data/doc/css/common.css +0 -1
- data/doc/css/full_list.css +0 -57
- data/doc/css/style.css +0 -338
- data/doc/file.README.html +0 -102
- data/doc/file_list.html +0 -55
- data/doc/frames.html +0 -28
- data/doc/index.html +0 -102
- data/doc/js/app.js +0 -214
- data/doc/js/full_list.js +0 -178
- data/doc/js/jquery.js +0 -4
- data/doc/method_list.html +0 -64
- data/doc/top-level-namespace.html +0 -112
- data/id3_tags.gemspec +0 -30
- data/spec/assets/all_id3.mp3 +0 -0
- data/spec/assets/black_pixel.png +0 -0
- data/spec/assets/no_id3.mp3 +0 -0
- data/spec/helpers/duplicate_file_helper.rb +0 -11
- data/spec/lib/idempotency_spec.rb +0 -14
- data/spec/lib/read_id3_tags_spec.rb +0 -72
- data/spec/lib/write_id3_tags_spec.rb +0 -67
@@ -1,67 +0,0 @@
|
|
1
|
-
require 'id3_tags'
|
2
|
-
require_relative '../helpers/duplicate_file_helper'
|
3
|
-
|
4
|
-
describe 'Id3Tags.write_tags_to' do
|
5
|
-
context 'given a track with all the ID3 metadata and a Hash of empty ID3' do
|
6
|
-
let(:original_track) {File.join File.dirname(__FILE__), '../assets/all_id3.mp3'}
|
7
|
-
let(:new_metadata) { {} }
|
8
|
-
|
9
|
-
it 'resets all the editable ID3 tags of the track to nil' do
|
10
|
-
with_duplicate_file_of(original_track) do |duplicate|
|
11
|
-
Id3Tags.write_tags_to(duplicate, new_metadata)
|
12
|
-
id3_tags = Id3Tags.read_tags_from(duplicate)
|
13
|
-
[:album, :artist, :comment, :genre, :title, :grouping, :lyrics,
|
14
|
-
:album_artist, :composer, :bpm].each do |field|
|
15
|
-
id3_tags[field].should be_nil
|
16
|
-
end
|
17
|
-
id3_tags[:year].should == 0
|
18
|
-
id3_tags[:compilation].should be_false
|
19
|
-
# NOTE: Taglib does NOT allow the track_number to be nil; the old
|
20
|
-
# value is persisted in this case, so we cannot test for nil?
|
21
|
-
#id3_tags[:track][:number].should be_nil
|
22
|
-
id3_tags[:track][:count].should be_nil
|
23
|
-
id3_tags[:disk][:number].should be_nil
|
24
|
-
id3_tags[:disk][:count].should be_nil
|
25
|
-
id3_tags[:cover_art][:mime_type].should be_nil
|
26
|
-
id3_tags[:cover_art][:data].should be_nil
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context 'given a track with no metadata and a Hash full of ID3' do
|
32
|
-
let(:original_track) {File.join File.dirname(__FILE__), '../assets/no_id3.mp3'}
|
33
|
-
let(:new_cover_art) {File.join File.dirname(__FILE__), '../assets/black_pixel.png'}
|
34
|
-
let(:new_cover_art_data) {File.open(new_cover_art, 'rb') {|io| io.read}}
|
35
|
-
let(:new_metadata) { {title: "A track", album: "An album", artist:
|
36
|
-
"An artist", year: 2012, comment: "A comment", genre: "A genre", bpm: 68,
|
37
|
-
composer: "A composer", lyrics: "A lyrics line 1\rand line 2",
|
38
|
-
album_artist: "An album artist", grouping: "A group", compilation: true,
|
39
|
-
track: {number: 1, count: 24}, disk: {number: 1, count: 2}, cover_art:
|
40
|
-
{mime_type: "image/png", data: new_cover_art_data}}
|
41
|
-
}
|
42
|
-
|
43
|
-
it 'sets all the editable ID3 tags of a track' do
|
44
|
-
with_duplicate_file_of(original_track) do |duplicate|
|
45
|
-
Id3Tags.write_tags_to(duplicate, new_metadata)
|
46
|
-
id3_tags = Id3Tags.read_tags_from(duplicate)
|
47
|
-
id3_tags[:album].should == 'An album'
|
48
|
-
id3_tags[:artist].should == 'An artist'
|
49
|
-
id3_tags[:comment].should == 'A comment'
|
50
|
-
id3_tags[:genre].should == 'A genre'
|
51
|
-
id3_tags[:title].should == 'A track'
|
52
|
-
id3_tags[:grouping].should == 'A group'
|
53
|
-
id3_tags[:lyrics].should == "A lyrics line 1\rand line 2"
|
54
|
-
id3_tags[:album_artist].should == 'An album artist'
|
55
|
-
id3_tags[:composer].should == 'A composer'
|
56
|
-
id3_tags[:bpm].should == 68
|
57
|
-
id3_tags[:compilation].should be_true
|
58
|
-
id3_tags[:track][:number].should == 1
|
59
|
-
id3_tags[:track][:count].should == 24
|
60
|
-
id3_tags[:disk][:number].should == 1
|
61
|
-
id3_tags[:disk][:count].should == 2
|
62
|
-
id3_tags[:cover_art][:mime_type].should == 'image/png'
|
63
|
-
id3_tags[:cover_art][:data].should == new_cover_art_data
|
64
|
-
end
|
65
|
-
end
|
66
|
-
end
|
67
|
-
end
|