Skip to content
Snippets Groups Projects
Commit a7158a79 authored by Francesco Andreuzzi's avatar Francesco Andreuzzi
Browse files

Support new audio formats

parent 68622e02
Branches
Tags
No related merge requests found
......@@ -16,7 +16,11 @@ public class tracks implements CommandAbstraction {
@Override
public String exec(ExecInfo info) {
List<String> names = info.player.getNames();
Tuils.addPrefix(names, " ");
if(names == null) {
return info.res.getString(R.string.output_musicfoldererror);
}
Tuils.addPrefix(names, Tuils.DOUBLE_SPACE);
Tuils.insertHeaders(names, false);
return Tuils.toPlanString(names);
}
......
......@@ -19,6 +19,8 @@ import ohi.andre.consolelauncher.tuils.broadcast.HeadsetBroadcast;
public class MusicManager implements OnCompletionListener {
public static final String[] MUSIC_EXTENSIONS = {".mp3", ".wav", ".ogg", ".flac"};
public static final boolean USE_SCROLL_COMPARE = true;
private File songFolder;
......@@ -45,6 +47,7 @@ public class MusicManager implements OnCompletionListener {
c.registerReceiver(headsetReceiver, new IntentFilter(Intent.ACTION_HEADSET_PLUG));
randomActive = Boolean.parseBoolean(preferencesManager.getValue(PreferencesManager.PLAY_RANDOM));
songFolder = new File(preferencesManager.getValue(PreferencesManager.SONGSFOLDER));
}
......@@ -60,14 +63,19 @@ public class MusicManager implements OnCompletionListener {
// return the path by complete name
public String getPath(String name) {
File file = new File(songFolder, name);
if (!file.exists())
if (!file.exists()) {
return null;
}
return file.getAbsolutePath();
}
// return names
public List<String> getNames() {
List<File> songs = Tuils.getSongsInFolder(songFolder);
if(songs == null) {
return null;
}
List<String> names = new ArrayList<>();
for (File file : songs)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment