private void button4_Click(object sender, EventArgs e) { // Get your own API_KEY and API_SECRET from http://www.last.fm/api/account string API_KEY = "60d35bf7777d870ec958a21872bacb24"; string API_SECRET = "099158e5216ad77239be5e0a2228cf04"; // Create your session Session session = new Session(API_KEY, API_SECRET); //session.Authenticate("",Lastfm.Utilities.md5("")); // Set this static property to a System.Net.IWebProxy object //Lastfm.ProxySupport.Proxy = new System.Net.WebProxy("221.2.216.38", 8080); //Artist artist = new Artist("Lady Gaga", session); //string s = artist.Bio.GetURL(SiteLanguage.English); //ArtistBio artistBio=new ArtistBio(artist,session); //string contents = Regex.Replace(artistBio.getContent(), "<[^>]*>", ""); //string img = artist.GetImageURL(); Country country = new Country("RO", session); TopTrack[] tracks = country.GetTopTracks(); string s = tracks[0].Item.ToString(); // hzt //Connection connection = new Connection("mpm", Assembly.GetEntryAssembly().GetName().Version.ToString(), "", session); //ScrobbleManager scrobbleManager=new ScrobbleManager(connection); //NowplayingTrack track1 = new NowplayingTrack("Nexx", "Syncronize Lips", new TimeSpan(0, 2, 0)); //scrobbleManager.ReportNowplaying(track1); //Entry entry = new Entry("Nexx", "Syncronize Lips", DateTime.Now, PlaybackSource.User, new TimeSpan(0, 2, 0), ScrobbleMode.Played); //scrobbleManager.Queue(entry); //scrobbleManager.Submit(); // scrobbleManager.Submit(); // Test it out... Track track = new Track("david arnold", "the hot fuzz suite", session); Artist artist = track.Artist; ArtistBio artistBio = artist.Bio; string ss = artistBio.getContent(); Console.WriteLine(track.GetAlbum()); }
public bool SetSkinProperties(YouTubeEntry youTubeEntry, string prefix, bool grab, bool download) { if (youTubeEntry == null) { return(true); } ArtistItem artistItem = DatabaseProvider.InstanInstance.GetArtist(youTubeEntry); if (artistItem == null && grab) { string vidId = Youtube2MP.GetVideoId(youTubeEntry); artistItem = SitesCache.GetByVideoId(vidId) != null ? Grabber.GetFromVideoSite(SitesCache.GetByVideoId(vidId).SIte) : Grabber.GetFromVideoId(vidId); } if (artistItem == null) { string art = GetArtistName(youTubeEntry.Title.Text); artistItem = GetArtistsByName(art); } if ((artistItem == null || string.IsNullOrEmpty(artistItem.Bio) || string.IsNullOrEmpty(artistItem.Img_url)) && grab) { if (artistItem == null || string.IsNullOrEmpty((artistItem.Name))) { artistItem = new ArtistItem() { Name = GetArtistName(youTubeEntry.Title.Text) } } ; try { Lastfm.Services.Artist artist = new Lastfm.Services.Artist(artistItem.Name, Youtube2MP.LastFmProfile.Session); if (string.IsNullOrEmpty(artistItem.Img_url)) { artistItem.Img_url = artist.GetImageURL(ImageSize.Huge); } if (string.IsNullOrEmpty(artistItem.Bio)) { ArtistBio artistBio = artist.Bio; artistBio.Lang = GUILocalizeStrings.GetCultureName(GUILocalizeStrings.CurrentLanguage()); string contents = Regex.Replace(HttpUtility.HtmlDecode(artistBio.getContent()), "<.*?>", string.Empty); if (string.IsNullOrEmpty(contents)) { artistBio.Lang = string.Empty; contents = Regex.Replace(HttpUtility.HtmlDecode(artistBio.getContent()), "<.*?>", string.Empty); } artistItem.Bio = contents; } if (string.IsNullOrEmpty(artistItem.Tags)) { int i = 0; string tags = ""; TopTag[] topTags = artist.GetTopTags(); foreach (TopTag tag in topTags) { tags += tag.Item.Name + "|"; if (i < 5) { if (!string.IsNullOrEmpty(artistItem.Id)) { SaveTag(artistItem, tag.Item.Name); } } i++; } artistItem.Tags = tags; } DatabaseProvider.InstanInstance.AddArtist(artistItem); } catch (Exception exception) { Log.Debug(exception.Message); } } if (artistItem != null) { if (download && !File.Exists(artistItem.LocalImage)) { Youtube2MP.DownloadFile(artistItem.Img_url, artistItem.LocalImage); } SetSkinProperties(artistItem, prefix); } return(false); }