Ejemplo n.º 1
0
 def get_weekly_tag_chart(self, start=None, end=None):
     """
     Get a tag chart for the group, for a given date range.
     If no date range is supplied, it will return the most 
     recent tag chart for the group. 
     
     @param start:    the date at which the chart should start from (optional)
     @type start:     C{datetime.datetime}
     @param end:      the date at which the chart should end on (optional)
     @type end:       C{datetime.datetime}
     
     @return:         a tag chart for the group
     @rtype:          L{WeeklyTagChart}
     
     @raise InvalidParametersError: Both start and end parameter have to be either
                                    provided or not provided. Providing only one of
                                    them will raise an exception.
                                    
     @note: This method is a composite method. It is not provided directly by the
            last.fm API. It uses other methods to collect the data, analyzes it and
            creates a chart. So this method is a little heavy to call, as it does
            mulitple calls to the API. 
     """
     from lastfm.chart import WeeklyChart, WeeklyTagChart
     WeeklyChart._check_chart_params({}, self, start, end)
     return WeeklyTagChart.create_from_data(self._api, self, start, end)
Ejemplo n.º 2
0
 def get_weekly_tag_chart(self, start = None, end = None):
     """
     Get a tag chart for the group, for a given date range.
     If no date range is supplied, it will return the most 
     recent tag chart for the group. 
     
     @param start:    the date at which the chart should start from (optional)
     @type start:     C{datetime.datetime}
     @param end:      the date at which the chart should end on (optional)
     @type end:       C{datetime.datetime}
     
     @return:         a tag chart for the group
     @rtype:          L{WeeklyTagChart}
     
     @raise InvalidParametersError: Both start and end parameter have to be either
                                    provided or not provided. Providing only one of
                                    them will raise an exception.
                                    
     @note: This method is a composite method. It is not provided directly by the
            last.fm API. It uses other methods to collect the data, analyzes it and
            creates a chart. So this method is a little heavy to call, as it does
            mulitple calls to the API. 
     """
     from lastfm.chart import WeeklyChart, WeeklyTagChart
     WeeklyChart._check_chart_params({}, self, start, end)
     return WeeklyTagChart.create_from_data(self._api, self, start, end)
Ejemplo n.º 3
0
 def get_weekly_album_chart(self, start=None, end=None):
     """
     Get an album chart for the group, for a given date range.
     If no date range is supplied, it will return the most 
     recent album chart for the group. 
     
     @param start:    the date at which the chart should start from (optional)
     @type start:     C{datetime.datetime}
     @param end:      the date at which the chart should end on (optional)
     @type end:       C{datetime.datetime}
     
     @return:         an album chart for the group
     @rtype:          L{WeeklyAlbumChart}
     
     @raise InvalidParametersError: Both start and end parameter have to be either
                                    provided or not provided. Providing only one of
                                    them will raise an exception.
     """
     from lastfm.chart import WeeklyChart, WeeklyAlbumChart
     params = self._default_params({
         'method':
         '%s.getWeeklyAlbumChart' % self.__class__.__name__.lower()
     })
     params = WeeklyChart._check_chart_params(params, self, start, end)
     data = self._api._fetch_data(params).find('weeklyalbumchart')
     return WeeklyAlbumChart.create_from_data(self._api, self, data)
Ejemplo n.º 4
0
 def weekly_chart_list(self):
     """
     a list of available weekly charts for this group
     @rtype: L{list} of L{WeeklyChart}
     """
     from lastfm.chart import WeeklyChart
     params = self._default_params(
         {'method': '%s.getWeeklyChartList' % self.__class__.__name__.lower()})
     data = self._api._fetch_data(params).find('weeklychartlist')
     return [
             WeeklyChart.create_from_data(self._api, self, c)
             for c in data.findall('chart')
             ]
Ejemplo n.º 5
0
 def get_weekly_album_chart(self, start = None, end = None):
     """
     Get an album chart for the group, for a given date range.
     If no date range is supplied, it will return the most 
     recent album chart for the group. 
     
     @param start:    the date at which the chart should start from (optional)
     @type start:     C{datetime.datetime}
     @param end:      the date at which the chart should end on (optional)
     @type end:       C{datetime.datetime}
     
     @return:         an album chart for the group
     @rtype:          L{WeeklyAlbumChart}
     
     @raise InvalidParametersError: Both start and end parameter have to be either
                                    provided or not provided. Providing only one of
                                    them will raise an exception.
     """
     from lastfm.chart import WeeklyChart, WeeklyAlbumChart
     params = self._default_params(
         {'method': '%s.getWeeklyAlbumChart' % self.__class__.__name__.lower()})
     params = WeeklyChart._check_chart_params(params, self, start, end)
     data = self._api._fetch_data(params).find('weeklyalbumchart')
     return WeeklyAlbumChart.create_from_data(self._api, self, data)