public static void main(String args[])
{
String password = "";
String username = "";
System.out.println(Calendar.getInstance().getTime());
IGoogleMusicAPI api = new GoogleMusicAPI();
// IGoogleMusicAPI api = new GoogleSkyJamAPI();
// GoogleSkyJamAPI api = new GoogleSkyJamAPI(new ApacheConnector(), new
// JSON(), new File("."));
// GoogleMusicAPI aa = new GoogleMusicAPI(new ApacheConnector(), new
// JSON(), new File("."));
try
{
new GoogleSkyJamAPI().login(username, password);
new GoogleMusicAPI().login(username, password);
} catch (Exception e)
{
e.printStackTrace();
}
try
{
api.login(username, password);
// QueryResponse response = api.search("Jane");
// api.downloadSongs(response.getResults().getSongs());
Song _song = new Song();
_song.setId("bc94ef2b-7d16-3815-b1cb-63fbef75b87c");
api.downloadSong(_song);
Playlists playlists = api.getAllPlaylists();
if (playlists.getMagicPlaylists() != null)
{
for (Playlist list : playlists.getMagicPlaylists())
{
System.out.println("--- " + list.getTitle() + " "
+ list.getPlaylistId() + " ---");
for (Song song : list.getPlaylist())
{
System.out.println(song.getName() + " "
+ song.getArtist());
}
}
}
Collection<Song> tracks = api.getAllSongs();
for (Song track : tracks)
{
if (track.getAlbumArtUrl() != null)
{
File track_f = api.downloadSong(track);
populateFileWithTuneTags(track_f, track);
break;
}
}
for (Playlist list : playlists.getPlaylists())
{
System.out.println("--- " + list.getTitle() + " "
+ list.getPlaylistId() + " ---");
for (Song song : list.getPlaylist())
{
System.out.println(song.getName() + " " + song.getArtist());
if (song.getAlbumArtUrl() != null)
{
File song_f = api.downloadSong(song);
populateFileWithTuneTags(song_f, song);
break;
}
}
}
Collection<Song> songs = api.getAllSongs();
api.downloadSong(songs.iterator().next());
// api.downloadSongs(songs);
} catch (Exception e)
{
e.printStackTrace();
}