public ArtistItem(Artist artist) { InitializeComponent(); Artist = artist; artistName.Text = artist.Name; randomCoverArt.Image = GetRandomAlbum(artist); }
public SongsControl(Artist artist) { Init(); var panel = new Panel { AutoScroll = true, Dock = DockStyle.Fill }; Controls.Add(panel); var viewer = new SongViewer.SongViewer(artist) { Dock = DockStyle.Fill }; panel.Height = viewer.Height; panel.Controls.Add(viewer); }
public ArtistInfo GetArtistInfo(Artist artist) { try { StringBuilder urlBuilder = new StringBuilder("https://ws.audioscrobbler.com/2.0/?method=artist.getinfo&artist="); urlBuilder.Append(HttpUtility.UrlEncode(artist.Name)); urlBuilder.Append("&api_key="); urlBuilder.Append(apiKey); WebRequest request = WebRequest.Create(urlBuilder.ToString()); using (Stream response = request.GetResponse().GetResponseStream()) return new ArtistInfo(response); } catch (Exception ex) { //TODO: Write to logger Debug.WriteLine("An exception occured in LastFm. StackTrace: {0}", ex.StackTrace); return null; } }
public SongsControl(Artist artist) { Init(); }
public Bitmap GetRandomAlbum(Artist artist) { var albums = SubsonicRequest.GetArtistAlbums(artist); var r = new Random(albums.Count); return albums[albums.Count - 1].CoverArt(45); }
public AlbumsControl(Artist artist) { Init(); Controls.Add(new AlbumViewer.AlbumViewer(artist) { Dock = DockStyle.Fill }); }
public SongViewer(Artist artist) { InitializeComponent(); ThreadPool.QueueUserWorkItem(CreateSongContainerArtist, artist); }
public AlbumViewer(Artist artist) { Init(new List<Artist> {artist}); }
public static IEnumerable<Album> GetCachedAlbums(Artist artist) { throw new NotImplementedException(); }
public static IEnumerable<Album> GetArtistAlbums(Artist artist, bool ignoreCache = false) { if (!ignoreCache && Cache.CashExists(CacheType.Index)) return Cache.GetCachedAlbums(artist); Dictionary<string, string> paramaters = new Dictionary<string, string> { { "id", artist.ID } }; string url = BuildRequestUrl(RequestType.getMusicDirectory, paramaters); var response = SendRequest(url); if (!response.Successful) throw new Exception(String.Format("Error returned from Subsonic server :{0}", response.ErrorMessage)); IEnumerable<XElement> albumElements = Utility.GetElementsFromDocument(response.ResponseXml, Album.XmlTag); return (from albumElement in albumElements select new Album(albumElement)); }