Package com.tulskiy.musique.playlist

Examples of com.tulskiy.musique.playlist.Playlist


        Configuration config = Application.getInstance().getConfiguration();
       
        Iterator pConfs = config.configurationsAt(getPlaylistKey()).iterator();
        while (pConfs.hasNext()) {
            Playlist playlist = new Playlist();
            playlist.setColumns(new LinkedList<PlaylistColumn>());

            HierarchicalConfiguration pConf = (HierarchicalConfiguration) pConfs.next();
            playlist.setName(pConf.getString("name", "Default"));
            playlist.setGroupBy(pConf.getString("groupBy"));
            playlist.setLibraryView(pConf.getBoolean("isLibraryView", false));
           
            Iterator cConfs = pConf.configurationsAt("columns.column").iterator();
            while (cConfs.hasNext()) {
                PlaylistColumn column = new PlaylistColumn();

                HierarchicalConfiguration cConf = (HierarchicalConfiguration) cConfs.next();
                column.setName(cConf.getString("name"));
                column.setExpression(cConf.getString("expression"));
                column.setSize(cConf.getInt("size"));
                column.setAllign(cConf.getInt("alignment"));

                playlist.getColumns().add(column);
            }

            playlists.add(playlist);
        }
View Full Code Here


     */
    public static void setPlaylistsRaw(List<String> playlistsRaw) {
        List<Playlist> playlists = new LinkedList<Playlist>();

        for (String playlistRaw : playlistsRaw) {
            Playlist playlist = new Playlist(playlistRaw);
            playlist.setColumns(getColumns());
            playlists.add(playlist);
        }
       
        setPlaylists(playlists);
    }
View Full Code Here

    public static void setPlaylists(List<Playlist> playlists) {
        Configuration config = Application.getInstance().getConfiguration();

        config.clearTree(getPlaylistKey());
        for (int i = 0; i < playlists.size(); i++) {
            Playlist playlist = playlists.get(i);

            config.addProperty(getPlaylistKey() + "(-1)" + ".name", playlist.getName());
            config.addProperty(getPlaylistKey() + ".groupBy", playlist.getGroupBy());
            config.addProperty(getPlaylistKey() + ".isLibraryView", playlist.isLibraryView());

            for (int j = 0; j < playlist.getColumns().size(); j++) {
                PlaylistColumn column = playlist.getColumns().get(j);

                if (i == 0 && j == 0) {
                    config.addProperty(getPlaylistKey() + ".columns(-1).column(-1).name", column.getName());
                }
                else {
View Full Code Here

        this.fillEmpty = fillEmpty;
    }

    @Override
    protected Playlist doInBackground() throws Exception {
        Playlist newPlaylist = new Playlist();

        String str = search.toLowerCase().trim();
        String[] text = str.split("\\s+");
        if (!str.isEmpty() && text.length > 0) {
            for (int i = 0, playlistSize = playlist.size(); i < playlistSize; i++) {
                Track track = playlist.get(i);

                boolean hasText[] = new boolean[text.length];
                for (FieldKey field : fields) {
                    FieldValues values = track.getTrackData().getTagFieldValues(field);
                    if (values != null) {
                for (int k = 0; k < values.size(); k++) {
                  String value = values.get(k);
                        if (!Util.isEmpty(value)) {
                            value = value.toLowerCase();
                            String[] vals = value.split("\\s+");
                            for (String val : vals) {
                                for (int j = 0, textLength = text.length; j < textLength; j++) {
                                    String s = text[j];
                                    if (val.startsWith(s)) {
                                        hasText[j] = true;
                                    }
                                }
                            }
                        }
                    }
                    }
                }

                boolean toAdd = true;
                for (boolean b : hasText) {
                    toAdd &= b;
                }

                if (toAdd) {
                    newPlaylist.add(track);
                    viewToModelList.add(i);
                }
            }
        } else if (fillEmpty) {
            newPlaylist.addAll(playlist);
        }
        return newPlaylist;
    }
View Full Code Here

TOP

Related Classes of com.tulskiy.musique.playlist.Playlist

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.