artist wiki working

This commit is contained in:
aj 2018-03-29 14:18:49 -07:00
parent caa408aadd
commit bf7f7dcf2d
3 changed files with 11 additions and 7 deletions

View File

@ -40,7 +40,7 @@ public class WikiView extends JFrame {
super(name); super(name);
setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
setLayout(new GridLayout(1,1)); setLayout(new GridLayout(1,1));
setSize(400, 500); setSize(500, 700);
// setResizable(false); // setResizable(false);
// buttons.setLayout(new FlowLayout()); // buttons.setLayout(new FlowLayout());

View File

@ -9,8 +9,8 @@ import sarsoo.fmframework.net.TestCall;
import sarsoo.fmframework.parser.Parser; import sarsoo.fmframework.parser.Parser;
public class Artist extends FMObj{ public class Artist extends FMObj{
protected boolean streamable; // protected boolean streamable;
protected boolean onTour; // protected boolean onTour;
protected ArrayList<Album> albums; protected ArrayList<Album> albums;
protected ArrayList<Artist> similarArtists; protected ArrayList<Artist> similarArtists;
protected ArrayList<Tag> tagList; protected ArrayList<Tag> tagList;
@ -19,13 +19,13 @@ public class Artist extends FMObj{
super(name, null, null, 0, 0, 0, null); super(name, null, null, 0, 0, 0, null);
} }
public Artist(String name, String url, String mbid, int listeners, int playCount, int userPlayCount, boolean streamable, boolean onTour, Wiki wiki) { public Artist(String name, String url, String mbid, int listeners, int playCount, int userPlayCount, Wiki wiki) {
super(name, url, mbid, listeners, playCount, userPlayCount, wiki); super(name, url, mbid, listeners, playCount, userPlayCount, wiki);
} }
public static Artist getArtist(String name, String username) { public static Artist getArtist(String name, String username) {
String url = Network.getArtistInfoUrl(name, username); String url = Network.getArtistInfoUrl(name, username);
TestCall.test(url); // TestCall.test(url);
Document response = Network.getResponse(url); Document response = Network.getResponse(url);
Artist artist = Parser.parseArtist(response); Artist artist = Parser.parseArtist(response);
return artist; return artist;

View File

@ -112,19 +112,23 @@ public class Parser {
Node node; Node node;
for (counter = 0; counter < wikiContents.getLength(); counter++) { for (counter = 0; counter < wikiContents.getLength(); counter++) {
node = wikiContents.item(counter); node = wikiContents.item(counter);
System.out.println(node.getNodeName() + node.getTextContent());
if (node.getNodeName().equals("published")) { if (node.getNodeName().equals("published")) {
System.out.println(node.getNodeName() + node.getTextContent());
date = node.getTextContent(); date = node.getTextContent();
} }
if (node.getNodeName().equals("summary")) { if (node.getNodeName().equals("summary")) {
System.out.println(node.getNodeName() + node.getTextContent());
summary = node.getTextContent(); summary = node.getTextContent();
} }
if (node.getNodeName().equals("content")) { if (node.getNodeName().equals("content")) {
System.out.println(node.getNodeName() + node.getTextContent());
content = node.getTextContent(); content = node.getTextContent();
} }
} }
if (date != null && content != null) if (date != null && content != null)
System.out.println("wiki init");
wiki = new Wiki(date, summary, content); wiki = new Wiki(date, summary, content);
// if (wikiNodeList.item(0) != null) { // if (wikiNodeList.item(0) != null) {
// String date = wikiNodeList.item(0).getFirstChild().getTextContent(); // String date = wikiNodeList.item(0).getFirstChild().getTextContent();
@ -147,7 +151,7 @@ public class Parser {
// } // }
} }
Artist artist = new Artist(name, url, mbid, listeners, playCount, userPlayCount, false, false, null); Artist artist = new Artist(name, url, mbid, listeners, playCount, userPlayCount, wiki);
return artist; return artist;
} }
return null; return null;