Added "keep" flag to songs, which will stop them being deleted.

crossfading
Nekojimi 3 years ago
parent 17591cd6a7
commit cc17eb0bd9
  1. 3
      src/main/java/moe/nekojimi/chords/MusicHandler.java
  2. 11
      src/main/java/moe/nekojimi/chords/Song.java

@ -95,7 +95,8 @@ public class MusicHandler implements AudioSendHandler, Closeable, Consumer<Song>
} }
if (currentSong != null) if (currentSong != null)
{ {
currentSong.delete(); if (!currentSong.isKept())
currentSong.delete();
currentSong = null; currentSong = null;
} }
currentSong = songQueue.poll(); currentSong = songQueue.poll();

@ -22,6 +22,7 @@ public class Song
private String requestedBy; private String requestedBy;
private String requestedIn; private String requestedIn;
private boolean kept = false;
public Song(URL url) public Song(URL url)
{ {
@ -100,6 +101,16 @@ public class Song
this.requestedIn = requestedIn; this.requestedIn = requestedIn;
} }
public boolean isKept()
{
return kept;
}
public void setKept(boolean kept)
{
this.kept = kept;
}
@Override @Override
public String toString() public String toString()
{ {

Loading…
Cancel
Save