easytag 0.4.3 → 1.0.0

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.
Files changed (60) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile +7 -2
  4. data/README.md +33 -27
  5. data/Rakefile +7 -7
  6. data/easytag.gemspec +2 -4
  7. data/lib/easytag.rb +12 -2
  8. data/lib/easytag/attributes/base.rb +32 -128
  9. data/lib/easytag/attributes/flac.rb +25 -0
  10. data/lib/easytag/attributes/mp3.rb +91 -554
  11. data/lib/easytag/attributes/mp4.rb +22 -492
  12. data/lib/easytag/attributes/ogg.rb +27 -0
  13. data/lib/easytag/attributes/vorbis.rb +18 -0
  14. data/lib/easytag/taggers/base.rb +19 -0
  15. data/lib/easytag/taggers/factory.rb +59 -0
  16. data/lib/easytag/taggers/flac.rb +23 -0
  17. data/lib/easytag/taggers/mp3.rb +77 -0
  18. data/lib/easytag/taggers/mp4.rb +73 -0
  19. data/lib/easytag/taggers/ogg.rb +25 -0
  20. data/lib/easytag/taggers/vorbis.rb +66 -0
  21. data/lib/easytag/util.rb +9 -31
  22. data/lib/easytag/version.rb +3 -4
  23. data/scripts/build_attributes_table.rb +34 -0
  24. data/{test → spec/data}/consistency.01.m4a +0 -0
  25. data/{test → spec/data}/consistency.01.mp3 +0 -0
  26. data/spec/data/consistency.flac +0 -0
  27. data/{test/consistency.02.m4a → spec/data/consistency.m4a} +0 -0
  28. data/{test/consistency.02.mp3 → spec/data/consistency.mp3} +0 -0
  29. data/spec/data/consistency.multiple_images.flac +0 -0
  30. data/{test/no_tags.m4a → spec/data/consistency.multiple_images.m4a} +0 -0
  31. data/spec/data/consistency.multiple_images.mp3 +0 -0
  32. data/spec/data/consistency.multiple_images.ogg +0 -0
  33. data/spec/data/consistency.ogg +0 -0
  34. data/{test → spec/data}/musicbrainz.m4a +0 -0
  35. data/spec/data/no_tags.flac +0 -0
  36. data/spec/data/no_tags.m4a +0 -0
  37. data/{test → spec/data}/no_tags.mp3 +0 -0
  38. data/spec/data/no_tags.ogg +0 -0
  39. data/{test → spec/data}/only_id3v1.mp3 +0 -0
  40. data/{test → spec/data}/only_id3v2.mp3 +0 -0
  41. data/spec/flac_tagger_spec.rb +24 -0
  42. data/spec/mp3_tagger_spec.rb +64 -0
  43. data/spec/mp4_tagger_spec.rb +22 -0
  44. data/spec/ogg_tagger_spec.rb +21 -0
  45. data/spec/shared_examples.rb +115 -0
  46. data/spec/spec_helper.rb +34 -0
  47. data/spec/tagger_factory_spec.rb +27 -0
  48. data/spec/util_spec.rb +47 -0
  49. metadata +47 -48
  50. data/lib/easytag/attributes.rb +0 -0
  51. data/lib/easytag/base.rb +0 -28
  52. data/lib/easytag/file.rb +0 -44
  53. data/lib/easytag/interfaces.rb +0 -18
  54. data/lib/easytag/interfaces/base.rb +0 -24
  55. data/lib/easytag/interfaces/mp3.rb +0 -48
  56. data/lib/easytag/interfaces/mp4.rb +0 -14
  57. data/test/test_consistency.rb +0 -233
  58. data/test/test_mp3.rb +0 -98
  59. data/test/test_mp4.rb +0 -49
  60. data/test/test_util.rb +0 -72
