DynamicPlaylistSession createPlaylistSession(){
  mSessionReady=false;
  mSessionError=false;
  EchoNest echoNest=new EchoNest();
  String type=generateTasteCatalogIfNeededAndGetType(echoNest);
  if (!mSessionError) {
    if (DEBUG)     Log.d(TAG,"Creating dynamic playlist.");
    String catalogId=(mCatalog != null ? mCatalog.getID() : null);
    try {
      mPlaylistSession=echoNest.createDynamicPlaylist(type,catalogId,mMoods,mStyles);
    }
 catch (    EchoNestException e) {
      Log.e(TAG,"Unable to create the dynamic playlist",e);
      mSessionError=true;
    }
  }
  if (!mSessionError) {
    DynamicPlaylistSteerParams p=new DynamicPlaylistSteerParams();
    if (mEnergy >= 0) {
      p.addTargetValue(DynamicPlaylistSteerParams.SteeringParameter.energy,mEnergy);
    }
    if (mFamiliar >= 0) {
      p.addTargetValue(DynamicPlaylistSteerParams.SteeringParameter.artist_familiarity,mFamiliar);
    }
    if (mSpeechiness >= 0) {
      p.add("target_speechiness",mSpeechiness);
    }
    if (mAdventurousness >= 0) {
      p.setAdventurousness(mAdventurousness);
    }
    if (mSongTypes != null && mSongTypes.length > 0) {
      for (      String songType : mSongTypes) {
        if (!songType.isEmpty()) {
          p.add("song_type",songType);
        }
      }
    }
    try {
      mPlaylistSession.steer(p);
    }
 catch (    EchoNestException e) {
      Log.e(TAG,"Unable to steer session data",e);
      mSessionError=true;
    }
  }
  mSessionReady=true;
  return mPlaylistSession;
}

DynamicPlaylistSession createPlaylistSession ( ) { mSessionReady = false ; mSessionError = false ; EchoNest echoNest = new EchoNest ( ) ; String type = generateTasteCatalogIfNeededAndGetType ( echoNest ) ; if ( ! mSessionError ) { if ( DEBUG ) Log . d ( TAG , "Creating dynamic playlist." ) ; String catalogId = ( mCatalog != null ? mCatalog . getID ( ) : null ) ; try { mPlaylistSession = echoNest . createDynamicPlaylist ( type , catalogId , mMoods , mStyles ) ; } catch ( EchoNestException e ) { Log . e ( TAG , "Unable to create the dynamic playlist" , e ) ; mSessionError = true ; } } if ( ! mSessionError ) { DynamicPlaylistSteerParams p = new DynamicPlaylistSteerParams ( ) ; if ( mEnergy >= 0 ) { p . addTargetValue ( DynamicPlaylistSteerParams . SteeringParameter . energy , mEnergy ) ; } if ( mFamiliar >= 0 ) { p . addTargetValue ( DynamicPlaylistSteerParams . SteeringParameter . artist_familiarity , mFamiliar ) ; } if ( mSpeechiness >= 0 ) { p . add ( "target_speechiness" , mSpeechiness ) ; } if ( mAdventurousness >= 0 ) { p . setAdventurousness ( mAdventurousness ) ; } if ( mSongTypes != null && mSongTypes . length > 0 ) { for ( String songType : mSongTypes ) { if ( ! songType . isEmpty ( ) ) { p . add ( "song_type" , songType ) ; } } } try { mPlaylistSession . steer ( p ) ; } catch ( EchoNestException e ) { Log . e ( TAG , "Unable to steer session data" , e ) ; mSessionError = true ; } } mSessionReady = true ; return mPlaylistSession ; }
creates or reset the echonest session for this bucket . this will reset the bucket on the echonest end and initialize a new session .
