Skip to content

Commit

Permalink
clean init build
Browse files Browse the repository at this point in the history
  • Loading branch information
fscarponi committed Mar 10, 2021
1 parent f54f57c commit 9a7eb68
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 4 deletions.
32 changes: 32 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<h2>HtmlResource downloader</h2>

HtmlResource downloader is used for efficiently download massive amount of resources (files) from websites

<h2>warning:</h2>
<h3> App strategy is very aggressive, he recursively go deep into web structure, be sure to set parameter with cognition</h3>
<h5>
Al files are downloaded by a different coroutines whit the same http ktor client, it will cause a bandwidth saturation
</h5>
Usage:<br>
<ul>
<li>Clone Repo -> Distributable</li>
Actually you can build a distributable though gradle task!
<br> Application needs in the same dir a parameters.json file with parameters for start the task
<br> see DataStructure.kt/Parameters for json structure
<br><br>
<li>Clone Repo -> Run From IDE</li>
You can set parameters in main, and if there is not a parameters.json in the mail folder, it will be created!<br>
Remember to delete parameter.json if you want to reset them

</ul>
Output:<br>
<ul>
<li>all files will be downloaded in "outputFolder", without lose path structure
</li>
<li>all skip preference (see parameteres) will be attended</li>
<li>if some file throw some kind of error will be skipped and signed in skippedFile.csv, with relative error description</li>
<li>detailed and annoying infos are printed on console </li>

</ul>


8 changes: 4 additions & 4 deletions src/main/kotlin/Main.kt
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ suspend fun main() = coroutineScope {
runCatching {
withContext(Dispatchers.IO) {
val file = File("parameters.json")
if (file.exists()) file.delete()

file.createNewFile()
file.writeText(par.toJson())
if (!file.exists()) {
file.createNewFile()
file.writeText(par.toJson())
}
}
}
val startTime = Instant.now()
Expand Down

0 comments on commit 9a7eb68

Please sign in to comment.