Merge lp:~simonschneegans/do-plugins/grooveshark into lp:do-plugins

Proposed by Simon Schneegans
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
Reviewer Review Type Date Requested Status
Do Plugins Team Pending
Review via email: mp+21155@code.launchpad.net

Description of the change

New Plugin: Grooveshark

I wrote a plugin which searches the well-known song-streaming site "www.grooveshark.com" for the desired song and, in case of success, opens a web browser playing it. Additionally it adds an action which searches for the given keywords and returns up to six, best matching songs to Do, so one of them can be played.

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!

To post a comment you must log in.
682. By Simon Schneegans <simon@simon-laptop>

Corrected some information in the addin.xml file

683. By Simon Schneegans <simon@simon-laptop>

Reverted some changes done to unrelated files

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

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'Baconator/Baconator.mdp'
--- Baconator/Baconator.mdp 2009-06-29 08:47:41 +0000
+++ Baconator/Baconator.mdp 2010-03-24 12:58:27 +0000
@@ -25,4 +25,4 @@
25 <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" />25 <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" />
26 <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />26 <ProjectReference type="Gac" localcopy="True" refto="Mono.Posix, Version=2.0.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
27 </References>27 </References>
28</Project>
29\ No newline at end of file28\ No newline at end of file
29</Project>
3030
=== modified file 'Banshee/Banshee.mdp'
--- Banshee/Banshee.mdp 2009-06-29 08:47:41 +0000
+++ Banshee/Banshee.mdp 2010-03-24 12:58:27 +0000
@@ -42,4 +42,4 @@
42 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />42 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
43 </References>43 </References>
44 <Deployment.LinuxDeployData scriptName="banshee-1" />44 <Deployment.LinuxDeployData scriptName="banshee-1" />
45</Project>
46\ No newline at end of file45\ No newline at end of file
46</Project>
4747
=== modified file 'Chromium/Chromium.mdp'
--- Chromium/Chromium.mdp 2009-07-25 05:33:43 +0000
+++ Chromium/Chromium.mdp 2010-03-24 12:58:27 +0000
@@ -23,4 +23,4 @@
23 <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.dll" />23 <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Platform.dll" />
24 <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" />24 <ProjectReference type="Assembly" localcopy="True" specificVersion="False" refto="../../../../../../usr/local/lib/gnome-do/Do.Universe.dll" />
25 </References>25 </References>
26</Project>
27\ No newline at end of file26\ No newline at end of file
27</Project>
2828
=== modified file 'DoPlugins.mds'
--- DoPlugins.mds 2009-11-08 23:58:01 +0000
+++ DoPlugins.mds 2010-03-24 12:58:27 +0000
@@ -78,6 +78,7 @@
78 <Entry build="True" name="Baconator" configuration="Debug" />78 <Entry build="True" name="Baconator" configuration="Debug" />
79 <Entry build="True" name="Chromium" configuration="Debug" />79 <Entry build="True" name="Chromium" configuration="Debug" />
80 <Entry build="True" name="GNOME-Calculator" configuration="Debug" />80 <Entry build="True" name="GNOME-Calculator" configuration="Debug" />
81 <Entry build="True" name="Grooveshark" configuration="Debug" />
81 </Configuration>82 </Configuration>
82 <Configuration name="Release" ctype="CombineConfiguration">83 <Configuration name="Release" ctype="CombineConfiguration">
83 <Entry build="True" name="Rhythmbox" configuration="Release" />84 <Entry build="True" name="Rhythmbox" configuration="Release" />
@@ -157,6 +158,7 @@
157 <Entry build="True" name="Baconator" configuration="Release" />158 <Entry build="True" name="Baconator" configuration="Release" />
158 <Entry build="True" name="Chromium" configuration="Release" />159 <Entry build="True" name="Chromium" configuration="Release" />
159 <Entry build="True" name="GNOME-Calculator" configuration="Release" />160 <Entry build="True" name="GNOME-Calculator" configuration="Release" />
161 <Entry build="True" name="Grooveshark" configuration="Release" />
160 </Configuration>162 </Configuration>
161 </Configurations>163 </Configurations>
162 <StartMode startupentry="Rhythmbox" single="True">164 <StartMode startupentry="Rhythmbox" single="True">
@@ -237,6 +239,7 @@
237 <Execute type="None" entry="Baconator" />239 <Execute type="None" entry="Baconator" />
238 <Execute type="None" entry="Chromium" />240 <Execute type="None" entry="Chromium" />
239 <Execute type="None" entry="GNOME-Calculator" />241 <Execute type="None" entry="GNOME-Calculator" />
242 <Execute type="None" entry="Grooveshark" />
240 </StartMode>243 </StartMode>
241 <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" />244 <MonoDevelop.ChangeLogAddIn.ChangeLogInfo policy="UpdateNearestChangeLog" />
242 <Entries>245 <Entries>
@@ -317,5 +320,6 @@
317 <Entry filename="Baconator/Baconator.mdp" />320 <Entry filename="Baconator/Baconator.mdp" />
318 <Entry filename="Chromium/Chromium.mdp" />321 <Entry filename="Chromium/Chromium.mdp" />
319 <Entry filename="GNOME-Calculator/GNOME-Calculator.mdp" />322 <Entry filename="GNOME-Calculator/GNOME-Calculator.mdp" />
323 <Entry filename="Grooveshark/Grooveshark.mdp" />
320 </Entries>324 </Entries>
321</Combine>325</Combine>
322\ No newline at end of file326\ No newline at end of file
323327
=== modified file 'Evolution/Evolution.mdp'
--- Evolution/Evolution.mdp 2009-09-28 01:50:31 +0000
+++ Evolution/Evolution.mdp 2010-03-24 12:58:27 +0000
@@ -26,4 +26,4 @@
26 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />26 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
27 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />27 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
28 </References>28 </References>
29</Project>
30\ No newline at end of file29\ No newline at end of file
30</Project>
3131
=== modified file 'GNOME-Calculator/GNOME-Calculator.mdp'
--- GNOME-Calculator/GNOME-Calculator.mdp 2009-11-08 23:58:01 +0000
+++ GNOME-Calculator/GNOME-Calculator.mdp 2010-03-24 12:58:27 +0000
@@ -26,4 +26,4 @@
26 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />26 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
27 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />27 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
28 </References>28 </References>
29</Project>29</Project>
30\ No newline at end of file30\ No newline at end of file
3131
=== added directory 'Grooveshark'
=== added file 'Grooveshark/Grooveshark.mdp'
--- Grooveshark/Grooveshark.mdp 1970-01-01 00:00:00 +0000
+++ Grooveshark/Grooveshark.mdp 2010-03-24 12:58:27 +0000
@@ -0,0 +1,35 @@
1<Project name="Grooveshark" fileversion="2.0" language="C#" clr-version="Net_2_0" targetFramework="3.5" ctype="DotNetProject">
2 <Configurations active="Debug">
3 <Configuration name="Debug" ctype="DotNetProjectConfiguration">
4 <Output directory="bin/Debug" assembly="Grooveshark" />
5 <Build debugmode="True" target="Library" />
6 <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_2_0" />
7 <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" definesymbols="DEBUG" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
8 </Configuration>
9 <Configuration name="Release" ctype="DotNetProjectConfiguration">
10 <Output directory="bin/Release" assembly="Grooveshark" />
11 <Build debugmode="False" target="Library" />
12 <Execution runwithwarnings="True" consolepause="False" runtime="MsNet" clr-version="Net_2_0" />
13 <CodeGeneration compiler="Mcs" warninglevel="4" optimize="True" unsafecodeallowed="False" generateoverflowchecks="True" generatexmldocumentation="False" ctype="CSharpCompilerParameters" />
14 </Configuration>
15 </Configurations>
16 <Contents>
17 <File name="." subtype="Directory" buildaction="Compile" />
18 <File name="src" subtype="Directory" buildaction="Compile" />
19 <File name="src/GroovesharkSearchAction.cs" subtype="Code" buildaction="Compile" />
20 <File name="Resources/Grooveshark.addin.xml" subtype="Code" buildaction="EmbedAsResource" />
21 <File name="src/GroovesharkPlayAction.cs" subtype="Code" buildaction="Compile" />
22 <File name="Resources/icons" subtype="Directory" buildaction="Compile" />
23 <File name="Resources/icons/grooveshark.svg" subtype="Code" buildaction="EmbedAsResource" />
24 </Contents>
25 <References>
26 <ProjectReference type="Gac" localcopy="True" refto="System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
27 <ProjectReference type="Gac" localcopy="True" refto="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
28 <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
29 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
30 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
31 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform.Linux, Version=0.9.0.0, Culture=neutral" />
32 <ProjectReference type="Gac" localcopy="True" refto="gdk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
33 <ProjectReference type="Gac" localcopy="True" refto="gtk-sharp, Version=2.12.0.0, Culture=neutral, PublicKeyToken=35e10195dab3c99f" />
34 </References>
35</Project>
0\ No newline at end of file36\ No newline at end of file
137
=== added file 'Grooveshark/Grooveshark.mds'
--- Grooveshark/Grooveshark.mds 1970-01-01 00:00:00 +0000
+++ Grooveshark/Grooveshark.mds 2010-03-24 12:58:27 +0000
@@ -0,0 +1,16 @@
1<Combine fileversion="2.0">
2 <Configurations active="Debug">
3 <Configuration name="Debug" ctype="CombineConfiguration">
4 <Entry build="True" name="Grooveshark" configuration="Debug" />
5 </Configuration>
6 <Configuration name="Release" ctype="CombineConfiguration">
7 <Entry build="True" name="Grooveshark" configuration="Release" />
8 </Configuration>
9 </Configurations>
10 <StartMode startupentry="Grooveshark" single="True">
11 <Execute type="None" entry="Grooveshark" />
12 </StartMode>
13 <Entries>
14 <Entry filename="Grooveshark.mdp" />
15 </Entries>
16</Combine>
017
=== added file 'Grooveshark/Grooveshark.pidb'
1Binary files Grooveshark/Grooveshark.pidb 1970-01-01 00:00:00 +0000 and Grooveshark/Grooveshark.pidb 2010-03-24 12:58:27 +0000 differ18Binary files Grooveshark/Grooveshark.pidb 1970-01-01 00:00:00 +0000 and Grooveshark/Grooveshark.pidb 2010-03-24 12:58:27 +0000 differ
=== added directory 'Grooveshark/Resources'
=== added file 'Grooveshark/Resources/Grooveshark.addin.xml'
--- Grooveshark/Resources/Grooveshark.addin.xml 1970-01-01 00:00:00 +0000
+++ Grooveshark/Resources/Grooveshark.addin.xml 2010-03-24 12:58:27 +0000
@@ -0,0 +1,28 @@
1<Addin
2 id="Grooveshark"
3 namespace="Do"
4 version="0.1"
5 name="Grooveshark"
6 description="Listen to songs from Grooveshark."
7 author="Simon Schneegans"
8 category="Community"
9 defaultEnabled="false"
10 url="http://do.davebsd.com/wiki/Grooveshark_Plugin"
11>
12
13 <Runtime>
14 <Import assembly="Grooveshark.dll"/>
15 </Runtime>
16
17 <Localizer type="Gettext" catalog="gnome-do-plugins" location="@expanded_datadir@/locale" />
18
19 <Dependencies>
20 <Addin id="Universe" version="1.0" />
21 </Dependencies>
22
23 <Extension path="/Do/Action">
24 <Action type="Grooveshark.GroovesharkPlayAction" />
25 <Action type="Grooveshark.GroovesharkSearchAction" />
26 </Extension>
27
28</Addin>
0\ No newline at end of file29\ No newline at end of file
130
=== added directory 'Grooveshark/Resources/icons'
=== added file 'Grooveshark/Resources/icons/grooveshark.svg'
--- Grooveshark/Resources/icons/grooveshark.svg 1970-01-01 00:00:00 +0000
+++ Grooveshark/Resources/icons/grooveshark.svg 2010-03-24 12:58:27 +0000
@@ -0,0 +1,65 @@
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!-- Created with Inkscape (http://www.inkscape.org/) -->
3
4<svg
5 xmlns:dc="http://purl.org/dc/elements/1.1/"
6 xmlns:cc="http://creativecommons.org/ns#"
7 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
8 xmlns:svg="http://www.w3.org/2000/svg"
9 xmlns="http://www.w3.org/2000/svg"
10 xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
11 xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
12 id="svg2440"
13 sodipodi:version="0.32"
14 inkscape:version="0.47pre4 r22446"
15 width="48"
16 height="48"
17 version="1.0"
18 sodipodi:docname="Grooveshark.svg"
19 inkscape:output_extension="org.inkscape.output.svg.inkscape">
20 <metadata
21 id="metadata2445">
22 <rdf:RDF>
23 <cc:Work
24 rdf:about="">
25 <dc:format>image/svg+xml</dc:format>
26 <dc:type
27 rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
28 </cc:Work>
29 </rdf:RDF>
30 </metadata>
31 <defs
32 id="defs2443">
33 <inkscape:perspective
34 sodipodi:type="inkscape:persp3d"
35 inkscape:vp_x="0 : 526.18109 : 1"
36 inkscape:vp_y="0 : 1000 : 0"
37 inkscape:vp_z="744.09448 : 526.18109 : 1"
38 inkscape:persp3d-origin="372.04724 : 350.78739 : 1"
39 id="perspective2447" />
40 </defs>
41 <sodipodi:namedview
42 inkscape:window-height="667"
43 inkscape:window-width="640"
44 inkscape:pageshadow="2"
45 inkscape:pageopacity="0.0"
46 guidetolerance="10.0"
47 gridtolerance="10.0"
48 objecttolerance="10.0"
49 borderopacity="1.0"
50 bordercolor="#666666"
51 pagecolor="#ffffff"
52 id="base"
53 showgrid="false"
54 inkscape:zoom="6.5336666"
55 inkscape:cx="17.143647"
56 inkscape:cy="19.048619"
57 inkscape:window-x="88"
58 inkscape:window-y="99"
59 inkscape:current-layer="svg2440"
60 inkscape:window-maximized="0" />
61 <path
62 style="fill:#000000"
63 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"
64 id="path2451" />
65</svg>
066
=== added directory 'Grooveshark/src'
=== added file 'Grooveshark/src/GroovesharkPlayAction.cs'
--- Grooveshark/src/GroovesharkPlayAction.cs 1970-01-01 00:00:00 +0000
+++ Grooveshark/src/GroovesharkPlayAction.cs 2010-03-24 12:58:27 +0000
@@ -0,0 +1,72 @@
1// GroovesharkPlayAction.cs
2//
3// GNOME Do is the legal property of its developers, whose names are too
4// numerous to list here. Please refer to the COPYRIGHT file distributed with
5// this source distribution.
6//
7// This program is free software: you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by the Free
9// Software Foundation, either version 3 of the License, or (at your option)
10// any later version.
11//
12// This program is distributed in the hope that it will be useful, but WITHOUT
13// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15// more details.
16//
17// You should have received a copy of the GNU General Public License along with
18// this program. If not, see <http://www.gnu.org/licenses/>.
19
20using System;
21using System.Net;
22using System.IO;
23using System.Linq;
24using System.Collections.Generic;
25
26using Mono.Addins;
27
28using Do.Platform;
29using Do.Platform.Linux;
30using Do.Universe;
31using Do.Universe.Common;
32
33namespace Grooveshark {
34
35 // This action opens a web-browser playing the desired song from www.grooveshark.com
36 public class GroovesharkPlayAction : Act
37 {
38 public override string Name {
39 get { return AddinManager.CurrentLocalizer.GetString ("Play on Grooveshark"); }
40 }
41
42 public override string Description {
43 get { return AddinManager.CurrentLocalizer.GetString ("Listen to this song on Grooveshark."); }
44 }
45
46 public override string Icon {
47 get { return "grooveshark.svg@" + GetType ().Assembly.FullName; }
48 }
49
50 public override IEnumerable<Type> SupportedItemTypes {
51 get { yield return typeof (ITextItem); }
52 }
53
54 //Here's the actual ation code
55 //see http://apidocs.tinysong.com/ for API-Instructions concerning Grooveshark
56 public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
57 {
58 string search = (items.First () as ITextItem).Text;
59 string searchUrl ="http://tinysong.com/a/"+search;
60 WebRequest wrq = WebRequest.Create (searchUrl);
61 WebResponse wrs = wrq.GetResponse ();
62 StreamReader sr = new StreamReader (wrs.GetResponseStream ());
63 string songUrl = sr.ReadToEnd();
64 if (songUrl=="NSF;")
65 {
66 Gtk.Application.Invoke ((o, e) => Services.Notifications.Notify (Name, AddinManager.CurrentLocalizer.GetString ("No Results Found")));
67 }
68 else Services.Environment.OpenUrl (songUrl);
69 yield break;
70 }
71 }
72}
0\ No newline at end of file73\ No newline at end of file
174
=== added file 'Grooveshark/src/GroovesharkSearchAction.cs'
--- Grooveshark/src/GroovesharkSearchAction.cs 1970-01-01 00:00:00 +0000
+++ Grooveshark/src/GroovesharkSearchAction.cs 2010-03-24 12:58:27 +0000
@@ -0,0 +1,147 @@
1// GroovesharkSearchAction.cs
2//
3// GNOME Do is the legal property of its developers, whose names are too
4// numerous to list here. Please refer to the COPYRIGHT file distributed with
5// this source distribution.
6//
7// This program is free software: you can redistribute it and/or modify it
8// under the terms of the GNU General Public License as published by the Free
9// Software Foundation, either version 3 of the License, or (at your option)
10// any later version.
11//
12// This program is distributed in the hope that it will be useful, but WITHOUT
13// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
14// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
15// more details.
16//
17// You should have received a copy of the GNU General Public License along with
18// this program. If not, see <http://www.gnu.org/licenses/>.
19
20using System;
21using System.Net;
22using System.IO;
23using System.Linq;
24using System.Collections.Generic;
25
26using Mono.Addins;
27
28using Do.Platform;
29using Do.Platform.Linux;
30using Do.Universe;
31using Do.Universe.Common;
32
33namespace Grooveshark {
34
35 //No longer in Do, have to subclass
36 //Taken from the GoogleSearch-Plugin: Thanks to Brian Lukas!
37 public class BookmarkItem : Item, IBookmarkItem
38 {
39 protected string name, url;
40 public BookmarkItem (string name, string url)
41 {
42 this.name = name;
43 this.url = url;
44 }
45 public override string Name
46 {
47 get { return name; }
48 }
49 public override string Description
50 {
51 get { return url; }
52 }
53
54 public override string Icon
55 {
56 get { return "grooveshark.svg@" + GetType ().Assembly.FullName; }
57 }
58
59 public string Url
60 {
61 get { return url; }
62 }
63 }
64
65 //This action returns up to six links targeting songs on Grooveshark to Do
66 public class GroovesharkSearchAction : Act
67 {
68 public override string Name {
69 get { return AddinManager.CurrentLocalizer.GetString ("Search Grooveshark"); }
70 }
71
72 public override string Description {
73 get { return AddinManager.CurrentLocalizer.GetString ("Returns up to six songs from Grooveshark."); }
74 }
75
76 public override string Icon {
77 get { return "grooveshark.svg@" + GetType ().Assembly.FullName; }
78 }
79
80 public override IEnumerable<Type> SupportedItemTypes {
81 get { yield return typeof (ITextItem); }
82 }
83
84 public List<SearchResult> results = new List<SearchResult> ();
85
86 //Here's the actual action code
87 //see http://apidocs.tinysong.com/ for API-Instructions concerning Grooveshark
88 public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modItems)
89 {
90 string search = (items.First () as ITextItem).Text;
91 string searchurl ="http://tinysong.com/s/"+search;
92 WebRequest wrq = WebRequest.Create (searchurl);
93 WebResponse wrs = wrq.GetResponse ();
94 StreamReader sr = new StreamReader (wrs.GetResponseStream ());
95 string answer = sr.ReadToEnd();
96 if (answer=="NSF;")
97 {
98 Gtk.Application.Invoke ((o, e) => Services.Notifications.Notify (Name, AddinManager.CurrentLocalizer.GetString ("No Results Found")));
99 yield break;
100 }
101 else
102 {
103 IEnumerable<SearchResult> results = this.SplitAnswer(answer);
104 foreach (SearchResult result in results)
105 yield return new BookmarkItem(result.name, result.url);
106 }
107 }
108
109 //Method which splits the given answer-string from Grooveshark into single results
110 //Grooveshark returns the results in the form:
111 //tinysong link; songID; songName; artistID; artistName; albumID; albumName; Grooveshark link tinysong link; songID; songName; artistID; artistName; albumID; albumName; Grooveshark link....
112 //this string is split at every ';'. Since the individual results aren't seperated by any symbol
113 //the "Grooveshark link" at the beginning of each new result's "tinysong link" has to be deleted: This is done with
114 //the constructor of the class SearchResult
115 private IEnumerable<SearchResult> SplitAnswer(string inString)
116 {
117 string [] array;
118 array = inString.Split(';');
119 for (int i=0;i<array.Length-1;i+=7)
120 {
121 SearchResult result = new SearchResult(array [i], array [i+2], array [i+4], array [i+6]);
122 yield return result;
123 }
124 }
125 }
126
127 //Class for single results
128 public class SearchResult
129 {
130 public string name="";
131 public string url="";
132
133 //Constructor which cleans the given information from whitspaces and the leading "Grooveshark link"
134 public SearchResult(string inUrl, string inSong, string inArtist, string inAlbum)
135 {
136 if (inUrl.Contains("http://listen.grooveshark.com"))
137 {
138 inUrl=inUrl.Trim();
139 inUrl=inUrl.Remove(0,4);
140 inUrl=inUrl.Remove(0,inUrl.IndexOf("http"));
141 this.url=inUrl;
142 }
143 else this.url=inUrl.Trim();
144 this.name=inArtist.Trim()+": "+inSong.Trim()+" ("+inAlbum.Trim()+")";
145 }
146 }
147}
0\ No newline at end of file148\ No newline at end of file
1149
=== modified file 'OpenSearch/OpenSearch.mdp'
--- OpenSearch/OpenSearch.mdp 2009-09-08 22:10:42 +0000
+++ OpenSearch/OpenSearch.mdp 2010-03-24 12:58:27 +0000
@@ -35,4 +35,4 @@
35 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />35 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
36 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />36 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
37 </References>37 </References>
38</Project>
39\ No newline at end of file38\ No newline at end of file
39</Project>
4040
=== modified file 'Pastebin/Pastebin.mdp'
--- Pastebin/Pastebin.mdp 2010-01-24 10:42:11 +0000
+++ Pastebin/Pastebin.mdp 2010-03-24 12:58:27 +0000
@@ -51,4 +51,4 @@
51 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />51 <ProjectReference type="Gac" localcopy="True" refto="Do.Platform, Version=0.9.0.0, Culture=neutral" />
52 </References>52 </References>
53 <GtkDesignInfo gettextClass="Mono.Addins.AddinManager.CurrentLocalizer" />53 <GtkDesignInfo gettextClass="Mono.Addins.AddinManager.CurrentLocalizer" />
54</Project>54</Project>
55\ No newline at end of file55\ No newline at end of file
5656
=== modified file 'Skype/Skype.mdp'
--- Skype/Skype.mdp 2009-09-28 02:23:58 +0000
+++ Skype/Skype.mdp 2010-03-24 12:58:27 +0000
@@ -50,4 +50,4 @@
50 <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />50 <ProjectReference type="Gac" localcopy="True" refto="Mono.Addins, Version=0.4.0.0, Culture=neutral, PublicKeyToken=0738eb9f132ed756" />
51 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />51 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
52 </References>52 </References>
53</Project>
54\ No newline at end of file53\ No newline at end of file
54</Project>
5555
=== modified file 'SqueezeCenter/SqueezeCenterPlugin.mdp'
--- SqueezeCenter/SqueezeCenterPlugin.mdp 2009-08-03 19:36:02 +0000
+++ SqueezeCenter/SqueezeCenterPlugin.mdp 2010-03-24 12:58:27 +0000
@@ -66,4 +66,4 @@
66 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />66 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
67 </References>67 </References>
68 <GtkDesignInfo gettextClass="Mono.Addins.AddinManager.CurrentLocalizer" />68 <GtkDesignInfo gettextClass="Mono.Addins.AddinManager.CurrentLocalizer" />
69</Project>69</Project>
70\ No newline at end of file70\ No newline at end of file
7171
=== modified file 'WindowManager/WindowManager.mdp'
--- WindowManager/WindowManager.mdp 2009-10-11 20:48:44 +0000
+++ WindowManager/WindowManager.mdp 2010-03-24 12:58:27 +0000
@@ -52,4 +52,4 @@
52 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />52 <ProjectReference type="Gac" localcopy="True" refto="Do.Universe, Version=0.9.0.0, Culture=neutral" />
53 </References>53 </References>
54 <LanguageParameters ApplicationIcon="." ctype="CSharpProjectParameters" />54 <LanguageParameters ApplicationIcon="." ctype="CSharpProjectParameters" />
55</Project>55</Project>
56\ No newline at end of file56\ No newline at end of file

Subscribers

People subscribed via source and target branches