diff options
author | said belhadj <saidbelhadj0312@gmail.com> | 2021-06-26 01:58:15 +0200 |
---|---|---|
committer | said belhadj <saidbelhadj0312@gmail.com> | 2021-06-26 01:58:15 +0200 |
commit | e58b48a3162539cb79ff495d6040ca6f53f069d6 (patch) | |
tree | b85ebc592158883f806d6dc7b45e53fd7ee3b5df /src/musichub/business/MusicHub.java | |
parent | f920b48762cae194d5a9f7808273826714166424 (diff) |
Add the possibility to listen a song thanks to Audio System library
Diffstat (limited to 'src/musichub/business/MusicHub.java')
-rw-r--r-- | src/musichub/business/MusicHub.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/musichub/business/MusicHub.java b/src/musichub/business/MusicHub.java index 38e2214..e138d84 100644 --- a/src/musichub/business/MusicHub.java +++ b/src/musichub/business/MusicHub.java @@ -6,8 +6,12 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import java.io.IOException; import java.util.*; +import javax.sound.sampled.LineUnavailableException; +import javax.sound.sampled.UnsupportedAudioFileException; + class SortByDate implements Comparator<Album> { public int compare(Album a1, Album a2) { return a1.getDate().compareTo(a2.getDate()); @@ -326,4 +330,13 @@ public class MusicHub { } xmlHandler.createXMLFile(document, ELEMENTS_FILE_PATH); } + + public void getSong(List<AudioElement> Songs, String songTitle) throws NoAlbumFoundException, UnsupportedAudioFileException, IOException, LineUnavailableException { + for (AudioElement s : Songs) { + if (s.getTitle().equalsIgnoreCase(songTitle)) { + s.playSong(); + } + } + + } }
\ No newline at end of file |