1   
  2   
  3   
  4  """ 
  5  Copyright (c) 2010 The Echo Nest. All rights reserved. 
  6  Created by Tyler Williams on 2010-04-25. 
  7   
  8  The Playlist module loosely covers http://developer.echonest.com/docs/v4/playlist.html 
  9  Refer to the official api documentation if you are unsure about something. 
 10  """ 
 11   
 12  import util 
 13  from proxies import PlaylistProxy, BetaPlaylistProxy 
 14  from song import Song 
 15  import catalog 
 16   
 18      """ 
 19      A Dynamic Playlist object 
 20       
 21      Attributes: 
 22          session_id (str): Playlist Session ID 
 23   
 24          song (song object): The current song 
 25   
 26          info (dictionary): Information about this playlist 
 27       
 28      Example: 
 29          >>> p = Playlist(type='artist-radio', artist=['ida maria', 'florence + the machine']) 
 30          >>> p 
 31          <Dynamic Playlist - 9c210205d4784144b4fa90770fa55d0b> 
 32          >>> p.song 
 33          <song - Later On> 
 34          >>> p.get_next_song() 
 35          <song - Overall> 
 36          >>>  
 37   
 38      """ 
 39       
 40 -    def __init__(self, session_id=None, type='artist', artist_pick='song_hotttnesss-desc', variety=.5, artist_id=None, artist=None, \ 
 41                          song_id=None, track_id=None, description=None, style=None, mood=None, \ 
 42                          max_tempo=None, min_tempo=None, max_duration=None, \ 
 43                          min_duration=None, max_loudness=None, min_loudness=None, max_danceability=None, min_danceability=None, \ 
 44                          max_energy=None, min_energy=None, artist_max_familiarity=None, artist_min_familiarity=None, \ 
 45                          artist_max_hotttnesss=None, artist_min_hotttnesss=None, song_max_hotttnesss=None, song_min_hotttnesss=None, \ 
 46                          min_longitude=None, max_longitude=None, min_latitude=None, max_latitude=None, adventurousness=0.2, \ 
 47                          mode=None, key=None, buckets=[], sort=None, limit=False,  
 48                          dmca=False, chain_xspf=False, \ 
 49                          seed_catalog=None, steer=None, source_catalog=None, steer_description=None, test_new_things=None, rank_type=None, 
 50                          artist_start_year_after=None, artist_start_year_before=None, artist_end_year_after=None, artist_end_year_before=None): 
  51          """ 
 52          Args: 
 53   
 54          Kwargs: 
 55              type (str): a string representing the playlist type ('artist', 'artist-radio', ...) 
 56   
 57              artist_pick (str): How songs should be chosen for each artist 
 58   
 59              variety (float): A number between 0 and 1 specifying the variety of the playlist 
 60   
 61              artist_id (str): the artist_id 
 62   
 63              artist (str): the name of an artist 
 64   
 65              song_id (str): the song_id 
 66   
 67              track_id (str): the track_id 
 68   
 69              description (str): A string describing the artist and song 
 70               
 71              style (str): A string describing the style/genre of the artist and song 
 72   
 73              mood (str): A string describing the mood of the artist and song 
 74               
 75              results (int): An integer number of results to return 
 76   
 77              max_tempo (float): The max tempo of song results 
 78   
 79              min_tempo (float): The min tempo of song results 
 80   
 81              max_duration (float): The max duration of song results 
 82   
 83              min_duration (float): The min duration of song results 
 84   
 85              max_loudness (float): The max loudness of song results 
 86   
 87              min_loudness (float): The min loudness of song results 
 88   
 89              artist_max_familiarity (float): A float specifying the max familiarity of artists to search for 
 90   
 91              artist_min_familiarity (float): A float specifying the min familiarity of artists to search for 
 92   
 93              artist_max_hotttnesss (float): A float specifying the max hotttnesss of artists to search for 
 94   
 95              artist_min_hotttnesss (float): A float specifying the max hotttnesss of artists to search for 
 96   
 97              song_max_hotttnesss (float): A float specifying the max hotttnesss of songs to search for 
 98   
 99              song_min_hotttnesss (float): A float specifying the max hotttnesss of songs to search for 
100   
101              max_energy (float): The max energy of song results 
102   
103              min_energy (float): The min energy of song results 
104   
105              max_dancibility (float): The max dancibility of song results 
106   
107              min_dancibility (float): The min dancibility of song results 
108   
109              mode (int): 0 or 1 (minor or major) 
110   
111              key (int): 0-11 (c, c-sharp, d, e-flat, e, f, f-sharp, g, a-flat, a, b-flat, b) 
112   
113              max_latitude (float): A float specifying the max latitude of artists to search for 
114   
115              min_latitude (float): A float specifying the min latitude of artists to search for 
116   
117              max_longitude (float): A float specifying the max longitude of artists to search for 
118   
119              min_longitude (float): A float specifying the min longitude of artists to search for                         
120   
121              adventurousness (float): A float ranging from 0 for old favorites to 1.0 for unheard music according to a seed_catalog 
122   
123              sort (str): A string indicating an attribute and order for sorting the results 
124   
125              buckets (list): A list of strings specifying which buckets to retrieve 
126   
127              limit (bool): A boolean indicating whether or not to limit the results to one of the id spaces specified in buckets 
128   
129              seed_catalog (str or Catalog): A Catalog object or catalog id to use as a seed 
130               
131              source_catalog (str or Catalog): A Catalog object or catalog id 
132               
133              steer (str): A steering value to determine the target song attributes 
134               
135              steer_description (str): A steering value to determine the target song description term attributes 
136               
137              rank_type (str): A string denoting the desired ranking for description searches, either 'relevance' or 'familiarity' 
138               
139              artist_start_year_before (int): Returned songs's artists will have started recording music before this year. 
140               
141              artist_start_year_after (int): Returned songs's artists will have started recording music after this year. 
142               
143              artist_end_year_before (int): Returned songs's artists will have stopped recording music before this year. 
144               
145              artist_end_year_after (int): Returned songs's artists will have stopped recording music after this year. 
146               
147          Returns: 
148              A dynamic playlist object 
149           
150               
151          """ 
152          limit = str(limit).lower() 
153          dmca = str(dmca).lower() 
154          chain_xspf = str(chain_xspf).lower() 
155           
156          if isinstance(seed_catalog, catalog.Catalog): 
157              seed_catalog = seed_catalog.id 
158   
159          if isinstance(source_catalog, catalog.Catalog): 
160              source_catalog = source_catalog.id 
161   
162          kwargs = locals() 
163          kwargs['bucket'] = kwargs['buckets'] 
164          del kwargs['buckets'] 
165          del kwargs['self'] 
166          del kwargs['session_id'] 
167           
168          super(Playlist, self).__init__(session_id, **kwargs) 
 169       
