Beispiel #1
0
 @Override
 protected Object doCall() throws DownloadFailedException {
   final String outputFilename =
       TokenReplacer.replaceAll(downloaders.getDownloadOutput(), getEpisode());
   final String outputTmpFileName = outputFilename + TMP;
   // delete to prevent resuming since most of the download can't resume
   final File outputFile = new File(outputFilename);
   // create download dir if doesn't exist
   if (outputFile.getParentFile() != null && !outputFile.getParentFile().exists()) {
     outputFile.getParentFile().mkdir();
   }
   if (outputFile.exists()) {
     if (!outputFile.delete()) {
       throw new TechnicalException("can't delete file " + outputFile.getAbsolutePath());
     }
   }
   download(outputTmpFileName);
   File file = new File(outputTmpFileName);
   if (!file.exists()) {
     file = findFileWithoutExtension(outputFilename);
   }
   try {
     Files.move(file.toPath(), new File(outputFilename).toPath());
   } catch (IOException e) {
     throw new TechnicalException(e);
   }
   return null;
 }
Beispiel #2
0
 @Override
 public String toString() {
   return "DL"
       + getEpisode()
       + " "
       + (provider == null ? "no provider" : provider.getName())
       + " "
       + downloaders.getDownloadOutput();
 }