forked from MapComplete/MapComplete
		
	Scripts: robustify image downloader
This commit is contained in:
		
							parent
							
								
									3f4410ff19
								
							
						
					
					
						commit
						e4b3ee0ce1
					
				
					 1 changed files with 3 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -10,6 +10,7 @@ import { Imgur } from "../Logic/ImageProviders/Imgur"
 | 
			
		|||
import { LicenseInfo } from "../Logic/ImageProviders/LicenseInfo"
 | 
			
		||||
import { Utils } from "../Utils"
 | 
			
		||||
import Constants from "../Models/Constants"
 | 
			
		||||
import {concat} from "svelte-preprocess/dist/modules/utils";
 | 
			
		||||
 | 
			
		||||
export default class GenerateImageAnalysis extends Script {
 | 
			
		||||
    constructor() {
 | 
			
		||||
| 
						 | 
				
			
			@ -213,8 +214,9 @@ export default class GenerateImageAnalysis extends Script {
 | 
			
		|||
            const speed = handled / runningTime
 | 
			
		||||
            const timeLeft = Math.round(itemsLeft * speed)
 | 
			
		||||
            try {
 | 
			
		||||
                const urls = url.split(/[;,]/)
 | 
			
		||||
                const downloadedStatus = await Promise.all(
 | 
			
		||||
                    url.split(";").map((url) => this.downloadImage(url.trim(), imagePath))
 | 
			
		||||
                    urls.map((url) => this.downloadImage(url.trim(), imagePath))
 | 
			
		||||
                )
 | 
			
		||||
 | 
			
		||||
                for (const b of downloadedStatus) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue