From e64ffae239b19871704b4ac1e9cd58275ed58622 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sat, 26 Jun 2021 12:34:26 +0200 Subject: Changed the architecture to respect maven and generated an empty javadoc --- src/main/java/musichub/business/Album.java | 145 +++++++++ src/main/java/musichub/business/AudioBook.java | 78 +++++ src/main/java/musichub/business/AudioElement.java | 88 ++++++ src/main/java/musichub/business/Category.java | 14 + src/main/java/musichub/business/Genre.java | 14 + src/main/java/musichub/business/Language.java | 14 + src/main/java/musichub/business/MusicHub.java | 329 +++++++++++++++++++++ .../musichub/business/NoAlbumFoundException.java | 8 + .../musichub/business/NoElementFoundException.java | 8 + .../business/NoPlayListFoundException.java | 8 + src/main/java/musichub/business/PlayList.java | 100 +++++++ src/main/java/musichub/business/Song.java | 56 ++++ src/main/java/musichub/main/Main.java | 248 ++++++++++++++++ src/main/java/musichub/util/XMLHandler.java | 74 +++++ src/musichub/business/Album.java | 145 --------- src/musichub/business/AudioBook.java | 78 ----- src/musichub/business/AudioElement.java | 88 ------ src/musichub/business/Category.java | 14 - src/musichub/business/Genre.java | 14 - src/musichub/business/Language.java | 14 - src/musichub/business/MusicHub.java | 329 --------------------- src/musichub/business/NoAlbumFoundException.java | 8 - src/musichub/business/NoElementFoundException.java | 8 - .../business/NoPlayListFoundException.java | 8 - src/musichub/business/PlayList.java | 100 ------- src/musichub/business/Song.java | 56 ---- src/musichub/main/Main.java | 248 ---------------- src/musichub/util/XMLHandler.java | 74 ----- 28 files changed, 1184 insertions(+), 1184 deletions(-) create mode 100644 src/main/java/musichub/business/Album.java create mode 100644 src/main/java/musichub/business/AudioBook.java create mode 100644 src/main/java/musichub/business/AudioElement.java create mode 100644 src/main/java/musichub/business/Category.java create mode 100644 src/main/java/musichub/business/Genre.java create mode 100644 src/main/java/musichub/business/Language.java create mode 100644 src/main/java/musichub/business/MusicHub.java create mode 100644 src/main/java/musichub/business/NoAlbumFoundException.java create mode 100644 src/main/java/musichub/business/NoElementFoundException.java create mode 100644 src/main/java/musichub/business/NoPlayListFoundException.java create mode 100644 src/main/java/musichub/business/PlayList.java create mode 100644 src/main/java/musichub/business/Song.java create mode 100644 src/main/java/musichub/main/Main.java create mode 100644 src/main/java/musichub/util/XMLHandler.java delete mode 100644 src/musichub/business/Album.java delete mode 100644 src/musichub/business/AudioBook.java delete mode 100644 src/musichub/business/AudioElement.java delete mode 100644 src/musichub/business/Category.java delete mode 100644 src/musichub/business/Genre.java delete mode 100644 src/musichub/business/Language.java delete mode 100644 src/musichub/business/MusicHub.java delete mode 100644 src/musichub/business/NoAlbumFoundException.java delete mode 100644 src/musichub/business/NoElementFoundException.java delete mode 100644 src/musichub/business/NoPlayListFoundException.java delete mode 100644 src/musichub/business/PlayList.java delete mode 100644 src/musichub/business/Song.java delete mode 100644 src/musichub/main/Main.java delete mode 100644 src/musichub/util/XMLHandler.java (limited to 'src') diff --git a/src/main/java/musichub/business/Album.java b/src/main/java/musichub/business/Album.java new file mode 100644 index 0000000..01fd179 --- /dev/null +++ b/src/main/java/musichub/business/Album.java @@ -0,0 +1,145 @@ +package musichub.business; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.*; + + +public class Album { + private final String title; + private final int lengthInSeconds; + private final UUID uuid; + private String artist; + private Date date; + private ArrayList songsUIDs; + + public Album(String title, String artist, int lengthInSeconds, String id, String date, ArrayList songsUIDs) { + this.title = title; + this.artist = artist; + this.lengthInSeconds = lengthInSeconds; + this.uuid = UUID.fromString(id); + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + this.date = sdf.parse(date); + } catch (ParseException ex) { + ex.printStackTrace(); + } + this.songsUIDs = songsUIDs; + } + + public Album(String title, String artist, int lengthInSeconds, String date) { + this.title = title; + this.artist = artist; + this.lengthInSeconds = lengthInSeconds; + this.uuid = UUID.randomUUID(); + try { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + this.date = sdf.parse(date); + } catch (ParseException ex) { + ex.printStackTrace(); + } + this.songsUIDs = new ArrayList<>(); + } + + public Album(Element xmlElement) throws Exception { + { + this.title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); + this.lengthInSeconds = Integer.parseInt(xmlElement.getElementsByTagName("lengthInSeconds").item(0).getTextContent()); + String uuid = null; + try { + uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); + } catch (Exception ex) { + System.out.println("Empty album UUID, will create a new one"); + } + if ((uuid == null) || (uuid.isEmpty())) + this.uuid = UUID.randomUUID(); + else this.uuid = UUID.fromString(uuid); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + this.date = sdf.parse(xmlElement.getElementsByTagName("date").item(0).getTextContent()); + //parse list of songs: + Node songsElement = xmlElement.getElementsByTagName("songs").item(0); + NodeList songUUIDNodes = songsElement.getChildNodes(); + if (songUUIDNodes == null) return; + + this.songsUIDs = new ArrayList<>(); + + for (int i = 0; i < songUUIDNodes.getLength(); i++) { + if (songUUIDNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { + Element songElement = (Element) songUUIDNodes.item(i); + if (songElement.getNodeName().equals("UUID")) { + try { + this.addSong(UUID.fromString(songElement.getTextContent())); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + } + } + + + public void addSong(UUID song) { + songsUIDs.add(song); + } + + + public List getSongs() { + return songsUIDs; + } + + public ArrayList getSongsRandomly() { + ArrayList shuffledSongs = songsUIDs; + Collections.shuffle(shuffledSongs); + return shuffledSongs; + } + + public String getTitle() { + return title; + } + + public Date getDate() { + return date; + } + + public void createXMLElement(Document document, Element parentElement) { + Element albumElement = document.createElement("album"); + parentElement.appendChild(albumElement); + + Element nameElement = document.createElement("title"); + nameElement.appendChild(document.createTextNode(title)); + albumElement.appendChild(nameElement); + + Element artistElement = document.createElement("artist"); + artistElement.appendChild(document.createTextNode(artist)); + albumElement.appendChild(artistElement); + + Element lengthElement = document.createElement("lengthInSeconds"); + lengthElement.appendChild(document.createTextNode(Integer.valueOf(lengthInSeconds).toString())); + albumElement.appendChild(lengthElement); + + Element UUIDElement = document.createElement("UUID"); + UUIDElement.appendChild(document.createTextNode(uuid.toString())); + albumElement.appendChild(UUIDElement); + + Element dateElement = document.createElement("date"); + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + dateElement.appendChild(document.createTextNode(sdf.format(date))); + albumElement.appendChild(dateElement); + + Element songsElement = document.createElement("songs"); + for (UUID currentUUID : this.songsUIDs) { + Element songUUIDElement = document.createElement("UUID"); + songUUIDElement.appendChild(document.createTextNode(currentUUID.toString())); + songsElement.appendChild(songUUIDElement); + } + albumElement.appendChild(songsElement); + + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/AudioBook.java b/src/main/java/musichub/business/AudioBook.java new file mode 100644 index 0000000..80392d6 --- /dev/null +++ b/src/main/java/musichub/business/AudioBook.java @@ -0,0 +1,78 @@ +package musichub.business; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +public class AudioBook extends AudioElement { + private Language language; + private Category category; + + public AudioBook(String title, String artist, int lengthInSeconds, String uid, String content, String language, String category) { + super(title, artist, lengthInSeconds, uid, content); + this.setLanguage(language); + this.setCategory(category); + } + + public AudioBook(String title, String artist, int lengthInSeconds, String content, String language, String category) { + super(title, artist, lengthInSeconds, content); + this.setLanguage(language); + this.setCategory(category); + } + + public AudioBook(Element xmlElement) { + super(xmlElement); + this.setLanguage(xmlElement.getElementsByTagName("language").item(0).getTextContent()); + this.setCategory(xmlElement.getElementsByTagName("category").item(0).getTextContent()); + } + + public Language getLanguage() { + return this.language; + } + + public void setLanguage(String language) { + switch (language.toLowerCase()) { + default -> this.language = Language.ENGLISH; + case "french" -> this.language = Language.FRENCH; + case "german" -> this.language = Language.GERMAN; + case "spanish" -> this.language = Language.SPANISH; + case "italian" -> this.language = Language.ITALIAN; + } + } + + public Category getCategory() { + return this.category; + } + + public void setCategory(String category) { + switch (category.toLowerCase()) { + default -> this.category = Category.YOUTH; + case "novel" -> this.category = Category.NOVEL; + case "theater" -> this.category = Category.THEATER; + case "documentary" -> this.category = Category.DOCUMENTARY; + case "speech" -> this.category = Category.SPEECH; + } + } + + + public String toString() { + return super.toString() + ", Language = " + getLanguage() + ", Category = " + getCategory() + "\n"; + } + + + public void createXMLElement(Document document, Element parentElement) { + // audiobook element + Element audioBook = document.createElement("audiobook"); + + super.createXMLElement(document, audioBook); + + Element languageElement = document.createElement("language"); + languageElement.appendChild(document.createTextNode(language.getLanguage())); + audioBook.appendChild(languageElement); + + Element categoryElement = document.createElement("category"); + categoryElement.appendChild(document.createTextNode(category.getCategory())); + audioBook.appendChild(categoryElement); + + parentElement.appendChild(audioBook); + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/AudioElement.java b/src/main/java/musichub/business/AudioElement.java new file mode 100644 index 0000000..e0a686b --- /dev/null +++ b/src/main/java/musichub/business/AudioElement.java @@ -0,0 +1,88 @@ +package musichub.business; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +import java.util.UUID; + +public abstract class AudioElement { + protected String title; + protected String artist; + protected int lengthInSeconds; + protected UUID uuid; + protected String content; + + public AudioElement(String title, String artist, int lengthInSeconds, String id, String content) { + this.title = title; + this.artist = artist; + this.lengthInSeconds = lengthInSeconds; + this.uuid = UUID.fromString(id); + this.content = content; + } + + public AudioElement(String title, String artist, int lengthInSeconds, String content) { + this.title = title; + this.artist = artist; + this.lengthInSeconds = lengthInSeconds; + this.content = content; + this.uuid = UUID.randomUUID(); + } + + public AudioElement(Element xmlElement) { + { + title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); + artist = xmlElement.getElementsByTagName("artist").item(0).getTextContent(); + lengthInSeconds = Integer.parseInt(xmlElement.getElementsByTagName("length").item(0).getTextContent()); + content = xmlElement.getElementsByTagName("content").item(0).getTextContent(); + String uuid = null; + try { + uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); + } catch (Exception ex) { + System.out.println("Empty element UUID, will create a new one"); + } + if ((uuid == null) || (uuid.isEmpty())) + this.uuid = UUID.randomUUID(); + else this.uuid = UUID.fromString(uuid); + } + } + + public UUID getUUID() { + return this.uuid; + } + + public String getArtist() { + return this.artist; + } + + public String getTitle() { + return this.title; + } + + public String toString() { + return "Title = " + this.title + ", Artist = " + this.artist + ", Length = " + this.lengthInSeconds + ", Content = " + this.content; + } + + public void createXMLElement(Document document, Element parentElement) { + Element nameElement = document.createElement("title"); + nameElement.appendChild(document.createTextNode(title)); + parentElement.appendChild(nameElement); + + Element artistElement = document.createElement("artist"); + artistElement.appendChild(document.createTextNode(artist)); + parentElement.appendChild(artistElement); + + Element lengthElement = document.createElement("length"); + lengthElement.appendChild(document.createTextNode(Integer.valueOf(lengthInSeconds).toString())); + parentElement.appendChild(lengthElement); + + Element UUIDElement = document.createElement("UUID"); + UUIDElement.appendChild(document.createTextNode(uuid.toString())); + parentElement.appendChild(UUIDElement); + + Element contentElement = document.createElement("content"); + contentElement.appendChild(document.createTextNode(content)); + parentElement.appendChild(contentElement); + + } + +} \ No newline at end of file diff --git a/src/main/java/musichub/business/Category.java b/src/main/java/musichub/business/Category.java new file mode 100644 index 0000000..f676e51 --- /dev/null +++ b/src/main/java/musichub/business/Category.java @@ -0,0 +1,14 @@ +package musichub.business; + +public enum Category { + YOUTH("youth"), NOVEL("novel"), THEATER("theater"), DOCUMENTARY("documentary"), SPEECH("speech"); + private final String category; + + Category(String category) { + this.category = category; + } + + public String getCategory() { + return category; + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/Genre.java b/src/main/java/musichub/business/Genre.java new file mode 100644 index 0000000..18deca6 --- /dev/null +++ b/src/main/java/musichub/business/Genre.java @@ -0,0 +1,14 @@ +package musichub.business; + +public enum Genre { + JAZZ("jazz"), CLASSIC("classic"), HIPHOP("hiphop"), ROCK("rock"), POP("pop"), RAP("rap"); + private final String genre; + + Genre(String genre) { + this.genre = genre; + } + + public String getGenre() { + return genre; + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/Language.java b/src/main/java/musichub/business/Language.java new file mode 100644 index 0000000..679e586 --- /dev/null +++ b/src/main/java/musichub/business/Language.java @@ -0,0 +1,14 @@ +package musichub.business; + +public enum Language { + FRENCH("french"), ENGLISH("english"), ITALIAN("italian"), SPANISH("spanish"), GERMAN("german"); + private final String language; + + Language(String language) { + this.language = language; + } + + public String getLanguage() { + return language; + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/MusicHub.java b/src/main/java/musichub/business/MusicHub.java new file mode 100644 index 0000000..38e2214 --- /dev/null +++ b/src/main/java/musichub/business/MusicHub.java @@ -0,0 +1,329 @@ +package musichub.business; + +import musichub.util.XMLHandler; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.util.*; + +class SortByDate implements Comparator { + public int compare(Album a1, Album a2) { + return a1.getDate().compareTo(a2.getDate()); + } +} + +class SortByGenre implements Comparator { + public int compare(Song s1, Song s2) { + return s1.getGenre().compareTo(s2.getGenre()); + } +} + +class SortByAuthor implements Comparator { + public int compare(AudioElement e1, AudioElement e2) { + return e1.getArtist().compareTo(e2.getArtist()); + } +} + +public class MusicHub { + public static final String DIR = System.getProperty("user.dir"); + public static final String ALBUMS_FILE_PATH = DIR + "/files/albums.xml"; + public static final String PLAYLISTS_FILE_PATH = DIR + "/files/playlists.xml"; + public static final String ELEMENTS_FILE_PATH = DIR + "/files/elements.xml"; + private final List albums; + private final List playlists; + private final List elements; + private final XMLHandler xmlHandler = new XMLHandler(); + + public MusicHub() { + albums = new LinkedList<>(); + playlists = new LinkedList<>(); + elements = new LinkedList<>(); + this.loadElements(); + this.loadAlbums(); + this.loadPlaylists(); + } + + public void addElement(AudioElement element) { + elements.add(element); + } + + public void addAlbum(Album album) { + albums.add(album); + } + + public void addPlaylist(PlayList playlist) { + playlists.add(playlist); + } + + public void deletePlayList(String playListTitle) throws NoPlayListFoundException { + + PlayList thePlayList = null; + boolean result = false; + for (PlayList pl : playlists) { + if (pl.getTitle().equalsIgnoreCase(playListTitle)) { + thePlayList = pl; + break; + } + } + + if (thePlayList != null) + result = playlists.remove(thePlayList); + if (!result) throw new NoPlayListFoundException("Playlist " + playListTitle + " not found!"); + } + + public Iterator albums() { + return albums.listIterator(); + } + + public Iterator playlists() { + return playlists.listIterator(); + } + + public Iterator elements() { + return elements.listIterator(); + } + + public String getAlbumsTitlesSortedByDate() { + StringBuilder titleList = new StringBuilder(); + albums.sort(new SortByDate()); + for (Album al : albums) + titleList.append(al.getTitle()).append("\n"); + return titleList.toString(); + } + + public String getAudiobooksTitlesSortedByAuthor() { + StringBuilder titleList = new StringBuilder(); + List audioBookList = new ArrayList<>(); + for (AudioElement ae : elements) + if (ae instanceof AudioBook) + audioBookList.add(ae); + audioBookList.sort(new SortByAuthor()); + for (AudioElement ab : audioBookList) + titleList.append(ab.getArtist()).append("\n"); + return titleList.toString(); + } + + public List getAlbumSongs(String albumTitle) throws NoAlbumFoundException { + Album theAlbum = null; + ArrayList songsInAlbum = new ArrayList<>(); + for (Album al : albums) { + if (al.getTitle().equalsIgnoreCase(albumTitle)) { + theAlbum = al; + break; + } + } + if (theAlbum == null) throw new NoAlbumFoundException("No album with this title in the MusicHub!"); + + List songIDs = theAlbum.getSongs(); + for (UUID id : songIDs) + for (AudioElement el : elements) { + if (el instanceof Song) { + if (el.getUUID().equals(id)) songsInAlbum.add(el); + } + } + return songsInAlbum; + + } + + public List getAlbumSongsSortedByGenre(String albumTitle) throws NoAlbumFoundException { + Album theAlbum = null; + ArrayList songsInAlbum = new ArrayList<>(); + for (Album al : albums) { + if (al.getTitle().equalsIgnoreCase(albumTitle)) { + theAlbum = al; + break; + } + } + if (theAlbum == null) throw new NoAlbumFoundException("No album with this title in the MusicHub!"); + + List songIDs = theAlbum.getSongs(); + for (UUID id : songIDs) + for (AudioElement el : elements) { + if (el instanceof Song) { + if (el.getUUID().equals(id)) songsInAlbum.add((Song) el); + } + } + songsInAlbum.sort(new SortByGenre()); + return songsInAlbum; + + } + + public void addElementToAlbum(String elementTitle, String albumTitle) throws NoAlbumFoundException, NoElementFoundException { + Album theAlbum = null; + int i; + boolean found = false; + for (i = 0; i < albums.size(); i++) { + if (albums.get(i).getTitle().equalsIgnoreCase(albumTitle)) { + theAlbum = albums.get(i); + found = true; + break; + } + } + + if (found) { + AudioElement theElement = null; + for (AudioElement ae : elements) { + if (ae.getTitle().equalsIgnoreCase(elementTitle)) { + theElement = ae; + break; + } + } + if (theElement != null) { + theAlbum.addSong(theElement.getUUID()); + //replace the album in the list + albums.set(i, theAlbum); + } else throw new NoElementFoundException("Element " + elementTitle + " not found!"); + } else throw new NoAlbumFoundException("Album " + albumTitle + " not found!"); + + } + + public void addElementToPlayList(String elementTitle, String playListTitle) throws NoPlayListFoundException, NoElementFoundException { + PlayList thePlaylist = null; + int i; + boolean found = false; + + for (i = 0; i < playlists.size(); i++) { + if (playlists.get(i).getTitle().equalsIgnoreCase(playListTitle)) { + thePlaylist = playlists.get(i); + found = true; + break; + } + } + + if (found) { + AudioElement theElement = null; + for (AudioElement ae : elements) { + if (ae.getTitle().equalsIgnoreCase(elementTitle)) { + theElement = ae; + break; + } + } + if (theElement != null) { + thePlaylist.addElement(theElement.getUUID()); + //replace the album in the list + playlists.set(i, thePlaylist); + } else throw new NoElementFoundException("Element " + elementTitle + " not found!"); + + } else throw new NoPlayListFoundException("Playlist " + playListTitle + " not found!"); + + } + + private void loadAlbums() { + NodeList albumNodes = xmlHandler.parseXMLFile(ALBUMS_FILE_PATH); + if (albumNodes == null) return; + + for (int i = 0; i < albumNodes.getLength(); i++) { + if (albumNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { + Element albumElement = (Element) albumNodes.item(i); + if (albumElement.getNodeName().equals("album")) { + try { + this.addAlbum(new Album(albumElement)); + } catch (Exception ex) { + System.out.println("Something is wrong with the XML album element"); + } + } + } + } + } + + private void loadPlaylists() { + NodeList playlistNodes = xmlHandler.parseXMLFile(PLAYLISTS_FILE_PATH); + if (playlistNodes == null) return; + + for (int i = 0; i < playlistNodes.getLength(); i++) { + if (playlistNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { + Element playlistElement = (Element) playlistNodes.item(i); + if (playlistElement.getNodeName().equals("playlist")) { + try { + this.addPlaylist(new PlayList(playlistElement)); + } catch (Exception ex) { + System.out.println("Something is wrong with the XML playlist element"); + } + } + } + } + } + + private void loadElements() { + NodeList audioelementsNodes = xmlHandler.parseXMLFile(ELEMENTS_FILE_PATH); + if (audioelementsNodes == null) return; + + for (int i = 0; i < audioelementsNodes.getLength(); i++) { + if (audioelementsNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { + Element audioElement = (Element) audioelementsNodes.item(i); + if (audioElement.getNodeName().equals("song")) { + try { + AudioElement newSong = new Song(audioElement); + this.addElement(newSong); + } catch (Exception ex) { + System.out.println("Something is wrong with the XML song element"); + } + } + if (audioElement.getNodeName().equals("audiobook")) { + try { + AudioElement newAudioBook = new AudioBook(audioElement); + this.addElement(newAudioBook); + } catch (Exception ex) { + System.out.println("Something is wrong with the XML audiobook element"); + } + } + } + } + } + + + public void saveAlbums() { + Document document = xmlHandler.createXMLDocument(); + if (document == null) return; + + // root element + Element root = document.createElement("albums"); + document.appendChild(root); + + //save all albums + for (Iterator albumsIter = this.albums(); albumsIter.hasNext(); ) { + Album currentAlbum = albumsIter.next(); + currentAlbum.createXMLElement(document, root); + } + xmlHandler.createXMLFile(document, ALBUMS_FILE_PATH); + } + + public void savePlayLists() { + Document document = xmlHandler.createXMLDocument(); + if (document == null) return; + + // root element + Element root = document.createElement("playlists"); + document.appendChild(root); + + //save all playlists + for (Iterator playlistsIter = this.playlists(); playlistsIter.hasNext(); ) { + PlayList currentPlayList = playlistsIter.next(); + currentPlayList.createXMLElement(document, root); + } + xmlHandler.createXMLFile(document, PLAYLISTS_FILE_PATH); + } + + public void saveElements() { + Document document = xmlHandler.createXMLDocument(); + if (document == null) return; + + // root element + Element root = document.createElement("elements"); + document.appendChild(root); + + //save all AudioElements + for (AudioElement currentElement : elements) { + + if (currentElement instanceof Song) { + currentElement.createXMLElement(document, root); + } + if (currentElement instanceof AudioBook) { + currentElement.createXMLElement(document, root); + } + } + xmlHandler.createXMLFile(document, ELEMENTS_FILE_PATH); + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/NoAlbumFoundException.java b/src/main/java/musichub/business/NoAlbumFoundException.java new file mode 100644 index 0000000..04cbfcd --- /dev/null +++ b/src/main/java/musichub/business/NoAlbumFoundException.java @@ -0,0 +1,8 @@ +package musichub.business; + +public class NoAlbumFoundException extends Exception { + + public NoAlbumFoundException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/NoElementFoundException.java b/src/main/java/musichub/business/NoElementFoundException.java new file mode 100644 index 0000000..a9b0d76 --- /dev/null +++ b/src/main/java/musichub/business/NoElementFoundException.java @@ -0,0 +1,8 @@ +package musichub.business; + +public class NoElementFoundException extends Exception { + + public NoElementFoundException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/NoPlayListFoundException.java b/src/main/java/musichub/business/NoPlayListFoundException.java new file mode 100644 index 0000000..c5eb413 --- /dev/null +++ b/src/main/java/musichub/business/NoPlayListFoundException.java @@ -0,0 +1,8 @@ +package musichub.business; + +public class NoPlayListFoundException extends Exception { + + public NoPlayListFoundException(String msg) { + super(msg); + } +} \ No newline at end of file diff --git a/src/main/java/musichub/business/PlayList.java b/src/main/java/musichub/business/PlayList.java new file mode 100644 index 0000000..4180a62 --- /dev/null +++ b/src/main/java/musichub/business/PlayList.java @@ -0,0 +1,100 @@ +package musichub.business; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + +import java.util.ArrayList; +import java.util.UUID; + +public class PlayList { + private final String title; + private final UUID uuid; + private ArrayList elementUUIDs; + + public PlayList(String title, String id, ArrayList elementUUIDs) { + this.title = title; + this.uuid = UUID.fromString(id); + this.elementUUIDs = elementUUIDs; + } + + public PlayList(String title) { + this.title = title; + this.uuid = UUID.randomUUID(); + this.elementUUIDs = new ArrayList<>(); + } + + public PlayList(Element xmlElement) { + { + this.title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); + + String uuid = null; + try { + uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); + } catch (Exception ex) { + System.out.println("Empty playlist UUID, will create a new one"); + } + if ((uuid == null) || (uuid.isEmpty())) + this.uuid = UUID.randomUUID(); + else this.uuid = UUID.fromString(uuid); + + //parse list of elements: + Node elementsElement = xmlElement.getElementsByTagName("elements").item(0); + NodeList elementUUIDNodes = elementsElement.getChildNodes(); + if (elementUUIDNodes == null) return; + + this.elementUUIDs = new ArrayList<>(); + + + for (int i = 0; i < elementUUIDNodes.getLength(); i++) { + if (elementUUIDNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { + Element elementElement = (Element) elementUUIDNodes.item(i); + if (elementElement.getNodeName().equals("UUID")) { + try { + this.addElement(UUID.fromString(elementElement.getTextContent())); + } catch (Exception ex) { + ex.printStackTrace(); + } + } + } + } + } + } + + public void addElement(UUID element) { + elementUUIDs.add(element); + } + + public ArrayList getElements() { + return elementUUIDs; + } + + public String getTitle() { + return title; + } + + public void createXMLElement(Document document, Element parentElement) { + Element playlistElement = document.createElement("playlist"); + parentElement.appendChild(playlistElement); + + Element nameElement = document.createElement("title"); + nameElement.appendChild(document.createTextNode(title)); + playlistElement.appendChild(nameElement); + + Element UUIDElement = document.createElement("UUID"); + UUIDElement.appendChild(document.createTextNode(uuid.toString())); + playlistElement.appendChild(UUIDElement); + + + Element elementsElement = document.createElement("elements"); + for (UUID currentUUID : this.elementUUIDs) { + + Element elementUUIDElement = document.createElement("UUID"); + elementUUIDElement.appendChild(document.createTextNode(currentUUID.toString())); + elementsElement.appendChild(elementUUIDElement); + } + playlistElement.appendChild(elementsElement); + } + +} \ No newline at end of file diff --git a/src/main/java/musichub/business/Song.java b/src/main/java/musichub/business/Song.java new file mode 100644 index 0000000..3e9011b --- /dev/null +++ b/src/main/java/musichub/business/Song.java @@ -0,0 +1,56 @@ +package musichub.business; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; + + +public class Song extends AudioElement { + private Genre genre; + + public Song(String title, String artist, int length, String uid, String content, String genre) { + super(title, artist, length, uid, content); + this.setGenre(genre); + } + + public Song(String title, String artist, int length, String content, String genre) { + super(title, artist, length, content); + this.setGenre(genre); + } + + public Song(Element xmlElement) { + super(xmlElement); + this.setGenre(xmlElement.getElementsByTagName("genre").item(0).getTextContent()); + } + + public String getGenre() { + return genre.getGenre(); + } + + public void setGenre(String genre) { + switch (genre.toLowerCase()) { + default -> this.genre = Genre.JAZZ; + case "classic" -> this.genre = Genre.CLASSIC; + case "hiphop" -> this.genre = Genre.HIPHOP; + case "rock" -> this.genre = Genre.ROCK; + case "pop" -> this.genre = Genre.POP; + case "rap" -> this.genre = Genre.RAP; + } + } + + public String toString() { + return super.toString() + ", Genre = " + getGenre() + "\n"; + } + + public void createXMLElement(Document document, Element parentElement) { + // song element + Element song = document.createElement("song"); + + super.createXMLElement(document, song); + + Element genreElement = document.createElement("genre"); + genreElement.appendChild(document.createTextNode(genre.getGenre())); + song.appendChild(genreElement); + + parentElement.appendChild(song); + } +} \ No newline at end of file diff --git a/src/main/java/musichub/main/Main.java b/src/main/java/musichub/main/Main.java new file mode 100644 index 0000000..b72a95b --- /dev/null +++ b/src/main/java/musichub/main/Main.java @@ -0,0 +1,248 @@ +package musichub.main; + +import musichub.business.*; + +import java.util.Iterator; +import java.util.Scanner; + +public class Main { + public static void main(String[] args) { + + MusicHub theHub = new MusicHub(); + + System.out.println("Type h for available commands"); + + + Scanner scan = new Scanner(System.in); + String choice = scan.nextLine(); + + String albumTitle; + + if (choice.length() == 0) System.exit(0); + + while (!choice.equals("")) { //if the user puts nothing, quit the loop/system + switch (choice.charAt(0)) { + case 'q': //added the option directly in the switch instead of the loop + System.exit(0); + case 'h': + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 't': + //album titles, ordered by date + System.out.println(theHub.getAlbumsTitlesSortedByDate()); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 'g': + //songs of an album, sorted by genre + System.out.println("Songs of an album sorted by genre will be displayed; enter the album name, available albums are:"); + System.out.println(theHub.getAlbumsTitlesSortedByDate()); + + albumTitle = scan.nextLine(); + try { + System.out.println(theHub.getAlbumSongsSortedByGenre(albumTitle)); + } catch (NoAlbumFoundException ex) { + System.out.println("No album found with the requested title " + ex.getMessage()); + } + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 'd': + //songs of an album + System.out.println("Songs of an album will be displayed; enter the album name, available albums are:"); + System.out.println(theHub.getAlbumsTitlesSortedByDate()); + + albumTitle = scan.nextLine(); + try { + System.out.println(theHub.getAlbumSongs(albumTitle)); + } catch (NoAlbumFoundException ex) { + System.out.println("No album found with the requested title " + ex.getMessage()); + } + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 'u': + //audiobooks ordered by author + System.out.println(theHub.getAudiobooksTitlesSortedByAuthor()); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 'c': + // add a new song + System.out.println("Enter a new song: "); + System.out.println("Song title: "); + String title = scan.nextLine(); + System.out.println("Song genre (jazz, classic, hiphop, rock, pop, rap):"); + String genre = scan.nextLine(); + System.out.println("Song artist: "); + String artist = scan.nextLine(); + System.out.println("Song length in seconds: "); + int length = Integer.parseInt(scan.nextLine()); + System.out.println("Song content: "); + String content = scan.nextLine(); + Song s = new Song(title, artist, length, content, genre); + theHub.addElement(s); + System.out.println("New element list: "); + Iterator it = theHub.elements(); + while (it.hasNext()) System.out.println(it.next().getTitle()); + System.out.println("Song created!"); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 'a': + // add a new album + System.out.println("Enter a new album: "); + System.out.println("Album title: "); + String aTitle = scan.nextLine(); + System.out.println("Album artist: "); + String aArtist = scan.nextLine(); + System.out.println("Album length in seconds: "); + int aLength = Integer.parseInt(scan.nextLine()); + System.out.println("Album date as YYYY-DD-MM: "); + String aDate = scan.nextLine(); + Album a = new Album(aTitle, aArtist, aLength, aDate); + theHub.addAlbum(a); + System.out.println("New list of albums: "); + Iterator ita = theHub.albums(); + while (ita.hasNext()) System.out.println(ita.next().getTitle()); + System.out.println("Album created!"); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case '+': + //add a song to an album: + System.out.println("Add an existing song to an existing album"); + System.out.println("Type the name of the song you wish to add. Available songs: "); + Iterator itae = theHub.elements(); + while (itae.hasNext()) { + AudioElement ae = itae.next(); + if (ae instanceof Song) System.out.println(ae.getTitle()); + } + String songTitle = scan.nextLine(); + + System.out.println("Type the name of the album you wish to enrich. Available albums: "); + Iterator ait = theHub.albums(); + while (ait.hasNext()) { + Album al = ait.next(); + System.out.println(al.getTitle()); + } + String titleAlbum = scan.nextLine(); + try { + theHub.addElementToAlbum(songTitle, titleAlbum); + } catch (NoAlbumFoundException | NoElementFoundException ex) { + System.out.println(ex.getMessage()); + } + System.out.println("Song added to the album!"); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 'l': + // add a new audiobook + System.out.println("Enter a new audiobook: "); + System.out.println("AudioBook title: "); + String bTitle = scan.nextLine(); + System.out.println("AudioBook category (youth, novel, theater, documentary, speech)"); + String bCategory = scan.nextLine(); + System.out.println("AudioBook artist: "); + String bArtist = scan.nextLine(); + System.out.println("AudioBook length in seconds: "); + int bLength = Integer.parseInt(scan.nextLine()); + System.out.println("AudioBook content: "); + String bContent = scan.nextLine(); + System.out.println("AudioBook language (french, english, italian, spanish, german)"); + String bLanguage = scan.nextLine(); + AudioBook b = new AudioBook(bTitle, bArtist, bLength, bContent, bLanguage, bCategory); + theHub.addElement(b); + System.out.println("Audiobook created! New element list: "); + Iterator itl = theHub.elements(); + while (itl.hasNext()) System.out.println(itl.next().getTitle()); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 'p': + //create a new playlist from existing elements + System.out.println("Add an existing song or audiobook to a new playlist"); + System.out.println("Existing playlists:"); + Iterator itpl = theHub.playlists(); + while (itpl.hasNext()) { + PlayList pl = itpl.next(); + System.out.println(pl.getTitle()); + } + System.out.println("Type the name of the playlist you wish to create:"); + String playListTitle = scan.nextLine(); + PlayList pl = new PlayList(playListTitle); + theHub.addPlaylist(pl); + System.out.println("Available elements: "); + + Iterator itael = theHub.elements(); + while (itael.hasNext()) { + AudioElement ae = itael.next(); + System.out.println(ae.getTitle()); + } + while (choice.charAt(0) != 'n') { + System.out.println("Type the name of the audio element you wish to add or 'n' to exit:"); + String elementTitle = scan.nextLine(); + try { + theHub.addElementToPlayList(elementTitle, playListTitle); + } catch (NoPlayListFoundException | NoElementFoundException ex) { + System.out.println(ex.getMessage()); + } + + System.out.println("Type y to add a new one, n to end"); + choice = scan.nextLine(); + } + System.out.println("Playlist created!"); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case '-': + //delete a playlist + System.out.println("Delete an existing playlist. Available playlists:"); + Iterator itp = theHub.playlists(); + while (itp.hasNext()) { + PlayList p = itp.next(); + System.out.println(p.getTitle()); + } + String plTitle = scan.nextLine(); + try { + theHub.deletePlayList(plTitle); + } catch (NoPlayListFoundException ex) { + System.out.println(ex.getMessage()); + } + System.out.println("Playlist deleted!"); + printAvailableCommands(); + choice = scan.nextLine(); + break; + case 's': + //save elements, albums, playlists + theHub.saveElements(); + theHub.saveAlbums(); + theHub.savePlayLists(); + System.out.println("Elements, albums and playlists saved!"); + printAvailableCommands(); + choice = scan.nextLine(); + break; + default: + + break; + } + } + scan.close(); + } + + private static void printAvailableCommands() { + System.out.println("t: display the album titles, ordered by date"); + System.out.println("g: display songs of an album, ordered by genre"); + System.out.println("d: display songs of an album"); + System.out.println("u: display audiobooks ordered by author"); + System.out.println("c: add a new song"); + System.out.println("a: add a new album"); + System.out.println("+: add a song to an album"); + System.out.println("l: add a new audiobook"); + System.out.println("p: create a new playlist from existing songs and audio books"); + System.out.println("-: delete an existing playlist"); + System.out.println("s: save elements, albums, playlists"); + System.out.println("q: quit program"); + } +} \ No newline at end of file diff --git a/src/main/java/musichub/util/XMLHandler.java b/src/main/java/musichub/util/XMLHandler.java new file mode 100644 index 0000000..4b61842 --- /dev/null +++ b/src/main/java/musichub/util/XMLHandler.java @@ -0,0 +1,74 @@ +package musichub.util; + +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; +import org.xml.sax.SAXException; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.ParserConfigurationException; +import javax.xml.transform.Transformer; +import javax.xml.transform.TransformerException; +import javax.xml.transform.TransformerFactory; +import javax.xml.transform.dom.DOMSource; +import javax.xml.transform.stream.StreamResult; +import java.io.File; +import java.io.IOException; + + +public class XMLHandler { + TransformerFactory transformerFactory; + Transformer transformer; + DocumentBuilderFactory documentFactory; + DocumentBuilder documentBuilder; + + public XMLHandler() { + try { + transformerFactory = TransformerFactory.newInstance(); + transformer = transformerFactory.newTransformer(); + documentFactory = DocumentBuilderFactory.newInstance(); + documentBuilder = documentFactory.newDocumentBuilder(); + } catch (TransformerException | ParserConfigurationException tfe) { + tfe.printStackTrace(); + } + } + + public void createXMLFile(Document document, String filePath) { + try { + // create the xml file + //transform the DOM Object to an XML File + DOMSource domSource = new DOMSource(document); + StreamResult streamResult = new StreamResult(new File(filePath)); + + // If you use + // StreamResult result = new StreamResult(System.out); + // the output will be pushed to the standard output ... + // You can use that for debugging + + transformer.transform(domSource, streamResult); + + } catch (TransformerException tfe) { + tfe.printStackTrace(); + } + } + + public Document createXMLDocument() { + return documentBuilder.newDocument(); + } + + public NodeList parseXMLFile(String filePath) { + NodeList elementNodes = null; + try { + Document document = documentBuilder.parse(new File(filePath)); + Element root = document.getDocumentElement(); + + elementNodes = root.getChildNodes(); + } catch (SAXException | IOException e) { + e.printStackTrace(); + } + return elementNodes; + } + + +} \ No newline at end of file diff --git a/src/musichub/business/Album.java b/src/musichub/business/Album.java deleted file mode 100644 index 01fd179..0000000 --- a/src/musichub/business/Album.java +++ /dev/null @@ -1,145 +0,0 @@ -package musichub.business; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import java.text.ParseException; -import java.text.SimpleDateFormat; -import java.util.*; - - -public class Album { - private final String title; - private final int lengthInSeconds; - private final UUID uuid; - private String artist; - private Date date; - private ArrayList songsUIDs; - - public Album(String title, String artist, int lengthInSeconds, String id, String date, ArrayList songsUIDs) { - this.title = title; - this.artist = artist; - this.lengthInSeconds = lengthInSeconds; - this.uuid = UUID.fromString(id); - try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - this.date = sdf.parse(date); - } catch (ParseException ex) { - ex.printStackTrace(); - } - this.songsUIDs = songsUIDs; - } - - public Album(String title, String artist, int lengthInSeconds, String date) { - this.title = title; - this.artist = artist; - this.lengthInSeconds = lengthInSeconds; - this.uuid = UUID.randomUUID(); - try { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - this.date = sdf.parse(date); - } catch (ParseException ex) { - ex.printStackTrace(); - } - this.songsUIDs = new ArrayList<>(); - } - - public Album(Element xmlElement) throws Exception { - { - this.title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); - this.lengthInSeconds = Integer.parseInt(xmlElement.getElementsByTagName("lengthInSeconds").item(0).getTextContent()); - String uuid = null; - try { - uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); - } catch (Exception ex) { - System.out.println("Empty album UUID, will create a new one"); - } - if ((uuid == null) || (uuid.isEmpty())) - this.uuid = UUID.randomUUID(); - else this.uuid = UUID.fromString(uuid); - - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - this.date = sdf.parse(xmlElement.getElementsByTagName("date").item(0).getTextContent()); - //parse list of songs: - Node songsElement = xmlElement.getElementsByTagName("songs").item(0); - NodeList songUUIDNodes = songsElement.getChildNodes(); - if (songUUIDNodes == null) return; - - this.songsUIDs = new ArrayList<>(); - - for (int i = 0; i < songUUIDNodes.getLength(); i++) { - if (songUUIDNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { - Element songElement = (Element) songUUIDNodes.item(i); - if (songElement.getNodeName().equals("UUID")) { - try { - this.addSong(UUID.fromString(songElement.getTextContent())); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - } - } - } - } - - - public void addSong(UUID song) { - songsUIDs.add(song); - } - - - public List getSongs() { - return songsUIDs; - } - - public ArrayList getSongsRandomly() { - ArrayList shuffledSongs = songsUIDs; - Collections.shuffle(shuffledSongs); - return shuffledSongs; - } - - public String getTitle() { - return title; - } - - public Date getDate() { - return date; - } - - public void createXMLElement(Document document, Element parentElement) { - Element albumElement = document.createElement("album"); - parentElement.appendChild(albumElement); - - Element nameElement = document.createElement("title"); - nameElement.appendChild(document.createTextNode(title)); - albumElement.appendChild(nameElement); - - Element artistElement = document.createElement("artist"); - artistElement.appendChild(document.createTextNode(artist)); - albumElement.appendChild(artistElement); - - Element lengthElement = document.createElement("lengthInSeconds"); - lengthElement.appendChild(document.createTextNode(Integer.valueOf(lengthInSeconds).toString())); - albumElement.appendChild(lengthElement); - - Element UUIDElement = document.createElement("UUID"); - UUIDElement.appendChild(document.createTextNode(uuid.toString())); - albumElement.appendChild(UUIDElement); - - Element dateElement = document.createElement("date"); - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - dateElement.appendChild(document.createTextNode(sdf.format(date))); - albumElement.appendChild(dateElement); - - Element songsElement = document.createElement("songs"); - for (UUID currentUUID : this.songsUIDs) { - Element songUUIDElement = document.createElement("UUID"); - songUUIDElement.appendChild(document.createTextNode(currentUUID.toString())); - songsElement.appendChild(songUUIDElement); - } - albumElement.appendChild(songsElement); - - } -} \ No newline at end of file diff --git a/src/musichub/business/AudioBook.java b/src/musichub/business/AudioBook.java deleted file mode 100644 index 80392d6..0000000 --- a/src/musichub/business/AudioBook.java +++ /dev/null @@ -1,78 +0,0 @@ -package musichub.business; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -public class AudioBook extends AudioElement { - private Language language; - private Category category; - - public AudioBook(String title, String artist, int lengthInSeconds, String uid, String content, String language, String category) { - super(title, artist, lengthInSeconds, uid, content); - this.setLanguage(language); - this.setCategory(category); - } - - public AudioBook(String title, String artist, int lengthInSeconds, String content, String language, String category) { - super(title, artist, lengthInSeconds, content); - this.setLanguage(language); - this.setCategory(category); - } - - public AudioBook(Element xmlElement) { - super(xmlElement); - this.setLanguage(xmlElement.getElementsByTagName("language").item(0).getTextContent()); - this.setCategory(xmlElement.getElementsByTagName("category").item(0).getTextContent()); - } - - public Language getLanguage() { - return this.language; - } - - public void setLanguage(String language) { - switch (language.toLowerCase()) { - default -> this.language = Language.ENGLISH; - case "french" -> this.language = Language.FRENCH; - case "german" -> this.language = Language.GERMAN; - case "spanish" -> this.language = Language.SPANISH; - case "italian" -> this.language = Language.ITALIAN; - } - } - - public Category getCategory() { - return this.category; - } - - public void setCategory(String category) { - switch (category.toLowerCase()) { - default -> this.category = Category.YOUTH; - case "novel" -> this.category = Category.NOVEL; - case "theater" -> this.category = Category.THEATER; - case "documentary" -> this.category = Category.DOCUMENTARY; - case "speech" -> this.category = Category.SPEECH; - } - } - - - public String toString() { - return super.toString() + ", Language = " + getLanguage() + ", Category = " + getCategory() + "\n"; - } - - - public void createXMLElement(Document document, Element parentElement) { - // audiobook element - Element audioBook = document.createElement("audiobook"); - - super.createXMLElement(document, audioBook); - - Element languageElement = document.createElement("language"); - languageElement.appendChild(document.createTextNode(language.getLanguage())); - audioBook.appendChild(languageElement); - - Element categoryElement = document.createElement("category"); - categoryElement.appendChild(document.createTextNode(category.getCategory())); - audioBook.appendChild(categoryElement); - - parentElement.appendChild(audioBook); - } -} \ No newline at end of file diff --git a/src/musichub/business/AudioElement.java b/src/musichub/business/AudioElement.java deleted file mode 100644 index e0a686b..0000000 --- a/src/musichub/business/AudioElement.java +++ /dev/null @@ -1,88 +0,0 @@ -package musichub.business; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - -import java.util.UUID; - -public abstract class AudioElement { - protected String title; - protected String artist; - protected int lengthInSeconds; - protected UUID uuid; - protected String content; - - public AudioElement(String title, String artist, int lengthInSeconds, String id, String content) { - this.title = title; - this.artist = artist; - this.lengthInSeconds = lengthInSeconds; - this.uuid = UUID.fromString(id); - this.content = content; - } - - public AudioElement(String title, String artist, int lengthInSeconds, String content) { - this.title = title; - this.artist = artist; - this.lengthInSeconds = lengthInSeconds; - this.content = content; - this.uuid = UUID.randomUUID(); - } - - public AudioElement(Element xmlElement) { - { - title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); - artist = xmlElement.getElementsByTagName("artist").item(0).getTextContent(); - lengthInSeconds = Integer.parseInt(xmlElement.getElementsByTagName("length").item(0).getTextContent()); - content = xmlElement.getElementsByTagName("content").item(0).getTextContent(); - String uuid = null; - try { - uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); - } catch (Exception ex) { - System.out.println("Empty element UUID, will create a new one"); - } - if ((uuid == null) || (uuid.isEmpty())) - this.uuid = UUID.randomUUID(); - else this.uuid = UUID.fromString(uuid); - } - } - - public UUID getUUID() { - return this.uuid; - } - - public String getArtist() { - return this.artist; - } - - public String getTitle() { - return this.title; - } - - public String toString() { - return "Title = " + this.title + ", Artist = " + this.artist + ", Length = " + this.lengthInSeconds + ", Content = " + this.content; - } - - public void createXMLElement(Document document, Element parentElement) { - Element nameElement = document.createElement("title"); - nameElement.appendChild(document.createTextNode(title)); - parentElement.appendChild(nameElement); - - Element artistElement = document.createElement("artist"); - artistElement.appendChild(document.createTextNode(artist)); - parentElement.appendChild(artistElement); - - Element lengthElement = document.createElement("length"); - lengthElement.appendChild(document.createTextNode(Integer.valueOf(lengthInSeconds).toString())); - parentElement.appendChild(lengthElement); - - Element UUIDElement = document.createElement("UUID"); - UUIDElement.appendChild(document.createTextNode(uuid.toString())); - parentElement.appendChild(UUIDElement); - - Element contentElement = document.createElement("content"); - contentElement.appendChild(document.createTextNode(content)); - parentElement.appendChild(contentElement); - - } - -} \ No newline at end of file diff --git a/src/musichub/business/Category.java b/src/musichub/business/Category.java deleted file mode 100644 index f676e51..0000000 --- a/src/musichub/business/Category.java +++ /dev/null @@ -1,14 +0,0 @@ -package musichub.business; - -public enum Category { - YOUTH("youth"), NOVEL("novel"), THEATER("theater"), DOCUMENTARY("documentary"), SPEECH("speech"); - private final String category; - - Category(String category) { - this.category = category; - } - - public String getCategory() { - return category; - } -} \ No newline at end of file diff --git a/src/musichub/business/Genre.java b/src/musichub/business/Genre.java deleted file mode 100644 index 18deca6..0000000 --- a/src/musichub/business/Genre.java +++ /dev/null @@ -1,14 +0,0 @@ -package musichub.business; - -public enum Genre { - JAZZ("jazz"), CLASSIC("classic"), HIPHOP("hiphop"), ROCK("rock"), POP("pop"), RAP("rap"); - private final String genre; - - Genre(String genre) { - this.genre = genre; - } - - public String getGenre() { - return genre; - } -} \ No newline at end of file diff --git a/src/musichub/business/Language.java b/src/musichub/business/Language.java deleted file mode 100644 index 679e586..0000000 --- a/src/musichub/business/Language.java +++ /dev/null @@ -1,14 +0,0 @@ -package musichub.business; - -public enum Language { - FRENCH("french"), ENGLISH("english"), ITALIAN("italian"), SPANISH("spanish"), GERMAN("german"); - private final String language; - - Language(String language) { - this.language = language; - } - - public String getLanguage() { - return language; - } -} \ No newline at end of file diff --git a/src/musichub/business/MusicHub.java b/src/musichub/business/MusicHub.java deleted file mode 100644 index 38e2214..0000000 --- a/src/musichub/business/MusicHub.java +++ /dev/null @@ -1,329 +0,0 @@ -package musichub.business; - -import musichub.util.XMLHandler; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import java.util.*; - -class SortByDate implements Comparator { - public int compare(Album a1, Album a2) { - return a1.getDate().compareTo(a2.getDate()); - } -} - -class SortByGenre implements Comparator { - public int compare(Song s1, Song s2) { - return s1.getGenre().compareTo(s2.getGenre()); - } -} - -class SortByAuthor implements Comparator { - public int compare(AudioElement e1, AudioElement e2) { - return e1.getArtist().compareTo(e2.getArtist()); - } -} - -public class MusicHub { - public static final String DIR = System.getProperty("user.dir"); - public static final String ALBUMS_FILE_PATH = DIR + "/files/albums.xml"; - public static final String PLAYLISTS_FILE_PATH = DIR + "/files/playlists.xml"; - public static final String ELEMENTS_FILE_PATH = DIR + "/files/elements.xml"; - private final List albums; - private final List playlists; - private final List elements; - private final XMLHandler xmlHandler = new XMLHandler(); - - public MusicHub() { - albums = new LinkedList<>(); - playlists = new LinkedList<>(); - elements = new LinkedList<>(); - this.loadElements(); - this.loadAlbums(); - this.loadPlaylists(); - } - - public void addElement(AudioElement element) { - elements.add(element); - } - - public void addAlbum(Album album) { - albums.add(album); - } - - public void addPlaylist(PlayList playlist) { - playlists.add(playlist); - } - - public void deletePlayList(String playListTitle) throws NoPlayListFoundException { - - PlayList thePlayList = null; - boolean result = false; - for (PlayList pl : playlists) { - if (pl.getTitle().equalsIgnoreCase(playListTitle)) { - thePlayList = pl; - break; - } - } - - if (thePlayList != null) - result = playlists.remove(thePlayList); - if (!result) throw new NoPlayListFoundException("Playlist " + playListTitle + " not found!"); - } - - public Iterator albums() { - return albums.listIterator(); - } - - public Iterator playlists() { - return playlists.listIterator(); - } - - public Iterator elements() { - return elements.listIterator(); - } - - public String getAlbumsTitlesSortedByDate() { - StringBuilder titleList = new StringBuilder(); - albums.sort(new SortByDate()); - for (Album al : albums) - titleList.append(al.getTitle()).append("\n"); - return titleList.toString(); - } - - public String getAudiobooksTitlesSortedByAuthor() { - StringBuilder titleList = new StringBuilder(); - List audioBookList = new ArrayList<>(); - for (AudioElement ae : elements) - if (ae instanceof AudioBook) - audioBookList.add(ae); - audioBookList.sort(new SortByAuthor()); - for (AudioElement ab : audioBookList) - titleList.append(ab.getArtist()).append("\n"); - return titleList.toString(); - } - - public List getAlbumSongs(String albumTitle) throws NoAlbumFoundException { - Album theAlbum = null; - ArrayList songsInAlbum = new ArrayList<>(); - for (Album al : albums) { - if (al.getTitle().equalsIgnoreCase(albumTitle)) { - theAlbum = al; - break; - } - } - if (theAlbum == null) throw new NoAlbumFoundException("No album with this title in the MusicHub!"); - - List songIDs = theAlbum.getSongs(); - for (UUID id : songIDs) - for (AudioElement el : elements) { - if (el instanceof Song) { - if (el.getUUID().equals(id)) songsInAlbum.add(el); - } - } - return songsInAlbum; - - } - - public List getAlbumSongsSortedByGenre(String albumTitle) throws NoAlbumFoundException { - Album theAlbum = null; - ArrayList songsInAlbum = new ArrayList<>(); - for (Album al : albums) { - if (al.getTitle().equalsIgnoreCase(albumTitle)) { - theAlbum = al; - break; - } - } - if (theAlbum == null) throw new NoAlbumFoundException("No album with this title in the MusicHub!"); - - List songIDs = theAlbum.getSongs(); - for (UUID id : songIDs) - for (AudioElement el : elements) { - if (el instanceof Song) { - if (el.getUUID().equals(id)) songsInAlbum.add((Song) el); - } - } - songsInAlbum.sort(new SortByGenre()); - return songsInAlbum; - - } - - public void addElementToAlbum(String elementTitle, String albumTitle) throws NoAlbumFoundException, NoElementFoundException { - Album theAlbum = null; - int i; - boolean found = false; - for (i = 0; i < albums.size(); i++) { - if (albums.get(i).getTitle().equalsIgnoreCase(albumTitle)) { - theAlbum = albums.get(i); - found = true; - break; - } - } - - if (found) { - AudioElement theElement = null; - for (AudioElement ae : elements) { - if (ae.getTitle().equalsIgnoreCase(elementTitle)) { - theElement = ae; - break; - } - } - if (theElement != null) { - theAlbum.addSong(theElement.getUUID()); - //replace the album in the list - albums.set(i, theAlbum); - } else throw new NoElementFoundException("Element " + elementTitle + " not found!"); - } else throw new NoAlbumFoundException("Album " + albumTitle + " not found!"); - - } - - public void addElementToPlayList(String elementTitle, String playListTitle) throws NoPlayListFoundException, NoElementFoundException { - PlayList thePlaylist = null; - int i; - boolean found = false; - - for (i = 0; i < playlists.size(); i++) { - if (playlists.get(i).getTitle().equalsIgnoreCase(playListTitle)) { - thePlaylist = playlists.get(i); - found = true; - break; - } - } - - if (found) { - AudioElement theElement = null; - for (AudioElement ae : elements) { - if (ae.getTitle().equalsIgnoreCase(elementTitle)) { - theElement = ae; - break; - } - } - if (theElement != null) { - thePlaylist.addElement(theElement.getUUID()); - //replace the album in the list - playlists.set(i, thePlaylist); - } else throw new NoElementFoundException("Element " + elementTitle + " not found!"); - - } else throw new NoPlayListFoundException("Playlist " + playListTitle + " not found!"); - - } - - private void loadAlbums() { - NodeList albumNodes = xmlHandler.parseXMLFile(ALBUMS_FILE_PATH); - if (albumNodes == null) return; - - for (int i = 0; i < albumNodes.getLength(); i++) { - if (albumNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { - Element albumElement = (Element) albumNodes.item(i); - if (albumElement.getNodeName().equals("album")) { - try { - this.addAlbum(new Album(albumElement)); - } catch (Exception ex) { - System.out.println("Something is wrong with the XML album element"); - } - } - } - } - } - - private void loadPlaylists() { - NodeList playlistNodes = xmlHandler.parseXMLFile(PLAYLISTS_FILE_PATH); - if (playlistNodes == null) return; - - for (int i = 0; i < playlistNodes.getLength(); i++) { - if (playlistNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { - Element playlistElement = (Element) playlistNodes.item(i); - if (playlistElement.getNodeName().equals("playlist")) { - try { - this.addPlaylist(new PlayList(playlistElement)); - } catch (Exception ex) { - System.out.println("Something is wrong with the XML playlist element"); - } - } - } - } - } - - private void loadElements() { - NodeList audioelementsNodes = xmlHandler.parseXMLFile(ELEMENTS_FILE_PATH); - if (audioelementsNodes == null) return; - - for (int i = 0; i < audioelementsNodes.getLength(); i++) { - if (audioelementsNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { - Element audioElement = (Element) audioelementsNodes.item(i); - if (audioElement.getNodeName().equals("song")) { - try { - AudioElement newSong = new Song(audioElement); - this.addElement(newSong); - } catch (Exception ex) { - System.out.println("Something is wrong with the XML song element"); - } - } - if (audioElement.getNodeName().equals("audiobook")) { - try { - AudioElement newAudioBook = new AudioBook(audioElement); - this.addElement(newAudioBook); - } catch (Exception ex) { - System.out.println("Something is wrong with the XML audiobook element"); - } - } - } - } - } - - - public void saveAlbums() { - Document document = xmlHandler.createXMLDocument(); - if (document == null) return; - - // root element - Element root = document.createElement("albums"); - document.appendChild(root); - - //save all albums - for (Iterator albumsIter = this.albums(); albumsIter.hasNext(); ) { - Album currentAlbum = albumsIter.next(); - currentAlbum.createXMLElement(document, root); - } - xmlHandler.createXMLFile(document, ALBUMS_FILE_PATH); - } - - public void savePlayLists() { - Document document = xmlHandler.createXMLDocument(); - if (document == null) return; - - // root element - Element root = document.createElement("playlists"); - document.appendChild(root); - - //save all playlists - for (Iterator playlistsIter = this.playlists(); playlistsIter.hasNext(); ) { - PlayList currentPlayList = playlistsIter.next(); - currentPlayList.createXMLElement(document, root); - } - xmlHandler.createXMLFile(document, PLAYLISTS_FILE_PATH); - } - - public void saveElements() { - Document document = xmlHandler.createXMLDocument(); - if (document == null) return; - - // root element - Element root = document.createElement("elements"); - document.appendChild(root); - - //save all AudioElements - for (AudioElement currentElement : elements) { - - if (currentElement instanceof Song) { - currentElement.createXMLElement(document, root); - } - if (currentElement instanceof AudioBook) { - currentElement.createXMLElement(document, root); - } - } - xmlHandler.createXMLFile(document, ELEMENTS_FILE_PATH); - } -} \ No newline at end of file diff --git a/src/musichub/business/NoAlbumFoundException.java b/src/musichub/business/NoAlbumFoundException.java deleted file mode 100644 index 04cbfcd..0000000 --- a/src/musichub/business/NoAlbumFoundException.java +++ /dev/null @@ -1,8 +0,0 @@ -package musichub.business; - -public class NoAlbumFoundException extends Exception { - - public NoAlbumFoundException(String msg) { - super(msg); - } -} \ No newline at end of file diff --git a/src/musichub/business/NoElementFoundException.java b/src/musichub/business/NoElementFoundException.java deleted file mode 100644 index a9b0d76..0000000 --- a/src/musichub/business/NoElementFoundException.java +++ /dev/null @@ -1,8 +0,0 @@ -package musichub.business; - -public class NoElementFoundException extends Exception { - - public NoElementFoundException(String msg) { - super(msg); - } -} \ No newline at end of file diff --git a/src/musichub/business/NoPlayListFoundException.java b/src/musichub/business/NoPlayListFoundException.java deleted file mode 100644 index c5eb413..0000000 --- a/src/musichub/business/NoPlayListFoundException.java +++ /dev/null @@ -1,8 +0,0 @@ -package musichub.business; - -public class NoPlayListFoundException extends Exception { - - public NoPlayListFoundException(String msg) { - super(msg); - } -} \ No newline at end of file diff --git a/src/musichub/business/PlayList.java b/src/musichub/business/PlayList.java deleted file mode 100644 index 4180a62..0000000 --- a/src/musichub/business/PlayList.java +++ /dev/null @@ -1,100 +0,0 @@ -package musichub.business; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.Node; -import org.w3c.dom.NodeList; - -import java.util.ArrayList; -import java.util.UUID; - -public class PlayList { - private final String title; - private final UUID uuid; - private ArrayList elementUUIDs; - - public PlayList(String title, String id, ArrayList elementUUIDs) { - this.title = title; - this.uuid = UUID.fromString(id); - this.elementUUIDs = elementUUIDs; - } - - public PlayList(String title) { - this.title = title; - this.uuid = UUID.randomUUID(); - this.elementUUIDs = new ArrayList<>(); - } - - public PlayList(Element xmlElement) { - { - this.title = xmlElement.getElementsByTagName("title").item(0).getTextContent(); - - String uuid = null; - try { - uuid = xmlElement.getElementsByTagName("UUID").item(0).getTextContent(); - } catch (Exception ex) { - System.out.println("Empty playlist UUID, will create a new one"); - } - if ((uuid == null) || (uuid.isEmpty())) - this.uuid = UUID.randomUUID(); - else this.uuid = UUID.fromString(uuid); - - //parse list of elements: - Node elementsElement = xmlElement.getElementsByTagName("elements").item(0); - NodeList elementUUIDNodes = elementsElement.getChildNodes(); - if (elementUUIDNodes == null) return; - - this.elementUUIDs = new ArrayList<>(); - - - for (int i = 0; i < elementUUIDNodes.getLength(); i++) { - if (elementUUIDNodes.item(i).getNodeType() == Node.ELEMENT_NODE) { - Element elementElement = (Element) elementUUIDNodes.item(i); - if (elementElement.getNodeName().equals("UUID")) { - try { - this.addElement(UUID.fromString(elementElement.getTextContent())); - } catch (Exception ex) { - ex.printStackTrace(); - } - } - } - } - } - } - - public void addElement(UUID element) { - elementUUIDs.add(element); - } - - public ArrayList getElements() { - return elementUUIDs; - } - - public String getTitle() { - return title; - } - - public void createXMLElement(Document document, Element parentElement) { - Element playlistElement = document.createElement("playlist"); - parentElement.appendChild(playlistElement); - - Element nameElement = document.createElement("title"); - nameElement.appendChild(document.createTextNode(title)); - playlistElement.appendChild(nameElement); - - Element UUIDElement = document.createElement("UUID"); - UUIDElement.appendChild(document.createTextNode(uuid.toString())); - playlistElement.appendChild(UUIDElement); - - - Element elementsElement = document.createElement("elements"); - for (UUID currentUUID : this.elementUUIDs) { - - Element elementUUIDElement = document.createElement("UUID"); - elementUUIDElement.appendChild(document.createTextNode(currentUUID.toString())); - elementsElement.appendChild(elementUUIDElement); - } - playlistElement.appendChild(elementsElement); - } - -} \ No newline at end of file diff --git a/src/musichub/business/Song.java b/src/musichub/business/Song.java deleted file mode 100644 index 3e9011b..0000000 --- a/src/musichub/business/Song.java +++ /dev/null @@ -1,56 +0,0 @@ -package musichub.business; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; - - -public class Song extends AudioElement { - private Genre genre; - - public Song(String title, String artist, int length, String uid, String content, String genre) { - super(title, artist, length, uid, content); - this.setGenre(genre); - } - - public Song(String title, String artist, int length, String content, String genre) { - super(title, artist, length, content); - this.setGenre(genre); - } - - public Song(Element xmlElement) { - super(xmlElement); - this.setGenre(xmlElement.getElementsByTagName("genre").item(0).getTextContent()); - } - - public String getGenre() { - return genre.getGenre(); - } - - public void setGenre(String genre) { - switch (genre.toLowerCase()) { - default -> this.genre = Genre.JAZZ; - case "classic" -> this.genre = Genre.CLASSIC; - case "hiphop" -> this.genre = Genre.HIPHOP; - case "rock" -> this.genre = Genre.ROCK; - case "pop" -> this.genre = Genre.POP; - case "rap" -> this.genre = Genre.RAP; - } - } - - public String toString() { - return super.toString() + ", Genre = " + getGenre() + "\n"; - } - - public void createXMLElement(Document document, Element parentElement) { - // song element - Element song = document.createElement("song"); - - super.createXMLElement(document, song); - - Element genreElement = document.createElement("genre"); - genreElement.appendChild(document.createTextNode(genre.getGenre())); - song.appendChild(genreElement); - - parentElement.appendChild(song); - } -} \ No newline at end of file diff --git a/src/musichub/main/Main.java b/src/musichub/main/Main.java deleted file mode 100644 index b72a95b..0000000 --- a/src/musichub/main/Main.java +++ /dev/null @@ -1,248 +0,0 @@ -package musichub.main; - -import musichub.business.*; - -import java.util.Iterator; -import java.util.Scanner; - -public class Main { - public static void main(String[] args) { - - MusicHub theHub = new MusicHub(); - - System.out.println("Type h for available commands"); - - - Scanner scan = new Scanner(System.in); - String choice = scan.nextLine(); - - String albumTitle; - - if (choice.length() == 0) System.exit(0); - - while (!choice.equals("")) { //if the user puts nothing, quit the loop/system - switch (choice.charAt(0)) { - case 'q': //added the option directly in the switch instead of the loop - System.exit(0); - case 'h': - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 't': - //album titles, ordered by date - System.out.println(theHub.getAlbumsTitlesSortedByDate()); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 'g': - //songs of an album, sorted by genre - System.out.println("Songs of an album sorted by genre will be displayed; enter the album name, available albums are:"); - System.out.println(theHub.getAlbumsTitlesSortedByDate()); - - albumTitle = scan.nextLine(); - try { - System.out.println(theHub.getAlbumSongsSortedByGenre(albumTitle)); - } catch (NoAlbumFoundException ex) { - System.out.println("No album found with the requested title " + ex.getMessage()); - } - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 'd': - //songs of an album - System.out.println("Songs of an album will be displayed; enter the album name, available albums are:"); - System.out.println(theHub.getAlbumsTitlesSortedByDate()); - - albumTitle = scan.nextLine(); - try { - System.out.println(theHub.getAlbumSongs(albumTitle)); - } catch (NoAlbumFoundException ex) { - System.out.println("No album found with the requested title " + ex.getMessage()); - } - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 'u': - //audiobooks ordered by author - System.out.println(theHub.getAudiobooksTitlesSortedByAuthor()); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 'c': - // add a new song - System.out.println("Enter a new song: "); - System.out.println("Song title: "); - String title = scan.nextLine(); - System.out.println("Song genre (jazz, classic, hiphop, rock, pop, rap):"); - String genre = scan.nextLine(); - System.out.println("Song artist: "); - String artist = scan.nextLine(); - System.out.println("Song length in seconds: "); - int length = Integer.parseInt(scan.nextLine()); - System.out.println("Song content: "); - String content = scan.nextLine(); - Song s = new Song(title, artist, length, content, genre); - theHub.addElement(s); - System.out.println("New element list: "); - Iterator it = theHub.elements(); - while (it.hasNext()) System.out.println(it.next().getTitle()); - System.out.println("Song created!"); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 'a': - // add a new album - System.out.println("Enter a new album: "); - System.out.println("Album title: "); - String aTitle = scan.nextLine(); - System.out.println("Album artist: "); - String aArtist = scan.nextLine(); - System.out.println("Album length in seconds: "); - int aLength = Integer.parseInt(scan.nextLine()); - System.out.println("Album date as YYYY-DD-MM: "); - String aDate = scan.nextLine(); - Album a = new Album(aTitle, aArtist, aLength, aDate); - theHub.addAlbum(a); - System.out.println("New list of albums: "); - Iterator ita = theHub.albums(); - while (ita.hasNext()) System.out.println(ita.next().getTitle()); - System.out.println("Album created!"); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case '+': - //add a song to an album: - System.out.println("Add an existing song to an existing album"); - System.out.println("Type the name of the song you wish to add. Available songs: "); - Iterator itae = theHub.elements(); - while (itae.hasNext()) { - AudioElement ae = itae.next(); - if (ae instanceof Song) System.out.println(ae.getTitle()); - } - String songTitle = scan.nextLine(); - - System.out.println("Type the name of the album you wish to enrich. Available albums: "); - Iterator ait = theHub.albums(); - while (ait.hasNext()) { - Album al = ait.next(); - System.out.println(al.getTitle()); - } - String titleAlbum = scan.nextLine(); - try { - theHub.addElementToAlbum(songTitle, titleAlbum); - } catch (NoAlbumFoundException | NoElementFoundException ex) { - System.out.println(ex.getMessage()); - } - System.out.println("Song added to the album!"); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 'l': - // add a new audiobook - System.out.println("Enter a new audiobook: "); - System.out.println("AudioBook title: "); - String bTitle = scan.nextLine(); - System.out.println("AudioBook category (youth, novel, theater, documentary, speech)"); - String bCategory = scan.nextLine(); - System.out.println("AudioBook artist: "); - String bArtist = scan.nextLine(); - System.out.println("AudioBook length in seconds: "); - int bLength = Integer.parseInt(scan.nextLine()); - System.out.println("AudioBook content: "); - String bContent = scan.nextLine(); - System.out.println("AudioBook language (french, english, italian, spanish, german)"); - String bLanguage = scan.nextLine(); - AudioBook b = new AudioBook(bTitle, bArtist, bLength, bContent, bLanguage, bCategory); - theHub.addElement(b); - System.out.println("Audiobook created! New element list: "); - Iterator itl = theHub.elements(); - while (itl.hasNext()) System.out.println(itl.next().getTitle()); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 'p': - //create a new playlist from existing elements - System.out.println("Add an existing song or audiobook to a new playlist"); - System.out.println("Existing playlists:"); - Iterator itpl = theHub.playlists(); - while (itpl.hasNext()) { - PlayList pl = itpl.next(); - System.out.println(pl.getTitle()); - } - System.out.println("Type the name of the playlist you wish to create:"); - String playListTitle = scan.nextLine(); - PlayList pl = new PlayList(playListTitle); - theHub.addPlaylist(pl); - System.out.println("Available elements: "); - - Iterator itael = theHub.elements(); - while (itael.hasNext()) { - AudioElement ae = itael.next(); - System.out.println(ae.getTitle()); - } - while (choice.charAt(0) != 'n') { - System.out.println("Type the name of the audio element you wish to add or 'n' to exit:"); - String elementTitle = scan.nextLine(); - try { - theHub.addElementToPlayList(elementTitle, playListTitle); - } catch (NoPlayListFoundException | NoElementFoundException ex) { - System.out.println(ex.getMessage()); - } - - System.out.println("Type y to add a new one, n to end"); - choice = scan.nextLine(); - } - System.out.println("Playlist created!"); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case '-': - //delete a playlist - System.out.println("Delete an existing playlist. Available playlists:"); - Iterator itp = theHub.playlists(); - while (itp.hasNext()) { - PlayList p = itp.next(); - System.out.println(p.getTitle()); - } - String plTitle = scan.nextLine(); - try { - theHub.deletePlayList(plTitle); - } catch (NoPlayListFoundException ex) { - System.out.println(ex.getMessage()); - } - System.out.println("Playlist deleted!"); - printAvailableCommands(); - choice = scan.nextLine(); - break; - case 's': - //save elements, albums, playlists - theHub.saveElements(); - theHub.saveAlbums(); - theHub.savePlayLists(); - System.out.println("Elements, albums and playlists saved!"); - printAvailableCommands(); - choice = scan.nextLine(); - break; - default: - - break; - } - } - scan.close(); - } - - private static void printAvailableCommands() { - System.out.println("t: display the album titles, ordered by date"); - System.out.println("g: display songs of an album, ordered by genre"); - System.out.println("d: display songs of an album"); - System.out.println("u: display audiobooks ordered by author"); - System.out.println("c: add a new song"); - System.out.println("a: add a new album"); - System.out.println("+: add a song to an album"); - System.out.println("l: add a new audiobook"); - System.out.println("p: create a new playlist from existing songs and audio books"); - System.out.println("-: delete an existing playlist"); - System.out.println("s: save elements, albums, playlists"); - System.out.println("q: quit program"); - } -} \ No newline at end of file diff --git a/src/musichub/util/XMLHandler.java b/src/musichub/util/XMLHandler.java deleted file mode 100644 index 4b61842..0000000 --- a/src/musichub/util/XMLHandler.java +++ /dev/null @@ -1,74 +0,0 @@ -package musichub.util; - -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; -import org.xml.sax.SAXException; - -import javax.xml.parsers.DocumentBuilder; -import javax.xml.parsers.DocumentBuilderFactory; -import javax.xml.parsers.ParserConfigurationException; -import javax.xml.transform.Transformer; -import javax.xml.transform.TransformerException; -import javax.xml.transform.TransformerFactory; -import javax.xml.transform.dom.DOMSource; -import javax.xml.transform.stream.StreamResult; -import java.io.File; -import java.io.IOException; - - -public class XMLHandler { - TransformerFactory transformerFactory; - Transformer transformer; - DocumentBuilderFactory documentFactory; - DocumentBuilder documentBuilder; - - public XMLHandler() { - try { - transformerFactory = TransformerFactory.newInstance(); - transformer = transformerFactory.newTransformer(); - documentFactory = DocumentBuilderFactory.newInstance(); - documentBuilder = documentFactory.newDocumentBuilder(); - } catch (TransformerException | ParserConfigurationException tfe) { - tfe.printStackTrace(); - } - } - - public void createXMLFile(Document document, String filePath) { - try { - // create the xml file - //transform the DOM Object to an XML File - DOMSource domSource = new DOMSource(document); - StreamResult streamResult = new StreamResult(new File(filePath)); - - // If you use - // StreamResult result = new StreamResult(System.out); - // the output will be pushed to the standard output ... - // You can use that for debugging - - transformer.transform(domSource, streamResult); - - } catch (TransformerException tfe) { - tfe.printStackTrace(); - } - } - - public Document createXMLDocument() { - return documentBuilder.newDocument(); - } - - public NodeList parseXMLFile(String filePath) { - NodeList elementNodes = null; - try { - Document document = documentBuilder.parse(new File(filePath)); - Element root = document.getDocumentElement(); - - elementNodes = root.getChildNodes(); - } catch (SAXException | IOException e) { - e.printStackTrace(); - } - return elementNodes; - } - - -} \ No newline at end of file -- cgit v1.2.3 From 8e13dba6e1c39dd841d60fddc3c4060f9b4a4b85 Mon Sep 17 00:00:00 2001 From: Clyhtsuriva Date: Sat, 26 Jun 2021 13:32:26 +0200 Subject: Removed reduced pom and added the content of STZ-0001 with a switch modif. --- Song/Side_To_Side.wav | Bin 0 -> 43422962 bytes dependency-reduced-pom.xml | 67 --------------------- files/albums.xml | 2 + files/elements.xml | 6 +- pom.xml | 1 + src/main/java/musichub/business/AudioElement.java | 34 +++++++++++ src/main/java/musichub/business/MusicHub.java | 12 ++++ src/main/java/musichub/business/Song.java | 2 + src/main/java/musichub/main/Main.java | 12 +++- .../classes/musichub/business/AudioElement.class | Bin 3752 -> 5392 bytes target/classes/musichub/business/MusicHub.class | Bin 11031 -> 11543 bytes .../classes/musichub/business/SortByAuthor.class | Bin 901 -> 901 bytes target/classes/musichub/business/SortByDate.class | Bin 854 -> 854 bytes target/classes/musichub/business/SortByGenre.class | Bin 858 -> 858 bytes target/classes/musichub/main/Main.class | Bin 9390 -> 9840 bytes target/maven-archiver/pom.properties | 2 +- target/maven-javadoc-plugin-stale-data.txt | 38 ++++++------ target/original-spoteezer-0.1.0.jar | Bin 29836 -> 31130 bytes target/site/apidocs/allclasses-index.html | 2 +- target/site/apidocs/allpackages-index.html | 2 +- target/site/apidocs/help-doc.html | 2 +- target/site/apidocs/index-all.html | 6 +- target/site/apidocs/index.html | 2 +- target/site/apidocs/member-search-index.js | 2 +- target/site/apidocs/musichub/business/Album.html | 2 +- .../site/apidocs/musichub/business/AudioBook.html | 4 +- .../apidocs/musichub/business/AudioElement.html | 24 +++++++- .../site/apidocs/musichub/business/Category.html | 2 +- target/site/apidocs/musichub/business/Genre.html | 2 +- .../site/apidocs/musichub/business/Language.html | 2 +- .../site/apidocs/musichub/business/MusicHub.html | 36 ++++++++--- .../musichub/business/NoAlbumFoundException.html | 2 +- .../musichub/business/NoElementFoundException.html | 2 +- .../business/NoPlayListFoundException.html | 2 +- .../site/apidocs/musichub/business/PlayList.html | 2 +- target/site/apidocs/musichub/business/Song.html | 4 +- .../apidocs/musichub/business/class-use/Album.html | 2 +- .../musichub/business/class-use/AudioBook.html | 2 +- .../musichub/business/class-use/AudioElement.html | 12 +++- .../musichub/business/class-use/Category.html | 2 +- .../apidocs/musichub/business/class-use/Genre.html | 2 +- .../musichub/business/class-use/Language.html | 2 +- .../musichub/business/class-use/MusicHub.html | 2 +- .../business/class-use/NoAlbumFoundException.html | 6 +- .../class-use/NoElementFoundException.html | 2 +- .../class-use/NoPlayListFoundException.html | 2 +- .../musichub/business/class-use/PlayList.html | 2 +- .../apidocs/musichub/business/class-use/Song.html | 2 +- .../apidocs/musichub/business/package-summary.html | 2 +- .../apidocs/musichub/business/package-tree.html | 2 +- .../apidocs/musichub/business/package-use.html | 2 +- target/site/apidocs/musichub/main/Main.html | 13 +++- .../site/apidocs/musichub/main/class-use/Main.html | 2 +- .../apidocs/musichub/main/package-summary.html | 2 +- .../site/apidocs/musichub/main/package-tree.html | 2 +- target/site/apidocs/musichub/main/package-use.html | 2 +- target/site/apidocs/musichub/util/XMLHandler.html | 2 +- .../musichub/util/class-use/XMLHandler.html | 2 +- .../apidocs/musichub/util/package-summary.html | 2 +- .../site/apidocs/musichub/util/package-tree.html | 2 +- target/site/apidocs/musichub/util/package-use.html | 2 +- target/site/apidocs/overview-summary.html | 2 +- target/site/apidocs/overview-tree.html | 2 +- target/site/apidocs/serialized-form.html | 2 +- target/spoteezer-0.1.0.jar | Bin 365706 -> 367000 bytes 65 files changed, 208 insertions(+), 149 deletions(-) create mode 100644 Song/Side_To_Side.wav delete mode 100644 dependency-reduced-pom.xml (limited to 'src') diff --git a/Song/Side_To_Side.wav b/Song/Side_To_Side.wav new file mode 100644 index 0000000..3c874db Binary files /dev/null and b/Song/Side_To_Side.wav differ diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml deleted file mode 100644 index de729db..0000000 --- a/dependency-reduced-pom.xml +++ /dev/null @@ -1,67 +0,0 @@ - - - 4.0.0 - esiea.softwareengineering - spoteezer - 0.1.0 - - - - maven-shade-plugin - 3.2.4 - - - package - - shade - - - - - musichub.main.Main - - - - - - - - maven-surefire-plugin - 2.22.0 - - - org.jacoco - jacoco-maven-plugin - 0.8.7 - - - - prepare-agent - - - - report - test - - report - - - - - - maven-compiler-plugin - - 16 - 16 - - - - - - 16 - 16 - 16 - 16 - - diff --git a/files/albums.xml b/files/albums.xml index edfd610..edb2a94 100644 --- a/files/albums.xml +++ b/files/albums.xml @@ -12,6 +12,7 @@ b2ee0ca0-b5e2-4bc9-8fed-7932fb145f2f bbe99998-1be6-4a40-8bf0-6a7fce9087c9 66d277ca-cbc4-471c-a07e-082363375bcc + 44136020-dc80-4522-9b71-2b9aad5e3039 @@ -22,6 +23,7 @@ 1978-01-23 44136020-dc80-4522-9b71-2b9aad5e3039 + 66d277ca-cbc4-471c-a07e-082363375bcc \ No newline at end of file diff --git a/files/elements.xml b/files/elements.xml index 7fefc5f..553f228 100644 --- a/files/elements.xml +++ b/files/elements.xml @@ -9,11 +9,11 @@ pop - I Want to Hold your Hand - The Beatles + Side To Side + Ariana Grande 186 66d277ca-cbc4-471c-a07e-082363375bcc - i_want_to_hold_your_hand.mp3 + Song/Side_To_Side.wav rock diff --git a/pom.xml b/pom.xml index 821c1b6..7ebddc1 100644 --- a/pom.xml +++ b/pom.xml @@ -26,6 +26,7 @@ shade + false diff --git a/src/main/java/musichub/business/AudioElement.java b/src/main/java/musichub/business/AudioElement.java index e0a686b..0a51c16 100644 --- a/src/main/java/musichub/business/AudioElement.java +++ b/src/main/java/musichub/business/AudioElement.java @@ -3,6 +3,10 @@ package musichub.business; import org.w3c.dom.Document; import org.w3c.dom.Element; +import javax.sound.sampled.*; +import java.io.File; +import java.io.IOException; +import java.util.Scanner; import java.util.UUID; public abstract class AudioElement { @@ -85,4 +89,34 @@ public abstract class AudioElement { } + public void manageAudioElement() throws UnsupportedAudioFileException, IOException, LineUnavailableException { + + Scanner scanner = new Scanner(System.in); + + File file = new File(this.content); + AudioInputStream audioStream = AudioSystem.getAudioInputStream(file); + Clip clip = AudioSystem.getClip(); + clip.open(audioStream); + + String action = ""; + + while (!action.equals("Q")) { + System.out.println("P = Play \b S = Stop \b R = Reset \b Q = Quit"); + System.out.println("Enter your choice"); + action = scanner.next(); + action = action.toUpperCase(); + + switch (action) { + case "S", "Q" -> clip.stop(); + case "P" -> clip.start(); + case "R" -> clip.setMicrosecondPosition(0); + default -> System.out.println("try again"); + } + System.out.println("You stopped the Audio element"); + } + + clip.close(); + + } + } \ No newline at end of file diff --git a/src/main/java/musichub/business/MusicHub.java b/src/main/java/musichub/business/MusicHub.java index 38e2214..f289f1a 100644 --- a/src/main/java/musichub/business/MusicHub.java +++ b/src/main/java/musichub/business/MusicHub.java @@ -6,6 +6,9 @@ import org.w3c.dom.Element; import org.w3c.dom.Node; import org.w3c.dom.NodeList; +import javax.sound.sampled.LineUnavailableException; +import javax.sound.sampled.UnsupportedAudioFileException; +import java.io.IOException; import java.util.*; class SortByDate implements Comparator { @@ -326,4 +329,13 @@ public class MusicHub { } xmlHandler.createXMLFile(document, ELEMENTS_FILE_PATH); } + + public void getAudioElement(List audios, String elementTitle) throws NoAlbumFoundException, UnsupportedAudioFileException, IOException, LineUnavailableException { + for (AudioElement el : audios) { + if (el.getTitle().equalsIgnoreCase(elementTitle)) { + el.manageAudioElement(); + } + } + + } } \ No newline at end of file diff --git a/src/main/java/musichub/business/Song.java b/src/main/java/musichub/business/Song.java index 3e9011b..5d044a9 100644 --- a/src/main/java/musichub/business/Song.java +++ b/src/main/java/musichub/business/Song.java @@ -53,4 +53,6 @@ public class Song extends AudioElement { parentElement.appendChild(song); } + + } \ No newline at end of file diff --git a/src/main/java/musichub/main/Main.java b/src/main/java/musichub/main/Main.java index b72a95b..c820b5d 100644 --- a/src/main/java/musichub/main/Main.java +++ b/src/main/java/musichub/main/Main.java @@ -2,11 +2,15 @@ package musichub.main; import musichub.business.*; +import javax.sound.sampled.LineUnavailableException; +import javax.sound.sampled.UnsupportedAudioFileException; +import java.io.IOException; import java.util.Iterator; +import java.util.List; import java.util.Scanner; public class Main { - public static void main(String[] args) { + public static void main(String[] args) throws UnsupportedAudioFileException, IOException, LineUnavailableException { MusicHub theHub = new MusicHub(); @@ -41,7 +45,8 @@ public class Main { albumTitle = scan.nextLine(); try { - System.out.println(theHub.getAlbumSongsSortedByGenre(albumTitle)); + List songs = theHub.getAlbumSongsSortedByGenre(albumTitle); + System.out.println(songs); } catch (NoAlbumFoundException ex) { System.out.println("No album found with the requested title " + ex.getMessage()); } @@ -55,7 +60,10 @@ public class Main { albumTitle = scan.nextLine(); try { + List songs = theHub.getAlbumSongs(albumTitle); System.out.println(theHub.getAlbumSongs(albumTitle)); + String song = scan.nextLine(); + theHub.getAudioElement(songs, song); } catch (NoAlbumFoundException ex) { System.out.println("No album found with the requested title " + ex.getMessage()); } diff --git a/target/classes/musichub/business/AudioElement.class b/target/classes/musichub/business/AudioElement.class index ab20d50..3579513 100644 Binary files a/target/classes/musichub/business/AudioElement.class and b/target/classes/musichub/business/AudioElement.class differ diff --git a/target/classes/musichub/business/MusicHub.class b/target/classes/musichub/business/MusicHub.class index e1a0961..8b8b280 100644 Binary files a/target/classes/musichub/business/MusicHub.class and b/target/classes/musichub/business/MusicHub.class differ diff --git a/target/classes/musichub/business/SortByAuthor.class b/target/classes/musichub/business/SortByAuthor.class index fb8ee7a..ac4474a 100644 Binary files a/target/classes/musichub/business/SortByAuthor.class and b/target/classes/musichub/business/SortByAuthor.class differ diff --git a/target/classes/musichub/business/SortByDate.class b/target/classes/musichub/business/SortByDate.class index c52e870..6892059 100644 Binary files a/target/classes/musichub/business/SortByDate.class and b/target/classes/musichub/business/SortByDate.class differ diff --git a/target/classes/musichub/business/SortByGenre.class b/target/classes/musichub/business/SortByGenre.class index 2016012..7cabb3e 100644 Binary files a/target/classes/musichub/business/SortByGenre.class and b/target/classes/musichub/business/SortByGenre.class differ diff --git a/target/classes/musichub/main/Main.class b/target/classes/musichub/main/Main.class index 06c19ac..1e19601 100644 Binary files a/target/classes/musichub/main/Main.class and b/target/classes/musichub/main/Main.class differ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index 93fc220..1b408a6 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Sat Jun 26 12:55:18 CEST 2021 +#Sat Jun 26 13:25:26 CEST 2021 groupId=esiea.softwareengineering artifactId=spoteezer version=0.1.0 diff --git a/target/maven-javadoc-plugin-stale-data.txt b/target/maven-javadoc-plugin-stale-data.txt index 106bfed..c701b12 100644 --- a/target/maven-javadoc-plugin-stale-data.txt +++ b/target/maven-javadoc-plugin-stale-data.txt @@ -43,22 +43,22 @@ C:\Users\SoftA\.m2\repository\org\opentest4j\opentest4j\1.0.0\opentest4j-1.0.0.j C:\Users\SoftA\.m2\repository\org\junit\platform\junit-platform-commons\1.0.2\junit-platform-commons-1.0.2.jar = 1624015816770 C:\Users\SoftA\.m2\repository\org\junit\jupiter\junit-jupiter-engine\5.0.2\junit-jupiter-engine-5.0.2.jar = 1624015816790 C:\Users\SoftA\.m2\repository\org\junit\platform\junit-platform-engine\1.0.2\junit-platform-engine-1.0.2.jar = 1624015816783 -C:\Users\SoftA\Documents\spoteezer\src\main\java = 1624704746958 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allclasses-index.html = 1624704928892 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allpackages-index.html = 1624704928894 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\element-list = 1624704928806 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\help-doc.html = 1624704928918 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index-all.html = 1624704928914 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index.html = 1624704928876 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\jquery-ui.overrides.css = 1624704928938 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\member-search-index.js = 1624704928898 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\module-search-index.js = 1624704928895 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-summary.html = 1624704928916 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-tree.html = 1624704928873 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\package-search-index.js = 1624704928896 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\script.js = 1624704928921 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\search.js = 1624704928924 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\serialized-form.html = 1624704928827 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\stylesheet.css = 1624704928920 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\tag-search-index.js = 1624704928899 -C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\type-search-index.js = 1624704928897 \ No newline at end of file +C:\Users\SoftA\Documents\spoteezer\src\main\java = 1624705682872 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allclasses-index.html = 1624706731862 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\allpackages-index.html = 1624706731864 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\element-list = 1624706731767 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\help-doc.html = 1624706731890 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index-all.html = 1624706731885 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\index.html = 1624706731838 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\jquery-ui.overrides.css = 1624706731909 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\member-search-index.js = 1624706731868 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\module-search-index.js = 1624706731865 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-summary.html = 1624706731887 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\overview-tree.html = 1624706731835 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\package-search-index.js = 1624706731866 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\script.js = 1624706731894 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\search.js = 1624706731895 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\serialized-form.html = 1624706731788 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\stylesheet.css = 1624706731892 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\tag-search-index.js = 1624706731869 +C:\Users\SoftA\Documents\spoteezer\target\site\apidocs\type-search-index.js = 1624706731867 \ No newline at end of file diff --git a/target/original-spoteezer-0.1.0.jar b/target/original-spoteezer-0.1.0.jar index 28e38bb..b2c45cf 100644 Binary files a/target/original-spoteezer-0.1.0.jar and b/target/original-spoteezer-0.1.0.jar differ diff --git a/target/site/apidocs/allclasses-index.html b/target/site/apidocs/allclasses-index.html index fb49088..83bf57c 100644 --- a/target/site/apidocs/allclasses-index.html +++ b/target/site/apidocs/allclasses-index.html @@ -2,7 +2,7 @@ - + All Classes (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/allpackages-index.html b/target/site/apidocs/allpackages-index.html index 9c043ad..a9e8eb8 100644 --- a/target/site/apidocs/allpackages-index.html +++ b/target/site/apidocs/allpackages-index.html @@ -2,7 +2,7 @@ - + All Packages (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/help-doc.html b/target/site/apidocs/help-doc.html index e124b74..a2e0731 100644 --- a/target/site/apidocs/help-doc.html +++ b/target/site/apidocs/help-doc.html @@ -2,7 +2,7 @@ - + API Help (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/index-all.html b/target/site/apidocs/index-all.html index f91c9b3..cd292d0 100644 --- a/target/site/apidocs/index-all.html +++ b/target/site/apidocs/index-all.html @@ -2,7 +2,7 @@ - + Index (spoteezer 0.1.0 API) @@ -164,6 +164,8 @@ loadScripts(document, 'script');
 
