kinyerakenneth / lastfm-java

Automatically exported from code.google.com/p/lastfm-java
BSD 2-Clause "Simplified" License
0 stars 0 forks source link

Cant' get tracks from an album and can't get album from tracks #54

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. call album.getTracks() and call track.getAlbum()

What is the expected output? What do you see instead?
Artist.getTopAlbums method returns a collection of albums of specified artist. 
when i invoke album.getTracks from that collection I got only null value

What version of the product are you using? On what operating system?
i'm using lastfm-java-0.1.2.jar running on Ubuntu 12.10

Please provide any additional information below.
I also tried the other way around by invoking Artist.getTopTracks. After 
getting a single track i invoke track.getAlbum() but this time i got a Null 
pointer exception

Original issue reported on code.google.com by peerana...@gmail.com on 1 Jul 2013 at 10:19

GoogleCodeExporter commented 9 years ago
Artist.getTopAlbums does not return a track listing for each album. Similarly, 
artist.getTopTracks does not return the album information for each track. 
Hence, Album#getTracks() or Track#getAlbum() will return null when using those 
services, respectively.

A track listing for albums is only returned on album.getInfo calls. Please 
refer to the official documentation to see what data is returned by what 
services:

http://www.last.fm/api/show/artist.getTopAlbums
http://www.last.fm/api/show/artist.getTopTracks
http://www.last.fm/api/show/album.getInfo

Original comment by jannikov...@gmail.com on 2 Jul 2013 at 3:17

GoogleCodeExporter commented 9 years ago
Hi 

I tried Album.getInfo(band.getName(), album.getName(), key);
it worked for the first three times.

Now i got this error message:

[Fatal Error] :1:1: Premature end of file.
Exception in thread "main" de.umass.lastfm.CallException: 
org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; Premature end of 
file.
    at de.umass.lastfm.Caller.call(Caller.java:268)
    at de.umass.lastfm.Caller.call(Caller.java:189)
    at de.umass.lastfm.Album.getInfo(Album.java:117)
    at de.umass.lastfm.Album.getInfo(Album.java:95)
    at lastfm.LastFM.main(LastFM.java:118)
Caused by: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 1; 
Premature end of file.
    at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:251)
    at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)
    at de.umass.lastfm.Caller.createResultFromInputStream(Caller.java:324)
    at de.umass.lastfm.Caller.call(Caller.java:256)
    ... 4 more
Java Result: 1

I think it's because of Caller.getInstance().setUserAgent(user)
when i removed it the same error appears

thanks in advance

Original comment by peerana...@gmail.com on 2 Jul 2013 at 10:02