Example #1
0
        /// <summary>
        /// Get an album chart for a group, for a given date range.
        /// If no date range is supplied, it will return the most recent album chart for this group.
        /// </summary>
        /// <param name="weeklyRange">
        /// The date at which the chart should start from.
        /// The date at which the chart should end on.
        /// </param>
        /// <returns>Album chart for a group, for a given date range</returns>
        public Album[] GetWeeklyAlbumChart(WeeklyRange weeklyRange = null)
        {
            var p = getParams();

            if (weeklyRange != null)
            {
                p["from"] = Utilities.DateTimeToUTCTimestamp(weeklyRange.Start).ToString(CultureInfo.InvariantCulture);
                p["top"]  = Utilities.DateTimeToUTCTimestamp(weeklyRange.End).ToString(CultureInfo.InvariantCulture);
            }

            var req = request("group.getWeeklyAlbumChart", p);
            var res = extract <AlbumArray>(req, "weeklyalbumchart");

            return(res.Albums);
        }
Example #2
0
        /// <summary>
        /// Get an artist chart for a tag, for a given date range.
        /// If no date range is supplied, it will return the most recent artist chart for this tag.
        /// </summary>
        /// <param name="weeklyRange">
        /// The date at which the chart should start from. See Tag.getWeeklyChartList for more.
        /// The date at which the chart should end on. See Tag.getWeeklyChartList for more.
        /// </param>
        /// <param name="limit">The number of results to fetch per page. Defaults to 50.</param>
        /// <returns></returns>
        public Artist[] GetWeeklyArtistChart(WeeklyRange weeklyRange = null, int limit = 50)
        {
            var p = getParams();

            p["limit"] = limit.ToString(CultureInfo.InvariantCulture);
            if (weeklyRange != null)
            {
                p["start"] = Utilities.DateTimeToUTCTimestamp(weeklyRange.Start).ToString(CultureInfo.InvariantCulture);
                p["end"]   = Utilities.DateTimeToUTCTimestamp(weeklyRange.End).ToString(CultureInfo.InvariantCulture);
            }

            var req = request("tag.getWeeklyArtistChart", p);
            var res = extract <ArtistArray>(req, "weeklyartistchart");

            return(res.Artists);
        }
Example #3
0
        /// <summary>
        /// Get a chart of hyped (up and coming) artists for a metro
        /// </summary>
        /// <param name="metro">The metro's name</param>
        /// <param name="country">A country name, as defined by the ISO 3166-1 country names standard</param>
        /// <param name="weeklyRange">Timestamp of the weekly range</param>
        /// <param name="page">The page number to fetch. Defaults to first page</param>
        /// <param name="limit">The number of results to fetch per page. Defaults to 50</param>
        /// <returns></returns>
        public Artist[] GetMetroHypeArtistChart(string metro, string country,
                                                WeeklyRange weeklyRange = null, int page = 1, int limit = 50)
        {
            var p = getParams();

            p["metro"]   = metro;
            p["country"] = country;
            if (weeklyRange != null)
            {
                p["start"] = Utilities.DateTimeToUTCTimestamp(weeklyRange.Start).ToString(CultureInfo.InvariantCulture);
                p["end"]   = Utilities.DateTimeToUTCTimestamp(weeklyRange.End).ToString(CultureInfo.InvariantCulture);
            }
            p["page"]  = page.ToString(CultureInfo.InvariantCulture);
            p["limit"] = limit.ToString(CultureInfo.InvariantCulture);

            var req = request("geo.getMetroHypeArtistChart", p);
            var res = extract <ArtistArray>(req, "topartists");

            return(res.Artists);
        }