aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClyhtsuriva <61652557+clyhtsuriva@users.noreply.github.com>2021-06-27 19:21:05 +0000
committerGitHub <noreply@github.com>2021-06-27 19:21:05 +0000
commit4f3558f11535026f7310fdde4161bbaf56c2254e (patch)
treea9a1aa97bff4e5db34d49d39522a4cb5bb632325
parent948ff415cd3571c9f418765b30f1547dd16e84bf (diff)
parentac2ff63e60bba8e841746a067f27441e491f4235 (diff)
Merge pull request #15 from Said-Belhadj/feature/STZ-0017
Feature/STZ-0017
-rw-r--r--src/main/java/musichub/business/MusicHub.java4
-rw-r--r--src/main/java/musichub/main/Main.java10
-rw-r--r--target/classes/musichub/business/MusicHub.classbin11543 -> 12505 bytes
-rw-r--r--target/classes/musichub/main/Main.classbin10315 -> 10771 bytes
4 files changed, 11 insertions, 3 deletions
diff --git a/src/main/java/musichub/business/MusicHub.java b/src/main/java/musichub/business/MusicHub.java
index bbac505..660f0f8 100644
--- a/src/main/java/musichub/business/MusicHub.java
+++ b/src/main/java/musichub/business/MusicHub.java
@@ -340,7 +340,7 @@ public class MusicHub {
}
- public void searchAudioElement() throws UnsupportedAudioFileException, NoAlbumFoundException, LineUnavailableException, IOException {
+ public void searchAudioElement() throws UnsupportedAudioFileException, NoAlbumFoundException, LineUnavailableException, IOException, NoElementFoundException {
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);
@@ -353,7 +353,7 @@ public class MusicHub {
}
if(searchResult.isEmpty()){
- System.err.println("Aucun résultat pour votre recherche");
+ throw new NoElementFoundException("Any result for your search");
}
if (searchResult.size()==1){
this.getAudioElement(searchResult, searchResult.get(0).getTitle());
diff --git a/src/main/java/musichub/main/Main.java b/src/main/java/musichub/main/Main.java
index cd1fd5f..b0f98f4 100644
--- a/src/main/java/musichub/main/Main.java
+++ b/src/main/java/musichub/main/Main.java
@@ -246,7 +246,15 @@ public class Main {
break;
case 'r':
//search a music
- theHub.searchAudioElement();
+ try {
+ theHub.searchAudioElement();
+ }
+ catch (NoElementFoundException e){
+ System.err.println(e.getMessage());
+ }
+ catch (java.io.FileNotFoundException e){
+ System.err.println(e.getMessage()+" Please create a file with the extension .wav inside the song folder at root of the app");
+ }
printAvailableCommands();
case 'o':
//consult the app logs
diff --git a/target/classes/musichub/business/MusicHub.class b/target/classes/musichub/business/MusicHub.class
index 9554eeb..41af154 100644
--- a/target/classes/musichub/business/MusicHub.class
+++ b/target/classes/musichub/business/MusicHub.class
Binary files differ
diff --git a/target/classes/musichub/main/Main.class b/target/classes/musichub/main/Main.class
index 38501eb..802184b 100644
--- a/target/classes/musichub/main/Main.class
+++ b/target/classes/musichub/main/Main.class
Binary files differ