private ArrayList[] parseLibrary() {
        JSONParser jsonParser = new JSONParser();
        ArrayList<Song> songsArray = new ArrayList<Song>();
        TreeSet<Album> albums = new TreeSet<Album>();
        TreeSet<Artist> artistsSet = new TreeSet<Artist>();
        try {
            JSONObject result = (JSONObject) jsonParser.parse(this.json);
            JSONObject songs = (JSONObject) result.get("result");
            JSONArray songList = (JSONArray) songs.get("songs");
            int counter = 0;
            this.controller.setProgressBarMaximum(songList.size());
            for (Object song : songList) {
                JSONObject s = (JSONObject) song;
                JSONArray artists = (JSONArray) s.get("artist");
                String artist;
                if (artists.size() > 0) artist = artists.get(0).toString();
                else artist = s.get("artist").toString();
                JSONArray artistsIdJa = (JSONArray) s.get("artistid");
                int artistId = 0;
                if (artistsIdJa != null
                        && artistsIdJa.size() > 0) artistId = Integer.parseInt(artistsIdJa.get(0).toString());

                int albumId = 0;
                if (!s.get("albumid").toString().equals("")) albumId = Integer.parseInt(s.get("albumid").toString());
                JSONArray genres = (JSONArray) s.get("genre");
                String genre;
                if (genres.size() > 0) genre = genres.get(0).toString();
                else genre = "";
                int track = 0;
                if (!s.get("track").toString().equals("")) track = Integer.parseInt(s.get("track").toString());
                Song song1 = new Song(
                        Integer.parseInt(s.get("songid").toString()),
                        track,
                        (s.get("label")).toString(),
                        Integer.parseInt((s.get("duration")).toString()),
                        (artist),
                        artistId,
                        (s.get("album")).toString(),
                        albumId,
                        (genre));
                songsArray.add(song1);
                publish(counter);
                counter++;

                Album album = new Album(song1.getAlbumId(), song1.getAlbum(), song1.getArtistId());
                albums.add(album);

                Artist artist1 = new Artist(song1.getArtistId(), song1.getArtist());
                artistsSet.add(artist1);

            }
        } catch (Exception e) {
            this.controller.setConnection(false);
            e.printStackTrace();
        }
        return new ArrayList[]{songsArray, new ArrayList(albums), new ArrayList(artistsSet)};
    }