~mrooney/do-plugins/skreemr

« back to all changes in this revision

Viewing changes to Skreemr/src/SkreemrAction.cs

  • Committer: Michael Rooney
  • Date: 2009-03-21 08:26:07 UTC
  • Revision ID: mrooney@ubuntu.com-20090321082607-s4k43lqf2rt15g08
omiballz it works.

Show diffs side-by-side

added added

removed removed

Lines of Context:
54
54
                
55
55
                public override string Description
56
56
                {
57
 
                        get { return "Skreem tunes."; }
 
57
                        get { return "Skreem a tune."; }
58
58
                }
59
59
                
60
60
                public override string Icon
85
85
                public override IEnumerable<Item> Perform (IEnumerable<Item> items, IEnumerable<Item> modifierItems)
86
86
                {
87
87
                        string expression = (items.First () as ITextItem).Text;
88
 
                        string tune = "http://matt_bellamys_slave.tripod.com/sitebuildercontent/sitebuilderfiles/muse-cant_take_my_eyes_off_you.mp3";
89
 
                        Process.Start (string.Format ("totem {0}", tune));
 
88
                        string url = "http://www.skreemr.com/results.jsp?q=" + expression.Replace(" ", "+");
 
89
                        string contents = GetWebpageContents(url);
 
90
                        Match m = Regex.Match(contents, "<a href=\"(.*[.]mp3)\"");
 
91
                        if (m.Success)
 
92
                        {
 
93
                                string tune = m.Groups[1].Value;
 
94
                                System.Console.WriteLine("Tune: " + tune);
 
95
                                Process.Start (string.Format ("totem {0}", tune));
 
96
                        }
90
97
                        yield return null;
91
98
                }
92
99