@@ -1,98 +0,0 @@
1
- require 'test/unit'
2
-
3
- require 'easytag'
4
-
5
- TEST_DIR = File.dirname(File.absolute_path(__FILE__)) << File::SEPARATOR
6
-
7
- class TestID3v1OnlyMP3 < Test::Unit::TestCase
8
- def setup
9
- @f = EasyTag::File.new("#{TEST_DIR}only_id3v1.mp3")
10
- end
11
-
12
- def test_tags
13
- assert_equal('Track Title', @f.title)
14
- assert_equal('Track Artist', @f.artist)
15
- assert_equal('Album Name', @f.album)
16
- assert_equal(['this is a comment'], @f.comments)
17
- assert_equal('Swing', @f.genre)
18
- assert_equal(1988, @f.year)
19
- assert_equal(1988, @f.date.year)
20
- assert_equal(true, @f.album_art.empty?)
21
- assert_equal('', @f.apple_id)
22
- assert_equal([3, 0], @f.track_num)
23
- assert_equal([0, 0], @f.disc_num)
24
-
25
- end
26
- end
27
-
28
- class TestID3v2OnlyMP3 < Test::Unit::TestCase
29
- def setup
30
- @f = EasyTag::File.new("#{TEST_DIR}only_id3v2.mp3")
31
- end
32
-
33
- def test_tags
34
- assert_equal('Track Title', @f.title)
35
- assert_equal('Track Artist', @f.artist)
36
- assert_equal('Album Name', @f.album)
37
- assert_equal('this is a comment', @f.comment)
38
- assert_equal('Swing', @f.genre)
39
- assert_equal(1988, @f.year)
40
- assert_equal(1988, @f.date.year)
41
- assert_equal(true, @f.album_art.empty?)
42
- assert_equal('', @f.apple_id)
43
- assert_equal([3, 0], @f.track_num)
44
- assert_equal([0, 0], @f.disc_num)
45
-
46
- end
47
- end
48
-
49
- class TestNoTagsMP3 < Test::Unit::TestCase
50
- def setup
51
- @f = EasyTag::File.new("#{TEST_DIR}no_tags.mp3")
52
- end
53
-
54
- def test_tags
55
- assert_equal('', @f.title)
56
- assert_equal('', @f.artist)
57
- assert_equal('', @f.album)
58
- assert_equal('', @f.album_artist)
59
- assert_equal([], @f.comments)
60
- assert_equal('', @f.genre)
61
- assert_equal(0, @f.year)
62
- assert_equal(nil, @f.date)
63
- assert_equal(true, @f.album_art.empty?)
64
- assert_equal('', @f.apple_id)
65
- assert_equal([0, 0], @f.track_num)
66
- assert_equal([0, 0], @f.disc_num)
67
- assert_equal('', @f.conductor)
68
- assert_equal('', @f.remixer)
69
- assert_equal('', @f.mood)
70
- end
71
-
72
- def test_musicbrainz_data
73
- assert_equal('', @f.musicbrainz_album_artist_id)
74
- assert_equal('', @f.musicbrainz_album_status)
75
- assert_equal('', @f.musicbrainz_release_group_id)
76
- assert_equal('', @f.musicbrainz_album_id)
77
- assert_equal([], @f.musicbrainz_album_type)
78
- assert_equal('', @f.musicbrainz_track_id)
79
- assert_equal('', @f.musicbrainz_album_release_country)
80
- assert_equal([], @f.musicbrainz_artist_id)
81
- end
82
-
83
- def test_aliases
84
- assert_equal(@f.length, @f.duration)
85
- end
86
-
87
- def test_audio_properties
88
- assert_equal(4, @f.duration)
89
- assert_equal(74, @f.bitrate)
90
- assert_equal(44100, @f.sample_rate)
91
- assert_equal(2, @f.channels)
92
- assert_equal(true, @f.original?)
93
- assert_equal(3, @f.layer)
94
- assert_equal(false, @f.copyrighted?)
95
- assert_equal(false, @f.protection_enabled?)
96
- end
97
-
98
- end
@@ -1,49 +0,0 @@
1
- require 'test/unit'
2
-
3
- require 'easytag'
4
-
5
- TEST_DIR = File.dirname(File.absolute_path(__FILE__)) << File::SEPARATOR
6
-
7
- class TestNoTagsMP4 < Test::Unit::TestCase
8
- def setup
9
- @f = EasyTag::File.new("#{TEST_DIR}no_tags.m4a")
10
- end
11
-
12
- def test_tags
13
- assert_equal('', @f.title)
14
- assert_equal('', @f.artist)
15
- assert_equal('', @f.album)
16
- assert_equal('', @f.album_artist)
17
- assert_equal([], @f.comments)
18
- assert_equal('', @f.genre)
19
- assert_equal(0, @f.year)
20
- assert_equal(nil, @f.date)
21
- assert_equal(true, @f.album_art.empty?)
22
- assert_equal('', @f.apple_id)
23
- assert_equal([0, 0], @f.track_num)
24
- assert_equal([0, 0], @f.disc_num)
25
- assert_equal('', @f.conductor)
26
- assert_equal('', @f.remixer)
27
- assert_equal('', @f.mood)
28
- end
29
-
30
- def test_musicbrainz_data
31
- assert_equal('', @f.musicbrainz_album_artist_id)
32
- assert_equal('', @f.musicbrainz_album_status)
33
- assert_equal('', @f.musicbrainz_release_group_id)
34
- assert_equal('', @f.musicbrainz_album_id)
35
- assert_equal([], @f.musicbrainz_album_type)
36
- assert_equal('', @f.musicbrainz_track_id)
37
- assert_equal('', @f.musicbrainz_album_release_country)
38
- assert_equal([], @f.musicbrainz_artist_id)
39
- end
40
-
41
- def test_audio_properties
42
- assert_equal(4, @f.duration)
43
- assert_equal(176, @f.bitrate)
44
- assert_equal(44100, @f.sample_rate)
45
- assert_equal(2, @f.channels)
46
- assert_equal(16, @f.bits_per_sample)
47
- end
48
-
49
- end
@@ -1,72 +0,0 @@
1
- require 'test/unit'
2
-
3
- require 'easytag/util'
4
-
5
- class TestUtilities < Test::Unit::TestCase
6
- def test_get_datetime01
7
- date = EasyTag::Utilities.get_datetime('2006')
8
- assert_equal(2006, date.year)
9
- assert_equal(1, date.month)
10
- assert_equal(1, date.day)
11
- end
12
-
13
- def test_get_datetime02
14
- date = EasyTag::Utilities.get_datetime('1955-05')
15
- assert_equal(1955, date.year)
16
- assert_equal(5, date.month)
17
- assert_equal(1, date.day)
18
- end
19
-
20
- def test_get_datetime03
21
- date = EasyTag::Utilities.get_datetime('2012-12-07T08:00:00Z')
22
- assert_equal(2012, date.year)
23
- assert_equal(12, date.month)
24
- assert_equal(7, date.day)
25
- end
26
-
27
- def test_get_datetime04
28
- date = EasyTag::Utilities.get_datetime('19880711')
29
- assert_equal(1988, date.year)
30
- assert_equal(11, date.month)
31
- assert_equal(7, date.day)
32
- end
33
-
34
- def test_get_datetime05
35
- date = EasyTag::Utilities.get_datetime('')
36
- assert_equal(nil, date)
37
- end
38
-
39
- def test_get_datetime06
40
- date = EasyTag::Utilities.get_datetime('2000-00-00')
41
- assert_equal(2000, date.year)
42
- assert_equal(1, date.month)
43
- assert_equal(1, date.day)
44
- end
45
-
46
- def test_get_datetime07
47
- date = EasyTag::Utilities.get_datetime('2006-99-99')
48
- assert_equal(2006, date.year)
49
- assert_equal(1, date.month)
50
- assert_equal(1, date.day)
51
- end
52
-
53
-
54
- def test_get_int_pair
55
- assert_equal([0, 0], EasyTag::Utilities.get_int_pair(''))
56
- assert_equal([0, 0], EasyTag::Utilities.get_int_pair(nil))
57
- assert_equal([3, 0], EasyTag::Utilities.get_int_pair('3'))
58
- assert_equal([0, 9], EasyTag::Utilities.get_int_pair('/9'))
59
- assert_equal([5, 10], EasyTag::Utilities.get_int_pair('5/10'))
60
- end
61
-
62
- def test_normalize_string
63
- cases = [
64
- ['MusicBrainz Album Artist Id', 'musicbrainz_album_artist_id'],
65
- ['\'hi ^''$there #guys\"', 'hi_there_guys'],
66
- ]
67
- cases.each do |c|
68
- orig, result = c
69
- assert_equal(result, EasyTag::Utilities.normalize_string(orig))
70
- end
71
- end
72
- end