Compare commits

..

19 Commits

Author SHA1 Message Date
a61211e24a
Merge pull request #185 from InsanusMokrassar/0.17.2
0.17.2
2023-09-10 14:28:43 +06:00
caa2fb9b58 update dependencies 2023-09-10 14:28:04 +06:00
915cb09e37 start 0.17.2 2023-09-10 14:24:04 +06:00
930523f69a
Merge pull request #180 from InsanusMokrassar/0.17.1
0.17.1
2023-07-16 21:45:27 +06:00
773415f579 update dependencies 2023-07-16 21:42:13 +06:00
21803cb321 start 0.17.1 2023-07-16 21:38:18 +06:00
c6643dbdbc
Merge pull request #174 from InsanusMokrassar/0.17.0
0.17.0
2023-06-18 13:43:03 +06:00
58beceebf1 update dependencies 2023-06-18 13:42:17 +06:00
0acf4a88f4 start 0.17.0 2023-06-18 13:39:16 +06:00
ed48b3e4aa
Merge pull request #165 from InsanusMokrassar/0.16.0
0.16.0 microutils
2023-05-11 16:26:04 +06:00
1ed123596c add microutils and support of native platforms 2023-05-11 16:24:38 +06:00
76a0dbdf27
Merge pull request #164 from InsanusMokrassar/0.16.0
0.16.0
2023-05-11 15:57:00 +06:00
33775f3304 start 0.16.0 2023-05-11 15:19:14 +06:00
f7ca2bda89
Merge pull request #160 from InsanusMokrassar/0.15.1
0.15.1
2023-03-03 00:05:46 +06:00
9efade9daf
Update gradle-wrapper.properties 2023-03-01 18:28:55 +06:00
e4d1ff7fa9
Update CHANGELOG.md 2023-03-01 18:28:25 +06:00
e0b5f5d410
Update libs.versions.toml 2023-03-01 18:27:59 +06:00
adec37b9e5
0.15.1 2023-03-01 18:25:16 +06:00
8e042c6399
Merge pull request #158 from InsanusMokrassar/0.15.0
0.15.0
2023-02-28 12:46:37 +06:00
13 changed files with 95 additions and 50 deletions

View File

@ -1,5 +1,41 @@
# SauceNaoAPI Changelog
## 0.17.2
* Versions:
* `Coroutines`: `1.7.3`
* `Ktor`: `2.3.4`
* `MicroUtils`: `0.19.9`
## 0.17.1
* Versions:
* `Coroutines`: `1.7.2`
* `Ktor`: `2.3.2`
* `MicroUtils`: `0.19.7`
## 0.17.0
* Versions:
* `Kotlin`: `1.8.22`
* `Serialization`: `1.5.1`
* `Ktor`: `2.3.1`
* `MicroUtils`: `0.19.2`
* `Klock`: `4.0.3`
## 0.16.0
Add `MicroUtils` as used micro utils
* Versions:
* `Kotlin`: `1.8.21`
* `Ktor`: `2.3.0`
## 0.15.1
* Versions:
* `Ktor`: `2.2.4`
## 0.15.0
* Versions:

View File

