WillsItunesProject 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,74 @@
1
+ #!/usr/bin/env ruby -w
2
+
3
+ $: << 'lib'
4
+ require 'test/unit'
5
+ require 'wills_itunes_project'
6
+
7
+ SAMPLE_XML_FILE = "test/iTunes Music Library.xml" # 4019 tracks, 381 albums, 211 artists
8
+
9
+ class TestWillsItunesProject < Test::Unit::TestCase
10
+
11
+ @@itunes = WillsItunesProject.new SAMPLE_XML_FILE
12
+ # tried unsuccessfully to def startup rather than setup, so the file is parsed only once
13
+
14
+ def test_initialize
15
+ assert_instance_of Array, @@itunes.tracks
16
+ assert_instance_of WillsItunesProject::Track, @@itunes.tracks.first
17
+ end
18
+
19
+ def test_tracks
20
+ assert_equal 2200, @@itunes.tracks.size
21
+ assert_equal true, @@itunes.titles.include?("I Ain't No Joke")
22
+ end
23
+
24
+ def test_artists
25
+ assert_equal 174, @@itunes.artists.size
26
+ assert_equal true, @@itunes.artists.include?("Portishead")
27
+ end
28
+
29
+ def test_album_titles
30
+ assert_equal 170, @@itunes.albums.size
31
+ assert_equal true, @@itunes.albums.include?("Dummy")
32
+ end
33
+
34
+ def test_album_tracks
35
+ assert_equal 11, @@itunes.album_tracks("Dummy").size
36
+ end
37
+
38
+ def test_album_playtime
39
+ assert_equal 2955238, @@itunes.album_playtime("Dummy")
40
+ end
41
+
42
+ def test_track_playtime_all
43
+ assert_equal 535547663, @@itunes.total_playtime
44
+ end
45
+
46
+ def test_tracks_most_played
47
+ most_played = @@itunes.most_played
48
+ assert_equal 9, most_played.first.play_count
49
+ end
50
+
51
+ def test_top_rated
52
+ top_rated = @@itunes.top_rated
53
+ assert_equal 100, top_rated.first.rating
54
+ end
55
+
56
+ def test_high_bit_rate
57
+ high_bit_rate = @@itunes.high_bit_rate
58
+ assert_equal 256, high_bit_rate.first.bit_rate
59
+ end
60
+
61
+ def test_one_hit_albums
62
+ @@itunes.one_hit_albums.each do |track|
63
+ assert_not_equal 0, track.play_count
64
+ end
65
+ end
66
+
67
+ def test_poser
68
+ @@itunes.poser.each do |track|
69
+ assert_equal 0, track.play_count
70
+ assert 3 <= track.rating
71
+ end
72
+ end
73
+
74
+ end
metadata ADDED
@@ -0,0 +1,113 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: WillsItunesProject
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - Will Larson
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain:
11
+ - |
12
+ -----BEGIN CERTIFICATE-----
13
+ MIIDMDCCAhigAwIBAgIBADANBgkqhkiG9w0BAQUFADA+MRAwDgYDVQQDDAd3bGFy
14
+ c29uMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNjb20w
15
+ HhcNMDgxMjE4MDMxODI1WhcNMDkxMjE4MDMxODI1WjA+MRAwDgYDVQQDDAd3bGFy
16
+ c29uMRUwEwYKCZImiZPyLGQBGRYFZ21haWwxEzARBgoJkiaJk/IsZAEZFgNjb20w
17
+ ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQClnZ2fTJc2ahws02O7GqIF
18
+ 5r9lEK4A9OOR1HTYzS/gk8OiW1E+OX+6/Goj4ysXv+CGpgRJEDqZgpmyVHIymYnq
19
+ 7RGsXiolaqWFWtJbieBiHOycpcAyTSpo9jURfFitMUlcVUpemj2EbZNzIjzYOgQb
20
+ qYItOcagY7Vob3cpSe4L+SS060CeutdFwPAmhC7be43VXfbl+fLNFKIwzho4w1N7
21
+ cew9pFxhiT03yPLl98K5ZukVU3nS0DzrMWkbeCmJo/MFGhOTv+tARmuzUBb0dwWk
22
+ xynnhLJV+m8UVNguiH+EiOMVKAcb3vuSF3/lM43UbO+P+9Mkdgc2OGQg77VnKgl3
23
+ AgMBAAGjOTA3MAkGA1UdEwQCMAAwCwYDVR0PBAQDAgSwMB0GA1UdDgQWBBRm9ZL4
24
+ SMtxMProp1+Q0usV1NjnUjANBgkqhkiG9w0BAQUFAAOCAQEAGDMPt1kMOyxg2RzI
25
+ iEThlrCcYbzkvuOM39G9S8hMYPiJbQoubLpId8gp2jchVwIY0q3yqIhls0YaHQlX
26
+ WqU0o/mLGaJA5JGy45J0QtpVAO0CxqMbKiTVjONF1l1vEAKPEn6MN5w9mzNb2bhj
27
+ P/6ghvrcDRKDtcL6FFpDB3p1hdg5XSAsZ3mEXK4aastb3s0CrEzW9IBV4amM5xqs
28
+ sG9hXf6m6q76kraTRLXjmdWiSVD0jRHSN3AkAXP89qF8Uft2BXW/C1vrqQocW/ua
29
+ AUKitaSw7CMB6KDxpH1iWILorSNPu+Pz1jgJm+UJdpsVjJbLAIUEN/fn3ic76E67
30
+ Ev3A1Q==
31
+ -----END CERTIFICATE-----
32
+
33
+ date: 2008-12-17 00:00:00 -08:00
34
+ default_executable:
35
+ dependencies:
36
+ - !ruby/object:Gem::Dependency
37
+ name: nokogiri
38
+ type: :runtime
39
+ version_requirement:
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - ">="
43
+ - !ruby/object:Gem::Version
44
+ version: "0"
45
+ version:
46
+ - !ruby/object:Gem::Dependency
47
+ name: open-uri
48
+ type: :runtime
49
+ version_requirement:
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: "0"
55
+ version:
56
+ - !ruby/object:Gem::Dependency
57
+ name: hoe
58
+ type: :development
59
+ version_requirement:
60
+ version_requirements: !ruby/object:Gem::Requirement
61
+ requirements:
62
+ - - ">="
63
+ - !ruby/object:Gem::Version
64
+ version: 1.8.1
65
+ version:
66
+ description: Reads itunes data from itunes library XML files and provides useful information regarding the data within.
67
+ email:
68
+ - wlarson@gmail.com
69
+ executables: []
70
+
71
+ extensions: []
72
+
73
+ extra_rdoc_files:
74
+ - History.txt
75
+ - Manifest.txt
76
+ - README.txt
77
+ files:
78
+ - History.txt
79
+ - Manifest.txt
80
+ - README.txt
81
+ - Rakefile
82
+ - lib/wills_itunes_project.rb
83
+ - test/iTunes Music Library.xml
84
+ - test/test_wills_itunes_project.rb
85
+ has_rdoc: true
86
+ homepage: http://rubyforge.org/projects/uwruby/
87
+ post_install_message:
88
+ rdoc_options:
89
+ - --main
90
+ - README.txt
91
+ require_paths:
92
+ - lib
93
+ required_ruby_version: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ">="
96
+ - !ruby/object:Gem::Version
97
+ version: "0"
98
+ version:
99
+ required_rubygems_version: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - ">="
102
+ - !ruby/object:Gem::Version
103
+ version: "0"
104
+ version:
105
+ requirements: []
106
+
107
+ rubyforge_project: uwruby
108
+ rubygems_version: 1.2.0
109
+ signing_key:
110
+ specification_version: 2
111
+ summary: Reads itunes data from itunes library XML files and provides useful information regarding the data within.
112
+ test_files:
113
+ - test/test_wills_itunes_project.rb
metadata.gz.sig ADDED
Binary file