Examples of Song


Examples of Song

    private static void printAllSongs(){
        Collection songs = SongServices.getAllSongs().getAllSongs().values();
        System.out.println(songs.size() + " songs in collection.");

        Iterator it = songs.iterator();
        Song song;
        while (it.hasNext()){
            song = (Song)it.next();
            printSong(song);
        }
           
View Full Code Here

Examples of com.echonest.api.v4.Song

*/
public class DynamicPlaylistExample {

    public static void main(String[] args) throws EchoNestException, IOException {
        EchoNestAPI en = new EchoNestAPI();
        Song lastSong = null;
        en.setTraceSends(false);

        DynamicPlaylistParams params = new DynamicPlaylistParams();
        params.setType(PlaylistParams.PlaylistType.GENRE_RADIO);
        params.addGenre("dance pop");
        params.setMinEnergy(.6f);
        params.setMinDanceability(.6f);
        params.includeAudioSummary();
        DynamicPlaylistSession session = en.createDynamicPlaylist(params);


        boolean done = false;
        while (!done) {
            String keys = "nsfd+-";

            System.out.println();
            System.out.print("(n)ext (s)kip (f)av (d)one (+)faster (-)slower ->");

            int cv;
            do {
                cv = System.in.read();
            } while (keys.indexOf(cv) < 0);

            char c = (char) cv;

            // System.out.println("c " + c + " " + cv);

            if (c == 'd') {
                done = true;
            }

            if (c == 'f') {
                session.feedback(DynamicPlaylistSession.FeedbackType.favorite_song, "last");
            }

            if (c == 's') {
                session.feedback(DynamicPlaylistSession.FeedbackType.skip_song, "last");
            }

            if (c == 'n') {
                Playlist playlist = session.next();

                for (Song song : playlist.getSongs()) {
                    System.out.println(song.getTitle());
                    System.out.println(song.getArtistName());
                    System.out.printf("Dance: %f\n", song.getDanceability());
                    System.out.printf("Energy: %f\n", song.getEnergy());
                    System.out.printf("Tempo: %f\n", song.getTempo());
                    lastSong = song;
                }
            }

            if (c == '+') {
                if (lastSong != null) {
                    DynamicPlaylistSteerParams steerParams = new DynamicPlaylistSteerParams();
                    steerParams.addTargetValue(DynamicPlaylistSteerParams.SteeringParameter.tempo, (float) lastSong.getTempo() * 1.2f);
                    System.out.println("steer " + steerParams);
                    session.steer(steerParams);
                }
            }

            if (c == '-') {
                if (lastSong != null) {
                    DynamicPlaylistSteerParams steerParams = new DynamicPlaylistSteerParams();
                    steerParams.addTargetValue(DynamicPlaylistSteerParams.SteeringParameter.tempo, (float) lastSong.getTempo() * .8f);
                    System.out.println("steer " + steerParams);

                    session.steer(steerParams);
                }
            }
View Full Code Here

Examples of com.groovesquid.model.Song

        HashMap<String, Object>[] result = gson.fromJson(Grooveshark.sendRequest("albumGetAllSongs", new HashMap(){{
            put("albumID", album.getId());
        }}), AlbumResponse.class).getResult();

        for (HashMap<String, Object> hm : result) {
            songs.add(new Song(
                hm.get("SongID"),
                hm.get("Name"),
                hm.get("ArtistID"),
                hm.get("ArtistName"),
                hm.get("AlbumID"),
View Full Code Here

Examples of com.screenrunner.data.Song

    }
    return true;
  }
 
  public void songEditorSave() {
    Song s = ScreenRunner.songs.get(songEditorCurrentSong);
    songEditorDataToSong(s);
    s.saveAs(songEditorCurrentSong);
    setSongEditorModified(false);
    loadSong();
  }
View Full Code Here

Examples of datasoul.serviceitems.song.Song

        if(this.droppable){       
            try {
                Object obj = dtde.getTransferable().getTransferData(SerializableObject.serializableObjectFlavor);
                if (obj instanceof Song){
                    Song objclone = ((Song)obj).getClone();
                    ((ListTable)this.getModel()).addItem(objclone);
                }else{
                    ((ListTable)this.getModel()).addItem(obj);
                }
            } catch (UnsupportedFlavorException ex) {
View Full Code Here

Examples of datasoul.serviceitems.song.Song

       
        NodeList nodeList = nodeIn.getChildNodes();
        for (int i = 0; i < nodeList.getLength(); i++) {
            if (nodeList.item(i).getNodeType() == Node.ELEMENT_NODE) {
                if (nodeList.item(i).getNodeName().equals("Song")) {
                    Song song = new Song();
                    song.readObject(nodeList.item(i), zip);
                    this.addItem(song);
                } else if (nodeList.item(i).getNodeName().equals("TextServiceItem")) {
                    TextServiceItem tsi = new TextServiceItem();
                    tsi.readObject(nodeList.item(i), zip);
                    this.addItem(tsi);
View Full Code Here

Examples of datasoul.serviceitems.song.Song

            pbProgress.setMaximum(slt.getRowCount());
            for (int i=0; i<slt.getRowCount(); i++){
                Object o = slt.getServiceItem(i);
                pbProgress.setValue(i);
                if (o instanceof Song){
                    Song s = (Song) o;
                    r.setTemplate(s.getTemplate());
                    r.setTitle(s.getTitle());
                    r.setSongAuthor(s.getSongAuthor());
                    r.setSongSource(s.getSongSource());
                    r.setCopyright(s.getCopyright());
                    for (int k=0; k<s.getRowCount(); k++){
                        slideCount++;
                        r.setSlide(s.getSlideText(k));
                        if (k < s.getRowCount()-1){
                            r.setNextSlide(s.getSlideText(k+1));
                        }else{
                            r.setNextSlide("");
                        }
                        /* start rendering */
                        r.slideChange(-1);
View Full Code Here

Examples of datasoul.serviceitems.song.Song

            songFile = new File(path + File.separator + name + ".song");
        }


        // Create song object
        Song song = new Song();
        song.setTitle(name);
        song.setFilePath(songFile.getAbsolutePath());
        song.setTemplate(DisplayControlConfig.getInstance().getDefaultTemplateSong());

        // If needed, convert the file to ODP
        File processFile = officeFile;
        if (officeFile.getName().toLowerCase().endsWith("ppt") ||
                officeFile.getName().toLowerCase().endsWith("pptx")){
            OpenofficeHelper helper = new OpenofficeHelper();
            String convFile = helper.convertToODP(officeFile);
            processFile = new File(convFile);
            if (!processFile.exists()){
                throw new IOException(java.util.ResourceBundle.getBundle("datasoul/internationalize").getString("UNABLE TO CONVERT DOCUMENT: ")+officeFile.getName());
            }
            helper.dispose();
        }

        // Extract text from Office file
        StringBuffer sb = new StringBuffer();
        convertPresentationToText(processFile, sb);
        song.setText(sb.toString());

        // If needed, cleanup converted ODP file
        if (processFile != officeFile){
            processFile.delete();
        }

        // Write the file
        try{
            Node node = song.writeObject(null);
            Document doc = node.getOwnerDocument();
            doc.appendChild( node);                        // Add Root to Document
            FileOutputStream fos = new FileOutputStream(song.getFilePath());

            Source source = new DOMSource(doc);

            // Prepare the output file
            Result result = new StreamResult(fos);

            // Write the DOM document to the file
            Transformer xformer = TransformerFactory.newInstance().newTransformer();
            xformer.setOutputProperty(OutputKeys.INDENT, "yes");
            xformer.transform(source, result);

            fos.close();

        } catch(Exception e){
            ShowDialog.showWriteFileError(song.getFileName(), e);
        }

        // Update table
        AllSongsListTable.getInstance().addItem(song);
View Full Code Here

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

Examples of gmusic.api.model.Song

            {
                // 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
TOP
Copyright © 2018 www.massapi.com. 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.