From 948ff415cd3571c9f418765b30f1547dd16e84bf Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sun, 27 Jun 2021 18:59:41 +0200 Subject: Latest maven, jacoco and javadoc files --- .../jacoco/musichub.business/MusicHub.java.html | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'target/site/jacoco/musichub.business/MusicHub.java.html') diff --git a/target/site/jacoco/musichub.business/MusicHub.java.html b/target/site/jacoco/musichub.business/MusicHub.java.html index b9dfd09..d150675 100644 --- a/target/site/jacoco/musichub.business/MusicHub.java.html +++ b/target/site/jacoco/musichub.business/MusicHub.java.html @@ -339,5 +339,26 @@ public class MusicHub { } } + + public void searchAudioElement() throws UnsupportedAudioFileException, NoAlbumFoundException, LineUnavailableException, IOException { + Scanner scanner = new Scanner(System.in); + System.out.println("Entrez le titre ou l'artiste de la musique que vous souhaitez chercher dans la base de données"); + String word = scanner.next().toLowerCase(Locale.ROOT); + List<AudioElement> searchResult = new ArrayList<>(); + for(AudioElement el : elements){ + if(el.getTitle().toLowerCase(Locale.ROOT).contains(word) || el.getArtist().toLowerCase(Locale.ROOT).contains(word)){ + searchResult.add(el); + System.out.println(el); + } + } + + if(searchResult.isEmpty()){ + System.err.println("Aucun résultat pour votre recherche"); + } + if (searchResult.size()==1){ + this.getAudioElement(searchResult, searchResult.get(0).getTitle()); + } + } + } \ No newline at end of file -- cgit v1.2.3