Exemplo n.º 1
0
 public ArtistItem(Artist artist)
 {
     InitializeComponent();
     Artist = artist;
     artistName.Text = artist.Name;
     randomCoverArt.Image = GetRandomAlbum(artist);
 }
Exemplo n.º 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);
 }
Exemplo n.º 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;
            }
        }
Exemplo n.º 4
0
 public SongsControl(Artist artist)
 {
     Init();
 }
Exemplo n.º 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);
 }
Exemplo n.º 6
0
 public AlbumsControl(Artist artist)
 {
     Init();
     Controls.Add(new AlbumViewer.AlbumViewer(artist) { Dock = DockStyle.Fill });
 }
Exemplo n.º 7
0
 public SongViewer(Artist artist)
 {
     InitializeComponent();
     ThreadPool.QueueUserWorkItem(CreateSongContainerArtist, artist);
 }
Exemplo n.º 8
0
 public AlbumViewer(Artist artist)
 {
     Init(new List<Artist> {artist});
 }
Exemplo n.º 9
0
 public static IEnumerable<Album> GetCachedAlbums(Artist artist)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 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));
        }