/**
   * Method for generating the new File name of the music file, after the tag was completed
   *
   * @param musicFile the music file
   * @return new Filename
   */
  public static void generateNewFileName(MusicFile musicFile) {
    MusicTag tag = musicFile.getTag();

    if (!tag.getArtist().equals("")
        && tag.getArtist() != null
        && !tag.getTitlename().equals("")
        && tag.getTitlename() != null) {
      // Clearing artist and title
      int track;
      try {
        track = Integer.parseInt(tag.getRelease().getTrackNumber());
      } catch (NumberFormatException e) {
        track = 0;
      }

      String artist = cleanString(tag.getArtist());
      String title = cleanString(tag.getTitlename());
      artist = clearForbiddenCharacters(artist);
      title = clearForbiddenCharacters(title);

      if (track != 0) {
        musicFile.setNewFileName(
            track
                + " - "
                + artist
                + " - "
                + title
                + "."
                + MusicFileType.getFileExtension(musicFile.getFileType()));
      } else {
        musicFile.setNewFileName(
            artist + " - " + title + "." + MusicFileType.getFileExtension(musicFile.getFileType()));
      }

      musicFile.setNewFileNameIsSet(true);
    } else {
      musicFile.setNewFileNameIsSet(false);
    }
  }