mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2025-12-08 14:05:46 +00:00
Compare commits
58 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| d0c143dcd6 | |||
| 3ee0d0de7d | |||
| d04ee03043 | |||
| e173bd71e0 | |||
| 11aac1b581 | |||
| 4319c41e44 | |||
| dfd1ba807f | |||
| e926a5422d | |||
| d631d63490 | |||
| 60ae527dd0 | |||
| 05b8d7738f | |||
| b5ceff32bd | |||
| 64109735f8 | |||
| d4f902aefd | |||
| 2de15a54a1 | |||
| 036deeb318 | |||
| 4cc0223fbc | |||
| be292102aa | |||
| 9d473857be | |||
| 6ff3f76295 | |||
| 0ed1a8702b | |||
| c800a81a41 | |||
| 62ceae0066 | |||
| 8619d020f6 | |||
| affa06905e | |||
| cbe76b3d95 | |||
| 9f4feeccfc | |||
| 037074cef6 | |||
| dfe29296ab | |||
| ce1d185eff | |||
| a78611a27c | |||
| cba4b2ccdb | |||
| 6aabcca9d2 | |||
| 503c4226d7 | |||
| d82bff2563 | |||
| 8391e20dce | |||
| 67244683dd | |||
| 948dede0c8 | |||
| 6f171c5f6d | |||
| 6d85ccfffa | |||
| bce508a8c2 | |||
| 224f0a6cc0 | |||
| 61937ed209 | |||
| 8e861020d8 | |||
| c231b956b4 | |||
| c14df69ae1 | |||
| f55744a038 | |||
| f27c493771 | |||
| 7bc1e822fc | |||
| eb9456a233 | |||
| 8c8a02054d | |||
| f52eb2ad6e | |||
| 4fcdb6f728 | |||
| 18cdf4ffbe | |||
| 33d143ea12 | |||
| e0215dcf8f | |||
| ca4348b5f6 | |||
| 249cbba1f7 |
24
.github/workflows/build_and_publish.yml
vendored
Normal file
24
.github/workflows/build_and_publish.yml
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
name: Publish package to GitHub Packages
|
||||
on: [push]
|
||||
jobs:
|
||||
publishing:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Rewrite version
|
||||
run: |
|
||||
branch="`echo "${{ github.ref }}" | grep -o "[^/]*$"`"
|
||||
cat gradle.properties | sed -e "s/^library_version=\([0-9\.]*\)/library_version=\1-branch_$branch-build${{ github.run_number }}/" > gradle.properties.tmp
|
||||
rm gradle.properties
|
||||
mv gradle.properties.tmp gradle.properties
|
||||
- name: Build
|
||||
run: ./gradlew build
|
||||
- name: Publish
|
||||
run: ./gradlew publishAllPublicationsToGithubPackagesRepository --no-parallel -x signJsPublication -x signJvmPublication -x signKotlinMultiplatformPublication
|
||||
continue-on-error: true
|
||||
env:
|
||||
GITHUBPACKAGES_USER: ${{ github.actor }}
|
||||
GITHUBPACKAGES_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
|
||||
132
CHANGELOG.md
132
CHANGELOG.md
@@ -1,5 +1,97 @@
|
||||
# SauceNaoAPI Changelog
|
||||
|
||||
## 0.10.1
|
||||
|
||||
* Versions updates:
|
||||
* `Klock`: `2.6.2` -> `2.6.3`
|
||||
* `Ktor`: `1.6.7` -> `1.6.8`
|
||||
|
||||
## 0.10.0
|
||||
|
||||
Migration onto libs versions toml
|
||||
|
||||
## 0.9.1
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.5.30` -> `1.5.31`
|
||||
* `Klock`: `2.4.0` -> `2.4.2`
|
||||
* `Coroutines`: `1.5.1` -> `1.5.2`
|
||||
* Add several extensions to `ResultData`: `authors`, `froms`, `charactersList`, `titles`, `urls`
|
||||
|
||||
## 0.9.0
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.5.10` -> `1.5.30`
|
||||
* `Klock`: `2.1.2` -> `2.4.0`
|
||||
* `Ktor`: `1.5.4` -> `1.6.3`
|
||||
* `Serialization`: `1.2.1` -> `1.2.2`
|
||||
* `Coroutines`: `1.5.0` -> `1.5.1`
|
||||
|
||||
## 0.8.2
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.32` -> `1.5.10`
|
||||
* `Klock`: `2.0.7` -> `2.1.2`
|
||||
* `Ktor`: `1.5.3` -> `1.5.4`
|
||||
* `Serialization`: `1.1.0` -> `1.2.1`
|
||||
* `Coroutines`: `1.4.3` -> `1.5.0`
|
||||
|
||||
## 0.8.1
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.31` -> `1.4.32`
|
||||
* `Klock`: `2.0.6` -> `2.0.7`
|
||||
* `Ktor`: `1.5.2` -> `1.5.3`
|
||||
|
||||
## 0.8.0
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.21` -> `1.4.31`
|
||||
* `Klock`: `2.0.4` -> `2.0.6`
|
||||
* `Ktor`: `1.5.1` -> `1.5.2`
|
||||
* `Kotlin Serialisation`: `1.0.1` -> `1.1.0`
|
||||
* `Kotlin Coroutines`: `1.4.2` -> `1.4.3`
|
||||
|
||||
## 0.7.2
|
||||
|
||||
* Versions updates:
|
||||
* `Klock`: `2.0.2` -> `2.0.4`
|
||||
* `Ktor`: `1.5.0` -> `1.5.1`
|
||||
|
||||
## 0.7.1
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.20` -> `1.4.21`
|
||||
* `Klock`: `2.0.0` -> `2.0.2`
|
||||
* `Ktor`: `1.4.3` -> `1.5.0`
|
||||
|
||||
## 0.7.0
|
||||
|
||||
**BREAKING CHANGES: PACKAGE HAS BEEN CHANGED FROM `com.insanusmokrassar` to `dev.inmo`**
|
||||
|
||||
Migration:
|
||||
|
||||
* Packages in the whole project were changed `com.insanusmokrassar.SauceNaoAPI` -> `dev.inmo.saucenaoapi`
|
||||
* Change implementation in your gradle files: `implementation "com.insanusmokrassar:SauceNaoAPI:*"` ->
|
||||
`implementation "dev.inmo:saucenaoapi:*"`
|
||||
|
||||
## 0.6.2
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.10` -> `1.4.20`
|
||||
* `Kotlin Serialisation`: `1.0.0-RC2` -> `1.0.1`
|
||||
* `Kotlin Coroutines`: `1.3.9` -> `1.4.2`
|
||||
* `Klock`: `1.12.1` -> `2.0.0`
|
||||
* `Ktor`: `1.4.1` -> `1.4.3`
|
||||
|
||||
## 0.6.1
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.0` -> `1.4.10`
|
||||
* `Kotlin Serialisation`: `1.0.0-RC` -> `1.0.0-RC2`
|
||||
* `Klock`: `1.12.0` -> `1.12.1`
|
||||
* `Ktor`: `1.4.0` -> `1.4.1`
|
||||
|
||||
## 0.6.0
|
||||
|
||||
**MAIN PACKAGE WAS CHANGED: `com.github.insanusmokrassar` -> `com.insanusmokrassar`**
|
||||
@@ -12,31 +104,11 @@
|
||||
* `Klock`: `1.11.14` -> `1.12.0`
|
||||
* `Ktor`: `1.3.2` -> `1.4.0`
|
||||
|
||||
### 0.6.1
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.0` -> `1.4.10`
|
||||
* `Kotlin Serialisation`: `1.0.0-RC` -> `1.0.0-RC2`
|
||||
* `Klock`: `1.12.0` -> `1.12.1`
|
||||
* `Ktor`: `1.4.0` -> `1.4.1`
|
||||
|
||||
## 0.5.0
|
||||
|
||||
* Versions updates
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Update libraries versions
|
||||
* Kotlin `1.3.31` -> `1.3.50`
|
||||
* Coroutines `1.2.1` -> `1.3.2`
|
||||
* Serialization `0.11.0` -> `0.13.0`
|
||||
* Joda Time `2.10.1` -> `2.10.4`
|
||||
* Ktor `1.1.4` -> `1.2.5`
|
||||
* Now `SauceNaoAPI` is `Closeable`
|
||||
* Now `SauceNaoAPI` working with synchronous queue
|
||||
* `SauceNaoAPI` now will wait for some time when one of limits will be achieved
|
||||
|
||||
### 0.4.4
|
||||
## 0.4.4
|
||||
|
||||
* Uploading of file
|
||||
* Updates of versions
|
||||
@@ -44,15 +116,15 @@
|
||||
* `SauceNaoAPI` instances now can return `limitsState` object, which will contains `LimitsState` with currently known
|
||||
state of limits
|
||||
|
||||
### 0.4.3
|
||||
## 0.4.3
|
||||
|
||||
Hotfix for serializer of `SauceNaoAnswer`
|
||||
|
||||
### 0.4.2
|
||||
## 0.4.2
|
||||
|
||||
Hotfix for autostop for some time when there is no remaining quotas for requests
|
||||
|
||||
### 0.4.1 Managers experiments and row format in answer
|
||||
## 0.4.1 Managers experiments and row format in answer
|
||||
|
||||
* Add `TimeManager` - it will manage work with requests times
|
||||
* Add `RequestQuotaMagager` - it will manage quota for requests and call suspend
|
||||
@@ -61,6 +133,18 @@ if they will be over
|
||||
* Now `SauceNaoAnswer` have field `row` which contains `JsonObject` with
|
||||
all original answer fields
|
||||
|
||||
## 0.4.0
|
||||
|
||||
* Update libraries versions
|
||||
* Kotlin `1.3.31` -> `1.3.50`
|
||||
* Coroutines `1.2.1` -> `1.3.2`
|
||||
* Serialization `0.11.0` -> `0.13.0`
|
||||
* Joda Time `2.10.1` -> `2.10.4`
|
||||
* Ktor `1.1.4` -> `1.2.5`
|
||||
* Now `SauceNaoAPI` is `Closeable`
|
||||
* Now `SauceNaoAPI` working with synchronous queue
|
||||
* `SauceNaoAPI` now will wait for some time when one of limits will be achieved
|
||||
|
||||
## 0.3.0
|
||||
|
||||
* Now `results` field of `SauceNaoAnswer` is optional and is empty list by default
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# SauceNaoAPI
|
||||
|
||||
[](https://bintray.com/insanusmokrassar/InsanusMokrassar/SauceNaoAPI-mpp/_latestVersion)
|
||||
[](https://maven-badges.herokuapp.com/maven-central/dev.inmo/saucenaoapi)
|
||||
|
||||
|
||||
It is wrapper for [SauceNAO](https://saucenao.com/) API. For now, library is
|
||||
in preview state. It can be fully used, but some of info can be unavailable from
|
||||
@@ -11,7 +12,7 @@ wrapper classes, but now you can access them via `SauceNaoAnswer#row` field.
|
||||
### Gradle
|
||||
|
||||
```groovy
|
||||
implementation "com.insanusmokrassar:SauceNaoAPI:$saucenaoapi_version"
|
||||
implementation "dev.inmo:saucenaoapi:$saucenaoapi_version"
|
||||
```
|
||||
|
||||
## Requester
|
||||
|
||||
37
build.gradle
37
build.gradle
@@ -1,39 +1,35 @@
|
||||
buildscript {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version"
|
||||
classpath "com.github.breadmoirai:github-release:$gradle_github_release_plugin_version"
|
||||
classpath libs.buildscript.kt.gradle
|
||||
classpath libs.buildscript.kt.serialization
|
||||
classpath libs.buildscript.gh.release
|
||||
}
|
||||
}
|
||||
|
||||
plugins {
|
||||
id "org.jetbrains.kotlin.multiplatform" version "$kotlin_version"
|
||||
id "org.jetbrains.kotlin.plugin.serialization" version "$kotlin_version"
|
||||
alias(libs.plugins.multiplatform)
|
||||
alias(libs.plugins.serialization)
|
||||
}
|
||||
|
||||
project.version = "0.6.1"
|
||||
project.group = "com.insanusmokrassar"
|
||||
project.version = "$library_version"
|
||||
project.group = "dev.inmo"
|
||||
|
||||
apply from: "publish.gradle"
|
||||
apply from: "github_release.gradle"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js(BOTH) {
|
||||
js(IR) {
|
||||
browser()
|
||||
nodejs()
|
||||
}
|
||||
@@ -44,10 +40,10 @@ kotlin {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_runtime_version"
|
||||
api "com.soywiz.korlibs.klock:klock:$klock_version"
|
||||
api "io.ktor:ktor-client-core:$ktor_version"
|
||||
api libs.kt.coroutines
|
||||
api libs.kt.serialization
|
||||
api libs.klock
|
||||
api libs.ktor.client
|
||||
}
|
||||
}
|
||||
commonTest {
|
||||
@@ -56,18 +52,13 @@ kotlin {
|
||||
implementation kotlin('test-annotations-common')
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
}
|
||||
}
|
||||
jvmTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit')
|
||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
||||
implementation libs.ktor.client.okhttp
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
jsTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-js')
|
||||
}
|
||||
|
||||
@@ -2,7 +2,8 @@ private String getCurrentVersionChangelog() {
|
||||
OutputStream changelogDataOS = new ByteArrayOutputStream()
|
||||
exec {
|
||||
standardOutput = changelogDataOS
|
||||
commandLine './changelog_info_retriever', "$library_version", 'CHANGELOG.md'
|
||||
commandLine 'chmod', "+x", './changelog_parser.sh'
|
||||
commandLine './changelog_parser.sh', "$library_version", 'CHANGELOG.md'
|
||||
}
|
||||
|
||||
return changelogDataOS.toString().trim()
|
||||
@@ -18,9 +19,9 @@ if (new File(projectDir, "secret.gradle").exists()) {
|
||||
owner "InsanusMokrassar"
|
||||
repo "${rootProject.name}"
|
||||
|
||||
tagName "$library_version"
|
||||
releaseName "$library_version"
|
||||
targetCommitish "$library_version"
|
||||
tagName "${project.version}"
|
||||
releaseName "${project.version}"
|
||||
targetCommitish "${project.version}"
|
||||
|
||||
body getCurrentVersionChangelog()
|
||||
}
|
||||
|
||||
@@ -1,9 +1,3 @@
|
||||
kotlin.code.style=official
|
||||
kotlin_version=1.4.10
|
||||
kotlin_coroutines_version=1.3.9
|
||||
kotlin_serialisation_runtime_version=1.0.0-RC2
|
||||
klock_version=1.12.1
|
||||
ktor_version=1.4.1
|
||||
|
||||
gradle_github_release_plugin_version=2.2.12
|
||||
gradle_bintray_plugin_version=1.8.5
|
||||
library_version=0.10.1
|
||||
|
||||
30
gradle/libs.versions.toml
Normal file
30
gradle/libs.versions.toml
Normal file
@@ -0,0 +1,30 @@
|
||||
[versions]
|
||||
|
||||
kt = "1.6.10"
|
||||
kt-serialization = "1.3.2"
|
||||
kt-coroutines = "1.6.0"
|
||||
|
||||
klock = "2.6.3"
|
||||
ktor = "1.6.8"
|
||||
|
||||
gh-release = "2.2.12"
|
||||
|
||||
[libraries]
|
||||
|
||||
kt-stdlib = { module = "org.jetbrains.kotlin:kotlin-stdlib", version.ref = "kt" }
|
||||
kt-serialization = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kt-serialization" }
|
||||
kt-coroutines = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kt-coroutines" }
|
||||
|
||||
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" }
|
||||
|
||||
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" }
|
||||
|
||||
[plugins]
|
||||
|
||||
multiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kt" }
|
||||
serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kt" }
|
||||
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@@ -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-6.6.1-bin.zip
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
|
||||
|
||||
1960
kotlin-js-store/yarn.lock
Normal file
1960
kotlin-js-store/yarn.lock
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,53 +0,0 @@
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
task javadocsJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
|
||||
afterEvaluate {
|
||||
project.publishing.publications.all {
|
||||
// rename artifacts
|
||||
groupId "${project.group}"
|
||||
if (it.name.contains('kotlinMultiplatform')) {
|
||||
artifactId = "${project.name}"
|
||||
} else {
|
||||
artifactId = "${project.name}-$name"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publishing {
|
||||
publications.all {
|
||||
artifact javadocsJar
|
||||
|
||||
pom {
|
||||
description = "SauceNao API library"
|
||||
name = "SauceNao API"
|
||||
url = "https://insanusmokrassar.github.io/${project.name}"
|
||||
|
||||
scm {
|
||||
developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/${project.name}.git[push=]https://github.com/insanusmokrassar/${project.name}.git"
|
||||
url = "https://github.com/insanusmokrassar/${project.name}.git"
|
||||
}
|
||||
|
||||
developers {
|
||||
|
||||
developer {
|
||||
id = "InsanusMokrassar"
|
||||
name = "Ovsyannikov Alexey"
|
||||
email = "ovsyannikov.alexey95@gmail.com"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
licenses {
|
||||
|
||||
license {
|
||||
name = "Apache Software License 2.0"
|
||||
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
{"bintrayConfig":{"repo":"InsanusMokrassar","packageName":"${project.name}-mpp","packageVcs":"https://github.com/InsanusMokrassar/${project.name}"},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"SauceNao API","description":"SauceNao API library","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/insanusmokrassar/${project.name}.git","developers":[{"id":"InsanusMokrassar","name":"Ovsyannikov Alexey","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
||||
114
publish.gradle
114
publish.gradle
@@ -1,55 +1,79 @@
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
apply plugin: 'maven-publish'
|
||||
|
||||
apply from: "maven.publish.gradle"
|
||||
task javadocsJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
}
|
||||
|
||||
bintray {
|
||||
user = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')
|
||||
key = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')
|
||||
filesSpec {
|
||||
from "${buildDir}/publications/"
|
||||
eachFile {
|
||||
String directorySubname = it.getFile().parentFile.name
|
||||
if (it.getName() == "module.json") {
|
||||
if (directorySubname == "kotlinMultiplatform") {
|
||||
it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.module")
|
||||
} else {
|
||||
it.setPath("${project.name}-${directorySubname}/${project.version}/${project.name}-${directorySubname}-${project.version}.module")
|
||||
}
|
||||
} else {
|
||||
if (directorySubname == "kotlinMultiplatform" && it.getName() == "pom-default.xml") {
|
||||
it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.pom")
|
||||
} else {
|
||||
it.exclude()
|
||||
}
|
||||
publishing {
|
||||
publications.all {
|
||||
artifact javadocsJar
|
||||
|
||||
pom {
|
||||
description = "SauceNao API library"
|
||||
name = "SauceNao API"
|
||||
url = "https://insanusmokrassar.github.io/${project.name}"
|
||||
|
||||
scm {
|
||||
developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/${project.name}.git[push=]https://github.com/insanusmokrassar/${project.name}.git"
|
||||
url = "https://github.com/insanusmokrassar/${project.name}.git"
|
||||
}
|
||||
|
||||
developers {
|
||||
|
||||
developer {
|
||||
id = "InsanusMokrassar"
|
||||
name = "Ovsyannikov Alexey"
|
||||
email = "ovsyannikov.alexey95@gmail.com"
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
licenses {
|
||||
|
||||
license {
|
||||
name = "Apache Software License 2.0"
|
||||
url = "https://github.com/InsanusMokrassar/SauceNaoAPI/blob/master/LICENSE"
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
into "${project.group}".replace(".", "/")
|
||||
}
|
||||
pkg {
|
||||
repo = "InsanusMokrassar"
|
||||
name = "${project.name}-mpp"
|
||||
vcsUrl = "https://github.com/InsanusMokrassar/${project.name}"
|
||||
licenses = ["Apache-2.0"]
|
||||
version {
|
||||
name = "${project.version}"
|
||||
released = new Date()
|
||||
vcsTag = "${project.version}"
|
||||
gpg {
|
||||
sign = true
|
||||
passphrase = project.hasProperty('signing.gnupg.passphrase') ? project.property('signing.gnupg.passphrase') : System.getenv('signing.gnupg.passphrase')
|
||||
repositories {
|
||||
if ((project.hasProperty('GITHUBPACKAGES_USER') || System.getenv('GITHUBPACKAGES_USER') != null) && (project.hasProperty('GITHUBPACKAGES_PASSWORD') || System.getenv('GITHUBPACKAGES_PASSWORD') != null)) {
|
||||
maven {
|
||||
name = "GithubPackages"
|
||||
url = uri("https://maven.pkg.github.com/InsanusMokrassar/SauceNaoAPI")
|
||||
credentials {
|
||||
username = project.hasProperty('GITHUBPACKAGES_USER') ? project.property('GITHUBPACKAGES_USER') : System.getenv('GITHUBPACKAGES_USER')
|
||||
password = project.hasProperty('GITHUBPACKAGES_PASSWORD') ? project.property('GITHUBPACKAGES_PASSWORD') : System.getenv('GITHUBPACKAGES_PASSWORD')
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((project.hasProperty('SONATYPE_USER') || System.getenv('SONATYPE_USER') != null) && (project.hasProperty('SONATYPE_PASSWORD') || System.getenv('SONATYPE_PASSWORD') != null)) {
|
||||
maven {
|
||||
name = "sonatype"
|
||||
url = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/")
|
||||
credentials {
|
||||
username = project.hasProperty('SONATYPE_USER') ? project.property('SONATYPE_USER') : System.getenv('SONATYPE_USER')
|
||||
password = project.hasProperty('SONATYPE_PASSWORD') ? project.property('SONATYPE_PASSWORD') : System.getenv('SONATYPE_PASSWORD')
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload.doFirst {
|
||||
publications = publishing.publications.collect {
|
||||
if (it.name.contains('kotlinMultiplatform')) {
|
||||
null
|
||||
} else {
|
||||
it.name
|
||||
|
||||
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||
apply plugin: 'signing'
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
|
||||
sign publishing.publications
|
||||
}
|
||||
|
||||
task signAll {
|
||||
tasks.withType(Sign).forEach {
|
||||
dependsOn(it)
|
||||
}
|
||||
} - null
|
||||
}
|
||||
}
|
||||
|
||||
bintrayUpload.dependsOn publishToMavenLocal
|
||||
1
publish.kpsb
Normal file
1
publish.kpsb
Normal file
@@ -0,0 +1 @@
|
||||
{"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/SauceNaoAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"SauceNao API","description":"SauceNao API library","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/insanusmokrassar/${project.name}.git","developers":[{"id":"InsanusMokrassar","name":"Ovsyannikov Alexey","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"GithubPackages","url":"https://maven.pkg.github.com/InsanusMokrassar/SauceNaoAPI"},{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}],"gpgSigning":{"type":"dev.inmo.kmppscriptbuilder.core.models.GpgSigning.Optional"}}}
|
||||
@@ -1 +1,3 @@
|
||||
rootProject.name = 'SauceNaoAPI'
|
||||
rootProject.name = 'saucenaoapi'
|
||||
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
|
||||
@@ -1,17 +0,0 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI
|
||||
|
||||
sealed class OutputType {
|
||||
abstract val typeCode: Int
|
||||
}
|
||||
|
||||
object HtmlOutputType : OutputType() {
|
||||
override val typeCode: Int = 0
|
||||
}
|
||||
|
||||
object XmlOutputType : OutputType() {
|
||||
override val typeCode: Int = 1
|
||||
}
|
||||
|
||||
object JsonOutputType : OutputType() {
|
||||
override val typeCode: Int = 2
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.ResultMetaInfo
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.adapted
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.results.AdaptedResult
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.results.adapted
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.SauceNaoAnswer
|
||||
|
||||
val SauceNaoAnswer.adapted: AdaptedAnswer
|
||||
get() = header.adapted.let { resultMetainfo ->
|
||||
val adaptedResults = results.map {
|
||||
it.adapted(resultMetainfo)
|
||||
}
|
||||
AdaptedAnswer(
|
||||
resultMetainfo,
|
||||
adaptedResults
|
||||
)
|
||||
}
|
||||
|
||||
data class AdaptedAnswer(
|
||||
val resultMetaInfo: ResultMetaInfo,
|
||||
val results: List<AdaptedResult>
|
||||
)
|
||||
@@ -1,9 +0,0 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional.results
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.IndexInfo
|
||||
|
||||
data class ResultHeader(
|
||||
val similarity: Float,
|
||||
val thumbnail: String,
|
||||
val index: IndexInfo
|
||||
)
|
||||
@@ -1,18 +0,0 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.utils
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
||||
import com.soywiz.klock.DateTime
|
||||
|
||||
internal suspend fun calculateSleepTime(
|
||||
header: Header,
|
||||
mostOldestInShortPeriodGetter: suspend () -> DateTime?,
|
||||
mostOldestInLongPeriodGetter: suspend () -> DateTime?
|
||||
): DateTime? {
|
||||
return when {
|
||||
header.longRemaining < 1 -> mostOldestInLongPeriodGetter() ?.plus(LONG_TIME_RECALCULATING_MILLIS)
|
||||
header.shortRemaining < 1 -> mostOldestInShortPeriodGetter() ?.plus(SHORT_TIME_RECALCULATING_MILLIS)
|
||||
else -> null
|
||||
}
|
||||
}
|
||||
17
src/commonMain/kotlin/dev/inmo/saucenaoapi/OutputType.kt
Normal file
17
src/commonMain/kotlin/dev/inmo/saucenaoapi/OutputType.kt
Normal file
@@ -0,0 +1,17 @@
|
||||
package dev.inmo.saucenaoapi
|
||||
|
||||
sealed class OutputType {
|
||||
abstract val typeCode: Int
|
||||
}
|
||||
|
||||
object HtmlOutputType : dev.inmo.saucenaoapi.OutputType() {
|
||||
override val typeCode: Int = 0
|
||||
}
|
||||
|
||||
object XmlOutputType : dev.inmo.saucenaoapi.OutputType() {
|
||||
override val typeCode: Int = 1
|
||||
}
|
||||
|
||||
object JsonOutputType : dev.inmo.saucenaoapi.OutputType() {
|
||||
override val typeCode: Int = 2
|
||||
}
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI
|
||||
package dev.inmo.saucenaoapi
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.TooManyRequestsException
|
||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.sauceNaoAPIException
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.*
|
||||
import com.insanusmokrassar.SauceNaoAPI.utils.*
|
||||
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsException
|
||||
import dev.inmo.saucenaoapi.exceptions.sauceNaoAPIException
|
||||
import dev.inmo.saucenaoapi.models.*
|
||||
import dev.inmo.saucenaoapi.utils.*
|
||||
import io.ktor.client.HttpClient
|
||||
import io.ktor.client.features.ClientRequestException
|
||||
import io.ktor.client.request.*
|
||||
@@ -40,7 +40,7 @@ val defaultSauceNaoParser = Json {
|
||||
|
||||
data class SauceNaoAPI(
|
||||
private val apiToken: String? = null,
|
||||
private val outputType: OutputType = JsonOutputType,
|
||||
private val outputType: dev.inmo.saucenaoapi.OutputType = dev.inmo.saucenaoapi.JsonOutputType,
|
||||
private val client: HttpClient = HttpClient(),
|
||||
private val searchUrl: String = SEARCH_URL,
|
||||
private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
||||
@@ -158,7 +158,7 @@ data class SauceNaoAPI(
|
||||
minSimilarity: Float? = null
|
||||
): SauceNaoAnswer? {
|
||||
return suspendCoroutine<SauceNaoAnswer> {
|
||||
requestsChannel.offer(
|
||||
requestsChannel.trySend(
|
||||
it to HttpRequestBuilder().apply {
|
||||
url(searchUrl)
|
||||
|
||||
@@ -212,4 +212,4 @@ data class SauceNaoAPI(
|
||||
timeManager.close()
|
||||
quotaManager.close()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI
|
||||
package dev.inmo.saucenaoapi
|
||||
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.utils.io.core.Input
|
||||
@@ -0,0 +1,23 @@
|
||||
package dev.inmo.saucenaoapi.additional
|
||||
|
||||
import dev.inmo.saucenaoapi.additional.header.ResultMetaInfo
|
||||
import dev.inmo.saucenaoapi.additional.header.adapted
|
||||
import dev.inmo.saucenaoapi.additional.results.AdaptedResult
|
||||
import dev.inmo.saucenaoapi.additional.results.adapted
|
||||
import dev.inmo.saucenaoapi.models.SauceNaoAnswer
|
||||
|
||||
val SauceNaoAnswer.adapted: AdaptedAnswer
|
||||
get() = header.adapted.let { resultMetainfo ->
|
||||
val adaptedResults = results.map {
|
||||
it.adapted(resultMetainfo)
|
||||
}
|
||||
AdaptedAnswer(
|
||||
resultMetainfo,
|
||||
adaptedResults
|
||||
)
|
||||
}
|
||||
|
||||
data class AdaptedAnswer(
|
||||
val resultMetaInfo: ResultMetaInfo,
|
||||
val results: List<AdaptedResult>
|
||||
)
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional
|
||||
package dev.inmo.saucenaoapi.additional
|
||||
|
||||
import com.soywiz.klock.TimeSpan
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional.header
|
||||
package dev.inmo.saucenaoapi.additional.header
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.*
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
||||
import dev.inmo.saucenaoapi.additional.*
|
||||
import dev.inmo.saucenaoapi.models.Header
|
||||
|
||||
val Header.shortLimitStatus: LimitStatus
|
||||
get() = LimitStatus(
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional.header
|
||||
package dev.inmo.saucenaoapi.additional.header
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
||||
import dev.inmo.saucenaoapi.models.Header
|
||||
|
||||
data class IndexInfo(
|
||||
val id: Int,
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional.header
|
||||
package dev.inmo.saucenaoapi.additional.header
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
||||
import dev.inmo.saucenaoapi.models.Header
|
||||
|
||||
val Header.queryPreview
|
||||
get() = QueryResultPreview(
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional.header
|
||||
package dev.inmo.saucenaoapi.additional.header
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
||||
import dev.inmo.saucenaoapi.models.Header
|
||||
|
||||
data class ResultMetaInfo(
|
||||
val accountInfo: AccountInfo = AccountInfo(),
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.additional.results
|
||||
package dev.inmo.saucenaoapi.additional.results
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.IndexInfo
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.ResultMetaInfo
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.Result
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.ResultData
|
||||
import dev.inmo.saucenaoapi.additional.header.IndexInfo
|
||||
import dev.inmo.saucenaoapi.additional.header.ResultMetaInfo
|
||||
import dev.inmo.saucenaoapi.models.Result
|
||||
import dev.inmo.saucenaoapi.models.ResultData
|
||||
|
||||
fun Result.adapted(
|
||||
resultMetaInfo: ResultMetaInfo
|
||||
@@ -0,0 +1,9 @@
|
||||
package dev.inmo.saucenaoapi.additional.results
|
||||
|
||||
import dev.inmo.saucenaoapi.additional.header.IndexInfo
|
||||
|
||||
data class ResultHeader(
|
||||
val similarity: Float,
|
||||
val thumbnail: String,
|
||||
val index: IndexInfo
|
||||
)
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.exceptions
|
||||
package dev.inmo.saucenaoapi.exceptions
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||
import com.soywiz.klock.TimeSpan
|
||||
import io.ktor.client.features.ClientRequestException
|
||||
import io.ktor.client.statement.readText
|
||||
@@ -9,18 +9,17 @@ import io.ktor.http.HttpStatusCode.Companion.TooManyRequests
|
||||
import io.ktor.utils.io.errors.IOException
|
||||
|
||||
internal suspend fun ClientRequestException.sauceNaoAPIException(): Exception {
|
||||
val response = response ?: return this
|
||||
return when (response.status) {
|
||||
TooManyRequests -> {
|
||||
val answerContent = response.readText()
|
||||
when {
|
||||
answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent)
|
||||
else -> TooManyRequestsShortException(answerContent)
|
||||
}
|
||||
return when (response.status) {
|
||||
TooManyRequests -> {
|
||||
val answerContent = response.readText()
|
||||
when {
|
||||
answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent)
|
||||
else -> TooManyRequestsShortException(answerContent)
|
||||
}
|
||||
else -> this
|
||||
}
|
||||
else -> this
|
||||
}
|
||||
}
|
||||
|
||||
sealed class TooManyRequestsException(message: String, cause: Throwable? = null) : IOException(message, cause) {
|
||||
abstract val answerContent: String
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.models
|
||||
package dev.inmo.saucenaoapi.models
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.defaultSauceNaoParser
|
||||
import dev.inmo.saucenaoapi.defaultSauceNaoParser
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.models
|
||||
package dev.inmo.saucenaoapi.models
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.models
|
||||
package dev.inmo.saucenaoapi.models
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.models
|
||||
package dev.inmo.saucenaoapi.models
|
||||
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.models
|
||||
package dev.inmo.saucenaoapi.models
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.utils.CommonMultivariantStringSerializer
|
||||
import dev.inmo.saucenaoapi.utils.CommonMultivariantStringSerializer
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
@@ -159,3 +159,18 @@ data class ResultData(
|
||||
@SerialName("ext_urls")
|
||||
val extUrls: List<String> = emptyList()
|
||||
)
|
||||
|
||||
val ResultData.froms: List<String>
|
||||
get() = material ?.split(", ") ?: emptyList()
|
||||
|
||||
val ResultData.authors: List<String>
|
||||
get() = (creator ?.split(", ") ?: emptyList()) + (memberName ?.split(", ") ?: emptyList())
|
||||
|
||||
val ResultData.charactersList: List<String>
|
||||
get() = characters ?.split(", ") ?: emptyList()
|
||||
|
||||
val ResultData.titles: List<String>
|
||||
get() = title ?.split(", ") ?: emptyList()
|
||||
|
||||
val ResultData.urls: List<String>
|
||||
get() = extUrls + (url ?.split(", ") ?: emptyList())
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.models
|
||||
package dev.inmo.saucenaoapi.models
|
||||
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.models
|
||||
package dev.inmo.saucenaoapi.models
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.defaultSauceNaoParser
|
||||
import dev.inmo.saucenaoapi.defaultSauceNaoParser
|
||||
import kotlinx.serialization.*
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
@@ -1,17 +1,13 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.utils
|
||||
package dev.inmo.saucenaoapi.utils
|
||||
|
||||
import kotlinx.serialization.KSerializer
|
||||
import kotlinx.serialization.Serializer
|
||||
import kotlinx.serialization.builtins.ListSerializer
|
||||
import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.json.*
|
||||
|
||||
|
||||
@Serializer(String::class)
|
||||
object CommonMultivariantStringSerializer : KSerializer<String> by String.serializer() {
|
||||
private val stringArraySerializer = ListSerializer(String.serializer())
|
||||
|
||||
override fun deserialize(decoder: Decoder): String {
|
||||
return when (val parsed = JsonElement.serializer().deserialize(decoder)) {
|
||||
is JsonPrimitive -> parsed.content
|
||||
@@ -1,11 +1,11 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.utils
|
||||
package dev.inmo.saucenaoapi.utils
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.TooManyRequestsException
|
||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.TooManyRequestsLongException
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
||||
import com.insanusmokrassar.SauceNaoAPI.models.LimitsState
|
||||
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsException
|
||||
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsLongException
|
||||
import dev.inmo.saucenaoapi.models.Header
|
||||
import dev.inmo.saucenaoapi.models.LimitsState
|
||||
import com.soywiz.klock.DateTime
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
@@ -92,7 +92,7 @@ internal class RequestQuotaManager (
|
||||
quotaActions.send(callback)
|
||||
}
|
||||
}
|
||||
quotaActions.offer(callback)
|
||||
quotaActions.trySend(callback)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.utils
|
||||
package dev.inmo.saucenaoapi.utils
|
||||
|
||||
import kotlinx.coroutines.supervisorScope
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.insanusmokrassar.SauceNaoAPI.utils
|
||||
package dev.inmo.saucenaoapi.utils
|
||||
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||
import com.soywiz.klock.DateTime
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.channels.Channel
|
||||
@@ -84,7 +84,7 @@ internal class TimeManager(
|
||||
|
||||
suspend fun getMostOldestInLongPeriod(): DateTime? {
|
||||
return suspendCoroutine {
|
||||
actionsChannel.offer(
|
||||
actionsChannel.trySend(
|
||||
TimeManagerMostOldestInLongGetter(it)
|
||||
)
|
||||
}
|
||||
@@ -92,7 +92,7 @@ internal class TimeManager(
|
||||
|
||||
suspend fun getMostOldestInShortPeriod(): DateTime? {
|
||||
return suspendCoroutine {
|
||||
actionsChannel.offer(TimeManagerMostOldestInShortGetter(it))
|
||||
actionsChannel.trySend(TimeManagerMostOldestInShortGetter(it))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import com.insanusmokrassar.SauceNaoAPI.SauceNaoAPI
|
||||
import com.insanusmokrassar.SauceNaoAPI.utils.useSafe
|
||||
import dev.inmo.saucenaoapi.SauceNaoAPI
|
||||
import dev.inmo.saucenaoapi.utils.useSafe
|
||||
import io.ktor.http.ContentType
|
||||
import io.ktor.utils.io.streams.asInput
|
||||
import kotlinx.coroutines.*
|
||||
|
||||
Reference in New Issue
Block a user