@ -28,11 +28,19 @@ repositories {
}
kotlin {
jvm()
jvm {
compilations.main {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
js(IR) {
browser()
nodejs()
}
linuxX64()
mingwX64()
sourceSets {
@ -44,6 +52,9 @@ kotlin {
api libs.kt.serialization
api libs.klock
api libs.ktor.client
api libs.microutils.common
api libs.microutils.ktor.common
api libs.microutils.mimetypes
}
}
commonTest {
@ -65,3 +76,8 @@ kotlin {
}
}
}
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

View File

@ -1,3 +1,3 @@
kotlin.code.style=official
library_version=0.15.0
library_version=0.17.2

View File

@ -1,11 +1,13 @@
[versions]
kt = "1.8.10"
kt-serialization = "1.5.0"
kt-coroutines = "1.6.4"
kt = "1.8.22"
kt-serialization = "1.5.1"
kt-coroutines = "1.7.3"
klock = "3.4.0"
ktor = "2.2.3"
klock = "4.0.3"
ktor = "2.3.4"
microutils = "0.19.9"
gh-release = "2.4.1"
@ -20,6 +22,10 @@ klock = { module = "com.soywiz.korlibs.klock:klock", version.ref = "klock" }
ktor-client = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
microutils-common = { module = "dev.inmo:micro_utils.common", version.ref = "microutils" }
microutils-ktor-common = { module = "dev.inmo:micro_utils.ktor.common", version.ref = "microutils" }
microutils-mimetypes = { module = "dev.inmo:micro_utils.mime_types", version.ref = "microutils" }
buildscript-kt-gradle = { module = "org.jetbrains.kotlin:kotlin-gradle-plugin", version.ref = "kt" }
buildscript-kt-serialization = { module = "org.jetbrains.kotlin:kotlin-serialization", version.ref = "kt" }
buildscript-gh-release = { module = "com.github.breadmoirai:github-release", version.ref = "gh-release" }

View File

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip

View File

@ -1,5 +1,7 @@
package dev.inmo.saucenaoapi
import dev.inmo.micro_utils.common.MPPFile
import dev.inmo.micro_utils.ktor.common.input
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsException
import dev.inmo.saucenaoapi.exceptions.sauceNaoAPIException
import dev.inmo.saucenaoapi.models.*
@ -189,7 +191,7 @@ data class SauceNaoAPI(
resultsCount: Int? = null,
minSimilarity: Float? = null
): SauceNaoAnswer = request(
file.input,
file.input(),
file.contentType,
resultsCount,
minSimilarity
@ -206,7 +208,7 @@ data class SauceNaoAPI(
resultsCount: Int? = null,
minSimilarity: Float? = null
): SauceNaoAnswer = requestByDBs(
file.input,
file.input(),
file.contentType,
db,
dbs,
@ -228,7 +230,7 @@ data class SauceNaoAPI(
resultsCount: Int? = null,
minSimilarity: Float? = null
): SauceNaoAnswer = requestByMasks(
file.input,
file.input(),
file.contentType,
mask,
excludedMask,

View File

@ -1,6 +1,6 @@
package dev.inmo.saucenaoapi.additional
import com.soywiz.klock.TimeSpan
import korlibs.time.TimeSpan
typealias AccountType = Int
const val defaultAccountType: AccountType = 1 // "basic"

View File

@ -1,6 +1,6 @@
package dev.inmo.saucenaoapi.exceptions
import com.soywiz.klock.TimeSpan
import korlibs.time.TimeSpan
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
import io.ktor.client.plugins.ClientRequestException

View File

@ -1,9 +1,26 @@
package dev.inmo.saucenaoapi.utils
import dev.inmo.micro_utils.common.MPPFile
import dev.inmo.micro_utils.common.filename
import dev.inmo.micro_utils.ktor.common.input
import dev.inmo.micro_utils.mime_types.KnownMimeTypes
import dev.inmo.micro_utils.mime_types.getMimeType
import io.ktor.http.ContentType
import io.ktor.utils.io.core.Input
expect class MPPFile
@Deprecated(
"MPPFile from microutils is preferable since 0.16.0",
ReplaceWith("MPPFile", "dev.inmo.micro_utils.common.MPPFile")
)
typealias MPPFile = MPPFile
expect val MPPFile.input: Input
expect val MPPFile.contentType: ContentType
@Deprecated(
"input() from microutils is preferable since 0.16.0",
ReplaceWith("this.input()", "dev.inmo.micro_utils.ktor.common.input")
)
val MPPFile.input: Input
get() = input()
val MPPFile.contentType: ContentType
get() = ContentType.parse(
getMimeType(stringWithExtension = filename.extension) ?.raw ?: KnownMimeTypes.Any.raw
)

View File

@ -1,6 +1,6 @@
package dev.inmo.saucenaoapi.utils
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsException

View File

@ -1,6 +1,6 @@
package dev.inmo.saucenaoapi.utils
import com.soywiz.klock.DateTime
import korlibs.time.DateTime
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
import kotlinx.coroutines.*

View File

@ -1,18 +0,0 @@
package dev.inmo.saucenaoapi.utils
import io.ktor.http.ContentType
import io.ktor.utils.io.core.ByteReadPacket
import io.ktor.utils.io.core.Input
import org.khronos.webgl.Int8Array
import org.w3c.files.File
import org.w3c.files.FileReaderSync
actual typealias MPPFile = File
actual val MPPFile.input: Input
get() {
val reader = FileReaderSync()
return ByteReadPacket(Int8Array(reader.readAsArrayBuffer(this)) as ByteArray)
}
actual val MPPFile.contentType: ContentType
get() = ContentType.parse(type)

View File

@ -1,14 +0,0 @@
package dev.inmo.saucenaoapi.utils
import io.ktor.http.ContentType
import io.ktor.utils.io.core.Input
import io.ktor.utils.io.streams.asInput
import java.io.File
import java.nio.file.Files
actual typealias MPPFile = File
actual val MPPFile.input: Input
get() = inputStream().asInput()
actual val MPPFile.contentType: ContentType
get() = ContentType.parse(Files.probeContentType(toPath()))