Exemple #1
0
 private WeeklyTop GetTopByWeekForArtists(Week week, int topLength)
 {
     try
     {
         return new WeeklyTop
             {
                 WeekNo = week.WeekNo,
                 TopProcessed = week.TopProcessed,
                 ItemType = ItemType.Artist,
                 TopItems = Utility.Deserialize<LfmGetChartArtistsResponse>(
                     HttpHelper.Get(@"http://ws.audioscrobbler.com/2.0/?method=user.getweeklyartistchart" +
                         @"&user=scentmaster&from=" +
                         week.StartingFrom.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString() +
                         "&to=" +
                         week.EndingIn.Subtract(new DateTime(1970, 1, 1)).TotalSeconds.ToString() +
                         "&api_key=" + ApiKey))
                             .Artists
                             .TransformToTopItems(topLength)
             };
     }
     catch (Exception ex)
     {
         //Should log
         return null;
     }
 }
Exemple #2
0
        public WeeklyTop GetTopByWeek(Week requestedWeek, int topLength, ItemType itemType)
        {
            if (topLength < _defaultTopLength)
                topLength = _defaultTopLength;

            requestedWeek.TopProcessed = IsWeekProcessed(_topRecordProvider.GetTopProcessed(), requestedWeek.WeekNo, itemType);
            if (itemType == ItemType.Artist)
                return GetTopByWeekForArtists(requestedWeek, topLength);
            else
                return GetTopbyWeekForTracks(requestedWeek, topLength);
        }