171          return "<Dynamic Playlist - %s>" % self.session_id.encode('utf-8') 
 172       
173       
174       
175       
177          """Get the next song in the playlist 
178           
179          Args: 
180           
181          Kwargs: 
182           
183          Returns: 
184              A song object 
185           
186          Example: 
187           
188          >>> p = playlist.Playlist(type='artist-radio', artist=['ida maria', 'florence + the machine']) 
189          >>> p.get_next_song() 
190          <song - She Said> 
191          >>> 
192           
193          """ 
194          response = self.get_attribute('dynamic', session_id=self.session_id, **kwargs) 
195          self.cache['songs'] = response['songs'] 
196           
197          fix = lambda x : dict((str(k), v) for (k,v) in x.iteritems()) 
198          if len(self.cache['songs']): 
199              return Song(**fix(self.cache['songs'][0])) 
200          else: 
201              return None 
 202       
204          """Get the current song in the playlist 
205           
206          Args: 
207           
208          Kwargs: 
209           
210          Returns: 
211              A song object 
212           
213          Example: 
214           
215          >>> p = playlist.Playlist(type='artist-radio', artist=['ida maria', 'florence + the machine']) 
216          >>> p.song 
217          <song - Later On> 
218          >>> p.get_current_song() 
219          <song - Later On> 
220          >>>  
221   
222          """ 
223           
224          if not 'songs' in self.cache: 
225              self.get_next_song() 
226          if len(self.cache['songs']): 
227              return Song(**util.fix(self.cache['songs'][0])) 
228          else: 
229              return None 
 230   
