Exemplo n.º 1
0
        // Artist metadata
        //[0]: "_elementType"
        //[1]: "ratingKey"
        //[2]: "key"
        //[3]: "type"
        //[4]: "title"
        //[5]: "summary"
        //[6]: "index"
        //[7]: "thumb"
        //[8]: "art"
        //[9]: "addedAt"
        //[10]: "updatedAt"
        //[11]: "_children"

        private async Task <List <Artist> > GetMusicSectionArtists(MusicSection musicSection)
        {
            var max  = 10;
            var list = new List <Artist>();

            using (dynamic client = this.CreateDynamicClient(string.Format("library/sections/{0}/all", musicSection.SectionID)))
            {
                dynamic result = await client.get();

                var artists = result._children as IEnumerable <dynamic>;
                foreach (dynamic artist in artists)
                {
                    if (max-- == 0)
                    {
                        break;
                    }
                    DoProgress(String.Format("Adding '{0}'", artist.title));
                    var a = new Artist(musicSection, artist);
                    a.Albums = await GetArtistAlbums(a);

                    DoProgress(String.Format("...{0} albums", a.Albums.Count));

                    if (a.Albums.Count > 0)
                    {
                        list.Add(a);
                    }
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        // Artist metadata
        //[0]: "_elementType"
        //[1]: "ratingKey"
        //[2]: "key"
        //[3]: "type"
        //[4]: "title"
        //[5]: "summary"
        //[6]: "index"
        //[7]: "thumb"
        //[8]: "art"
        //[9]: "addedAt"
        //[10]: "updatedAt"
        //[11]: "_children"

        private async Task<List<Artist>> GetMusicSectionArtists(MusicSection musicSection)
        {
            var max = 10;
            var list = new List<Artist>();
            using (dynamic client = this.CreateDynamicClient(string.Format("library/sections/{0}/all", musicSection.SectionID)))
            {
                dynamic result = await client.get();
                var artists = result._children as IEnumerable<dynamic>;
                foreach (dynamic artist in artists)
                {
                    if (max-- == 0)
                    {
                        break;
                    }
                    DoProgress(String.Format("Adding '{0}'",artist.title));
                    var a = new Artist(musicSection, artist);
                    a.Albums = await GetArtistAlbums(a);
                    DoProgress(String.Format("...{0} albums", a.Albums.Count));
                    
                    if (a.Albums.Count > 0)
                    {
                        list.Add(a);
                    }
                }
            }
            return list;
        }