daapclient 0.0.2 → 0.1.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 (51) hide show
  1. data/README +8 -13
  2. data/doc/classes/Net.html +127 -0
  3. data/doc/classes/Net/DAAP.html +168 -0
  4. data/doc/classes/Net/DAAP/Client.html +269 -0
  5. data/doc/classes/Net/DAAP/Client.src/M000003.html +20 -0
  6. data/doc/classes/Net/DAAP/Client.src/M000004.html +28 -0
  7. data/doc/classes/Net/DAAP/Client.src/M000005.html +33 -0
  8. data/doc/classes/Net/DAAP/Client.src/M000006.html +37 -0
  9. data/doc/classes/Net/DAAP/Client.src/M000007.html +20 -0
  10. data/doc/classes/Net/DAAP/Client.src/M000008.html +24 -0
  11. data/doc/classes/Net/DAAP/Client.src/M000009.html +18 -0
  12. data/doc/classes/Net/DAAP/DAAPv2.html +165 -0
  13. data/doc/classes/Net/DAAP/DAAPv2.src/M000016.html +30 -0
  14. data/doc/classes/Net/DAAP/DAAPv2.src/M000017.html +21 -0
  15. data/doc/classes/Net/DAAP/DAAPv3.html +178 -0
  16. data/doc/classes/Net/DAAP/DAAPv3.src/M000018.html +30 -0
  17. data/doc/classes/Net/DAAP/DAAPv3.src/M000019.html +23 -0
  18. data/doc/classes/Net/DAAP/DMAP.html +176 -0
  19. data/doc/classes/Net/DAAP/DMAP.src/M000013.html +20 -0
  20. data/doc/classes/Net/DAAP/DMAP.src/M000014.html +18 -0
  21. data/doc/classes/Net/DAAP/DMAP.src/M000015.html +24 -0
  22. data/doc/classes/Net/DAAP/Database.html +224 -0
  23. data/doc/classes/Net/DAAP/Database.src/M000010.html +25 -0
  24. data/doc/classes/Net/DAAP/Database.src/M000011.html +21 -0
  25. data/doc/classes/Net/DAAP/Database.src/M000012.html +35 -0
  26. data/doc/classes/Net/DAAP/Playlist.html +192 -0
  27. data/doc/classes/Net/DAAP/Playlist.src/M000001.html +24 -0
  28. data/doc/classes/Net/DAAP/Playlist.src/M000002.html +30 -0
  29. data/doc/classes/Net/DAAP/Song.html +208 -0
  30. data/doc/classes/Net/DAAP/Song.src/M000020.html +27 -0
  31. data/doc/classes/Net/DAAP/Song.src/M000021.html +19 -0
  32. data/doc/created.rid +1 -0
  33. data/doc/files/CHANGELOG.html +134 -0
  34. data/doc/files/LICENSE.html +531 -0
  35. data/doc/files/README.html +182 -0
  36. data/doc/files/lib/net/daap/database_rb.html +101 -0
  37. data/doc/files/lib/net/daap/dmap_rb.html +101 -0
  38. data/doc/files/lib/net/daap/playlist_rb.html +101 -0
  39. data/doc/files/lib/net/daap/song_rb.html +101 -0
  40. data/doc/files/lib/net/daap_rb.html +114 -0
  41. data/doc/fr_class_index.html +35 -0
  42. data/doc/fr_file_index.html +34 -0
  43. data/doc/fr_method_index.html +47 -0
  44. data/doc/index.html +24 -0
  45. data/doc/rdoc-style.css +208 -0
  46. data/lib/net/CVS/Entries +1 -1
  47. data/lib/net/daap.rb +4 -4
  48. data/lib/net/daap/CVS/Entries +1 -1
  49. data/lib/net/daap/song.rb +2 -2
  50. metadata +60 -3
  51. data/lib/itunes_sync.rb +0 -19
data/README CHANGED
@@ -1,7 +1,5 @@
1
1
  = Net::DAAP
2
2
 
3
- Version 0.0.1
4
-
5
3
  This library is used for browsing iTunes DAAP servers.
6
4
 
7
5
  Most of this is based off the work in the perl version by Richard Clamp which
@@ -31,23 +29,20 @@ http://rubyforge.org/projects/daapclient
31
29
  == Example Usage
32
30
 
33
31
  require 'net/daap'
32
+ require 'fileutils'
34
33
 
35
34
  daap = Net::DAAP::Client.new('localhost')
35
+
36
36
  daap.connect do |dsn|
37
37
  daap.databases do |db|
38
38
  puts "All songs in the database"
39
39
  db.songs do |song|
