Download a process a filmliste from the web.

@param source     source url as string
@param listeFilme the list to read to
486092
private void processFromWeb(URL source, ListeFilme listeFilme) {
        Request.Builder builder = new Request.Builder().url(source);
        builder.addHeader("User-Agent", Config.getUserAgent());

        //our progress monitor callback
        InputStreamProgressMonitor monitor = new InputStreamProgressMonitor() {
            private int oldProgress = 0;

            @Override
            public void progress(long bytesRead, long size) {
                final int iProgress = (int) (bytesRead * 100 / size);
                if (iProgress != oldProgress) {
                    oldProgress = iProgress;
                    notifyProgress(source.toString(), iProgress);
                }
            }
        };

        try (Response response = MVHttpClient.getInstance().getHttpClient().newCall(builder.build()).execute();
             ResponseBody body = response.body()) {
            if (response.isSuccessful()) {
                try (InputStream input = new ProgressMonitorInputStream(body.byteStream(), body.contentLength(), monitor)) {
                    try (InputStream is = selectDecompressor(source.toString(), input);
                         JsonParser jp = new JsonFactory().createParser(is)) {
                        readData(jp, listeFilme);
                    }
                }
            }
        } catch (Exception ex) {
            Log.errorLog(945123641, ex, "FilmListe: " + source);
            listeFilme.clear();
        }
    }
1072571
public String createList(String sessionId, String name, String description) throws MovieDbException {
        return tmdbList.createList(sessionId, name, description);
    }
775599
private AFTPClient actionListDir() throws PageException, IOException {
	required("name", name);
	required("directory", directory);

	AFTPClient client = getClient();
	FTPFile[] files = client.listFiles(directory);
	if (files == null) files = new FTPFile[0];

	pageContext.setVariable(name, toQuery(files, "ftp", directory, client.getRemoteAddress().getHostName()));
	writeCfftp(client);
	return client;
    }
507376
public synchronized void filmeBeimSenderLaden(ListeFilme listeFilme) {
    initStart(listeFilme);
    // die mReader nach Prio starten
    mrStarten(0);
    if (!Config.getStop()) {
      // waren und wenn Suchlauf noch nicht abgebrochen weiter mit dem Rest
      mrWarten();
      mrStarten(1);
      allStarted = true;
    }
  }
744968
public static void copyResourceFile(String source, Path target) throws IOException {
        InputStream resource = FsCrawlerUtil.class.getResourceAsStream(source);
        FileUtils.copyInputStreamToFile(resource, target.toFile());
    }
1156686
public ListItem<MovieInfo> getList(String listId) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.ID, listId);

        URL url = new ApiUrl(apiKey, MethodBase.LIST).buildUrl(parameters);
        String webpage = httpTools.getRequest(url);

        try {
            return MAPPER.readValue(webpage, new TypeReference<ListItem<MovieInfo>>() {
            });
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to get list", url, ex);
        }
    }
111459
static ImmutableList<Source> listSources(OrganizationName organizationName) {
    try (SecurityCenterClient client = SecurityCenterClient.create()) {
      // Start setting up a request to list sources in an organization.
      // OrganizationName organizationName = OrganizationName.of(/*organizationId=*/"123234324");
      ListSourcesRequest.Builder request =
          ListSourcesRequest.newBuilder().setParent(organizationName.toString());

      // Call the API.
      ListSourcesPagedResponse response = client.listSources(request.build());

      // This creates one list for all sources.  If your organization has a large number of sources
      // this can cause out of memory issues.  You can process them batches by returning
      // the Iterable returned response.iterateAll() directly.
      ImmutableList<Source> results = ImmutableList.copyOf(response.iterateAll());
      System.out.println("Sources:");
      System.out.println(results);
      return results;
    } catch (IOException e) {
      throw new RuntimeException("Couldn't create client.", e);
    }
  }
1231767
public void process() {
    if (src == null && dest == null) {
      throw new IllegalArgumentException("Source and destination shouldn't be null together");
    }

    File destinationFile = null;
    try {
      destinationFile = getDestinationFile();
      ZipOutputStream out = null;
      ZipEntryOrInfoAdapter zipEntryAdapter = null;

      if (destinationFile.isFile()) {
        out = ZipFileUtil.createZipOutputStream(new BufferedOutputStream(new FileOutputStream(destinationFile)), charset);
        zipEntryAdapter = new ZipEntryOrInfoAdapter(new CopyingCallback(transformers, out, preserveTimestamps), null);
      }
      else { // directory
        zipEntryAdapter = new ZipEntryOrInfoAdapter(new UnpackingCallback(transformers, destinationFile), null);
      }
      try {
        processAllEntries(zipEntryAdapter);
      }
      finally {
        IOUtils.closeQuietly(out);
      }
        handleInPlaceActions(destinationFile);
    }
    catch (IOException e) {
      ZipExceptionUtil.rethrow(e);
    }
    finally {
      if (isInPlace()) {
        // destinationZip is a temporary file
        FileUtils.deleteQuietly(destinationFile);
      }
    }
  }