231      song = property(get_current_song) 
232       
234          """Get information about the playlist 
235           
236          Args: 
237           
238          Kwargs: 
239           
240          Returns: 
241              A dict with diagnostic information about the currently running playlist 
242           
243          Example: 
244           
245          >>> p = playlist.Playlist(type='artist-radio', artist=['ida maria', 'florence + the machine']) 
246          >>> p.info 
247          { 
248              u 'terms': [{ 
249                  u 'frequency': 1.0, 
250                  u 'name': u 'rock' 
251              }, 
252              { 
253                  u 'frequency': 0.99646542152360207, 
254                  u 'name': u 'pop' 
255              }, 
256              { 
257                  u 'frequency': 0.90801905502131963, 
258                  u 'name': u 'indie' 
259              }, 
260              { 
261                  u 'frequency': 0.90586455490260576, 
262                  u 'name': u 'indie rock' 
263              }, 
264              { 
265                  u 'frequency': 0.8968907243373172, 
266                  u 'name': u 'alternative' 
267              }, 
268              [...] 
269              { 
270                  u 'frequency': 0.052197425644931635, 
271                  u 'name': u 'easy listening' 
272              }], 
273              u 'description': [], 
274              u 'seed_songs': [], 
275              u 'banned_artists': [], 
276              u 'rules': [{ 
277                  u 'rule': u "Don't put two copies of the same song in a playlist." 
278              }, 
279              { 
280                  u 'rule': u 'Give preference to artists that are not already in the playlist' 
281              }], 
282              u 'session_id': u '9c1893e6ace04c8f9ce745f38b35ff95', 
283              u 'seeds': [u 'ARI4XHX1187B9A1216', u 'ARNCHOP121318C56B8'], 
284              u 'skipped_songs': [], 
285              u 'banned_songs': [], 
286              u 'playlist_type': u 'artist-radio', 
287              u 'seed_catalogs': [], 
288              u 'rated_songs': [], 
289              u 'history': [{ 
290                  u 'artist_id': u 'ARN6QMG1187FB56C8D', 
291                  u 'artist_name': u 'Laura Marling', 
292                  u 'id': u 'SOMSHNP12AB018513F', 
293                  u 'served_time': 1291412277.204201, 
294                  u 'title': u 'Hope In The Air' 
295              }] 
296          } 
297           
298          >>> p.session_info() 
299          (same result as above) 
300          >>>  
301   
302          """ 
303          return self.get_attribute("session_info", session_id=self.session_id) 
 304       
305      info = property(session_info) 
 306   
307   
308 -def basic(type='artist-radio', artist_id=None, artist=None, song_id=None, song=None, track_id=None, 
309            dmca=False, results=15, buckets=None, limit=False): 
 310      """Get a basic playlist 
311       
312      Args: 
313       
314      Kwargs: 
315          type (str): a string representing the playlist type ('artist-radio' or 'song-radio') 
316           
317          artist_id (str): the artist_id to seed the playlist 
318           
319          artist (str): the name of an artist to seed the playlist 
320           
321          song_id (str): a song_id to seed the playlist 
322           
323          song (str): the name of a song to seed the playlist 
324           
325          track_id (str): the name of a track to seed the playlist 
326           
327          dmca (bool): make the playlist dmca-compliant 
328           
329          results (int): desired length of the playlist 
330           
331          buckets (list): A list of strings specifying which buckets to retrieve 
332           
333          limit (bool): Whether results should be restricted to any idspaces given in the buckets parameter 
334      """ 
335       
336      limit = str(limit).lower() 
337      dmca = str(dmca).lower() 
338       
339      kwargs = locals() 
340      kwargs['bucket'] = kwargs['buckets'] 
341      del kwargs['buckets'] 
342       
343      result = util.callm("%s/%s" % ('playlist', 'basic'), kwargs) 
344      return [Song(**util.fix(s_dict)) for s_dict in result['response']['songs']]     
 345   
346   
347 -def static(type='artist', artist_pick='song_hotttnesss-desc', variety=.5, artist_id=None, artist=None, \ 
348                      song_id=None, track_id=None, description=None, style=None, mood=None, \ 
349                      results=15, max_tempo=None, min_tempo=None, max_duration=None, \ 
350                      min_duration=None, max_loudness=None, min_loudness=None, max_danceability=None, min_danceability=None, \ 
351                      max_energy=None, min_energy=None, artist_max_familiarity=None, artist_min_familiarity=None, \ 
352                      artist_max_hotttnesss=None, artist_min_hotttnesss=None, song_max_hotttnesss=None, song_min_hotttnesss=None, \ 
353                      min_longitude=None, max_longitude=None, min_latitude=None, max_latitude=None, adventurousness=0.2, \ 
354                      mode=None, key=None, buckets=[], sort=None, limit=False, seed_catalog=None, source_catalog=None, rank_type=None, test_new_things=None, 
355                      artist_start_year_after=None, artist_start_year_before=None, artist_end_year_after=None, artist_end_year_before=None,dmca=False, distribution=None, song_type=None): 
 356      """Get a static playlist 
357       
358      Args: 
359       
360      Kwargs: 
361          type (str): a string representing the playlist type ('artist', 'artist-radio', ...) 
362           
363          artist_pick (str): How songs should be chosen for each artist 
364           
365          variety (float): A number between 0 and 1 specifying the variety of the playlist 
366           
367          artist_id (str): the artist_id 
368           
369          artist (str): the name of an artist 
370           
371          song_id (str): the song_id 
372           
373          track_id (str): the track id 
374           
375          description (str): A string describing the artist and song 
376           
377          style (str): A string describing the style/genre of the artist and song 
378       
379          mood (str): A string describing the mood of the artist and song 
380           
381          results (int): An integer number of results to return 
382       
383          max_tempo (float): The max tempo of song results 
384       
385          min_tempo (float): The min tempo of song results 
386       
387          max_duration (float): The max duration of song results 
388       
389          min_duration (float): The min duration of song results 
390       
391          max_loudness (float): The max loudness of song results 
392       
393          min_loudness (float): The min loudness of song results 
394       
395          artist_max_familiarity (float): A float specifying the max familiarity of artists to search for 
396       
397          artist_min_familiarity (float): A float specifying the min familiarity of artists to search for 
398       
399          artist_max_hotttnesss (float): A float specifying the max hotttnesss of artists to search for 
400       
401          artist_min_hotttnesss (float): A float specifying the max hotttnesss of artists to search for 
402       
403          song_max_hotttnesss (float): A float specifying the max hotttnesss of songs to search for 
404       
405          song_min_hotttnesss (float): A float specifying the max hotttnesss of songs to search for 
406       
407          max_energy (float): The max energy of song results 
408       
409          min_energy (float): The min energy of song results 
410       
411          max_dancibility (float): The max dancibility of song results 
412       
413          min_dancibility (float): The min dancibility of song results 
414       
415          mode (int): 0 or 1 (minor or major) 
416       
417          key (int): 0-11 (c, c-sharp, d, e-flat, e, f, f-sharp, g, a-flat, a, b-flat, b) 
418       
419          max_latitude (float): A float specifying the max latitude of artists to search for 
420       
421          min_latitude (float): A float specifying the min latitude of artists to search for 
422       
423          max_longitude (float): A float specifying the max longitude of artists to search for 
424       
425          min_longitude (float): A float specifying the min longitude of artists to search for                         
426           
427          adventurousness (float): A float ranging from 0 for old favorites to 1.0 for unheard music according to a seed_catalog 
428       
429          sort (str): A string indicating an attribute and order for sorting the results 
430       
431          buckets (list): A list of strings specifying which buckets to retrieve 
432       
433          limit (bool): A boolean indicating whether or not to limit the results to one of the id spaces specified in buckets 
434           
435          seed_catalog (str or Catalog): An Artist Catalog object or Artist Catalog id to use as a seed 
436           
437          source_catalog (str or Catalog): A Catalog object or catalog id 
438   
439          rank_type (str): A string denoting the desired ranking for description searches, either 'relevance' or 'familiarity'     
440           
441          artist_start_year_before (int): Returned songs's artists will have started recording music before this year. 
442           
443          artist_start_year_after (int): Returned songs's artists will have started recording music after this year. 
444           
445          artist_end_year_before (int): Returned songs's artists will have stopped recording music before this year. 
446           
447          artist_end_year_after (int): Returned songs's artists will have stopped recording music after this year. 
448   
449          distribution (str): Affects the range of artists returned and how many songs each artsits will have in the playlist realative to how similar they are to the seed. (wandering, focused) 
450   
451          song_type (str):  A string or list of strings of the type of songs allowed.  The only valid song type at the moment is 'christmas'. 
452                            Valid formats are 'song_type', 'song_type:true', 'song_type:false', or 'song_type:any'. 
453   
454      Returns: 
455          A list of Song objects 
456       
457      Example: 
458       
459      >>> p = playlist.static(type='artist-radio', artist=['ida maria', 'florence + the machine']) 
460      >>> p 
461      [<song - Pickpocket>, 
462       <song - Self-Taught Learner>, 
463       <song - Maps>, 
464       <song - Window Blues>, 
465       <song - That's Not My Name>, 
466       <song - My Lover Will Go>, 
467       <song - Home Sweet Home>, 
468       <song - Stella & God>, 
469       <song - Don't You Want To Share The Guilt?>, 
470       <song - Forget About It>, 
471       <song - Dull Life>, 
472       <song - This Trumpet In My Head>, 
473       <song - Keep Your Head>, 
474       <song - One More Time>, 
475       <song - Knights in Mountain Fox Jackets>] 
476      >>>  
477   
478      """ 
479      limit = str(limit).lower() 
480   
481      if seed_catalog and isinstance(seed_catalog, catalog.Catalog): 
482          seed_catalog = seed_catalog.id 
483   
484      if source_catalog and isinstance(source_catalog, catalog.Catalog): 
485          source_catalog = source_catalog.id 
486      dmca = str(dmca).lower() 
487      kwargs = locals() 
488      kwargs['bucket'] = kwargs['buckets'] 
489      del kwargs['buckets'] 
490       
491      result = util.callm("%s/%s" % ('playlist', 'static'), kwargs) 
492      return [Song(**util.fix(s_dict)) for s_dict in result['response']['songs']] 
 493       
495      """ 
496      A Beta Dynamic Playlist object. 
497   
498      Attributes: 
499   
500      Example: 
501      """ 
502   
503 -    def __init__( 
504          self, 
505          session_id=None, 
506          type=None, 
507          artist_pick=None, 
508          variety=None, 
509          artist_id=None, 
510          artist=None, 
511          song_id=None, 
512          track_id=None, 
513          description=None, 
514          style=None, 
515          mood=None, 
516          max_tempo=None, 
517          min_tempo=None, 
518          max_duration=None, 
519          min_duration=None, 
520          max_loudness=None, 
521          min_loudness=None, 
522          max_danceability=None, 
523          min_danceability=None, 
524          max_energy=None, 
525          min_energy=None, 
526          artist_max_familiarity=None, 
527          artist_min_familiarity=None, 
528          artist_max_hotttnesss=None, 
529          artist_min_hotttnesss=None, 
530          song_max_hotttnesss=None, 
531          song_min_hotttnesss=None, 
532          min_longitude=None, 
533          max_longitude=None, 
534          min_latitude=None, 
535          max_latitude=None, 
536          adventurousness=None, 
537          mode=None, 
538          key=None, 
539          buckets=[], 
540          sort=None, 
541          limit=False, 
542          seed_catalog=None, 
543          source_catalog=None, 
544          rank_type=None, 
545          test_new_things=None, 
546          artist_start_year_after=None, 
547          artist_start_year_before=None, 
548          artist_end_year_after=None, 
549          artist_end_year_before=None, 
550          dmca=False, 
551          distribution=None, 
552          song_type=None, 
553          ): 
 554   
555          limit = str(limit).lower() 
556          dmca = str(dmca).lower() 
557   
558          if isinstance(seed_catalog, catalog.Catalog): 
559              seed_catalog = seed_catalog.id 
560   
561          super(BetaPlaylist, self).__init__( 
562              session_id=session_id, 
563              type=type, 
564              artist_pick=artist_pick, 
565              variety=variety, 
566              artist_id=artist_id, 
567              artist=artist, 
568              song_id=song_id, 
569              track_id=track_id, 
570              description=description, 
571              style=style, 
572              mood=mood, 
573              max_tempo=max_tempo, 
574              min_tempo=min_tempo, 
575              max_duration=max_duration, 
576              min_duration=min_duration, 
577              max_loudness=max_loudness, 
578              min_loudness=min_loudness, 
579              max_danceability=max_danceability, 
580              min_danceability=min_danceability, 
581              max_energy=max_energy, 
582              min_energy=min_energy, 
583              artist_max_familiarity=artist_max_familiarity, 
584              artist_min_familiarity=artist_min_familiarity, 
585              artist_max_hotttnesss=artist_max_hotttnesss, 
586              artist_min_hotttnesss=artist_min_hotttnesss, 
587              song_max_hotttnesss=song_max_hotttnesss, 
588              song_min_hotttnesss=song_min_hotttnesss, 
589              min_longitude=min_longitude, 
590              max_longitude=max_longitude, 
591              min_latitude=min_latitude, 
592              max_latitude=max_latitude, 
593              adventurousness=adventurousness, 
594              mode=mode, 
595              key=key, 
596              buckets=buckets, 
597              sort=sort, 
598              limit=limit, 
599              seed_catalog=seed_catalog, 
600              source_catalog=source_catalog, 
601              rank_type=rank_type, 
602              test_new_things=test_new_things, 
603              artist_start_year_after=artist_start_year_after, 
604              artist_start_year_before=artist_start_year_before, 
605              artist_end_year_after=artist_end_year_after, 
606              artist_end_year_before=artist_end_year_before, 
607              dmca=dmca, 
608              distribution=distribution, 
609              song_type=song_type, 
610              ) 
 611   
