Exemple #1
0
 public ArtistItem(Artist artist)
 {
     InitializeComponent();
     Artist = artist;
     artistName.Text = artist.Name;
     randomCoverArt.Image = GetRandomAlbum(artist);
 }
Exemple #2
0
 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);
 }
Exemple #3
0
        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;
            }
        }
Exemple #4
0
 public SongsControl(Artist artist)
 {
     Init();
 }
Exemple #5
0
 public Bitmap GetRandomAlbum(Artist artist)
 {
     var albums = SubsonicRequest.GetArtistAlbums(artist);
     var r = new Random(albums.Count);
     return albums[albums.Count - 1].CoverArt(45);
 }
Exemple #6
0
 public AlbumsControl(Artist artist)
 {
     Init();
     Controls.Add(new AlbumViewer.AlbumViewer(artist) { Dock = DockStyle.Fill });
 }
Exemple #7
0
 public SongViewer(Artist artist)
 {
     InitializeComponent();
     ThreadPool.QueueUserWorkItem(CreateSongContainerArtist, artist);
 }
Exemple #8
0
 public AlbumViewer(Artist artist)
 {
     Init(new List<Artist> {artist});
 }
Exemple #9
0
 public static IEnumerable<Album> GetCachedAlbums(Artist artist)
 {
     throw new NotImplementedException();
 }
Exemple #10
0
        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));
        }