throw new DownloadRetry("unable to download video, bad content");
}
target(dinfo);
Direct direct;
if (dinfo.multipart()) {
// multi part? overwrite.
direct = new DirectMultipart(dinfo, targetFile);
} else if (dinfo.getRange()) {
// range download? try to resume download from last
// position
if (targetFile.exists() && targetFile.length() != dinfo.getCount())
targetFile = null;
direct = new DirectRange(dinfo, targetFile);
} else {
// single download? overwrite file
direct = new DirectSingle(dinfo, targetFile);
}
direct.download(stop, new Runnable() {
@Override
public void run() {
switch (dinfo.getState()) {
case DOWNLOADING:
info.setState(States.DOWNLOADING);