getAudiobooksTitlesSortedByAuthor() - Method in class musichub.business.MusicHub
 
+
getAudioElement(List<AudioElement>, String) - Method in class musichub.business.MusicHub
+
 
getCategory() - Method in class musichub.business.AudioBook
 
getCategory() - Method in enum class musichub.business.Category
@@ -223,6 +225,8 @@ loadScripts(document, 'script');
 
Main() - Constructor for class musichub.main.Main
 
+
manageAudioElement() - Method in class musichub.business.AudioElement
+
 
MusicHub - Class in musichub.business
 
MusicHub() - Constructor for class musichub.business.MusicHub
diff --git a/target/site/apidocs/index.html b/target/site/apidocs/index.html index 7c966a1..87cf0ec 100644 --- a/target/site/apidocs/index.html +++ b/target/site/apidocs/index.html @@ -2,7 +2,7 @@ - + Overview (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/member-search-index.js b/target/site/apidocs/member-search-index.js index d356ad0..784449a 100644 --- a/target/site/apidocs/member-search-index.js +++ b/target/site/apidocs/member-search-index.js @@ -1 +1 @@ -memberSearchIndex = [{"p":"musichub.business","c":"MusicHub","l":"addAlbum(Album)","u":"addAlbum(musichub.business.Album)"},{"p":"musichub.business","c":"MusicHub","l":"addElement(AudioElement)","u":"addElement(musichub.business.AudioElement)"},{"p":"musichub.business","c":"PlayList","l":"addElement(UUID)","u":"addElement(java.util.UUID)"},{"p":"musichub.business","c":"MusicHub","l":"addElementToAlbum(String, String)","u":"addElementToAlbum(java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"addElementToPlayList(String, String)","u":"addElementToPlayList(java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"addPlaylist(PlayList)","u":"addPlaylist(musichub.business.PlayList)"},{"p":"musichub.business","c":"Album","l":"addSong(UUID)","u":"addSong(java.util.UUID)"},{"p":"musichub.business","c":"Album","l":"Album(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"Album","l":"Album(String, String, int, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String)"},{"p":"musichub.business","c":"Album","l":"Album(String, String, int, String, String, ArrayList)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.util.ArrayList)"},{"p":"musichub.business","c":"MusicHub","l":"ALBUMS_FILE_PATH"},{"p":"musichub.business","c":"MusicHub","l":"albums()"},{"p":"musichub.business","c":"AudioElement","l":"artist"},{"p":"musichub.business","c":"AudioBook","l":"AudioBook(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioBook","l":"AudioBook(String, String, int, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"AudioBook","l":"AudioBook(String, String, int, String, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"AudioElement","l":"AudioElement(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioElement","l":"AudioElement(String, String, int, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String)"},{"p":"musichub.business","c":"AudioElement","l":"AudioElement(String, String, int, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"Genre","l":"CLASSIC"},{"p":"musichub.business","c":"AudioElement","l":"content"},{"p":"musichub.util","c":"XMLHandler","l":"createXMLDocument()"},{"p":"musichub.business","c":"Album","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioBook","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioElement","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"PlayList","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"Song","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.util","c":"XMLHandler","l":"createXMLFile(Document, String)","u":"createXMLFile(org.w3c.dom.Document,java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"deletePlayList(String)","u":"deletePlayList(java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"DIR"},{"p":"musichub.business","c":"Category","l":"DOCUMENTARY"},{"p":"musichub.business","c":"MusicHub","l":"ELEMENTS_FILE_PATH"},{"p":"musichub.business","c":"MusicHub","l":"elements()"},{"p":"musichub.business","c":"Language","l":"ENGLISH"},{"p":"musichub.business","c":"Language","l":"FRENCH"},{"p":"musichub.business","c":"Language","l":"GERMAN"},{"p":"musichub.business","c":"MusicHub","l":"getAlbumSongs(String)","u":"getAlbumSongs(java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"getAlbumSongsSortedByGenre(String)","u":"getAlbumSongsSortedByGenre(java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"getAlbumsTitlesSortedByDate()"},{"p":"musichub.business","c":"AudioElement","l":"getArtist()"},{"p":"musichub.business","c":"MusicHub","l":"getAudiobooksTitlesSortedByAuthor()"},{"p":"musichub.business","c":"AudioBook","l":"getCategory()"},{"p":"musichub.business","c":"Category","l":"getCategory()"},{"p":"musichub.business","c":"Album","l":"getDate()"},{"p":"musichub.business","c":"PlayList","l":"getElements()"},{"p":"musichub.business","c":"Genre","l":"getGenre()"},{"p":"musichub.business","c":"Song","l":"getGenre()"},{"p":"musichub.business","c":"AudioBook","l":"getLanguage()"},{"p":"musichub.business","c":"Language","l":"getLanguage()"},{"p":"musichub.business","c":"Album","l":"getSongs()"},{"p":"musichub.business","c":"Album","l":"getSongsRandomly()"},{"p":"musichub.business","c":"Album","l":"getTitle()"},{"p":"musichub.business","c":"AudioElement","l":"getTitle()"},{"p":"musichub.business","c":"PlayList","l":"getTitle()"},{"p":"musichub.business","c":"AudioElement","l":"getUUID()"},{"p":"musichub.business","c":"Genre","l":"HIPHOP"},{"p":"musichub.business","c":"Language","l":"ITALIAN"},{"p":"musichub.business","c":"Genre","l":"JAZZ"},{"p":"musichub.business","c":"AudioElement","l":"lengthInSeconds"},{"p":"musichub.main","c":"Main","l":"Main()","u":"%3Cinit%3E()"},{"p":"musichub.main","c":"Main","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"musichub.business","c":"MusicHub","l":"MusicHub()","u":"%3Cinit%3E()"},{"p":"musichub.business","c":"NoAlbumFoundException","l":"NoAlbumFoundException(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"NoElementFoundException","l":"NoElementFoundException(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"NoPlayListFoundException","l":"NoPlayListFoundException(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"Category","l":"NOVEL"},{"p":"musichub.util","c":"XMLHandler","l":"parseXMLFile(String)","u":"parseXMLFile(java.lang.String)"},{"p":"musichub.business","c":"PlayList","l":"PlayList(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"PlayList","l":"PlayList(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"PlayList","l":"PlayList(String, String, ArrayList)","u":"%3Cinit%3E(java.lang.String,java.lang.String,java.util.ArrayList)"},{"p":"musichub.business","c":"MusicHub","l":"PLAYLISTS_FILE_PATH"},{"p":"musichub.business","c":"MusicHub","l":"playlists()"},{"p":"musichub.business","c":"Genre","l":"POP"},{"p":"musichub.business","c":"Genre","l":"RAP"},{"p":"musichub.business","c":"Genre","l":"ROCK"},{"p":"musichub.business","c":"MusicHub","l":"saveAlbums()"},{"p":"musichub.business","c":"MusicHub","l":"saveElements()"},{"p":"musichub.business","c":"MusicHub","l":"savePlayLists()"},{"p":"musichub.business","c":"AudioBook","l":"setCategory(String)","u":"setCategory(java.lang.String)"},{"p":"musichub.business","c":"Song","l":"setGenre(String)","u":"setGenre(java.lang.String)"},{"p":"musichub.business","c":"AudioBook","l":"setLanguage(String)","u":"setLanguage(java.lang.String)"},{"p":"musichub.business","c":"Song","l":"Song(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"Song","l":"Song(String, String, int, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"Song","l":"Song(String, String, int, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"Language","l":"SPANISH"},{"p":"musichub.business","c":"Category","l":"SPEECH"},{"p":"musichub.business","c":"Category","l":"THEATER"},{"p":"musichub.business","c":"AudioElement","l":"title"},{"p":"musichub.business","c":"AudioBook","l":"toString()"},{"p":"musichub.business","c":"AudioElement","l":"toString()"},{"p":"musichub.business","c":"Song","l":"toString()"},{"p":"musichub.business","c":"AudioElement","l":"uuid"},{"p":"musichub.business","c":"Category","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"musichub.business","c":"Genre","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"musichub.business","c":"Language","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"musichub.business","c":"Category","l":"values()"},{"p":"musichub.business","c":"Genre","l":"values()"},{"p":"musichub.business","c":"Language","l":"values()"},{"p":"musichub.util","c":"XMLHandler","l":"XMLHandler()","u":"%3Cinit%3E()"},{"p":"musichub.business","c":"Category","l":"YOUTH"}];updateSearchResults(); \ No newline at end of file +memberSearchIndex = [{"p":"musichub.business","c":"MusicHub","l":"addAlbum(Album)","u":"addAlbum(musichub.business.Album)"},{"p":"musichub.business","c":"MusicHub","l":"addElement(AudioElement)","u":"addElement(musichub.business.AudioElement)"},{"p":"musichub.business","c":"PlayList","l":"addElement(UUID)","u":"addElement(java.util.UUID)"},{"p":"musichub.business","c":"MusicHub","l":"addElementToAlbum(String, String)","u":"addElementToAlbum(java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"addElementToPlayList(String, String)","u":"addElementToPlayList(java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"addPlaylist(PlayList)","u":"addPlaylist(musichub.business.PlayList)"},{"p":"musichub.business","c":"Album","l":"addSong(UUID)","u":"addSong(java.util.UUID)"},{"p":"musichub.business","c":"Album","l":"Album(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"Album","l":"Album(String, String, int, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String)"},{"p":"musichub.business","c":"Album","l":"Album(String, String, int, String, String, ArrayList)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.util.ArrayList)"},{"p":"musichub.business","c":"MusicHub","l":"ALBUMS_FILE_PATH"},{"p":"musichub.business","c":"MusicHub","l":"albums()"},{"p":"musichub.business","c":"AudioElement","l":"artist"},{"p":"musichub.business","c":"AudioBook","l":"AudioBook(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioBook","l":"AudioBook(String, String, int, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"AudioBook","l":"AudioBook(String, String, int, String, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"AudioElement","l":"AudioElement(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioElement","l":"AudioElement(String, String, int, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String)"},{"p":"musichub.business","c":"AudioElement","l":"AudioElement(String, String, int, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"Genre","l":"CLASSIC"},{"p":"musichub.business","c":"AudioElement","l":"content"},{"p":"musichub.util","c":"XMLHandler","l":"createXMLDocument()"},{"p":"musichub.business","c":"Album","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioBook","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"AudioElement","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"PlayList","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.business","c":"Song","l":"createXMLElement(Document, Element)","u":"createXMLElement(org.w3c.dom.Document,org.w3c.dom.Element)"},{"p":"musichub.util","c":"XMLHandler","l":"createXMLFile(Document, String)","u":"createXMLFile(org.w3c.dom.Document,java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"deletePlayList(String)","u":"deletePlayList(java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"DIR"},{"p":"musichub.business","c":"Category","l":"DOCUMENTARY"},{"p":"musichub.business","c":"MusicHub","l":"ELEMENTS_FILE_PATH"},{"p":"musichub.business","c":"MusicHub","l":"elements()"},{"p":"musichub.business","c":"Language","l":"ENGLISH"},{"p":"musichub.business","c":"Language","l":"FRENCH"},{"p":"musichub.business","c":"Language","l":"GERMAN"},{"p":"musichub.business","c":"MusicHub","l":"getAlbumSongs(String)","u":"getAlbumSongs(java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"getAlbumSongsSortedByGenre(String)","u":"getAlbumSongsSortedByGenre(java.lang.String)"},{"p":"musichub.business","c":"MusicHub","l":"getAlbumsTitlesSortedByDate()"},{"p":"musichub.business","c":"AudioElement","l":"getArtist()"},{"p":"musichub.business","c":"MusicHub","l":"getAudiobooksTitlesSortedByAuthor()"},{"p":"musichub.business","c":"MusicHub","l":"getAudioElement(List, String)","u":"getAudioElement(java.util.List,java.lang.String)"},{"p":"musichub.business","c":"AudioBook","l":"getCategory()"},{"p":"musichub.business","c":"Category","l":"getCategory()"},{"p":"musichub.business","c":"Album","l":"getDate()"},{"p":"musichub.business","c":"PlayList","l":"getElements()"},{"p":"musichub.business","c":"Genre","l":"getGenre()"},{"p":"musichub.business","c":"Song","l":"getGenre()"},{"p":"musichub.business","c":"AudioBook","l":"getLanguage()"},{"p":"musichub.business","c":"Language","l":"getLanguage()"},{"p":"musichub.business","c":"Album","l":"getSongs()"},{"p":"musichub.business","c":"Album","l":"getSongsRandomly()"},{"p":"musichub.business","c":"Album","l":"getTitle()"},{"p":"musichub.business","c":"AudioElement","l":"getTitle()"},{"p":"musichub.business","c":"PlayList","l":"getTitle()"},{"p":"musichub.business","c":"AudioElement","l":"getUUID()"},{"p":"musichub.business","c":"Genre","l":"HIPHOP"},{"p":"musichub.business","c":"Language","l":"ITALIAN"},{"p":"musichub.business","c":"Genre","l":"JAZZ"},{"p":"musichub.business","c":"AudioElement","l":"lengthInSeconds"},{"p":"musichub.main","c":"Main","l":"Main()","u":"%3Cinit%3E()"},{"p":"musichub.main","c":"Main","l":"main(String[])","u":"main(java.lang.String[])"},{"p":"musichub.business","c":"AudioElement","l":"manageAudioElement()"},{"p":"musichub.business","c":"MusicHub","l":"MusicHub()","u":"%3Cinit%3E()"},{"p":"musichub.business","c":"NoAlbumFoundException","l":"NoAlbumFoundException(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"NoElementFoundException","l":"NoElementFoundException(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"NoPlayListFoundException","l":"NoPlayListFoundException(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"Category","l":"NOVEL"},{"p":"musichub.util","c":"XMLHandler","l":"parseXMLFile(String)","u":"parseXMLFile(java.lang.String)"},{"p":"musichub.business","c":"PlayList","l":"PlayList(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"PlayList","l":"PlayList(String)","u":"%3Cinit%3E(java.lang.String)"},{"p":"musichub.business","c":"PlayList","l":"PlayList(String, String, ArrayList)","u":"%3Cinit%3E(java.lang.String,java.lang.String,java.util.ArrayList)"},{"p":"musichub.business","c":"MusicHub","l":"PLAYLISTS_FILE_PATH"},{"p":"musichub.business","c":"MusicHub","l":"playlists()"},{"p":"musichub.business","c":"Genre","l":"POP"},{"p":"musichub.business","c":"Genre","l":"RAP"},{"p":"musichub.business","c":"Genre","l":"ROCK"},{"p":"musichub.business","c":"MusicHub","l":"saveAlbums()"},{"p":"musichub.business","c":"MusicHub","l":"saveElements()"},{"p":"musichub.business","c":"MusicHub","l":"savePlayLists()"},{"p":"musichub.business","c":"AudioBook","l":"setCategory(String)","u":"setCategory(java.lang.String)"},{"p":"musichub.business","c":"Song","l":"setGenre(String)","u":"setGenre(java.lang.String)"},{"p":"musichub.business","c":"AudioBook","l":"setLanguage(String)","u":"setLanguage(java.lang.String)"},{"p":"musichub.business","c":"Song","l":"Song(Element)","u":"%3Cinit%3E(org.w3c.dom.Element)"},{"p":"musichub.business","c":"Song","l":"Song(String, String, int, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"Song","l":"Song(String, String, int, String, String, String)","u":"%3Cinit%3E(java.lang.String,java.lang.String,int,java.lang.String,java.lang.String,java.lang.String)"},{"p":"musichub.business","c":"Language","l":"SPANISH"},{"p":"musichub.business","c":"Category","l":"SPEECH"},{"p":"musichub.business","c":"Category","l":"THEATER"},{"p":"musichub.business","c":"AudioElement","l":"title"},{"p":"musichub.business","c":"AudioBook","l":"toString()"},{"p":"musichub.business","c":"AudioElement","l":"toString()"},{"p":"musichub.business","c":"Song","l":"toString()"},{"p":"musichub.business","c":"AudioElement","l":"uuid"},{"p":"musichub.business","c":"Category","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"musichub.business","c":"Genre","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"musichub.business","c":"Language","l":"valueOf(String)","u":"valueOf(java.lang.String)"},{"p":"musichub.business","c":"Category","l":"values()"},{"p":"musichub.business","c":"Genre","l":"values()"},{"p":"musichub.business","c":"Language","l":"values()"},{"p":"musichub.util","c":"XMLHandler","l":"XMLHandler()","u":"%3Cinit%3E()"},{"p":"musichub.business","c":"Category","l":"YOUTH"}];updateSearchResults(); \ No newline at end of file diff --git a/target/site/apidocs/musichub/business/Album.html b/target/site/apidocs/musichub/business/Album.html index 3e67075..8d24dd6 100644 --- a/target/site/apidocs/musichub/business/Album.html +++ b/target/site/apidocs/musichub/business/Album.html @@ -2,7 +2,7 @@ - + Album (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/AudioBook.html b/target/site/apidocs/musichub/business/AudioBook.html index 48361da..0d8d9b5 100644 --- a/target/site/apidocs/musichub/business/AudioBook.html +++ b/target/site/apidocs/musichub/business/AudioBook.html @@ -2,7 +2,7 @@ - + AudioBook (spoteezer 0.1.0 API) @@ -159,7 +159,7 @@ loadScripts(document, 'script');

Methods inherited from class musichub.business.AudioElement

-getArtist, getTitle, getUUID
+getArtist, getTitle, getUUID, manageAudioElement

Methods inherited from class java.lang.Object

clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
diff --git a/target/site/apidocs/musichub/business/AudioElement.html b/target/site/apidocs/musichub/business/AudioElement.html index 89abaab..493874c 100644 --- a/target/site/apidocs/musichub/business/AudioElement.html +++ b/target/site/apidocs/musichub/business/AudioElement.html @@ -2,7 +2,7 @@ - + AudioElement (spoteezer 0.1.0 API) @@ -164,9 +164,12 @@ loadScripts(document, 'script');
 
- - +
void
+
 
+ + +
 
@@ -290,6 +293,21 @@ loadScripts(document, 'script'); Element parentElement) +
  • +
    +

    manageAudioElement

    +
    public void manageAudioElement() + throws UnsupportedAudioFileException, +IOException, +LineUnavailableException
    +
    +
    Throws:
    +
    UnsupportedAudioFileException
    +
    IOException
    +
    LineUnavailableException
    +
    +
    +
  • diff --git a/target/site/apidocs/musichub/business/Category.html b/target/site/apidocs/musichub/business/Category.html index 839a958..7748822 100644 --- a/target/site/apidocs/musichub/business/Category.html +++ b/target/site/apidocs/musichub/business/Category.html @@ -2,7 +2,7 @@ - + Category (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/Genre.html b/target/site/apidocs/musichub/business/Genre.html index 0b854bf..f943c15 100644 --- a/target/site/apidocs/musichub/business/Genre.html +++ b/target/site/apidocs/musichub/business/Genre.html @@ -2,7 +2,7 @@ - + Genre (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/Language.html b/target/site/apidocs/musichub/business/Language.html index 96488c5..3690e27 100644 --- a/target/site/apidocs/musichub/business/Language.html +++ b/target/site/apidocs/musichub/business/Language.html @@ -2,7 +2,7 @@ - + Language (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/MusicHub.html b/target/site/apidocs/musichub/business/MusicHub.html index 9c5266c..9ef7adf 100644 --- a/target/site/apidocs/musichub/business/MusicHub.html +++ b/target/site/apidocs/musichub/business/MusicHub.html @@ -2,7 +2,7 @@ - + MusicHub (spoteezer 0.1.0 API) @@ -171,18 +171,22 @@ loadScripts(document, 'script');
     
    - - +
    void
    +
    getAudioElement​(List<AudioElement> audios, + String elementTitle)
     
    -
    void
    - + +
     
    void
    - +
     
    void
    - +
     
    +
    void
    + +
     
    @@ -373,6 +377,24 @@ loadScripts(document, 'script');
    public void saveElements()
    +
  • +
    +

    getAudioElement

    +
    public void getAudioElement(List<AudioElement> audios, + String elementTitle) + throws NoAlbumFoundException, +UnsupportedAudioFileException, +IOException, +LineUnavailableException
    +
    +
    Throws:
    +
    NoAlbumFoundException
    +
    UnsupportedAudioFileException
    +
    IOException
    +
    LineUnavailableException
    +
    +
    +
  • diff --git a/target/site/apidocs/musichub/business/NoAlbumFoundException.html b/target/site/apidocs/musichub/business/NoAlbumFoundException.html index 5a480c3..0809462 100644 --- a/target/site/apidocs/musichub/business/NoAlbumFoundException.html +++ b/target/site/apidocs/musichub/business/NoAlbumFoundException.html @@ -2,7 +2,7 @@ - + NoAlbumFoundException (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/NoElementFoundException.html b/target/site/apidocs/musichub/business/NoElementFoundException.html index 704f5ce..81e9dce 100644 --- a/target/site/apidocs/musichub/business/NoElementFoundException.html +++ b/target/site/apidocs/musichub/business/NoElementFoundException.html @@ -2,7 +2,7 @@ - + NoElementFoundException (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/NoPlayListFoundException.html b/target/site/apidocs/musichub/business/NoPlayListFoundException.html index 9d832fc..6a2c7a3 100644 --- a/target/site/apidocs/musichub/business/NoPlayListFoundException.html +++ b/target/site/apidocs/musichub/business/NoPlayListFoundException.html @@ -2,7 +2,7 @@ - + NoPlayListFoundException (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/PlayList.html b/target/site/apidocs/musichub/business/PlayList.html index 80f0b18..c294b58 100644 --- a/target/site/apidocs/musichub/business/PlayList.html +++ b/target/site/apidocs/musichub/business/PlayList.html @@ -2,7 +2,7 @@ - + PlayList (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/Song.html b/target/site/apidocs/musichub/business/Song.html index 0a4f1fd..57e0fa5 100644 --- a/target/site/apidocs/musichub/business/Song.html +++ b/target/site/apidocs/musichub/business/Song.html @@ -2,7 +2,7 @@ - + Song (spoteezer 0.1.0 API) @@ -151,7 +151,7 @@ loadScripts(document, 'script');

    Methods inherited from class musichub.business.AudioElement

    -getArtist, getTitle, getUUID
    +getArtist, getTitle, getUUID, manageAudioElement

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    diff --git a/target/site/apidocs/musichub/business/class-use/Album.html b/target/site/apidocs/musichub/business/class-use/Album.html index c7a6a88..eeb9cfe 100644 --- a/target/site/apidocs/musichub/business/class-use/Album.html +++ b/target/site/apidocs/musichub/business/class-use/Album.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.Album (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/AudioBook.html b/target/site/apidocs/musichub/business/class-use/AudioBook.html index 83d738a..07abecb 100644 --- a/target/site/apidocs/musichub/business/class-use/AudioBook.html +++ b/target/site/apidocs/musichub/business/class-use/AudioBook.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.AudioBook (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/AudioElement.html b/target/site/apidocs/musichub/business/class-use/AudioElement.html index 1a553bf..a0c35cf 100644 --- a/target/site/apidocs/musichub/business/class-use/AudioElement.html +++ b/target/site/apidocs/musichub/business/class-use/AudioElement.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.AudioElement (spoteezer 0.1.0 API) @@ -99,6 +99,16 @@ loadScripts(document, 'script');
    MusicHub.addElement​(AudioElement element)
     
    +
    Method parameters in musichub.business with type arguments of type AudioElement
    +
    +
    Modifier and Type
    +
    Method
    +
    Description
    +
    void
    +
    MusicHub.getAudioElement​(List<AudioElement> audios, + String elementTitle)
    +
     
    +
    diff --git a/target/site/apidocs/musichub/business/class-use/Category.html b/target/site/apidocs/musichub/business/class-use/Category.html index 62d35c3..f916411 100644 --- a/target/site/apidocs/musichub/business/class-use/Category.html +++ b/target/site/apidocs/musichub/business/class-use/Category.html @@ -2,7 +2,7 @@ - + Uses of Enum Class musichub.business.Category (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/Genre.html b/target/site/apidocs/musichub/business/class-use/Genre.html index e87b8fb..a952ca6 100644 --- a/target/site/apidocs/musichub/business/class-use/Genre.html +++ b/target/site/apidocs/musichub/business/class-use/Genre.html @@ -2,7 +2,7 @@ - + Uses of Enum Class musichub.business.Genre (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/Language.html b/target/site/apidocs/musichub/business/class-use/Language.html index cf13a0c..6205bc4 100644 --- a/target/site/apidocs/musichub/business/class-use/Language.html +++ b/target/site/apidocs/musichub/business/class-use/Language.html @@ -2,7 +2,7 @@ - + Uses of Enum Class musichub.business.Language (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/MusicHub.html b/target/site/apidocs/musichub/business/class-use/MusicHub.html index 7ae64d9..8f239ba 100644 --- a/target/site/apidocs/musichub/business/class-use/MusicHub.html +++ b/target/site/apidocs/musichub/business/class-use/MusicHub.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.MusicHub (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/NoAlbumFoundException.html b/target/site/apidocs/musichub/business/class-use/NoAlbumFoundException.html index 165de5a..d948beb 100644 --- a/target/site/apidocs/musichub/business/class-use/NoAlbumFoundException.html +++ b/target/site/apidocs/musichub/business/class-use/NoAlbumFoundException.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.NoAlbumFoundException (spoteezer 0.1.0 API) @@ -81,6 +81,10 @@ loadScripts(document, 'script');
    MusicHub.getAlbumSongsSortedByGenre​(String albumTitle)
     
    +
    void
    +
    MusicHub.getAudioElement​(List<AudioElement> audios, + String elementTitle)
    +
     
    diff --git a/target/site/apidocs/musichub/business/class-use/NoElementFoundException.html b/target/site/apidocs/musichub/business/class-use/NoElementFoundException.html index b26799b..ae74b4d 100644 --- a/target/site/apidocs/musichub/business/class-use/NoElementFoundException.html +++ b/target/site/apidocs/musichub/business/class-use/NoElementFoundException.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.NoElementFoundException (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/NoPlayListFoundException.html b/target/site/apidocs/musichub/business/class-use/NoPlayListFoundException.html index 0ff787f..aab3251 100644 --- a/target/site/apidocs/musichub/business/class-use/NoPlayListFoundException.html +++ b/target/site/apidocs/musichub/business/class-use/NoPlayListFoundException.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.NoPlayListFoundException (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/PlayList.html b/target/site/apidocs/musichub/business/class-use/PlayList.html index f230f7f..4fdd1e0 100644 --- a/target/site/apidocs/musichub/business/class-use/PlayList.html +++ b/target/site/apidocs/musichub/business/class-use/PlayList.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.PlayList (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/class-use/Song.html b/target/site/apidocs/musichub/business/class-use/Song.html index 9d1c95e..92d62d4 100644 --- a/target/site/apidocs/musichub/business/class-use/Song.html +++ b/target/site/apidocs/musichub/business/class-use/Song.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.business.Song (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/package-summary.html b/target/site/apidocs/musichub/business/package-summary.html index 0df1343..b5af4ec 100644 --- a/target/site/apidocs/musichub/business/package-summary.html +++ b/target/site/apidocs/musichub/business/package-summary.html @@ -2,7 +2,7 @@ - + musichub.business (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/package-tree.html b/target/site/apidocs/musichub/business/package-tree.html index 8104cc3..f640a6b 100644 --- a/target/site/apidocs/musichub/business/package-tree.html +++ b/target/site/apidocs/musichub/business/package-tree.html @@ -2,7 +2,7 @@ - + musichub.business Class Hierarchy (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/business/package-use.html b/target/site/apidocs/musichub/business/package-use.html index a1cf6fb..7ed1edb 100644 --- a/target/site/apidocs/musichub/business/package-use.html +++ b/target/site/apidocs/musichub/business/package-use.html @@ -2,7 +2,7 @@ - + Uses of Package musichub.business (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/main/Main.html b/target/site/apidocs/musichub/main/Main.html index f0ef281..f8bfd28 100644 --- a/target/site/apidocs/musichub/main/Main.html +++ b/target/site/apidocs/musichub/main/Main.html @@ -2,7 +2,7 @@ - + Main (spoteezer 0.1.0 API) @@ -146,7 +146,16 @@ loadScripts(document, 'script');
  • main

    -
    public static void main(String[] args)
    +
    public static void main(String[] args) + throws UnsupportedAudioFileException, +IOException, +LineUnavailableException
    +
    +
    Throws:
    +
    UnsupportedAudioFileException
    +
    IOException
    +
    LineUnavailableException
    +
  • diff --git a/target/site/apidocs/musichub/main/class-use/Main.html b/target/site/apidocs/musichub/main/class-use/Main.html index 0af879d..6d45c1a 100644 --- a/target/site/apidocs/musichub/main/class-use/Main.html +++ b/target/site/apidocs/musichub/main/class-use/Main.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.main.Main (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/main/package-summary.html b/target/site/apidocs/musichub/main/package-summary.html index 4be4c16..350f1ec 100644 --- a/target/site/apidocs/musichub/main/package-summary.html +++ b/target/site/apidocs/musichub/main/package-summary.html @@ -2,7 +2,7 @@ - + musichub.main (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/main/package-tree.html b/target/site/apidocs/musichub/main/package-tree.html index 96aab23..8322e63 100644 --- a/target/site/apidocs/musichub/main/package-tree.html +++ b/target/site/apidocs/musichub/main/package-tree.html @@ -2,7 +2,7 @@ - + musichub.main Class Hierarchy (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/main/package-use.html b/target/site/apidocs/musichub/main/package-use.html index e22beef..698c432 100644 --- a/target/site/apidocs/musichub/main/package-use.html +++ b/target/site/apidocs/musichub/main/package-use.html @@ -2,7 +2,7 @@ - + Uses of Package musichub.main (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/util/XMLHandler.html b/target/site/apidocs/musichub/util/XMLHandler.html index 4b8d7ba..942ecac 100644 --- a/target/site/apidocs/musichub/util/XMLHandler.html +++ b/target/site/apidocs/musichub/util/XMLHandler.html @@ -2,7 +2,7 @@ - + XMLHandler (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/util/class-use/XMLHandler.html b/target/site/apidocs/musichub/util/class-use/XMLHandler.html index 7435f8d..f3cd47c 100644 --- a/target/site/apidocs/musichub/util/class-use/XMLHandler.html +++ b/target/site/apidocs/musichub/util/class-use/XMLHandler.html @@ -2,7 +2,7 @@ - + Uses of Class musichub.util.XMLHandler (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/util/package-summary.html b/target/site/apidocs/musichub/util/package-summary.html index b38851e..12cbd12 100644 --- a/target/site/apidocs/musichub/util/package-summary.html +++ b/target/site/apidocs/musichub/util/package-summary.html @@ -2,7 +2,7 @@ - + musichub.util (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/util/package-tree.html b/target/site/apidocs/musichub/util/package-tree.html index c4625b5..b987ff3 100644 --- a/target/site/apidocs/musichub/util/package-tree.html +++ b/target/site/apidocs/musichub/util/package-tree.html @@ -2,7 +2,7 @@ - + musichub.util Class Hierarchy (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/musichub/util/package-use.html b/target/site/apidocs/musichub/util/package-use.html index 471f563..cf30494 100644 --- a/target/site/apidocs/musichub/util/package-use.html +++ b/target/site/apidocs/musichub/util/package-use.html @@ -2,7 +2,7 @@ - + Uses of Package musichub.util (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/overview-summary.html b/target/site/apidocs/overview-summary.html index f15374c..0415e8e 100644 --- a/target/site/apidocs/overview-summary.html +++ b/target/site/apidocs/overview-summary.html @@ -2,7 +2,7 @@ - + spoteezer 0.1.0 API diff --git a/target/site/apidocs/overview-tree.html b/target/site/apidocs/overview-tree.html index cecf679..b53ddc6 100644 --- a/target/site/apidocs/overview-tree.html +++ b/target/site/apidocs/overview-tree.html @@ -2,7 +2,7 @@ - + Class Hierarchy (spoteezer 0.1.0 API) diff --git a/target/site/apidocs/serialized-form.html b/target/site/apidocs/serialized-form.html index d1ab954..de7162a 100644 --- a/target/site/apidocs/serialized-form.html +++ b/target/site/apidocs/serialized-form.html @@ -2,7 +2,7 @@ - + Serialized Form (spoteezer 0.1.0 API) diff --git a/target/spoteezer-0.1.0.jar b/target/spoteezer-0.1.0.jar index 3f4d90b..9f65573 100644 Binary files a/target/spoteezer-0.1.0.jar and b/target/spoteezer-0.1.0.jar differ -- cgit v1.2.3