Android Open Source - RadioRake M3u Handler






From Project

Back to project page RadioRake.

License

The source code is released under:

GNU General Public License

If you think the Android project RadioRake listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.asp.radiorake.filehandling;
//from ww w  . j a  v  a  2  s. c  o  m
import android.util.Log;

import com.asp.radiorake.RadioDetails;

import java.io.BufferedReader;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileReader;
import java.io.IOException;

public class M3uHandler extends FileHandler {

    private static final String M3UTAG = "com.asp.radiorake.filehandling.M3uHandler";

    public static RadioDetails parse(RadioDetails radioDetails, String basePath) {

        String m3uFile = getFile(radioDetails.getPlaylistUrl(), basePath);

        try {

            FileReader fileReader = new FileReader(m3uFile);
            BufferedReader bufferedReader = new BufferedReader(fileReader);

            String line;
            while ((line = bufferedReader.readLine()) != null) {
                if (!line.startsWith("#") && line.startsWith("http")) {
                    radioDetails.setStreamUrl(line);
                    Log.d(M3UTAG, ".m3u contained these details: " + line);
                }
            }
            bufferedReader.close();
            fileReader.close();

        } catch (FileNotFoundException e) {
            Log.e(M3UTAG, m3uFile + " cannot be found", e);
        } catch (IOException e) {
            Log.e(M3UTAG, m3uFile + " cannot be read", e);
        } finally {
            new File(m3uFile).delete();
        }

        return radioDetails;
    }
}




Java Source Code List

com.asp.radiorake.AddNewScheduledRecordingActivity.java
com.asp.radiorake.AlarmHelper.java
com.asp.radiorake.CallReceiver.java
com.asp.radiorake.ConfirmDetailsActivity.java
com.asp.radiorake.DatabaseHelper.java
com.asp.radiorake.DatePickerFragment.java
com.asp.radiorake.LastPlayedFile.java
com.asp.radiorake.ListScheduledRecordingsActivity.java
com.asp.radiorake.NotificationHelper.java
com.asp.radiorake.PlayerService.java
com.asp.radiorake.PlayingFile.java
com.asp.radiorake.RadioActivity.java
com.asp.radiorake.RadioApplication.java
com.asp.radiorake.RadioDetails.java
com.asp.radiorake.RebootBroadcastReceiver.java
com.asp.radiorake.RecordingsActivity.java
com.asp.radiorake.RecordioBaseActivity.java
com.asp.radiorake.RemoteControlReceiver.java
com.asp.radiorake.ScheduledRecordingsCursorAdaptor.java
com.asp.radiorake.TimePickerFragment.java
com.asp.radiorake.filehandling.FileHandler.java
com.asp.radiorake.filehandling.M3uHandler.java
com.asp.radiorake.filehandling.PlsHandler.java
com.asp.radiorake.recording.RecorderService.java
com.asp.radiorake.recording.RecordingBroadcastReceiver.java
com.asp.radiorake.utils.DateUtils.java
com.asp.radiorake.utils.StringUtils.java