613          return "<Beta Dynamic Playlist - %s>" % self.session_id.encode('utf-8') 
 614   
616          response = self.get_attribute( 
617              method='next', 
618              session_id=self.session_id, 
619              results=results, 
620              lookahead=lookahead 
621              ) 
622          self.cache['songs'] = response['songs'] 
623          self.cache['lookahead'] = response['lookahead'] 
624          if len(self.cache['songs']): 
625              songs = self.cache['songs'][:] 
626              songs = [Song(**util.fix(song)) for song in songs] 
627              return songs 
628          else: 
629              return None 
 630   
641   
643          if not 'lookahead' in self.cache: 
644              return None 
645          if len(self.cache['lookahead']): 
646              lookahead = self.cache['lookahead'][:] 
647              lookahead = [Song(**util.fix(song)) for song in lookahead] 
648   
649              return lookahead 
650          else: 
651              return None 
 652   
653      songs = property(get_current_songs) 
654   
656          return self.get_attribute("info", session_id=self.session_id) 
 657   
659          self.get_attribute("delete", session_id=self.session_id) 
660          return True 
 661   
662 -    def restart( 
663          self, 
664          type=None, 
665          artist_pick=None, 
666          variety=None, 
667          artist_id=None, 
668          artist=None, 
669          song_id=None, 
670          track_id=None, 
671          description=None, 
672          style=None, 
673          mood=None, 
674          max_tempo=None, 
675          min_tempo=None, 
676          max_duration=None, 
677          min_duration=None, 
678          max_loudness=None, 
679          min_loudness=None, 
680          max_danceability=None, 
681          min_danceability=None, 
682          max_energy=None, 
683          min_energy=None, 
684          artist_max_familiarity=None, 
685          artist_min_familiarity=None, 
686          artist_max_hotttnesss=None, 
687          artist_min_hotttnesss=None, 
688          song_max_hotttnesss=None, 
689          song_min_hotttnesss=None, 
690          min_longitude=None, 
691          max_longitude=None, 
692          min_latitude=None, 
693          max_latitude=None, 
694          adventurousness=None, 
695          mode=None, 
696          key=None, 
697          buckets=[], 
698          sort=None, 
699          limit=False, 
700          seed_catalog=None, 
701          source_catalog=None, 
702          rank_type=None, 
703          test_new_things=None, 
704          artist_start_year_after=None, 
705          artist_start_year_before=None, 
706          artist_end_year_after=None, 
707          artist_end_year_before=None, 
708          dmca=False, 
709          distribution=None, 
710          song_type=None, 
711          ): 
 712          limit = str(limit).lower() 
713          dmca = str(dmca).lower() 
714   
715          if isinstance(seed_catalog, catalog.Catalog): 
716              seed_catalog = seed_catalog.id 
717   
718   
719          return self.get_attribute( 
720              method='restart', 
721              session_id=self.session_id, 
722              type=type, 
723              artist_pick=artist_pick, 
724              variety=variety, 
725              artist_id=artist_id, 
726              artist=artist, 
727              song_id=song_id, 
728              track_id=track_id, 
729              description=description, 
730              style=style, 
731              mood=mood, 
732              max_tempo=max_tempo, 
733              min_tempo=min_tempo, 
734              max_duration=max_duration, 
735              min_duration=min_duration, 
736              max_loudness=max_loudness, 
737              min_loudness=min_loudness, 
738              max_danceability=max_danceability, 
739              min_danceability=min_danceability, 
740              max_energy=max_energy, 
741              min_energy=min_energy, 
742              artist_max_familiarity=artist_max_familiarity, 
743              artist_min_familiarity=artist_min_familiarity, 
744              artist_max_hotttnesss=artist_max_hotttnesss, 
745              artist_min_hotttnesss=artist_min_hotttnesss, 
746              song_max_hotttnesss=song_max_hotttnesss, 
747              song_min_hotttnesss=song_min_hotttnesss, 
748              min_longitude=min_longitude, 
749              max_longitude=max_longitude, 
750              min_latitude=min_latitude, 
751              max_latitude=max_latitude, 
752              adventurousness=adventurousness, 
753              mode=mode, 
754              key=key, 
755              bucket=buckets, 
756              sort=sort, 
757              limit=limit, 
758              seed_catalog=seed_catalog, 
759              source_catalog=source_catalog, 
760              rank_type=rank_type, 
761              test_new_things=test_new_things, 
762              artist_start_year_after=artist_start_year_after, 
763              artist_start_year_before=artist_start_year_before, 
764              artist_end_year_after=artist_end_year_after, 
765              artist_end_year_before=artist_end_year_before, 
766              dmca=dmca, 
767              distribution=distribution, 
768              song_type=song_type, 
769              ) 
 770   
