From d75e47b3978489113c2918a33db0282da94d33e8 Mon Sep 17 00:00:00 2001 From: abe Date: Fri, 25 Oct 2024 13:41:47 +0100 Subject: [PATCH] add Constants file for shared configuration values --- src/main/kotlin/com/abmo/CliArguments.kt | 4 +++- src/main/kotlin/com/abmo/Constant.kt | 7 +++++++ src/main/kotlin/com/abmo/model/Config.kt | 3 ++- 3 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 src/main/kotlin/com/abmo/Constant.kt diff --git a/src/main/kotlin/com/abmo/CliArguments.kt b/src/main/kotlin/com/abmo/CliArguments.kt index f01c461..f843ef2 100644 --- a/src/main/kotlin/com/abmo/CliArguments.kt +++ b/src/main/kotlin/com/abmo/CliArguments.kt @@ -1,5 +1,7 @@ package com.abmo +import com.abmo.Constant.DEFAULT_CONCURRENT_DOWNLOAD_LIMIT + class CliArguments(private val args: Array) { fun getHeaders(): Map? { @@ -49,7 +51,7 @@ class CliArguments(private val args: Array) { } } - return 6 + return DEFAULT_CONCURRENT_DOWNLOAD_LIMIT } } \ No newline at end of file diff --git a/src/main/kotlin/com/abmo/Constant.kt b/src/main/kotlin/com/abmo/Constant.kt new file mode 100644 index 0000000..89e2500 --- /dev/null +++ b/src/main/kotlin/com/abmo/Constant.kt @@ -0,0 +1,7 @@ +package com.abmo + +object Constant { + + const val DEFAULT_CONCURRENT_DOWNLOAD_LIMIT = 6 + +} \ No newline at end of file diff --git a/src/main/kotlin/com/abmo/model/Config.kt b/src/main/kotlin/com/abmo/model/Config.kt index ccc9719..7d049ee 100644 --- a/src/main/kotlin/com/abmo/model/Config.kt +++ b/src/main/kotlin/com/abmo/model/Config.kt @@ -1,5 +1,6 @@ package com.abmo.model +import com.abmo.Constant.DEFAULT_CONCURRENT_DOWNLOAD_LIMIT import java.io.File data class Config( @@ -7,5 +8,5 @@ data class Config( val resolution: String, var outputFile: File?, val header: Map? = null, - val connections: Int = 6 + val connections: Int = DEFAULT_CONCURRENT_DOWNLOAD_LIMIT ) \ No newline at end of file