659889
def _download_movielens(dest_path):
    

    url = 'http://files.grouplens.org/datasets/movielens/ml-100k.zip'
    req = requests.get(url, stream=True)

    with open(dest_path, 'wb') as fd:
        for chunk in req.iter_content():
            fd.write(chunk)
599628
def process_files(self):
        
        from .files import VideoFile, ExtractedVideoThumbnailFile, WebVideoFile

        downloaded = super(VideoNode, self).process_files()

        try:
            # Extract thumbnail if one hasn't been provided and derive_thumbnail is set
            if self.generate_thumbnail and not self.has_thumbnail():
                videos = [f for f in self.files if isinstance(f, VideoFile) or isinstance(f, WebVideoFile)]
                assert len(videos) > 0 and videos[0].filename, "Cannot extract thumbnail (No videos found on node {0})".format(self.source_id)

                self.set_thumbnail(ExtractedVideoThumbnailFile(config.get_storage_path(videos[0].filename)))
                downloaded.append(self.thumbnail.get_filename())

        except AssertionError as ae:
            config.LOGGER.warning(ae)

        return downloaded
1018831
@Override
    public List<StringSource> createSources(String sourceFileName) {
        return Util.list(new StringSource(sourceFileName, source));
    }
380873
private StatusCode modifyMovieList(String sessionId, String listId, int movieId, MethodSub operation) throws MovieDbException {
        TmdbParameters parameters = new TmdbParameters();
        parameters.add(Param.SESSION_ID, sessionId);
        parameters.add(Param.ID, listId);

        String jsonBody = new PostTools()
                .add(PostBody.MEDIA_ID, movieId)
                .build();

        URL url = new ApiUrl(apiKey, MethodBase.LIST).subMethod(operation).buildUrl(parameters);
        String webpage = httpTools.postRequest(url, jsonBody);

        try {
            return MAPPER.readValue(webpage, StatusCode.class);
        } catch (IOException ex) {
            throw new MovieDbException(ApiExceptionType.MAPPING_FAILED, "Failed to remove item from list", url, ex);
        }
    }
243912
def download_as_text(name, filename):
    
    location = list(IPList.objects.filter(name))
    if location:
        iplist = location[0]
        return iplist.download(filename=filename, as_type='txt')
179736
def download(self, FILENAME=None):
        """"""
        resultFilename = None
        url = self.__url+'/services'                
        result = Util.retrieveJsonResponseFromServer(url)
        dataItems = result['data']
        for item in dataItems:
            plugin = Plugin(item)        
            result = plugin.getParameterByValue("fr.cnes.sitools.resources.order.DirectOrderResource")            
            if result == None:
                continue
            else:
                urlParameter = plugin.getParameterByType('PARAMETER_ATTACHMENT')
                urlPlugin = urlParameter.getValue()
                encodingParameter = plugin.getParameterByName('archiveType')
                encodingPlugin = encodingParameter.getValue()
                query = self.getQueries()
                query.setBaseUrl(self.__url + urlPlugin)
                url = query.getUrl()                
                (filename, header) = Util.urlretrieve('%s' % url, FILENAME)
                if FILENAME == None:
                    os.rename(filename, filename + "." + encodingPlugin)
                    resultFilename = filename + "." + encodingPlugin
                else:
                    os.rename(FILENAME, FILENAME + "." + encodingPlugin)
                    resultFilename = FILENAME + "." + encodingPlugin
                break
        return resultFilename
1243705
public Response download(String url, File destination, String... headers) throws IOException {
		try (Response resp = response(url, headers)) {
			if (resp.isSuccessful()) {
				try (BufferedSink sink = Okio.buffer(Okio.sink(destination))) {
					resp.body().source().readAll(sink);
				}
			}
			return resp;
		}
	}
943801
public static <E, S> List<E> copy(List<S> sourceList, Class<E> targetClass) {
        if (sourceList == null || sourceList.isEmpty()) {
            return Collections.emptyList();
        }
        List<E> list = new ArrayList<>(sourceList.size());

        if (!(sourceList instanceof ArrayList)) {
            sourceList = new ArrayList<>(sourceList);
        }

        for (S source : sourceList) {
            E e = copy(source, targetClass);
            if (e != null) {
                list.add(e);
            }
        }
        return list;
    }
190583
function processSourceFile(work_directory, file_path) {

    var path = create('fs.path', work_directory).combine(file_path),
        source = create('fs.filereader(utf8)', path).readSync();

    // replace /*#include filename.ext*/
    var result = source.replace(/\/\*#include \S+\*\//gm, function(line) {
        var include_file_path = /\/\*#include (\S+)\*\//.exec(line)[1];
        // list .js file
        watch_list.push(include_file_path);
        // recursively perform substitutions
        return processSourceFile(path.getParentPath().path, include_file_path);
    });

    return result;
}