Compare commits
No commits in common. "95d2e41a03451086bd099a97989fd377e793effd" and "abd676fa49516169d240407ff058f8a70a58af2b" have entirely different histories.
95d2e41a03
...
abd676fa49
|
@ -105,8 +105,7 @@ public class MusicHandler implements AudioSendHandler, Closeable, Consumer<Track
|
||||||
} catch (UnsupportedAudioFileException | IOException ex)
|
} catch (UnsupportedAudioFileException | IOException ex)
|
||||||
{
|
{
|
||||||
Logger.getLogger(Chords.class.getName()).log(Level.SEVERE, null, ex);
|
Logger.getLogger(Chords.class.getName()).log(Level.SEVERE, null, ex);
|
||||||
currentTrack = null;
|
skipTrack();
|
||||||
requestTrack();
|
|
||||||
} finally
|
} finally
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,9 +10,6 @@ import com.amihaiemil.eoyaml.YamlMapping;
|
||||||
import com.amihaiemil.eoyaml.YamlSequence;
|
import com.amihaiemil.eoyaml.YamlSequence;
|
||||||
import com.amihaiemil.eoyaml.YamlSequenceBuilder;
|
import com.amihaiemil.eoyaml.YamlSequenceBuilder;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileInputStream;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.InputStream;
|
|
||||||
import java.net.MalformedURLException;
|
import java.net.MalformedURLException;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -28,7 +25,6 @@ public class Track implements Comparable<Track>
|
||||||
private String artist;
|
private String artist;
|
||||||
private final URL url;
|
private final URL url;
|
||||||
private File location = null;
|
private File location = null;
|
||||||
private InputStream inputStream = null;
|
|
||||||
private int number;
|
private int number;
|
||||||
private List<Format> formats = new ArrayList<>();
|
private List<Format> formats = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -140,18 +136,6 @@ public class Track implements Comparable<Track>
|
||||||
this.location = location;
|
this.location = location;
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream getInputStream() throws FileNotFoundException
|
|
||||||
{
|
|
||||||
if (inputStream == null && location != null)
|
|
||||||
inputStream = new FileInputStream(location);
|
|
||||||
return inputStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setInputStream(InputStream inputStream)
|
|
||||||
{
|
|
||||||
this.inputStream = inputStream;
|
|
||||||
}
|
|
||||||
|
|
||||||
void delete()
|
void delete()
|
||||||
{
|
{
|
||||||
if (location != null)
|
if (location != null)
|
||||||
|
|
|
@ -26,7 +26,7 @@ public class TrackPlayer implements Closeable
|
||||||
|
|
||||||
private static final int DESIRED_BUFFER_SIZE = 3840 * 500;
|
private static final int DESIRED_BUFFER_SIZE = 3840 * 500;
|
||||||
private static final int MAX_READ_FAILS = 3;
|
private static final int MAX_READ_FAILS = 3;
|
||||||
private static final int RETRY_COUNT = 8;
|
private static final int RETRY_COUNT = 10;
|
||||||
private static final int RETRY_DELAY = 100;
|
private static final int RETRY_DELAY = 100;
|
||||||
|
|
||||||
private final CircularByteBuffer audioBuffer = new CircularByteBuffer(3840 * 1024);
|
private final CircularByteBuffer audioBuffer = new CircularByteBuffer(3840 * 1024);
|
||||||
|
@ -43,11 +43,11 @@ public class TrackPlayer implements Closeable
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
in = AudioSystem.getAudioInputStream(track.getInputStream());
|
in = AudioSystem.getAudioInputStream(track.getLocation());
|
||||||
decodedFormat = AudioSendHandler.INPUT_FORMAT;
|
decodedFormat = AudioSendHandler.INPUT_FORMAT;
|
||||||
|
|
||||||
break; // it worked!
|
break; // it worked!
|
||||||
} catch (Exception ex)
|
} catch (IOException ex)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
|
@ -110,12 +110,7 @@ public class TrackRequest implements Comparable<TrackRequest>
|
||||||
|
|
||||||
public URL getUrl()
|
public URL getUrl()
|
||||||
{
|
{
|
||||||
if (url != null)
|
return url;
|
||||||
return url;
|
|
||||||
else if (result != null)
|
|
||||||
return (result.getLink());
|
|
||||||
else
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setUrl(URL url)
|
public void setUrl(URL url)
|
||||||
|
|
|
@ -36,9 +36,7 @@ public class QueueCommand extends Command
|
||||||
String message = ">>> ";
|
String message = ">>> ";
|
||||||
int i = 1;
|
int i = 1;
|
||||||
|
|
||||||
Track currentTrack = null;
|
final Track currentTrack = bot.getMusicHandler().getCurrentTrack();
|
||||||
if (bot.getMusicHandler() != null)
|
|
||||||
currentTrack = bot.getMusicHandler().getCurrentTrack();
|
|
||||||
if (currentTrack != null)
|
if (currentTrack != null)
|
||||||
message += ":notes: **Now playing: " + currentTrack + "**\n";
|
message += ":notes: **Now playing: " + currentTrack + "**\n";
|
||||||
else
|
else
|
||||||
|
|
Loading…
Reference in New Issue