Package gmusic.api.model

Examples of gmusic.api.model.Song


        {
            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)
            {
View Full Code Here


            {
                // retrieve the songValues as an Array for parsing to a Song
                // object
                final JsonArray values = songValues.getAsJsonArray();

                final Song s = new Song();
                s.setId(gson.fromJson(values.get(0), String.class));
                s.setTitle(gson.fromJson(values.get(1), String.class));
                s.setName(gson.fromJson(values.get(1), String.class));
                if (!Strings.isNullOrEmpty(gson.fromJson(values.get(2),
                        String.class)))
                {
                    s.setAlbumArtUrl("https:"
                            + gson.fromJson(values.get(2), String.class));
                }
                s.setArtist(gson.fromJson(values.get(3), String.class));
                s.setAlbum(gson.fromJson(values.get(4), String.class));
                s.setAlbumArtist(gson.fromJson(values.get(5), String.class));
                s.setGenre(gson.fromJson(values.get(11), String.class));
                s.setDurationMillis(gson.fromJson(values.get(13), Long.class));
                s.setType(gson.fromJson(values.get(16), Integer.class));
                s.setYear(gson.fromJson(values.get(18), Integer.class));
                s.setPlaycount(gson.fromJson(values.get(22), Integer.class));
                s.setRating(gson.fromJson(values.get(23), String.class));
                if (!Strings.isNullOrEmpty(gson.fromJson(values.get(24),
                        String.class)))
                {
                    s.setCreationDate(gson.fromJson(values.get(24), Float.class) / 1000);
                }
                if (!Strings.isNullOrEmpty(gson.fromJson(values.get(36),
                        String.class)))
                {
                    s.setUrl("https:"
                            + gson.fromJson(values.get(36), String.class));
                }

                chunkedCollection.add(s);
            }
View Full Code Here

        // then
        assertEquals(expectedSongListSize, songs.size());

        final List<Song> songList = Lists.newArrayList(songs.iterator());

        final Song song1 = songList.get(0);
        assertEquals(expectedSong1Title, song1.getTitle());
        assertEquals(expectedSong1Artist, song1.getArtist());
        assertEquals(expectedSong1Album, song1.getAlbum());
        assertEquals(expectedSong1Year, song1.getYear());

        final Song song2 = songList.get(1);
        assertEquals(expectedSong2Title, song2.getTitle());
        assertEquals(expectedSong2Artist, song2.getArtist());
        assertEquals(expectedSong2Album, song2.getAlbum());
        assertEquals(expectedSong2Year, song2.getYear());
    }
View Full Code Here

        final Collection<Song> songs = api.getAllSongs();

        // then
        assertEquals(expectedSongListSize, songs.size());

        final Song song = Lists.newArrayList(songs.iterator()).get(2);
        assertEquals(expectedSong3Title, song.getTitle());
        assertEquals(expectedSong3Artist, song.getArtist());
        assertEquals(expectedSong3Album, song.getAlbum());
        assertEquals(expectedSong3Year, song.getYear());
    }
View Full Code Here

        // then
        assertEquals(expectedSongListSize, songs.size());

        final List<Song> songList = Lists.newArrayList(songs.iterator());

        final Song song3 = songList.get(2);
        assertEquals(expectedSong3Title, song3.getTitle());
        assertEquals(expectedSong3Artist, song3.getArtist());
        assertEquals(expectedSong3Album, song3.getAlbum());
        assertEquals(expectedSong3Year, song3.getYear());

        final Song song5 = songList.get(4);
        assertEquals(expectedSong5Title, song5.getTitle());
        assertEquals(expectedSong5Artist, song5.getArtist());
        assertEquals(expectedSong5Album, song5.getAlbum());
        assertEquals(expectedSong5Year, song5.getYear());
    }
View Full Code Here

TOP

Related Classes of gmusic.api.model.Song

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.