daapclient 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. data/README +63 -0
  2. data/doc/classes/Net/DAAP/Client.html +251 -0
  3. data/doc/classes/Net/DAAP/Client.src/M000003.html +20 -0
  4. data/doc/classes/Net/DAAP/Client.src/M000004.html +25 -0
  5. data/doc/classes/Net/DAAP/Client.src/M000005.html +33 -0
  6. data/doc/classes/Net/DAAP/Client.src/M000006.html +37 -0
  7. data/doc/classes/Net/DAAP/Client.src/M000007.html +20 -0
  8. data/doc/classes/Net/DAAP/Client.src/M000008.html +24 -0
  9. data/doc/classes/Net/DAAP/DAAPv2.html +165 -0
  10. data/doc/classes/Net/DAAP/DAAPv2.src/M000015.html +30 -0
  11. data/doc/classes/Net/DAAP/DAAPv2.src/M000016.html +21 -0
  12. data/doc/classes/Net/DAAP/DAAPv3.html +178 -0
  13. data/doc/classes/Net/DAAP/DAAPv3.src/M000017.html +30 -0
  14. data/doc/classes/Net/DAAP/DAAPv3.src/M000018.html +23 -0
  15. data/doc/classes/Net/DAAP/DMAP.html +189 -0
  16. data/doc/classes/Net/DAAP/DMAP.src/M000012.html +20 -0
  17. data/doc/classes/Net/DAAP/DMAP.src/M000013.html +18 -0
  18. data/doc/classes/Net/DAAP/DMAP.src/M000014.html +24 -0
  19. data/doc/classes/Net/DAAP/Database.html +224 -0
  20. data/doc/classes/Net/DAAP/Database.src/M000009.html +25 -0
  21. data/doc/classes/Net/DAAP/Database.src/M000010.html +21 -0
  22. data/doc/classes/Net/DAAP/Database.src/M000011.html +35 -0
  23. data/doc/classes/Net/DAAP/Playlist.html +192 -0
  24. data/doc/classes/Net/DAAP/Playlist.src/M000001.html +24 -0
  25. data/doc/classes/Net/DAAP/Playlist.src/M000002.html +30 -0
  26. data/doc/classes/Net/DAAP/Song.html +208 -0
  27. data/doc/classes/Net/DAAP/Song.src/M000019.html +27 -0
  28. data/doc/classes/Net/DAAP/Song.src/M000020.html +19 -0
  29. data/doc/classes/Net/DAAP.html +168 -0
  30. data/doc/classes/Net.html +127 -0
  31. data/doc/created.rid +1 -0
  32. data/doc/files/CHANGELOG.html +110 -0
  33. data/doc/files/LICENSE.html +531 -0
  34. data/doc/files/README.html +176 -0
  35. data/doc/files/lib/net/daap/database_rb.html +101 -0
  36. data/doc/files/lib/net/daap/dmap_rb.html +101 -0
  37. data/doc/files/lib/net/daap/playlist_rb.html +101 -0
  38. data/doc/files/lib/net/daap/song_rb.html +101 -0
  39. data/doc/files/lib/net/daap_rb.html +114 -0
  40. data/doc/fr_class_index.html +35 -0
  41. data/doc/fr_file_index.html +34 -0
  42. data/doc/fr_method_index.html +46 -0
  43. data/doc/index.html +24 -0
  44. data/doc/rdoc-style.css +208 -0
  45. data/lib/CVS/Entries +1 -0
  46. data/lib/CVS/Repository +1 -0
  47. data/lib/CVS/Root +1 -0
  48. data/lib/net/CVS/Entries +2 -0
  49. data/lib/net/CVS/Repository +1 -0
  50. data/lib/net/CVS/Root +1 -0
  51. data/lib/net/daap/CVS/Entries +5 -0
  52. data/lib/net/daap/CVS/Repository +1 -0
  53. data/lib/net/daap/CVS/Root +1 -0
  54. data/lib/net/daap/database.rb +69 -0
  55. data/lib/net/daap/dmap.rb +575 -0
  56. data/lib/net/daap/playlist.rb +36 -0
  57. data/lib/net/daap/song.rb +27 -0
  58. data/lib/net/daap.rb +234 -0
  59. data/test/CVS/Entries +4 -0
  60. data/test/CVS/Repository +1 -0
  61. data/test/CVS/Root +1 -0
  62. data/test/data/CVS/Entries +1 -0
  63. data/test/data/CVS/Repository +1 -0
  64. data/test/data/CVS/Root +1 -0
  65. data/test/data/mt-daapd/079aca35773150da9fd98db10c7fd0c0.txt +0 -0
  66. data/test/data/mt-daapd/2972f65088b42a06b5d3ca089d71791d.txt +0 -0
  67. data/test/data/mt-daapd/440c2217e6207c54c317c296f71f9769.txt +0 -0
  68. data/test/data/mt-daapd/4d1ce9f941cbd823ed06f1f1baa5a3b9.txt +0 -0
  69. data/test/data/mt-daapd/7bded8b540fd082f102d25e181b47bc4.txt +0 -0
  70. data/test/data/mt-daapd/CVS/Entries +11 -0
  71. data/test/data/mt-daapd/CVS/Repository +1 -0
  72. data/test/data/mt-daapd/CVS/Root +1 -0
  73. data/test/data/mt-daapd/b3e894b87111bdba88e4765967f4b45a.txt +0 -0
  74. data/test/data/mt-daapd/d56b699830e77ba53855679cb1d252da.txt +0 -0
  75. data/test/data/mt-daapd/e61ce3062cb76770658896b778ad06cd.txt +0 -0
  76. data/test/data/mt-daapd/e9a8e709c2116651157182f130207048.txt +0 -0
  77. data/test/data/mt-daapd/f9073959a0afacebfab7e3bf19c2714a.txt +0 -0
  78. data/test/tc_client.rb +148 -0
  79. data/test/tc_protocol.rb +49 -0
  80. data/test/ts_daap.rb +6 -0
  81. metadata +148 -0
