示例#1
0
    def get(self, version):
        """Gets the top 100 trending (most popular) tracks on Audius"""
        trending_track_versions = trending_strategy_factory.get_versions_for_type(TrendingType.TRACKS).keys()
        version_list = list(filter(lambda v: v.name == version, trending_track_versions))
        if not version_list:
            abort_bad_path_param('version', ns)

        args = trending_parser.parse_args()
        strategy = trending_strategy_factory.get_strategy(TrendingType.TRACKS, version_list[0])
        trending_tracks = get_trending(args, strategy)
        return success_response(trending_tracks)
示例#2
0
 def get(self):
     """Gets the top 100 trending (most popular) tracks on Audius"""
     args = trending_parser.parse_args()
     time = args.get("time") if args.get("time") is not None else 'week'
     args = {
         'time': time,
         'genre': args.get("genre", None),
         'with_users': True
     }
     tracks = get_trending_tracks(args)
     tracks = list(map(extend_track, tracks))
     return success_response(tracks)
示例#3
0
    def get(self, version):
        trending_track_versions = trending_strategy_factory.get_versions_for_type(
            TrendingType.TRACKS).keys()
        version_list = list(
            filter(lambda v: v.name == version, trending_track_versions))
        if not version_list:
            abort_bad_path_param("version", ns)

        args = trending_parser.parse_args()
        strategy = trending_strategy_factory.get_strategy(
            TrendingType.TRACKS, version_list[0])
        trending_tracks = get_trending(args, strategy)
        return success_response(trending_tracks)
示例#4
0
 def get(self):
     """Gets the top 100 trending (most popular) tracks on Audius"""
     args = trending_parser.parse_args()
     trending = get_trending(args)
     return success_response(trending)