Example #1
0
        static void Main(string[] args)
        {
            //NounCollection coll = NounCollection.Instance;
            //String [] related = null;
            //Console.WriteLine(coll.Nouns["hello"].GetDescription(0, out related));

            //using (StreamWriter writer = new StreamWriter(File.Create(@"\1.txt")))
            //{
            //    for (int index = 0; index < 256; index++)
            //        writer.WriteLine(String.Concat(index, " ", (char)index));
            //}
            //Console.WriteLine((int)'e');//'é');

            //BingSearch search = new BingSearch();
            //search.SearchWeb("apj kalam");

            //Wikipedia wClass = new Wikipedia(new WikiQueryEngine());
            //Console.WriteLine(wClass.IsArticleAvailable("Plain white T's"));
            //SearchSuggestion searchSuggest = wClass.SearchArticles("Plain white T's", 10);
            //foreach (SearchSuggestionItem sItem in searchSuggest.Section)
            //{
            //    Console.WriteLine(sItem.Text + "\n\t" + sItem.Description + "\n" + sItem.Url);
            //}
            //Console.WriteLine(wClass.GetArticle("Seattle", false).Introduction);

            OmukSemantics semantics = new OmukSemantics();
            //YSearch search = new YSearch();
            //YSearchResultCollection resCollection = search.SearchWeb("me genera serotonina listening to Viva la Vida by Coldplay", 0, 10, ref semantics);
            BingSearch bsearch = new BingSearch();
            bsearch.SearchWeb("Am I Dreaming by Xscape", 0, 10, ref semantics);
            semantics.PostSearch();
            semantics.FormContext();

            LyricWiki wiki = new LyricWiki();
            LyricsResult lyrics = wiki.getSong("Rihanna", "Umbrella");
            Console.WriteLine(lyrics.lyrics);
            //Console.WriteLine("");
            LastFmService service = new LastFmService();
            //service.GetArtistInfo(

            //MusicBrainz mb = new MusicBrainz();
               // mb.GetAlbums

            //Grooveshark gshark = new Grooveshark();
            //GSSong[] song = gshark.SearchSong("Sugar", 2);

            //LyricWiki wiki = new LyricWiki();
            //LyricsResult lyrics = wiki.getSong("R.e.m", "Moon river");
            //lyrics.GetLyricsHtml();
            //SongResult songs = wiki.searchSongs("R.e.m", "Moon river");

            //String artist = "Flo rida";
            //String album = "Sugar";
            //int year = 2009;
            //String[] albums = null;
            //String res = wiki.getAlbum(ref artist, ref album, ref year, out albums);

            //AlbumData[] album = (AlbumData[])wiki.getArtist(ref artist);
            //LWLyrics lyrics = wiki.GetLyricsForSong("Flo rida", "sugar");
            //Console.WriteLine(wiki.IsArtist("rihanna"));
            //String[] albums = wiki.GetAlbums("rihanna");

            //LastFmService service = new LastFmService();
            //LFMArtist artist = service.GetArtistInfo("Rihanna");
            //List<LFMArtist> albums = service.SearchArtist("Kid Cudi", 0);

            //Immem immem = new Immem();
            //List<ImmemSearchItem> items = immem.SearchMedia("Rihanna good girl gone bad", "music", 0, 10);

            MusicBrainz mb = new MusicBrainz();
            List<MBAlbum> albums = mb.GetAlbums(String.Empty, "Rihanna", "73e5e69d-3554-40d8-8516-00cb38737a1c", 0, 10);
            List<MBSong> songs = mb.GetSongs("oh Carol", "Neil", "", "", "", 0, 2);

            //YouTube yt = new YouTube();
            //List<YTVideo> videos = yt.SearchVideos("oh carol", 0, 3);

            //RottenTomatoes rt = new RottenTomatoes();
            //String val = rt.GetTomatometerScore("http://www.rottentomatoes.com/m/1009437-heidi/");

            /*
            Twitter twitter = new Twitter();
            ////twitter.SearchTwitter("i gotta feeling", 0, 10);
            TMovieTrendsClass mTrends = new TMovieTrendsClass();
            twitter.GetMovieTrends("The Martian", ref mTrends);
            Console.WriteLine("");
            */

            //twitter.GetMovieTrends("\"the proposal\"",ref mTrends);
            //twitter.GetMovieTrends("\"year one\"", ref mTrends);
            //twitter.GetMovieTrends("\"Terminator Salvation\"", ref mTrends);
            //twitter.GetMovieTrends("\"Next day air\"", ref mTrends);
            //twitter.GetMovieTrends("\"Imagine That\"", ref mTrends);
            //twitter.GetMovieTrends("\"Taking of Pelham 1 2 3", ref mTrends);
            //twitter.GetMovieTrends("Wolverine", ref mTrends);
            //using (StreamWriter writer = new StreamWriter(File.Create("trend.txt")))
            //{
            //    foreach (KeyValuePair<String, int> keyval in mTrends.Trend)
            //    {
            //        if (keyval.Value > 3)
            //            writer.WriteLine(String.Format("{0} {1}", keyval.Key, keyval.Value));
            //    }
            //}

            //TSearchResultCollection twRes = twitter.SearchTwitter("palm pre", 0, 15);

            //Eventful evntful = new Eventful ();
            //EventCollection coll = evntful.SearchEvents("San Jose", 0, 10);
            //Digg digg = new Digg();
            //List<DiggResult> res = digg.SearchDigg("Hello", 0, 10);
            return;
        }
Example #2
0
        /// <summary>
        /// 
        /// </summary>
        public void FormContext()
        {
            if (this.Category.Equals("music"))
            {
                MusicBrainz mb = new MusicBrainz();
                String artist = String.Empty;
                String song = String.Empty;
                string mbid = String.Empty;
                int wStrength = Int32.MaxValue;
                int artistIndex = 0;
                String[] kWArr = this.KeyWords.ToArray();
                this.keyWords.Clear();

                for (int index = 0; index < kWArr.Length; index++)
                {
                    String txt = kWArr[index].ToLower();
                    List<MBArtist> artists = mb.GetArtists(txt, 0, 2);
                    if (artists != null)
                    {
                        foreach (MBArtist mbartist in artists)
                        {
                            String largeTxttmp = mbartist.Name.ToLower();
                            int weight = this.MapReplace(txt, largeTxttmp);

                            if (weight <= 3 && weight <= wStrength)
                            {
                                wStrength = weight;
                                artist = mbartist.Name;
                                mbid = mbartist.MBID;
                                artistIndex = index;
                            }
                        }
                    }
                }

                artistIndex = artistIndex == 0 ? 1 : 0;
                if (!String.IsNullOrEmpty(artist) && artistIndex < kWArr.Length)
                {
                    List<MBSong> songs = mb.GetSongs(kWArr[artistIndex], artist, String.Empty, String.Empty, String.Empty, 0, 3);

                    if (songs != null && songs.Count > 0)
                        song = songs[0].Title;
                    else
                    {
                        org.lyricwiki.www.service.LyricWiki lw = new org.lyricwiki.www.service.LyricWiki();
                        org.lyricwiki.www.service.LyricsResult lyrics = lw.getSong(artist, kWArr[artistIndex]);
                        if (lyrics != null)
                        {
                            song = lyrics.song;
                        }
                    }
                }

                this.keyWords.Add("artist:" + artist);
                this.keyWords.Add("album:" + String.Empty);
                this.keyWords.Add("song:" + song);
                this.keyWords.Add("mbid:" + mbid);
            }

            return;
        }