/// <summary>
        /// Get album's page async
        /// </summary>
        /// <returns>Parsed album's page</returns>
        public async Task <AlbumResult> GetFullAlbumAsync()
        {
            WebDownloader downloader = new WebDownloader(AlbumUrl);
            string        content    = await downloader.DownloadDataAsync();

            return(WebContentParser.Parse <AlbumResult>(content));
        }
Пример #2
0
        /// <summary>
        /// Get band's page async
        /// </summary>
        /// <returns>Parsed band's page</returns>
        public async Task <BandResult> GetFullBandAsync()
        {
            WebDownloader downloader = new WebDownloader(BandUrl);
            string        content    = await downloader.DownloadDataAsync();

            return(WebContentParser.Parse <BandResult>(content));
        }
Пример #3
0
        /// <summary>
        /// Gets list of band's albums simple list async
        /// </summary>
        public async Task <IEnumerable <AlbumBandResult> > GetAlbumsAsync(AlbumListType type)
        {
            WebDownloader wd      = new WebDownloader($@"https://www.metal-archives.com/band/discography/id/{Id}/tab/" + type.ToString().ToLower());
            string        content = await wd.DownloadDataAsync();

            return(WebContentParser.ParseList <AlbumBandResult>(content));
        }
Пример #4
0
        /// <summary>
        /// Gets actual song's lyrics async
        /// </summary>
        /// <returns>Lyrics or string.Empty if not exists</returns>
        public async Task <string> GetLyricsAsync()
        {
            string lyrics = string.Empty;

            if (HasLyrics)
            {
                WebDownloader wd = new WebDownloader($@"https://www.metal-archives.com/release/ajax-view-lyrics/id/{Id}");

                HtmlDocument document = new HtmlDocument();
                document.LoadHtml(await wd.DownloadDataAsync());

                lyrics = document.DocumentNode.InnerText.Trim();
            }

            return(lyrics);
        }
Пример #5
0
        /// <summary>
        /// If <see cref="NotesFullUrl"/> is not null, it returns full band's notes async
        /// </summary>
        /// <returns>Band's notes</returns>
        public async Task <string> GetFullNotesAsync()
        {
            if (string.IsNullOrEmpty(NotesFullUrl))
            {
                return(string.Empty);
            }

            WebDownloader downloader = new WebDownloader(NotesFullUrl);
            string        content    = await downloader.DownloadDataAsync();

            HtmlDocument doc = new HtmlDocument();

            doc.LoadHtml(content);

            return(doc.DocumentNode.InnerText);
        }
Пример #6
0
        /// <summary>
        /// Searches item by name async.
        /// </summary>
        /// <param name="name">Item's name</param>
        /// <returns>List of items result - without pagination, all rows at once</returns>
        public async Task <IEnumerable <T> > ByNameAsync(string name)
        {
            List <T> items = new List <T>();

            _configurator.Parameters["query"] = name;
            var             wd = new WebDownloader(_configurator.Url, _configurator.Parameters);
            IEnumerable <T> itemsToAdd;
            int             page = 0;

            do
            {
                _configurator.Parameters["iDisplayStart"] = page++.ToString();
                var response = await wd.DownloadDataAsync();

                itemsToAdd = ProcessParse(response);
                items.AddRange(itemsToAdd);
            }while (itemsToAdd.Count() != 0);

            return(items);
        }