Merge lp:~simonschneegans/do-plugins/grooveshark into lp:do-plugins
- grooveshark
- Merge into trunk
Status: | Needs review |
---|---|
Proposed branch: | lp:~simonschneegans/do-plugins/grooveshark |
Merge into: | lp:do-plugins |
Diff against target: |
548 lines (+377/-10) 17 files modified
Baconator/Baconator.mdp (+1/-1) Banshee/Banshee.mdp (+1/-1) Chromium/Chromium.mdp (+1/-1) DoPlugins.mds (+4/-0) Evolution/Evolution.mdp (+1/-1) GNOME-Calculator/GNOME-Calculator.mdp (+1/-1) Grooveshark/Grooveshark.mdp (+35/-0) Grooveshark/Grooveshark.mds (+16/-0) Grooveshark/Resources/Grooveshark.addin.xml (+28/-0) Grooveshark/Resources/icons/grooveshark.svg (+65/-0) Grooveshark/src/GroovesharkPlayAction.cs (+72/-0) Grooveshark/src/GroovesharkSearchAction.cs (+147/-0) OpenSearch/OpenSearch.mdp (+1/-1) Pastebin/Pastebin.mdp (+1/-1) Skype/Skype.mdp (+1/-1) SqueezeCenter/SqueezeCenterPlugin.mdp (+1/-1) WindowManager/WindowManager.mdp (+1/-1) |
To merge this branch: | bzr merge lp:~simonschneegans/do-plugins/grooveshark |
Related bugs: |
Reviewer | Review Type | Date Requested | Status |
---|---|---|---|
Do Plugins Team | Pending | ||
Review via email: mp+21155@code.launchpad.net |
Commit message
Description of the change
New Plugin: Grooveshark
I wrote a plugin which searches the well-known song-streaming site "www.grooveshar
In order to use this plugin just enter the name, artist and/or album of the song and choose "Play on Grooveshark" or "Search Grooveshark".
Since this is the first "application" I wrote there might be a lot of stupid mistakes and much strange stuff inside, but for me it worked like a charme and I don't see any bugs anymore, so I decided to propose to merge!
Unmerged revisions
- 683. By Simon Schneegans <simon@simon-laptop>
-
Reverted some changes done to unrelated files
- 682. By Simon Schneegans <simon@simon-laptop>
-
Corrected some information in the addin.xml file
- 681. By Simon Schneegans <simon@simon-laptop>
-
Cleaned up files and dependencies
- 680. By Simon Schneegans <simon@simon-laptop>
-
Initial import
Preview Diff
1 | === modified file 'Baconator/Baconator.mdp' |
2 | --- Baconator/Baconator.mdp 2009-06-29 08:47:41 +0000 |
3 | +++ Baconator/Baconator.mdp 2010-03-24 12:58:27 +0000 |
4 | @@ -25,4 +25,4 @@ |
5 | <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" /> |
6 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
7 | </References> |
8 | -</Project> |
9 | \ No newline at end of file |
10 | +</Project> |
11 | |
12 | === modified file 'Banshee/Banshee.mdp' |
13 | --- Banshee/Banshee.mdp 2009-06-29 08:47:41 +0000 |
14 | +++ Banshee/Banshee.mdp 2010-03-24 12:58:27 +0000 |
15 | @@ -42,4 +42,4 @@ |
16 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
17 | </References> |
18 | <Deployment.LinuxDeployData scriptName="banshee-1" /> |
19 | -</Project> |
20 | \ No newline at end of file |
21 | +</Project> |
22 | |
23 | === modified file 'Chromium/Chromium.mdp' |
24 | --- Chromium/Chromium.mdp 2009-07-25 05:33:43 +0000 |
25 | +++ Chromium/Chromium.mdp 2010-03-24 12:58:27 +0000 |
26 | @@ -23,4 +23,4 @@ |
27 | <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.dll" /> |
28 | <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" /> |
29 | </References> |
30 | -</Project> |
31 | \ No newline at end of file |
32 | +</Project> |
33 | |
34 | === modified file 'DoPlugins.mds' |
35 | --- DoPlugins.mds 2009-11-08 23:58:01 +0000 |
36 | +++ DoPlugins.mds 2010-03-24 12:58:27 +0000 |
37 | @@ -78,6 +78,7 @@ |
38 | <Entry build="True" name="Baconator" configuration="Debug" /> |
39 | <Entry build="True" name="Chromium" configuration="Debug" /> |
40 | <Entry build="True" name="GNOME-Calculator" configuration="Debug" /> |
41 | + <Entry build="True" name="Grooveshark" configuration="Debug" /> |
42 | </Configuration> |
43 | <Configuration name="Release" ctype="CombineConfiguration"> |
44 | <Entry build="True" name="Rhythmbox" configuration="Release" /> |
45 | @@ -157,6 +158,7 @@ |
46 | <Entry build="True" name="Baconator" configuration="Release" /> |
47 | <Entry build="True" name="Chromium" configuration="Release" /> |
48 | <Entry build="True" name="GNOME-Calculator" configuration="Release" /> |
49 | + <Entry build="True" name="Grooveshark" configuration="Release" /> |
50 | </Configuration> |
51 | </Configurations> |
52 | <StartMode startupentry="Rhythmbox" single="True"> |
53 | @@ -237,6 +239,7 @@ |
54 | <Execute type="None" entry="Baconator" /> |
55 | <Execute type="None" entry="Chromium" /> |
56 | <Execute type="None" entry="GNOME-Calculator" /> |
57 | + <Execute type="None" entry="Grooveshark" /> |
58 | </StartMode> |
59 | <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" /> |
60 | <Entries> |
61 | @@ -317,5 +320,6 @@ |
62 | <Entry filename="Baconator/Baconator.mdp" /> |
63 | <Entry filename="Chromium/Chromium.mdp" /> |
64 | <Entry filename="GNOME-Calculator/GNOME-Calculator.mdp" /> |
65 | + <Entry filename="Grooveshark/Grooveshark.mdp" /> |
66 | </Entries> |
67 | </Combine> |
68 | \ No newline at end of file |
69 | |
70 | === modified file 'Evolution/Evolution.mdp' |
71 | --- Evolution/Evolution.mdp 2009-09-28 01:50:31 +0000 |
72 | +++ Evolution/Evolution.mdp 2010-03-24 12:58:27 +0000 |
73 | @@ -26,4 +26,4 @@ |
74 | <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" /> |
75 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
76 | </References> |
77 | -</Project> |
78 | \ No newline at end of file |
79 | +</Project> |
80 | |
81 | === modified file 'GNOME-Calculator/GNOME-Calculator.mdp' |
82 | --- GNOME-Calculator/GNOME-Calculator.mdp 2009-11-08 23:58:01 +0000 |
83 | +++ GNOME-Calculator/GNOME-Calculator.mdp 2010-03-24 12:58:27 +0000 |
84 | @@ -26,4 +26,4 @@ |
85 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
86 | <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" /> |
87 | </References> |
88 | -</Project> |
89 | +</Project> |
90 | \ No newline at end of file |
91 | |
92 | === added directory 'Grooveshark' |
93 | === added file 'Grooveshark/Grooveshark.mdp' |
94 | --- Grooveshark/Grooveshark.mdp 1970-01-01 00:00:00 +0000 |
95 | +++ Grooveshark/Grooveshark.mdp 2010-03-24 12:58:27 +0000 |
96 | @@ -0,0 +1,35 @@ |
97 | +<Project name="Grooveshark" fileversion="2.0" language="C#" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject"> |
98 | + <Configurations active="Debug"> |
99 | + <Configuration name="Debug" ctype="DotNetProjectConfiguration"> |
100 | + <Output directory="bin/Debug" assembly="Grooveshark" /> |
101 | + <Build debugmode="True" target="Library" /> |
102 | + <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_2_0" /> |
103 | + <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
104 | + </Configuration> |
105 | + <Configuration name="Release" ctype="DotNetProjectConfiguration"> |
106 | + <Output directory="bin/Release" assembly="Grooveshark" /> |
107 | + <Build debugmode="False" target="Library" /> |
108 | + <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_2_0" /> |
109 | + <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" /> |
110 | + </Configuration> |
111 | + </Configurations> |
112 | + <Contents> |
113 | + <File name="." subtype="Directory" buildaction="Compile" /> |
114 | + <File name="src" subtype="Directory" buildaction="Compile" /> |
115 | + <File name="src/GroovesharkSearchAction.cs" subtype="Code" buildaction="Compile" /> |
116 | + <File name="Resources/Grooveshark.addin.xml" subtype="Code" buildaction="EmbedAsResource" /> |
117 | + <File name="src/GroovesharkPlayAction.cs" subtype="Code" buildaction="Compile" /> |
118 | + <File name="Resources/icons" subtype="Directory" buildaction="Compile" /> |
119 | + <File name="Resources/icons/grooveshark.svg" subtype="Code" buildaction="EmbedAsResource" /> |
120 | + </Contents> |
121 | + <References> |
122 | + <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
123 | + <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" /> |
124 | + <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
125 | + <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
126 | + <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" /> |
127 | + <ProjectReference type="Gac" localcopy="True" refto="Do.Platform.Linux, Version=0.9.0.0, Culture=neutral" /> |
128 | + <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
129 | + <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" /> |
130 | + </References> |
131 | +</Project> |
132 | \ No newline at end of file |
133 | |
134 | === added file 'Grooveshark/Grooveshark.mds' |
135 | --- Grooveshark/Grooveshark.mds 1970-01-01 00:00:00 +0000 |
136 | +++ Grooveshark/Grooveshark.mds 2010-03-24 12:58:27 +0000 |
137 | @@ -0,0 +1,16 @@ |
138 | +<Combine fileversion="2.0"> |
139 | + <Configurations active="Debug"> |
140 | + <Configuration name="Debug" ctype="CombineConfiguration"> |
141 | + <Entry build="True" name="Grooveshark" configuration="Debug" /> |
142 | + </Configuration> |
143 | + <Configuration name="Release" ctype="CombineConfiguration"> |
144 | + <Entry build="True" name="Grooveshark" configuration="Release" /> |
145 | + </Configuration> |
146 | + </Configurations> |
147 | + <StartMode startupentry="Grooveshark" single="True"> |
148 | + <Execute type="None" entry="Grooveshark" /> |
149 | + </StartMode> |
150 | + <Entries> |
151 | + <Entry filename="Grooveshark.mdp" /> |
152 | + </Entries> |
153 | +</Combine> |
154 | |
155 | === added file 'Grooveshark/Grooveshark.pidb' |
156 | Binary files Grooveshark/Grooveshark.pidb 1970-01-01 00:00:00 +0000 and Grooveshark/Grooveshark.pidb 2010-03-24 12:58:27 +0000 differ |
157 | === added directory 'Grooveshark/Resources' |
158 | === added file 'Grooveshark/Resources/Grooveshark.addin.xml' |
159 | --- Grooveshark/Resources/Grooveshark.addin.xml 1970-01-01 00:00:00 +0000 |
160 | +++ Grooveshark/Resources/Grooveshark.addin.xml 2010-03-24 12:58:27 +0000 |
161 | @@ -0,0 +1,28 @@ |
162 | +<Addin |
163 | + id="Grooveshark" |
164 | + namespace="Do" |
165 | + version="0.1" |
166 | + name="Grooveshark" |
167 | + description="Listen to songs from Grooveshark." |
168 | + author="Simon Schneegans" |
169 | + category="Community" |
170 | + defaultEnabled="false" |
171 | + url="http://do.davebsd.com/wiki/Grooveshark_Plugin" |
172 | +> |
173 | + |
174 | + <Runtime> |
175 | + <Import assembly="Grooveshark.dll"/> |
176 | + </Runtime> |
177 | + |
178 | + <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" /> |
179 | + |
180 | + <Dependencies> |
181 | + <Addin id="Universe" version="1.0" /> |
182 | + </Dependencies> |
183 | + |
184 | + <Extension path="/Do/Action"> |
185 | + <Action type="Grooveshark.GroovesharkPlayAction" /> |
186 | + <Action type="Grooveshark.GroovesharkSearchAction" /> |
187 | + </Extension> |
188 | + |
189 | +</Addin> |
190 | \ No newline at end of file |
191 | |
192 | === added directory 'Grooveshark/Resources/icons' |
193 | === added file 'Grooveshark/Resources/icons/grooveshark.svg' |
194 | --- Grooveshark/Resources/icons/grooveshark.svg 1970-01-01 00:00:00 +0000 |
195 | +++ Grooveshark/Resources/icons/grooveshark.svg 2010-03-24 12:58:27 +0000 |
196 | @@ -0,0 +1,65 @@ |
197 | +<?xml version="1.0" encoding="UTF-8" standalone="no"?> |
198 | +<!-- Created with Inkscape (http://www.inkscape.org/) --> |
199 | + |
200 | +<svg |
201 | + xmlns:dc="http://purl.org/dc/elements/1.1/" |
202 | + xmlns:cc="http://creativecommons.org/ns#" |
203 | + xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" |
204 | + xmlns:svg="http://www.w3.org/2000/svg" |
205 | + xmlns="http://www.w3.org/2000/svg" |
206 | + xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd" |
207 | + xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape" |
208 | + id="svg2440" |
209 | + sodipodi:version="0.32" |
210 | + inkscape:version="0.47pre4 r22446" |
211 | + width="48" |
212 | + height="48" |
213 | + version="1.0" |
214 | + sodipodi:docname="Grooveshark.svg" |
215 | + inkscape:output_extension="org.inkscape.output.svg.inkscape"> |
216 | + <metadata |
217 | + id="metadata2445"> |
218 | + <rdf:RDF> |
219 | + <cc:Work |
220 | + rdf:about=""> |
221 | + <dc:format>image/svg+xml</dc:format> |
222 | + <dc:type |
223 | + rdf:resource="http://purl.org/dc/dcmitype/StillImage" /> |
224 | + </cc:Work> |
225 | + </rdf:RDF> |
226 | + </metadata> |
227 | + <defs |
228 | + id="defs2443"> |
229 | + <inkscape:perspective |
230 | + sodipodi:type="inkscape:persp3d" |
231 | + inkscape:vp_x="0 : 526.18109 : 1" |
232 | + inkscape:vp_y="0 : 1000 : 0" |
233 | + inkscape:vp_z="744.09448 : 526.18109 : 1" |
234 | + inkscape:persp3d-origin="372.04724 : 350.78739 : 1" |
235 | + id="perspective2447" /> |
236 | + </defs> |
237 | + <sodipodi:namedview |
238 | + inkscape:window-height="667" |
239 | + inkscape:window-width="640" |
240 | + inkscape:pageshadow="2" |
241 | + inkscape:pageopacity="0.0" |
242 | + guidetolerance="10.0" |
243 | + gridtolerance="10.0" |
244 | + objecttolerance="10.0" |
245 | + borderopacity="1.0" |
246 | + bordercolor="#666666" |
247 | + pagecolor="#ffffff" |
248 | + id="base" |
249 | + showgrid="false" |
250 | + inkscape:zoom="6.5336666" |
251 | + inkscape:cx="17.143647" |
252 | + inkscape:cy="19.048619" |
253 | + inkscape:window-x="88" |
254 | + inkscape:window-y="99" |
255 | + inkscape:current-layer="svg2440" |
256 | + inkscape:window-maximized="0" /> |
257 | + <path |
258 | + style="fill:#000000" |
259 | + d="M 20.078129,45.700055 C 11.395738,44.050382 4.6015564,37.55234 2.4144438,28.806283 c -0.5370952,-2.147791 -0.5370952,-7.644939 0,-9.792731 1.1061948,-4.42357 3.2549413,-8.131281 6.4643582,-11.1543985 11.051152,-10.4096541 28.966422,-6.8440422 35.250792,7.0158385 1.871285,4.127031 2.414534,9.65835 1.369816,13.947354 -1.652336,6.783533 -5.756778,11.938269 -11.877655,14.917065 -1.285546,0.625628 -3.219228,1.353514 -4.297072,1.617527 -2.584093,0.632963 -6.881732,0.792439 -9.246554,0.343117 z M 39.707198,28.401834 c 1.109663,-0.573828 1.458267,-1.534898 1.563275,-4.309802 0.115732,-3.05827 -0.310462,-5.155873 -1.581694,-7.784615 C 37.481503,11.743045 33.785306,8.5797572 28.863573,7.0429524 27.36934,6.5763808 26.680219,6.5052362 23.791366,6.5192977 c -3.014382,0.014664 -3.524377,0.078251 -5.187484,0.6466811 -2.698708,0.9223877 -4.815376,2.2656778 -6.916647,4.3894782 -2.7093061,2.738354 -4.2327623,5.594661 -4.8604086,9.112715 -0.602685,3.378142 -0.3362445,5.603633 0.776001,6.481689 1.4902192,1.176445 4.5668036,-0.06933 6.5023456,-2.632934 1.750197,-2.318119 2.462314,-5.474789 2.217382,-9.829204 -0.08203,-1.45826 -0.213968,-2.896383 -0.293207,-3.19583 -0.136086,-0.51428 -0.100683,-0.53528 0.638845,-0.378938 1.453733,0.30733 4.183685,1.564253 5.946799,2.738021 2.433051,1.619769 6.145069,5.42 9.067295,9.282768 2.803609,3.705975 4.030339,4.823105 5.928907,5.399206 0.911278,0.276519 1.362284,0.248306 2.096004,-0.131116 z" |
260 | + id="path2451" /> |
261 | +</svg> |
262 | |
263 | === added directory 'Grooveshark/src' |
264 | === added file 'Grooveshark/src/GroovesharkPlayAction.cs' |
265 | --- Grooveshark/src/GroovesharkPlayAction.cs 1970-01-01 00:00:00 +0000 |
266 | +++ Grooveshark/src/GroovesharkPlayAction.cs 2010-03-24 12:58:27 +0000 |
267 | @@ -0,0 +1,72 @@ |
268 | +// GroovesharkPlayAction.cs |
269 | +// |
270 | +// GNOME Do is the legal property of its developers, whose names are too |
271 | +// numerous to list here. Please refer to the COPYRIGHT file distributed with |
272 | +// this source distribution. |
273 | +// |
274 | +// This program is free software: you can redistribute it and/or modify it |
275 | +// under the terms of the GNU General Public License as published by the Free |
276 | +// Software Foundation, either version 3 of the License, or (at your option) |
277 | +// any later version. |
278 | +// |
279 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
280 | +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
281 | +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
282 | +// more details. |
283 | +// |
284 | +// You should have received a copy of the GNU General Public License along with |
285 | +// this program. If not, see <http://www.gnu.org/licenses/>. |
286 | + |
287 | +using System; |
288 | +using System.Net; |
289 | +using System.IO; |
290 | +using System.Linq; |
291 | +using System.Collections.Generic; |
292 | + |
293 | +using Mono.Addins; |
294 | + |
295 | +using Do.Platform; |
296 | +using Do.Platform.Linux; |
297 | +using Do.Universe; |
298 | +using Do.Universe.Common; |
299 | + |
300 | +namespace Grooveshark { |
301 | + |
302 | + // This action opens a web-browser playing the desired song from www.grooveshark.com |
303 | + public class GroovesharkPlayAction : Act |
304 | + { |
305 | + public override string Name { |
306 | + get { return AddinManager.CurrentLocalizer.GetString ("Play on Grooveshark"); } |
307 | + } |
308 | + |
309 | + public override string Description { |
310 | + get { return AddinManager.CurrentLocalizer.GetString ("Listen to this song on Grooveshark."); } |
311 | + } |
312 | + |
313 | + public override string Icon { |
314 | + get { return "grooveshark.svg@" + GetType ().Assembly.FullName; } |
315 | + } |
316 | + |
317 | + public override IEnumerable<Type> SupportedItemTypes { |
318 | + get { yield return typeof (ITextItem); } |
319 | + } |
320 | + |
321 | + //Here's the actual ation code |
322 | + //see http://apidocs.tinysong.com/ for API-Instructions concerning Grooveshark |
323 | + public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) |
324 | + { |
325 | + string search = (items.First () as ITextItem).Text; |
326 | + string searchUrl ="http://tinysong.com/a/"+search; |
327 | + WebRequest wrq = WebRequest.Create (searchUrl); |
328 | + WebResponse wrs = wrq.GetResponse (); |
329 | + StreamReader sr = new StreamReader (wrs.GetResponseStream ()); |
330 | + string songUrl = sr.ReadToEnd(); |
331 | + if (songUrl=="NSF;") |
332 | + { |
333 | + Gtk.Application.Invoke ((o, e) => Services.Notifications.Notify (Name, AddinManager.CurrentLocalizer.GetString ("No Results Found"))); |
334 | + } |
335 | + else Services.Environment.OpenUrl (songUrl); |
336 | + yield break; |
337 | + } |
338 | + } |
339 | +} |
340 | \ No newline at end of file |
341 | |
342 | === added file 'Grooveshark/src/GroovesharkSearchAction.cs' |
343 | --- Grooveshark/src/GroovesharkSearchAction.cs 1970-01-01 00:00:00 +0000 |
344 | +++ Grooveshark/src/GroovesharkSearchAction.cs 2010-03-24 12:58:27 +0000 |
345 | @@ -0,0 +1,147 @@ |
346 | +// GroovesharkSearchAction.cs |
347 | +// |
348 | +// GNOME Do is the legal property of its developers, whose names are too |
349 | +// numerous to list here. Please refer to the COPYRIGHT file distributed with |
350 | +// this source distribution. |
351 | +// |
352 | +// This program is free software: you can redistribute it and/or modify it |
353 | +// under the terms of the GNU General Public License as published by the Free |
354 | +// Software Foundation, either version 3 of the License, or (at your option) |
355 | +// any later version. |
356 | +// |
357 | +// This program is distributed in the hope that it will be useful, but WITHOUT |
358 | +// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
359 | +// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
360 | +// more details. |
361 | +// |
362 | +// You should have received a copy of the GNU General Public License along with |
363 | +// this program. If not, see <http://www.gnu.org/licenses/>. |
364 | + |
365 | +using System; |
366 | +using System.Net; |
367 | +using System.IO; |
368 | +using System.Linq; |
369 | +using System.Collections.Generic; |
370 | + |
371 | +using Mono.Addins; |
372 | + |
373 | +using Do.Platform; |
374 | +using Do.Platform.Linux; |
375 | +using Do.Universe; |
376 | +using Do.Universe.Common; |
377 | + |
378 | +namespace Grooveshark { |
379 | + |
380 | + //No longer in Do, have to subclass |
381 | + //Taken from the GoogleSearch-Plugin: Thanks to Brian Lukas! |
382 | + public class BookmarkItem : Item, IBookmarkItem |
383 | + { |
384 | + protected string name, url; |
385 | + public BookmarkItem (string name, string url) |
386 | + { |
387 | + this.name = name; |
388 | + this.url = url; |
389 | + } |
390 | + public override string Name |
391 | + { |
392 | + get { return name; } |
393 | + } |
394 | + public override string Description |
395 | + { |
396 | + get { return url; } |
397 | + } |
398 | + |
399 | + public override string Icon |
400 | + { |
401 | + get { return "grooveshark.svg@" + GetType ().Assembly.FullName; } |
402 | + } |
403 | + |
404 | + public string Url |
405 | + { |
406 | + get { return url; } |
407 | + } |
408 | + } |
409 | + |
410 | + //This action returns up to six links targeting songs on Grooveshark to Do |
411 | + public class GroovesharkSearchAction : Act |
412 | + { |
413 | + public override string Name { |
414 | + get { return AddinManager.CurrentLocalizer.GetString ("Search Grooveshark"); } |
415 | + } |
416 | + |
417 | + public override string Description { |
418 | + get { return AddinManager.CurrentLocalizer.GetString ("Returns up to six songs from Grooveshark."); } |
419 | + } |
420 | + |
421 | + public override string Icon { |
422 | + get { return "grooveshark.svg@" + GetType ().Assembly.FullName; } |
423 | + } |
424 | + |
425 | + public override IEnumerable<Type> SupportedItemTypes { |
426 | + get { yield return typeof (ITextItem); } |
427 | + } |
428 | + |
429 | + public List<SearchResult> results = new List<SearchResult> (); |
430 | + |
431 | + //Here's the actual action code |
432 | + //see http://apidocs.tinysong.com/ for API-Instructions concerning Grooveshark |
433 | + public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems) |
434 | + { |
435 | + string search = (items.First () as ITextItem).Text; |
436 | + string searchurl ="http://tinysong.com/s/"+search; |
437 | + WebRequest wrq = WebRequest.Create (searchurl); |
438 | + WebResponse wrs = wrq.GetResponse (); |
439 | + StreamReader sr = new StreamReader (wrs.GetResponseStream ()); |
440 | + string answer = sr.ReadToEnd(); |
441 | + if (answer=="NSF;") |
442 | + { |
443 | + Gtk.Application.Invoke ((o, e) => Services.Notifications.Notify (Name, AddinManager.CurrentLocalizer.GetString ("No Results Found"))); |
444 | + yield break; |
445 | + } |
446 | + else |
447 | + { |
448 | + IEnumerable<SearchResult> results = this.SplitAnswer(answer); |
449 | + foreach (SearchResult result in results) |
450 | + yield return new BookmarkItem(result.name, result.url); |
451 | + } |
452 | + } |
453 | + |
454 | + //Method which splits the given answer-string from Grooveshark into single results |
455 | + //Grooveshark returns the results in the form: |
456 | + //tinysong link; songID; songName; artistID; artistName; albumID; albumName; Grooveshark link tinysong link; songID; songName; artistID; artistName; albumID; albumName; Grooveshark link.... |
457 | + //this string is split at every ';'. Since the individual results aren't seperated by any symbol |
458 | + //the "Grooveshark link" at the beginning of each new result's "tinysong link" has to be deleted: This is done with |
459 | + //the constructor of the class SearchResult |
460 | + private IEnumerable<SearchResult> SplitAnswer(string inString) |
461 | + { |
462 | + string [] array; |
463 | + array = inString.Split(';'); |
464 | + for (int i=0;i<array.Length-1;i+=7) |
465 | + { |
466 | + SearchResult result = new SearchResult(array [i], array [i+2], array [i+4], array [i+6]); |
467 | + yield return result; |
468 | + } |
469 | + } |
470 | + } |
471 | + |
472 | + //Class for single results |
473 | + public class SearchResult |
474 | + { |
475 | + public string name=""; |
476 | + public string url=""; |
477 | + |
478 | + //Constructor which cleans the given information from whitspaces and the leading "Grooveshark link" |
479 | + public SearchResult(string inUrl, string inSong, string inArtist, string inAlbum) |
480 | + { |
481 | + if (inUrl.Contains("http://listen.grooveshark.com")) |
482 | + { |
483 | + inUrl=inUrl.Trim(); |
484 | + inUrl=inUrl.Remove(0,4); |
485 | + inUrl=inUrl.Remove(0,inUrl.IndexOf("http")); |
486 | + this.url=inUrl; |
487 | + } |
488 | + else this.url=inUrl.Trim(); |
489 | + this.name=inArtist.Trim()+": "+inSong.Trim()+" ("+inAlbum.Trim()+")"; |
490 | + } |
491 | + } |
492 | +} |
493 | \ No newline at end of file |
494 | |
495 | === modified file 'OpenSearch/OpenSearch.mdp' |
496 | --- OpenSearch/OpenSearch.mdp 2009-09-08 22:10:42 +0000 |
497 | +++ OpenSearch/OpenSearch.mdp 2010-03-24 12:58:27 +0000 |
498 | @@ -35,4 +35,4 @@ |
499 | <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" /> |
500 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
501 | </References> |
502 | -</Project> |
503 | \ No newline at end of file |
504 | +</Project> |
505 | |
506 | === modified file 'Pastebin/Pastebin.mdp' |
507 | --- Pastebin/Pastebin.mdp 2010-01-24 10:42:11 +0000 |
508 | +++ Pastebin/Pastebin.mdp 2010-03-24 12:58:27 +0000 |
509 | @@ -51,4 +51,4 @@ |
510 | <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" /> |
511 | </References> |
512 | <GtkDesignInfo gettextClass="Mono.Addins.AddinManager.CurrentLocalizer" /> |
513 | -</Project> |
514 | +</Project> |
515 | \ No newline at end of file |
516 | |
517 | === modified file 'Skype/Skype.mdp' |
518 | --- Skype/Skype.mdp 2009-09-28 02:23:58 +0000 |
519 | +++ Skype/Skype.mdp 2010-03-24 12:58:27 +0000 |
520 | @@ -50,4 +50,4 @@ |
521 | <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" /> |
522 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
523 | </References> |
524 | -</Project> |
525 | \ No newline at end of file |
526 | +</Project> |
527 | |
528 | === modified file 'SqueezeCenter/SqueezeCenterPlugin.mdp' |
529 | --- SqueezeCenter/SqueezeCenterPlugin.mdp 2009-08-03 19:36:02 +0000 |
530 | +++ SqueezeCenter/SqueezeCenterPlugin.mdp 2010-03-24 12:58:27 +0000 |
531 | @@ -66,4 +66,4 @@ |
532 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
533 | </References> |
534 | <GtkDesignInfo gettextClass="Mono.Addins.AddinManager.CurrentLocalizer" /> |
535 | -</Project> |
536 | +</Project> |
537 | \ No newline at end of file |
538 | |
539 | === modified file 'WindowManager/WindowManager.mdp' |
540 | --- WindowManager/WindowManager.mdp 2009-10-11 20:48:44 +0000 |
541 | +++ WindowManager/WindowManager.mdp 2010-03-24 12:58:27 +0000 |
542 | @@ -52,4 +52,4 @@ |
543 | <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" /> |
544 | </References> |
545 | <LanguageParameters ApplicationIcon="." ctype="CSharpProjectParameters" /> |
546 | -</Project> |
547 | +</Project> |
548 | \ No newline at end of file |