diff --git a/app/src/main/java/com/kabouzeid/gramophone/helper/M3UConstants.java b/app/src/main/java/com/kabouzeid/gramophone/helper/M3UConstants.java deleted file mode 100644 index a6c6124f..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/helper/M3UConstants.java +++ /dev/null @@ -1,8 +0,0 @@ -package com.kabouzeid.gramophone.helper; - -public interface M3UConstants { - String EXTENSION = "m3u"; - String HEADER = "#EXTM3U"; - String ENTRY = "#EXTINF:"; - String DURATION_SEPARATOR = ","; -} \ No newline at end of file diff --git a/app/src/main/java/com/kabouzeid/gramophone/helper/M3UWriter.java b/app/src/main/java/com/kabouzeid/gramophone/helper/M3UWriter.java deleted file mode 100644 index 2ac0b179..00000000 --- a/app/src/main/java/com/kabouzeid/gramophone/helper/M3UWriter.java +++ /dev/null @@ -1,46 +0,0 @@ -package com.kabouzeid.gramophone.helper; - -import android.content.Context; - -import com.kabouzeid.gramophone.loader.PlaylistSongLoader; -import com.kabouzeid.gramophone.model.Playlist; -import com.kabouzeid.gramophone.model.Song; -import com.kabouzeid.gramophone.model.playlist.AbsSmartPlaylist; - -import java.io.BufferedWriter; -import java.io.File; -import java.io.FileWriter; -import java.io.IOException; -import java.util.List; - -public class M3UWriter implements M3UConstants { - - public static File write(Context context, File dir, Playlist playlist) throws IOException { - if (!dir.exists()) //noinspection ResultOfMethodCallIgnored - dir.mkdirs(); - File file = new File(dir, playlist.name.concat("." + EXTENSION)); - - List songs; - if (playlist instanceof AbsSmartPlaylist) { - songs = ((AbsSmartPlaylist) playlist).getSongs(context); - } else { - songs = PlaylistSongLoader.getPlaylistSongList(context, playlist.id.hashCode()); - } - - if (songs.size() > 0) { - BufferedWriter bw = new BufferedWriter(new FileWriter(file)); - - bw.write(HEADER); - for (Song song : songs) { - bw.newLine(); - bw.write(ENTRY + song.duration + DURATION_SEPARATOR + song.artistName + " - " + song.title); - bw.newLine(); - bw.write(song.data); - } - - bw.close(); - } - - return file; - } -}