771 -    def steer( 
772          self, 
773          max_tempo=None, 
774          min_tempo=None, 
775          target_tempo=None, 
776          max_duration=None, 
777          min_duration=None, 
778          target_duration=None, 
779          max_loudness=None, 
780          min_loudness=None, 
781          target_loudness=None, 
782          max_danceability=None, 
783          min_danceability=None, 
784          target_danceability=None, 
785          max_energy=None, 
786          min_energy=None, 
787          target_energy=None, 
788          max_artist_familiarity=None, 
789          min_artist_familiarity=None, 
790          target_artist_familiarity=None, 
791          max_artist_hotttnesss=None, 
792          min_artist_hotttnesss=None, 
793          target_artist_hotttnesss=None, 
794          max_song_hotttnesss=None, 
795          min_song_hotttnesss=None, 
796          target_song_hotttnesss=None, 
797          more_like_this=None, 
798          less_like_this=None, 
799          adventurousness=None, 
800          variety=None, 
801          description=None, 
802          style=None, 
803          mood=None, 
804          song_type=None, 
805          ): 
 806   
807          response = self.get_attribute( 
808              method='steer', 
809              session_id=self.session_id, 
810              max_tempo=max_tempo, 
811              min_tempo=min_tempo, 
812              target_tempo=target_tempo, 
813              max_duration=max_duration, 
814              min_duration=min_duration, 
815              target_duration=target_duration, 
816              max_loudness=max_loudness, 
817              min_loudness=min_loudness, 
818              target_loudness=target_loudness, 
819              max_danceability=max_danceability, 
820              min_danceability=min_danceability, 
821              target_danceability=target_danceability, 
822              max_energy=max_energy, 
823              min_energy=min_energy, 
824              target_energy=target_energy, 
825              max_artist_familiarity=max_artist_familiarity, 
826              min_artist_familiarity=min_artist_familiarity, 
827              target_artist_familiarity=target_artist_familiarity, 
828              max_artist_hotttnesss=max_artist_hotttnesss, 
829              min_artist_hotttnesss=min_artist_hotttnesss, 
830              target_artist_hotttnesss=target_artist_hotttnesss, 
831              max_song_hotttnesss=max_song_hotttnesss, 
832              min_song_hotttnesss=min_song_hotttnesss, 
833              target_song_hotttnesss=target_song_hotttnesss, 
834              more_like_this=more_like_this, 
835              less_like_this=less_like_this, 
836              adventurousness=adventurousness, 
837              variety=variety, 
838              description=description, 
839              style=style, 
840              mood=mood, 
841              song_type=song_type 
842              ) 
843   
844          self.cache['lookahead'] = [] 
845          return True 
 846   
847 -    def feedback( 
848          self, 
849          ban_artist=None, 
850          ban_song=None, 
851          skip_song=None, 
852          favorite_artist=None, 
853          favorite_song=None, 
854          play_song=None, 
855          unplay_song=None, 
856          rate_song=None, 
857          ): 
 858   
859          response = self.get_attribute( 
860              session_id=self.session_id, 
861              method='feedback', 
862              ban_artist=ban_artist, 
863              ban_song=ban_song, 
864              skip_song=skip_song, 
865              favorite_artist=favorite_artist, 
866              favorite_song=favorite_song, 
867              play_song=play_song, 
868              unplay_song=unplay_song, 
869              rate_song=rate_song, 
870              ) 
871   
872          self.cache['lookahead'] = [] 
873          return True 
 874