1
0
mirror of https://github.com/TeamNewPipe/NewPipe/ synced 2024-12-27 09:23:19 +01:00

route video downloads to "Movies" and audio to "Music"

use the standard Android folders when downloading files.
This commit is contained in:
Hans-Christoph Steiner 2016-01-02 01:33:08 +01:00
parent ccdd13d136
commit d715eae0d1

View File

@ -61,21 +61,24 @@ public class DownloadDialog extends DialogFragment {
String suffix = "";
String title = arguments.getString(TITLE);
String url = "";
String downloadFolder = "Download";
switch(which) {
case 0: // Video
suffix = arguments.getString(FILE_SUFFIX_VIDEO);
url = arguments.getString(VIDEO_URL);
downloadFolder = "Movies";
break;
case 1:
suffix = arguments.getString(FILE_SUFFIX_AUDIO);
url = arguments.getString(AUDIO_URL);
downloadFolder = "Music";
break;
default:
Log.d(TAG, "lolz");
}
//to avoid hard-coded string like "/storage/emulated/0/Movies"
String downloadPath = prefs.getString(getString(R.string.downloadPathPreference),
Environment.getExternalStorageDirectory().getAbsolutePath() + "/Movies");
Environment.getExternalStorageDirectory().getAbsolutePath() + "/" + downloadFolder);
final File dir = new File(downloadPath);
if(!dir.exists()) {
boolean mkdir = dir.mkdir(); //attempt to create directory