aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/musichub/business
diff options
context:
space:
mode:
authorClyhtsuriva <aimeric@adjutor.xyz>2021-06-28 17:59:30 +0200
committerClyhtsuriva <aimeric@adjutor.xyz>2021-06-28 17:59:30 +0200
commit98c51757595a8fa81c4ad1b00404c75574d9521e (patch)
tree3cc27a932f5e296057820b6e72a560f6bd5278a7 /src/main/java/musichub/business
parentcb02b2327687b379103778dba28df7b1e37a756c (diff)
parent2b592b4986b92c85150ecb9d08a521e6391cc160 (diff)
Merge branch 'feature/STZ-0005' into javadoc/STZ-0019
Diffstat (limited to 'src/main/java/musichub/business')
-rw-r--r--src/main/java/musichub/business/MusicHub.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/musichub/business/MusicHub.java b/src/main/java/musichub/business/MusicHub.java
index 660f0f8..f6805b6 100644
--- a/src/main/java/musichub/business/MusicHub.java
+++ b/src/main/java/musichub/business/MusicHub.java
@@ -359,5 +359,33 @@ public class MusicHub {
this.getAudioElement(searchResult, searchResult.get(0).getTitle());
}
}
+ public String getPlayListsTitles() {
+ StringBuilder titleList = new StringBuilder();
+ for (PlayList pl : playlists)
+ titleList.append(pl.getTitle()).append("\n");
+ return titleList.toString();
+ }
+
+ public List<AudioElement> getPlayListSongs(String playListTitle) throws NoPlayListFoundException {
+ PlayList thePlayList = null;
+ ArrayList<AudioElement> songsInPlayList = new ArrayList<>();
+ for (PlayList pl : playlists) {
+ if (pl.getTitle().equalsIgnoreCase(playListTitle)) {
+ thePlayList = pl;
+ break;
+ }
+ }
+ if (thePlayList == null) throw new NoPlayListFoundException("No playlist with this title in the MusicHub!");
+
+ List<UUID> songIDs = thePlayList.getElements();
+ for (UUID id : songIDs)
+ for (AudioElement el : elements) {
+ if (el instanceof Song) {
+ if (el.getUUID().equals(id)) songsInPlayList.add(el);
+ }
+ }
+ return songsInPlayList;
+
+ }
} \ No newline at end of file