|
|
|
@ -10,6 +10,9 @@ import com.amihaiemil.eoyaml.YamlMapping; |
|
|
|
|
import com.amihaiemil.eoyaml.YamlSequence; |
|
|
|
|
import com.amihaiemil.eoyaml.YamlSequenceBuilder; |
|
|
|
|
import java.io.File; |
|
|
|
|
import java.io.FileInputStream; |
|
|
|
|
import java.io.FileNotFoundException; |
|
|
|
|
import java.io.InputStream; |
|
|
|
|
import java.net.MalformedURLException; |
|
|
|
|
import java.net.URL; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
@ -25,6 +28,7 @@ public class Track implements Comparable<Track> |
|
|
|
|
private String artist; |
|
|
|
|
private final URL url; |
|
|
|
|
private File location = null; |
|
|
|
|
private InputStream inputStream = null; |
|
|
|
|
private int number; |
|
|
|
|
private List<Format> formats = new ArrayList<>(); |
|
|
|
|
|
|
|
|
@ -136,6 +140,18 @@ public class Track implements Comparable<Track> |
|
|
|
|
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() |
|
|
|
|
{ |
|
|
|
|
if (location != null) |
|
|
|
|