data/README ADDED
@@ -0,0 +1,63 @@
1
+ = Net::DAAP
2
+
3
+ Version 0.0.1
4
+
5
+ This library is used for browsing iTunes DAAP servers.
6
+
7
+ Most of this is based off the work in the perl version by Richard Clamp which
8
+ can be found here:
9
+
10
+ http://search.cpan.org/~rclamp/
11
+
12
+ Ruby version is by Aaron Patterson <aaronp@rubyforge.org>
13
+
14
+ == Installation
15
+
16
+ Make sure that Digest::M4P is installed before using this package. Digest::M4P
17
+ is available on the daap client ruby forge site:
18
+
19
+ http://rubyforge.org/frs/?group_id=1155
20
+
21
+ Digest::M4P has not been turned in to a Ruby gem as of this writing.
22
+
23
+ After that, just install the gem:
24
+
25
+ sudo gem install daapclient
26
+
27
+ == Example Usage
28
+
29
+ require 'net/daap'
30
+
31
+ daap = Net::DAAP::Client.new('localhost')
32
+ daap.connect do |dsn|
33
+ daap.databases do |db|
34
+ puts "All songs in the database"
35
+ db.songs do |song|
36
+ puts "#{song.artist} - #{song.name}"
37
+ end
38
+
39
+ puts "Songs for each playlist"
40
+ db.playlists do |pl|
41
+ puts "Playlist name: #{pl.name}"
42
+ pl.songs do |song|
43
+ puts "#{song.artist} - #{song.name}"
44
+ end
45
+ end
46
+ end
47
+ end
48
+
49
+ == Acknowledgements
50
+
51
+ The library is mostly a port of the Perl library, and owes most of its
52
+ communication logic to the original Perl version by Richard Clamp.
53
+
54
+ == Author
55
+
56
+ This Ruby version is Copyright (c) Aaron Patterson 2005
57
+ It also comes with a shameless plug for employment coding Ruby, my most
58
+ favorite language! ;-)
59
+
60
+ == License
61
+
62
+ This library is distributed un the GPL. Please see the LICENSE file.
63
+
@@ -0,0 +1,251 @@
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="#M000006">do_get</a>&nbsp;&nbsp;
105
+ <a href="#M000007">get_song</a>&nbsp;&nbsp;
106
+ <a href="#M000003">new</a>&nbsp;&nbsp;
107
+ <a href="#M000008">unpack_listing</a>&nbsp;&nbsp;
108
+ </div>
109
+ </div>
110
+
111
+ </div>
112
+
113
+
114
+ <!-- if includes -->
115
+
116
+ <div id="section">
117
+
118
+
119
+
120
+
121
+
122
+ <div id="attribute-list">
123
+ <h3 class="section-bar">Attributes</h3>
124
+
125
+ <div class="name-list">
126
+ <table>
127
+ <tr class="top-aligned-row context-row">
128
+ <td class="context-item-name">dmap</td>
129
+ <td class="context-item-value">&nbsp;[R]&nbsp;</td>
130
+ <td class="context-item-desc"></td>
131
+ </tr>
132
+ </table>
133
+ </div>
134
+ </div>
135
+
136
+
137
+
138
+ <!-- if method_list -->
139
+ <div id="methods">
140
+ <h3 class="section-bar">Public Class methods</h3>
141
+
142
+ <div id="method-M000003" class="method-detail">
143
+ <a name="M000003"></a>
144
+
145
+ <div class="method-heading">
146
+ <a href="Client.src/M000003.html" target="Code" class="method-signature"
147
+ onclick="popupCode('Client.src/M000003.html');return false;">
148
+ <span class="method-name">new</span><span class="method-args">(server_host)</span>
149
+ </a>
150
+ </div>
151
+
152
+ <div class="method-description">
153
+ <p>
154
+ Create a new <a href="Client.html">Client</a> and pass in the host where
155
+ the client will connect.
156
+ </p>
157
+ </div>
158
+ </div>
159
+
160
+ <h3 class="section-bar">Public Instance methods</h3>
161
+
162
+ <div id="method-M000004" class="method-detail">
163
+ <a name="M000004"></a>
164
+
165
+ <div class="method-heading">
166
+ <a href="Client.src/M000004.html" target="Code" class="method-signature"
167
+ onclick="popupCode('Client.src/M000004.html');return false;">
168
+ <span class="method-name">connect</span><span class="method-args">() {|@dsn| ...}</span>
169
+ </a>
170
+ </div>
171
+
172
+ <div class="method-description">
173
+ <p>
174
+ Connects to the iTunes server. This method should be called right after
175
+ construction. See <a href="../DAAP.html">DAAP</a> for an example.
176
+ </p>
177
+ </div>
178
+ </div>
179
+
180
+ <div id="method-M000005" class="method-detail">
181
+ <a name="M000005"></a>
182
+
183
+ <div class="method-heading">
184
+ <a href="Client.src/M000005.html" target="Code" class="method-signature"
185
+ onclick="popupCode('Client.src/M000005.html');return false;">
186
+ <span class="method-name">databases</span><span class="method-args">() {|Database.new( :db_info =&gt; value, :daap =&gt; self )| ...}</span>
187
+ </a>
188
+ </div>
189
+
190
+ <div class="method-description">
191
+ <p>
192
+ Returns the databases found on the iTunes server.
193
+ </p>
194
+ </div>
195
+ </div>
196
+
197
+ <div id="method-M000006" class="method-detail">
198
+ <a name="M000006"></a>
199
+
200
+ <div class="method-heading">
201
+ <a href="Client.src/M000006.html" target="Code" class="method-signature"
202
+ onclick="popupCode('Client.src/M000006.html');return false;">
203
+ <span class="method-name">do_get</span><span class="method-args">(request)</span>
204
+ </a>
205
+ </div>
206
+
207
+ <div class="method-description">
208
+ </div>
209
+ </div>
210
+
211
+ <div id="method-M000007" class="method-detail">
212
+ <a name="M000007"></a>
213
+
214
+ <div class="method-heading">
215
+ <a href="Client.src/M000007.html" target="Code" class="method-signature"
216
+ onclick="popupCode('Client.src/M000007.html');return false;">
217
+ <span class="method-name">get_song</span><span class="method-args">(request)</span>
218
+ </a>
219
+ </div>
220
+
221
+ <div class="method-description">
222
+ </div>
223
+ </div>
224
+
225
+ <div id="method-M000008" class="method-detail">
226
+ <a name="M000008"></a>
227
+
228
+ <div class="method-heading">
229
+ <a href="Client.src/M000008.html" target="Code" class="method-signature"
230
+ onclick="popupCode('Client.src/M000008.html');return false;">
231
+ <span class="method-name">unpack_listing</span><span class="method-args">(listing) {|record| ...}</span>
232
+ </a>
233
+ </div>
234
+
235
+ <div class="method-description">
236
+ </div>
237
+ </div>
238
+
239
+
240
+ </div>
241
+
242
+
243
+ </div>
244
+
245
+
246
+ <div id="validator-badges">
247
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
248
+ </div>
249
+
250
+ </body>
251
+ </html>
@@ -0,0 +1,20 @@
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>
7
+ <head>
8
+ <title>new (Net::DAAP::Client)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/net/daap.rb, line 52</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>(<span class="ruby-identifier">server_host</span>)
15
+ <span class="ruby-ivar">@server_host</span> = <span class="ruby-identifier">server_host</span>
16
+ <span class="ruby-ivar">@server_port</span> = <span class="ruby-value">3689</span>
17
+ <span class="ruby-ivar">@debug</span> = <span class="ruby-value">0</span>
18
+ <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,25 @@
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>
7
+ <head>
8
+ <title>connect (Net::DAAP::Client)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/net/daap.rb, line 60</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">connect</span>(<span class="ruby-operator">&amp;</span><span class="ruby-identifier">connection</span>)
15
+ <span class="ruby-ivar">@http_client</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">HTTP</span>.<span class="ruby-identifier">start</span>(<span class="ruby-ivar">@server_host</span>, <span class="ruby-ivar">@server_port</span>)
16
+ <span class="ruby-identifier">find_validator</span>
17
+ <span class="ruby-ivar">@dmap</span> = <span class="ruby-constant">Net</span><span class="ruby-operator">::</span><span class="ruby-constant">DAAP</span><span class="ruby-operator">::</span><span class="ruby-constant">DMAP</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">:daap</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span>)
18
+ <span class="ruby-identifier">load_server_info</span>
19
+ <span class="ruby-ivar">@connected</span> = <span class="ruby-value">1</span>
20
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-ivar">@dsn</span>
21
+ <span class="ruby-identifier">disconnect</span>
22
+ <span class="ruby-ivar">@connected</span> = <span class="ruby-value">0</span>
23
+ <span class="ruby-keyword kw">end</span></pre>
24
+ </body>
25
+ </html>
@@ -0,0 +1,33 @@
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>
7
+ <head>
8
+ <title>databases (Net::DAAP::Client)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/net/daap.rb, line 72</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">databases</span>
15
+ <span class="ruby-keyword kw">return</span> <span class="ruby-identifier">error</span>(<span class="ruby-value str">&quot;Not connected, can't fetch databases&quot;</span>) <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@connected</span>
16
+
17
+ <span class="ruby-identifier">listings</span> = <span class="ruby-ivar">@dmap</span>.<span class="ruby-identifier">find</span>(<span class="ruby-identifier">do_get</span>(<span class="ruby-value str">&quot;databases&quot;</span>),
18
+ <span class="ruby-value str">&quot;daap.serverdatabases/dmap.listing&quot;</span>)
19
+ <span class="ruby-comment cmt"># FIXME check the value of listing</span>
20
+ <span class="ruby-ivar">@databases</span> = []
21
+ <span class="ruby-identifier">unpack_listing</span>(<span class="ruby-identifier">listings</span>) <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">value</span><span class="ruby-operator">|</span>
22
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">block_given?</span>
23
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-constant">Database</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">:db_info</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">value</span>,
24
+ <span class="ruby-identifier">:daap</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span> )
25
+ <span class="ruby-keyword kw">else</span>
26
+ <span class="ruby-ivar">@databases</span> <span class="ruby-operator">&lt;&lt;</span> <span class="ruby-constant">Database</span>.<span class="ruby-identifier">new</span>( <span class="ruby-identifier">:db_info</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-identifier">value</span>,
27
+ <span class="ruby-identifier">:daap</span> =<span class="ruby-operator">&gt;</span> <span class="ruby-keyword kw">self</span> )
28
+ <span class="ruby-keyword kw">end</span>
29
+ <span class="ruby-keyword kw">end</span>
30
+ <span class="ruby-ivar">@databases</span>
31
+ <span class="ruby-keyword kw">end</span></pre>
32
+ </body>
33
+ </html>
@@ -0,0 +1,37 @@
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>
7
+ <head>
8
+ <title>do_get (Net::DAAP::Client)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/net/daap.rb, line 91</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">do_get</span>(<span class="ruby-identifier">request</span>)
15
+ <span class="ruby-identifier">debug</span>(<span class="ruby-value str">&quot;do_get&quot;</span>)
16
+ <span class="ruby-identifier">url</span> = <span class="ruby-constant">String</span>.<span class="ruby-identifier">new</span>(<span class="ruby-value str">'/'</span> <span class="ruby-operator">+</span> <span class="ruby-identifier">request</span>)
17
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@session_id</span>
18
+ <span class="ruby-identifier">url</span> <span class="ruby-operator">+=</span> <span class="ruby-identifier">url</span> <span class="ruby-operator">=~</span> <span class="ruby-regexp re">/\?/</span> <span class="ruby-operator">?</span> <span class="ruby-value str">&quot;&amp;&quot;</span> <span class="ruby-operator">:</span> <span class="ruby-value str">&quot;?&quot;</span>
19
+ <span class="ruby-identifier">url</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;session-id=#{@session_id}&quot;</span>
20
+ <span class="ruby-keyword kw">end</span>
21
+
22
+ <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@revision</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">request</span> <span class="ruby-operator">!=</span> <span class="ruby-value str">&quot;logout&quot;</span>
23
+ <span class="ruby-identifier">url</span> <span class="ruby-operator">+=</span> <span class="ruby-node">&quot;&amp;revision-number=#{@revision}&quot;</span>
24
+ <span class="ruby-keyword kw">end</span>
25
+ <span class="ruby-identifier">debug</span>(<span class="ruby-identifier">url</span>)
26
+
27
+ <span class="ruby-identifier">res</span> = <span class="ruby-ivar">@http_client</span>.<span class="ruby-identifier">get</span>(<span class="ruby-identifier">url</span>, <span class="ruby-identifier">request_headers</span>(<span class="ruby-identifier">url</span>))
28
+
29
+ <span class="ruby-identifier">content_type</span> = <span class="ruby-identifier">res</span>.<span class="ruby-identifier">header</span>[<span class="ruby-value str">'content-type'</span>]
30
+ <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">request</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/(?:\/items\/\d+\.|logout)/</span> <span class="ruby-operator">&amp;&amp;</span> <span class="ruby-identifier">content_type</span> <span class="ruby-operator">!~</span> <span class="ruby-regexp re">/dmap/</span>
31
+ <span class="ruby-identifier">raise</span> <span class="ruby-value str">&quot;Broken response&quot;</span>
32
+ <span class="ruby-keyword kw">end</span>
33
+
34
+ <span class="ruby-identifier">res</span>.<span class="ruby-identifier">body</span>
35
+ <span class="ruby-keyword kw">end</span></pre>
36
+ </body>
37
+ </html>
@@ -0,0 +1,20 @@
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>
7
+ <head>
8
+ <title>get_song (Net::DAAP::Client)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/net/daap.rb, line 114</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">get_song</span>(<span class="ruby-identifier">request</span>)
15
+ <span class="ruby-ivar">@request_id</span> = <span class="ruby-value">1</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-ivar">@request_id</span>
16
+ <span class="ruby-ivar">@request_id</span> <span class="ruby-operator">+=</span> <span class="ruby-value">1</span> <span class="ruby-keyword kw">if</span> <span class="ruby-ivar">@request_id</span>
17
+ <span class="ruby-identifier">do_get</span>(<span class="ruby-identifier">request</span>)
18
+ <span class="ruby-keyword kw">end</span></pre>
19
+ </body>
20
+ </html>
@@ -0,0 +1,24 @@
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>
7
+ <head>
8
+ <title>unpack_listing (Net::DAAP::Client)</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
11
+ </head>
12
+ <body class="standalone-code">
13
+ <pre><span class="ruby-comment cmt"># File lib/net/daap.rb, line 120</span>
14
+ <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">unpack_listing</span>(<span class="ruby-identifier">listing</span>, <span class="ruby-operator">&amp;</span><span class="ruby-identifier">func</span>)
15
+ <span class="ruby-identifier">listing</span>.<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">item</span><span class="ruby-operator">|</span>
16
+ <span class="ruby-identifier">record</span> = <span class="ruby-constant">Hash</span>.<span class="ruby-identifier">new</span>
17
+ <span class="ruby-identifier">item</span>[<span class="ruby-value">1</span>].<span class="ruby-identifier">each</span> <span class="ruby-keyword kw">do</span> <span class="ruby-operator">|</span><span class="ruby-identifier">pair_ref</span><span class="ruby-operator">|</span>
18
+ <span class="ruby-identifier">record</span>[<span class="ruby-identifier">pair_ref</span>[<span class="ruby-value">0</span>]] = <span class="ruby-identifier">pair_ref</span>[<span class="ruby-value">1</span>]
19
+ <span class="ruby-keyword kw">end</span>
20
+ <span class="ruby-keyword kw">yield</span> <span class="ruby-identifier">record</span>
21
+ <span class="ruby-keyword kw">end</span>
22
+ <span class="ruby-keyword kw">end</span></pre>
23
+ </body>
24
+ </html>
@@ -0,0 +1,165 @@
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::DAAPv2</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::DAAPv2</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
+ <p>
83
+ This class is used for generating a <a href="Client.html">Client</a>-<a
84
+ href="../DAAP.html">DAAP</a>-Validation header for iTunes version 4.2
85
+ servers.
86
+ </p>
87
+
88
+ </div>
89
+
90
+
91
+ </div>
92
+
93
+ <div id="method-list">
94
+ <h3 class="section-bar">Methods</h3>
95
+
96
+ <div class="name-list">
97
+ <a href="#M000015">new</a>&nbsp;&nbsp;
98
+ <a href="#M000016">validate</a>&nbsp;&nbsp;
99
+ </div>
100
+ </div>
101
+
102
+ </div>
103
+
104
+
105
+ <!-- if includes -->
106
+
107
+ <div id="section">
108
+
109
+
110
+
111
+
112
+
113
+
114
+
115
+
116
+ <!-- if method_list -->
117
+ <div id="methods">
118
+ <h3 class="section-bar">Public Class methods</h3>
119
+
120
+ <div id="method-M000015" class="method-detail">
121
+ <a name="M000015"></a>
122
+
123
+ <div class="method-heading">
124
+ <a href="DAAPv2.src/M000015.html" target="Code" class="method-signature"
125
+ onclick="popupCode('DAAPv2.src/M000015.html');return false;">
126
+ <span class="method-name">new</span><span class="method-args">()</span>
127
+ </a>
128
+ </div>
129
+
130
+ <div class="method-description">
131
+ </div>
132
+ </div>
133
+
134
+ <h3 class="section-bar">Public Instance methods</h3>
135
+
136
+ <div id="method-M000016" class="method-detail">
137
+ <a name="M000016"></a>
138
+
139
+ <div class="method-heading">
140
+ <a href="DAAPv2.src/M000016.html" target="Code" class="method-signature"
141
+ onclick="popupCode('DAAPv2.src/M000016.html');return false;">
142
+ <span class="method-name">validate</span><span class="method-args">(path, select = 2, req_id = nil)</span>
143
+ </a>
144
+ </div>
145
+
146
+ <div class="method-description">
147
+ <p>
148
+ Returns a validation header based on MD5
149
+ </p>
150
+ </div>
151
+ </div>
152
+
153
+
154
+ </div>
155
+
156
+
157
+ </div>
158
+
159
+
160
+ <div id="validator-badges">
161
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
162
+ </div>
163
+
164
+ </body>
165
+ </html>