/**
   * Return the folder where the file will be placed
   *
   * @param chunk The chunk
   */
  private String BuildDirPath(ResponseSongFileChunk chunk) {
    String defaultPath = Environment.getExternalStorageDirectory() + "/ClementineMusic";
    String path = mSharedPref.getString(App.SP_DOWNLOAD_DIR, defaultPath);

    StringBuilder sb = new StringBuilder();
    sb.append(path);
    sb.append(File.separator);
    if (mIsPlaylist && mCreatePlaylistDir) {
      sb.append(Utilities.removeInvalidFileCharacters(mPlaylistName));
      sb.append(File.separator);
    }

    // Create artist/album subfolder only when we have no playlist
    // or user set the settings
    if (!mIsPlaylist || mIsPlaylist && mCreatePlaylistArtistDir) {
      // Append artist name
      if (chunk.getSongMetadata().getAlbumartist().length() == 0) {
        sb.append(Utilities.removeInvalidFileCharacters(chunk.getSongMetadata().getArtist()));
      } else {
        sb.append(Utilities.removeInvalidFileCharacters(chunk.getSongMetadata().getAlbumartist()));
      }

      // append album
      sb.append(File.separator);
      sb.append(Utilities.removeInvalidFileCharacters(chunk.getSongMetadata().getAlbum()));
    }

    return sb.toString();
  }
  /**
   * Build the filename
   *
   * @param chunk The SongFileChunk
   * @return /sdcard/Music/Artist/Album/file.mp3
   */
  private String BuildFilePath(ResponseSongFileChunk chunk) {
    StringBuilder sb = new StringBuilder();
    sb.append(BuildDirPath(chunk));
    sb.append(File.separator);
    sb.append(Utilities.removeInvalidFileCharacters(chunk.getSongMetadata().getFilename()));

    return sb.toString();
  }