static Album albumFromElement(DomElement element, String artistName) { if (element == null) return null; Album album = new Album(null, null, artistName); MusicEntry.loadStandardInfo(album, element); if (element.hasChild("id")) { album.id = element.getChildText("id"); } if (element.hasChild("artist")) { album.artist = element.getChild("artist").getChildText("name"); if (album.artist == null) album.artist = element.getChildText("artist"); } if (element.hasChild("releasedate")) { try { album.releaseDate = RELEASE_DATE_FORMAT.parse(element.getChildText("releasedate")); } catch (ParseException e) { // uh oh } } if (element.hasChild("toptags")) { for (DomElement o : element.getChild("toptags").getChildren("tag")) { album.tags.add(o.getChildText("name")); } } return album; }
/** {@inheritDoc} */ @Override public Artist createItemFromElement(final DomElement element) { if (element == null) { return null; } final Artist artist = new Artist(null, null); MusicEntry.loadStandardInfo(artist, element); return artist; }
/** {@inheritDoc} */ @Override public Album createItemFromElement(final DomElement element) { if (element == null) { return null; } final Album album = new Album(null, null, null); MusicEntry.loadStandardInfo(album, element); if (element.hasChild("artist")) { album.artist = element.getChild("artist").getChildText("name"); if (album.artist == null) { album.artist = element.getChildText("artist"); } } return album; }