40
- puts "#{song.artist} - #{song.name}"
41
- end
42
-
43
- puts "Songs for each playlist"
44
- db.playlists do |pl|
45
- puts "Playlist name: #{pl.name}"
46
- pl.songs do |song|
47
- puts "#{song.artist} - #{song.name}"
48
- File::open("db/#{song.artist} - #{song.name}.#{song.format}", "w") do |f|
49
- f << song.get
50
- end
40
+ filename = "#{song.artist} - #{song.name}.#{song.format}"
41
+ directory = "db/#{song.album}"
42
+ FileUtils::mkdir_p(directory)
43
+
44
+ File.open("#{directory}/#{filename}", "w") do |f|
45
+ song.get { |str| f.write str }
51
46
  end
52
47
  end
53
48
  end
@@ -0,0 +1,127 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Net</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Net</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../files/lib/net/daap/database_rb.html">
59
+ lib/net/daap/database.rb
60
+ </a>
61
+ <br />
62
+ <a href="../files/lib/net/daap/dmap_rb.html">
63
+ lib/net/daap/dmap.rb
64
+ </a>
65
+ <br />
66
+ <a href="../files/lib/net/daap/playlist_rb.html">
67
+ lib/net/daap/playlist.rb
68
+ </a>
69
+ <br />
70
+ <a href="../files/lib/net/daap/song_rb.html">
71
+ lib/net/daap/song.rb
72
+ </a>
73
+ <br />
74
+ <a href="../files/lib/net/daap_rb.html">
75
+ lib/net/daap.rb
76
+ </a>
77
+ <br />
78
+ </td>
79
+ </tr>
80
+
81
+ </table>
82
+ </div>
83
+ <!-- banner header -->
84
+
85
+ <div id="bodyContent">
86
+
87
+
88
+
89
+ <div id="contextContent">
90
+
91
+
92
+
93
+ </div>
94
+
95
+
96
+ </div>
97
+
98
+
99
+ <!-- if includes -->
100
+
101
+ <div id="section">
102
+
103
+ <div id="class-list">
104
+ <h3 class="section-bar">Classes and Modules</h3>
105
+
106
+ Module <a href="Net/DAAP.html" class="link">Net::DAAP</a><br />
107
+
108
+ </div>
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ <!-- if method_list -->
117
+
118
+
119
+ </div>
120
+
121
+
122
+ <div id="validator-badges">
123
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
124
+ </div>
125
+
126
+ </body>
127
+ </html>
@@ -0,0 +1,168 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Module: Net::DAAP</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Module</strong></td>
53
+ <td class="class-name-in-header">Net::DAAP</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../files/lib/net/daap/database_rb.html">
59
+ lib/net/daap/database.rb
60
+ </a>
61
+ <br />
62
+ <a href="../../files/lib/net/daap/dmap_rb.html">
63
+ lib/net/daap/dmap.rb
64
+ </a>
65
+ <br />
66
+ <a href="../../files/lib/net/daap/playlist_rb.html">
67
+ lib/net/daap/playlist.rb
68
+ </a>
69
+ <br />
70
+ <a href="../../files/lib/net/daap/song_rb.html">
71
+ lib/net/daap/song.rb
72
+ </a>
73
+ <br />
74
+ <a href="../../files/lib/net/daap_rb.html">
75
+ lib/net/daap.rb
76
+ </a>
77
+ <br />
78
+ </td>
79
+ </tr>
80
+
81
+ </table>
82
+ </div>
83
+ <!-- banner header -->
84
+
85
+ <div id="bodyContent">
86
+
87
+
88
+
89
+ <div id="contextContent">
90
+
91
+ <div id="description">
92
+ <h1>Synopsis</h1>
93
+ <p>
94
+ The <a href="DAAP.html">DAAP</a> library is used for browsing an iTunes
95
+ share. Make sure that Digest::M4P is installed before using this library.
96
+ </p>
97
+ <h2>Example</h2>
98
+ <pre>
99
+ require 'rubygems'
100
+ require 'net/daap'
101
+
102
+ daap = Net::DAAP::Client.new('localhost')
103
+ daap.connect do |dsn|
104
+
105
+ daap.databases do |db|
106
+ puts &quot;All songs in the database&quot;
107
+ db.songs do |song|
108
+ puts &quot;#{song.artist} - #{song.name}&quot;
109
+ end
110
+
111
+ puts &quot;Songs for each playlist&quot;
112
+ db.playlists do |pl|
113
+ puts &quot;Playlist name: #{pl.name}&quot;
114
+ pl.songs do |song|
115
+ puts &quot;#{song.artist} - #{song.name}&quot;
116
+ File::open(&quot;dl/#{song.artist} - #{song.name}.#{song.format}&quot;, &quot;w&quot;) do |f|
117
+ f &lt;&lt; song.get
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+ </pre>
124
+
125
+ </div>
126
+
127
+
128
+ </div>
129
+
130
+
131
+ </div>
132
+
133
+
134
+ <!-- if includes -->
135
+
136
+ <div id="section">
137
+
138
+ <div id="class-list">
139
+ <h3 class="section-bar">Classes and Modules</h3>
140
+
141
+ Class <a href="DAAP/Client.html" class="link">Net::DAAP::Client</a><br />
142
+ Class <a href="DAAP/DAAPv2.html" class="link">Net::DAAP::DAAPv2</a><br />
143
+ Class <a href="DAAP/DAAPv3.html" class="link">Net::DAAP::DAAPv3</a><br />
144
+ Class <a href="DAAP/DMAP.html" class="link">Net::DAAP::DMAP</a><br />
145
+ Class <a href="DAAP/Database.html" class="link">Net::DAAP::Database</a><br />
146
+ Class <a href="DAAP/Playlist.html" class="link">Net::DAAP::Playlist</a><br />
147
+ Class <a href="DAAP/Song.html" class="link">Net::DAAP::Song</a><br />
148
+
149
+ </div>
150
+
151
+
152
+
153
+
154
+
155
+
156
+
157
+ <!-- if method_list -->
158
+
159
+
160
+ </div>
161
+
162
+
163
+ <div id="validator-badges">
164
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
165
+ </div>
166
+
167
+ </body>
168
+ </html>
@@ -0,0 +1,269 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>Class: Net::DAAP::Client</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="classHeader">
50
+ <table class="header-table">
51
+ <tr class="top-aligned-row">
52
+ <td><strong>Class</strong></td>
53
+ <td class="class-name-in-header">Net::DAAP::Client</td>
54
+ </tr>
55
+ <tr class="top-aligned-row">
56
+ <td><strong>In:</strong></td>
57
+ <td>
58
+ <a href="../../../files/lib/net/daap_rb.html">
59
+ lib/net/daap.rb
60
+ </a>
61
+ <br />
62
+ </td>
63
+ </tr>
64
+
65
+ <tr class="top-aligned-row">
66
+ <td><strong>Parent:</strong></td>
67
+ <td>
68
+ Object
69
+ </td>
70
+ </tr>
71
+ </table>
72
+ </div>
73
+ <!-- banner header -->
74
+
75
+ <div id="bodyContent">
76
+
77
+
78
+
79
+ <div id="contextContent">
80
+
81
+ <div id="description">
82
+ <h1>Synopsis</h1>
83
+ <p>
84
+ The <a href="Client.html">Client</a> class interacts with the iTunes server
85
+ to fetch lists of songs, databases, and playlists. Each <a
86
+ href="Client.html">Client</a> class can have many <a
87
+ href="Database.html">Database</a>, and each <a
88
+ href="Database.html">Database</a> can have many <a
89
+ href="Playlist.html">Playlist</a>, and many <a href="Song.html">Song</a>.
90
+ See <a href="../DAAP.html">DAAP</a> for a code example.
91
+ </p>
92
+
93
+ </div>
94
+
95
+
96
+ </div>
97
+
98
+ <div id="method-list">
99
+ <h3 class="section-bar">Methods</h3>
100
+
101
+ <div class="name-list">
102
+ <a href="#M000004">connect</a>&nbsp;&nbsp;
103
+ <a href="#M000005">databases</a>&nbsp;&nbsp;
104
+ <a href="#M000009">disconnect</a>&nbsp;&nbsp;
105
+ <a href="#M000006">do_get</a>&nbsp;&nbsp;
106
+ <a href="#M000007">get_song</a>&nbsp;&nbsp;
107
+ <a href="#M000003">new</a>&nbsp;&nbsp;
108
+ <a href="#M000008">unpack_listing</a>&nbsp;&nbsp;
109
+ </div>
110
+ </div>
111
+
112
+ </div>
113
+
114
+
115
+ <!-- if includes -->
116
+
117
+ <div id="section">
118
+
119
+
120
+
121
+
122
+
123
+ <div id="attribute-list">
124
+ <h3 class="section-bar">Attributes</h3>
125
+
126
+ <div class="name-list">
127
+ <table>
128
+ <tr class="top-aligned-row context-row">
129
+ <td class="context-item-name">dmap</td>
130
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
131
+ <td class="context-item-desc"></td>
132
+ </tr>
133
+ </table>
134
+ </div>
135
+ </div>
136
+
137
+
138
+
139
+ <!-- if method_list -->
140
+ <div id="methods">
141
+ <h3 class="section-bar">Public Class methods</h3>
142
+
143
+ <div id="method-M000003" class="method-detail">
144
+ <a name="M000003"></a>
145
+
146
+ <div class="method-heading">
147
+ <a href="Client.src/M000003.html" target="Code" class="method-signature"
148
+ onclick="popupCode('Client.src/M000003.html');return false;">
149
+ <span class="method-name">new</span><span class="method-args">(server_host)</span>
150
+ </a>
151
+ </div>
152
+
153
+ <div class="method-description">
154
+ <p>
155
+ Create a new <a href="Client.html">Client</a> and pass in the host where
156
+ the client will connect.
157
+ </p>
158
+ </div>
159
+ </div>
160
+
161
+ <h3 class="section-bar">Public Instance methods</h3>
162
+
163
+ <div id="method-M000004" class="method-detail">
164
+ <a name="M000004"></a>
165
+
166
+ <div class="method-heading">
167
+ <a href="Client.src/M000004.html" target="Code" class="method-signature"
168
+ onclick="popupCode('Client.src/M000004.html');return false;">
169
+ <span class="method-name">connect</span><span class="method-args">() {|@dsn| ...}</span>
170
+ </a>
171
+ </div>
172
+
173
+ <div class="method-description">
174
+ <p>
175
+ Connects to the iTunes server. This method should be called right after
176
+ construction. See <a href="../DAAP.html">DAAP</a> for an example.
177
+ </p>
178
+ </div>
179
+ </div>
180
+
181
+ <div id="method-M000005" class="method-detail">
182
+ <a name="M000005"></a>
183
+
184
+ <div class="method-heading">
185
+ <a href="Client.src/M000005.html" target="Code" class="method-signature"
186
+ onclick="popupCode('Client.src/M000005.html');return false;">
187
+ <span class="method-name">databases</span><span class="method-args">() {|db| ...}</span>
188
+ </a>
189
+ </div>
190
+
191
+ <div class="method-description">
192
+ <p>
193
+ Returns the databases found on the iTunes server.
194
+ </p>
195
+ </div>
196
+ </div>
197
+
198
+ <div id="method-M000009" class="method-detail">
199
+ <a name="M000009"></a>
200
+
201
+ <div class="method-heading">
202
+ <a href="Client.src/M000009.html" target="Code" class="method-signature"
203
+ onclick="popupCode('Client.src/M000009.html');return false;">
204
+ <span class="method-name">disconnect</span><span class="method-args">()</span>
205
+ </a>
206
+ </div>
207
+
208
+ <div class="method-description">
209
+ <p>
210
+ Disconnects from the <a href="../DAAP.html">DAAP</a> server
211
+ </p>
212
+ </div>
213
+ </div>
214
+
215
+ <div id="method-M000006" class="method-detail">
216
+ <a name="M000006"></a>
217
+
218
+ <div class="method-heading">
219
+ <a href="Client.src/M000006.html" target="Code" class="method-signature"
220
+ onclick="popupCode('Client.src/M000006.html');return false;">
221
+ <span class="method-name">do_get</span><span class="method-args">(request, &amp;block)</span>
222
+ </a>
223
+ </div>
224
+
225
+ <div class="method-description">
226
+ </div>
227
+ </div>
228
+
229
+ <div id="method-M000007" class="method-detail">
230
+ <a name="M000007"></a>
231
+
232
+ <div class="method-heading">
233
+ <a href="Client.src/M000007.html" target="Code" class="method-signature"
234
+ onclick="popupCode('Client.src/M000007.html');return false;">
235
+ <span class="method-name">get_song</span><span class="method-args">(request, &amp;block)</span>
236
+ </a>
237
+ </div>
238
+
239
+ <div class="method-description">
240
+ </div>
241
+ </div>
242
+
243
+ <div id="method-M000008" class="method-detail">
244
+ <a name="M000008"></a>
245
+
246
+ <div class="method-heading">
247
+ <a href="Client.src/M000008.html" target="Code" class="method-signature"
248
+ onclick="popupCode('Client.src/M000008.html');return false;">
249
+ <span class="method-name">unpack_listing</span><span class="method-args">(listing) {|record| ...}</span>
250
+ </a>
251
+ </div>
252
+
253
+ <div class="method-description">
254
+ </div>
255
+ </div>
256
+
257
+
258
+ </div>
259
+
260
+
261
+ </div>
262
+
263
+
264
+ <div id="validator-badges">
265
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
266
+ </div>
267
+
268
+ </body>
269
+ </html>