Package plugins.audioPlayer.javazoom.jlgui.player.amp.util

Examples of plugins.audioPlayer.javazoom.jlgui.player.amp.util.Config


     * @param filename
     * @return
     */
    protected boolean loadM3U(String filename)
    {
        Config config = Config.getInstance();
        _playlist = new Vector();
        boolean loaded = false;
        BufferedReader br = null;
        try
        {
            // Playlist from URL ? (http:, ftp:, file: ....)
            if (Config.startWithProtocol(filename))
            {
                br = new BufferedReader(new InputStreamReader((new URL(filename)).openStream()));
            }
            else
            {
                br = new BufferedReader(new FileReader(filename));
            }
            String line = null;
            String songName = null;
            String songFile = null;
            String songLength = null;
            while ((line = br.readLine()) != null)
            {
                if (line.trim().length() == 0) continue;
                if (line.startsWith("#"))
                {
                    if (line.toUpperCase().startsWith("#EXTINF"))
                    {
                        int indA = line.indexOf(",", 0);
                        if (indA != -1)
                        {
                            songName = line.substring(indA + 1, line.length());
                        }
                        int indB = line.indexOf(":", 0);
                        if (indB != -1)
                        {
                            if (indB < indA) songLength = (line.substring(indB + 1, indA)).trim();
                        }
                    }
                }
                else
                {
                    songFile = line;
                    if (songName == null) songName = songFile;
                    if (songLength == null) songLength = "-1";
                    PlaylistItem pli = null;
                    if (Config.startWithProtocol(songFile))
                    {
                        // URL.
                        pli = new PlaylistItem(songName, songFile, Long.parseLong(songLength), false);
                    }
                    else
                    {
                        // File.
                        File f = new File(songFile);
                        if (f.exists())
                        {
                            pli = new PlaylistItem(songName, songFile, Long.parseLong(songLength), true);
                        }
                        else
                        {
                            // Try relative path.
                            f = new File(config.getLastDir() + songFile);
                            if (f.exists())
                            {
                                pli = new PlaylistItem(songName, config.getLastDir() + songFile, Long.parseLong(songLength), true);
                            }
                            else
                            {
                                // Try optional M3U home.
                                if (M3UHome != null)
View Full Code Here


     * @param filename
     * @return
     */
    protected boolean loadPLS(String filename)
    {
        Config config = Config.getInstance();
        _playlist = new Vector();
        boolean loaded = false;
        BufferedReader br = null;
        try
        {
            // Playlist from URL ? (http:, ftp:, file: ....)
            if (Config.startWithProtocol(filename))
            {
                br = new BufferedReader(new InputStreamReader((new URL(filename)).openStream()));
            }
            else
            {
                br = new BufferedReader(new FileReader(filename));
            }
            String line = null;
            String songName = null;
            String songFile = null;
            String songLength = null;
            while ((line = br.readLine()) != null)
            {
                if (line.trim().length() == 0) continue;
                if ((line.toLowerCase().startsWith("file")))
                {
                    StringTokenizer st = new StringTokenizer(line, "=");
                    st.nextToken();
                    songFile = st.nextToken().trim();
                }
                else if ((line.toLowerCase().startsWith("title")))
                {
                    StringTokenizer st = new StringTokenizer(line, "=");
                    st.nextToken();
                    songName = st.nextToken().trim();
                }
                else if ((line.toLowerCase().startsWith("length")))
                {
                    StringTokenizer st = new StringTokenizer(line, "=");
                    st.nextToken();
                    songLength = st.nextToken().trim();
                }
                // New entry ?
                if (songFile != null)
                {
                    PlaylistItem pli = null;
                    if (songName == null) songName = songFile;
                    if (songLength == null) songLength = "-1";
                    if (Config.startWithProtocol(songFile))
                    {
                        // URL.
                        pli = new PlaylistItem(songName, songFile, Long.parseLong(songLength), false);
                    }
                    else
                    {
                        // File.
                        File f = new File(songFile);
                        if (f.exists())
                        {
                            pli = new PlaylistItem(songName, songFile, Long.parseLong(songLength), true);
                        }
                        else
                        {
                            // Try relative path.
                            f = new File(config.getLastDir() + songFile);
                            if (f.exists())
                            {
                                pli = new PlaylistItem(songName, config.getLastDir() + songFile, Long.parseLong(songLength), true);
                            }
                            else
                            {
                                // Try optional PLS home.
                                if (PLSHome != null)
View Full Code Here

    public PlaylistItem(String name, String location, long seconds, boolean isFile)
    {
        _name = name;
        _seconds = seconds;
        _isFile = isFile;
        Config config = Config.getInstance();
        if (config.getTaginfoPolicy().equals(Config.TAGINFO_POLICY_ALL))
        {
            // Read tag info for any File or URL. It could take time.
            setLocation(location, true);
        }
        else if (config.getTaginfoPolicy().equals(Config.TAGINFO_POLICY_FILE))
        {
            // Read tag info for any File only not for URL.
            if (_isFile) setLocation(location, true);
            else setLocation(location, false);
        }
View Full Code Here

    {
        if (ev.getSource() == close)
        {
            if (player != null)
            {
                Config config = player.getConfig();
                config.save();
            }
            dispose();
        }
    }
View Full Code Here

TOP

Related Classes of plugins.audioPlayer.javazoom.jlgui.player.amp.util.Config

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.