Exemple #1
0
  private List<Track> getUnderratedPlaylist(List<Track> tempTrackList) {
    Log.d(TAG, "getUnderratedPlaylist()");
    List<Track> tempList = new ArrayList<Track>();

    /**
     * referring to how many times does a song need to be played/selected before it is not a rookie
     * TODO XZ: in future, this should be a relative number such as top played song is at 100
     * completeCount hence an underrated song would be, say maxCount * 0.4?
     */
    int rookieThreshold = 10;

    if (!tempTrackList.isEmpty()) {
      Collections.shuffle(tempTrackList);

      for (Track t : tempTrackList) {

        int completedCount = t.getCompletedCount();
        int skippedCount = t.getSkippedCount();
        int selectedCount = t.getSelectedCount();
        int likedCount = t.getLikedCount();
        int dislikedCount = t.getDislikedCount();

        if (completedCount + selectedCount < rookieThreshold) {
          if (selectedCount > 2) {
            if (skippedCount <= completedCount) {
              tempList.add(t);
            }
          } else {
            if (completedCount > 2) {
              tempList.add(t);
            } else {
              if (likedCount > dislikedCount) {
                tempList.add(t);
              }
            }
          }
        }

        if (tempList.size() == 10) {
          break;
        }
      }
    }

    Log.d(TAG, "tempList.size():" + tempList.size());

    return tempList;
  }