fixed .webm download locatiion issue

This commit is contained in:
Christian Schabesberger 2016-09-27 21:33:26 +02:00
parent 920c169d55
commit f9ac199c1f
10 changed files with 32 additions and 43 deletions

View file

@ -4,7 +4,7 @@ public interface DownloadManager
{
int BLOCK_SIZE = 512 * 1024;
int startMission(String url, String name, int threads);
int startMission(String url, String name, boolean isAudio, int threads);
void resumeMission(int id);
void pauseMission(int id);
void deleteMission(int id);

View file

@ -31,11 +31,15 @@ public class DownloadManagerImpl implements DownloadManager
}
@Override
public int startMission(String url, String name, int threads) {
public int startMission(String url, String name, boolean isAudio, int threads) {
DownloadMission mission = new DownloadMission();
mission.url = url;
mission.name = name;
mission.location = NewPipeSettings.getDownloadPath(mContext, name);
if(isAudio) {
mission.location = NewPipeSettings.getAudioDownloadPath(mContext);
} else {
mission.location = NewPipeSettings.getVideoDownloadPath(mContext);
}
mission.timestamp = System.currentTimeMillis();
mission.threadCount = threads;
new Initializer(mContext, mission).start();

View file

@ -14,12 +14,12 @@ import android.os.Message;
import android.support.v4.app.NotificationCompat.Builder;
import android.util.Log;
import org.schabi.newpipe.download.DownloadActivity;
import org.schabi.newpipe.settings.NewPipeSettings;
import org.schabi.newpipe.R;
import us.shandian.giga.get.DownloadManager;
import us.shandian.giga.get.DownloadManagerImpl;
import us.shandian.giga.get.DownloadMission;
import org.schabi.newpipe.download.MainActivity;
import static org.schabi.newpipe.BuildConfig.DEBUG;
public class DownloadManagerService extends Service implements DownloadMission.MissionListener
@ -53,7 +53,7 @@ public class DownloadManagerService extends Service implements DownloadMission.M
Intent i = new Intent();
i.setAction(Intent.ACTION_MAIN);
i.setClass(this, MainActivity.class);
i.setClass(this, DownloadActivity.class);
Drawable icon = this.getResources().getDrawable(R.mipmap.ic_launcher);
@ -68,8 +68,8 @@ public class DownloadManagerService extends Service implements DownloadMission.M
PendingIntent.getActivity(
this,
0,
new Intent(this, MainActivity.class)
.setAction(MainActivity.INTENT_LIST),
new Intent(this, DownloadActivity.class)
.setAction(DownloadActivity.INTENT_LIST),
PendingIntent.FLAG_UPDATE_CURRENT
);

View file

@ -27,13 +27,8 @@ public class Utility
{
public static enum FileType {
APP,
VIDEO,
EXCEL,
WORD,
POWERPOINT,
MUSIC,
ARCHIVE,
UNKNOWN
}
@ -142,22 +137,11 @@ public class Utility
}
public static FileType getFileType(String file) {
if (file.endsWith(".apk")) {
return FileType.APP;
} else if (file.endsWith(".mp3") || file.endsWith(".wav") || file.endsWith(".flac") || file.endsWith(".m4a")) {
if (file.endsWith(".mp3") || file.endsWith(".wav") || file.endsWith(".flac") || file.endsWith(".m4a")) {
return FileType.MUSIC;
} else if (file.endsWith(".mp4") || file.endsWith(".mpeg") || file.endsWith(".rm") || file.endsWith(".rmvb")
|| file.endsWith(".flv") || file.endsWith(".webp") || file.endsWith(".webm")) {
return FileType.VIDEO;
} else if (file.endsWith(".doc") || file.endsWith(".docx")) {
return FileType.WORD;
} else if (file.endsWith(".xls") || file.endsWith(".xlsx")) {
return FileType.EXCEL;
} else if (file.endsWith(".ppt") || file.endsWith(".pptx")) {
return FileType.POWERPOINT;
} else if (file.endsWith(".zip") || file.endsWith(".rar") || file.endsWith(".7z") || file.endsWith(".gz")
|| file.endsWith("tar") || file.endsWith(".bz")) {
return FileType.ARCHIVE;
} else {
return FileType.UNKNOWN;
}