@@ -196,25 +196,23 @@ private void updateTrack() {
196196 * Starts the task to save the song information of the
197197 * currently recognized song.
198198 *
199- * @param song the song to be saved
200- * @see #saveSongImpl(Pair)
199+ * @see #saveSongImpl()
201200 */
202- public void saveSong (final Pair < String , String > song ) {
203- executorService .schedule (() -> saveSongImpl ( song ) , 0 , TimeUnit .NANOSECONDS );
201+ public void saveSong () {
202+ executorService .schedule (this :: saveSongImpl , 0 , TimeUnit .NANOSECONDS );
204203 }
205204
206205 /**
207206 * Saves the currently recognized song. After finishing,
208207 * the callback is invoked.
209208 *
210- * @param song the song to be saved
211209 * @see #writeCallback
212210 */
213- private void saveSongImpl (final Pair < String , String > song ) {
211+ private void saveSongImpl () {
214212 Pair <String , String > savedSong = null ;
215213 Exception e = null ;
216214 try {
217- savedSong = saveTrack (song );
215+ savedSong = saveTrack ();
218216 } catch (Exception exception ) {
219217 e = exception ;
220218 }
@@ -225,19 +223,19 @@ private void saveSongImpl(final Pair<String, String> song) {
225223 * Writes the currently recognized song to a file. The
226224 * file is placed into the folder returned by {@link Settings#getSavePath()}.
227225 *
228- * @param song the song to be saved
229226 * @return the saved song
230227 * @throws IOException if the file could not be written
231228 * @throws IllegalStateException if the file cannot be written
232229 */
233- private Pair <String , String > saveTrack (final Pair < String , String > song ) throws IOException {
230+ private Pair <String , String > saveTrack () throws IOException {
234231 if (!hasTrack ()) {
235232 throw new IllegalStateException ("No track recognized!" );
236233 }
237234 final var path = Settings .getInstance ().getSavePath ();
238235 if (path == null || path .isBlank ()) {
239236 throw new IllegalStateException ("Save folder not set!" );
240237 }
238+ final var song = getCurrentSong ();
241239 final var buffer = "titel:" + song .getFirst () + System .lineSeparator () +
242240 "interpreter:" + song .getSecond ();
243241 try (final var writer = new BufferedWriter (new FileWriter (createFileName ()))) {
0 commit comments