mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2025-12-08 14:05:46 +00:00
Compare commits
31 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 |
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 }}
|
||||
43
CHANGELOG.md
43
CHANGELOG.md
@@ -1,5 +1,48 @@
|
||||
# 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:
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
# SauceNaoAPI
|
||||
|
||||
[  ](https://bintray.com/insanusmokrassar/SauceNaoAPI/saucenaoapi/_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
|
||||
|
||||
25
build.gradle
25
build.gradle
@@ -1,20 +1,19 @@
|
||||
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.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 = "$library_version"
|
||||
@@ -25,14 +24,12 @@ apply from: "github_release.gradle"
|
||||
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
mavenCentral()
|
||||
maven { url "https://kotlin.bintray.com/kotlinx" }
|
||||
}
|
||||
|
||||
kotlin {
|
||||
jvm()
|
||||
js(BOTH) {
|
||||
js(IR) {
|
||||
browser()
|
||||
nodejs()
|
||||
}
|
||||
@@ -43,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_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 {
|
||||
@@ -58,7 +55,7 @@ kotlin {
|
||||
jvmTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit')
|
||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
||||
implementation libs.ktor.client.okhttp
|
||||
}
|
||||
}
|
||||
jsTest {
|
||||
|
||||
@@ -1,10 +1,3 @@
|
||||
kotlin.code.style=official
|
||||
kotlin_version=1.4.31
|
||||
kotlin_coroutines_version=1.4.3
|
||||
kotlin_serialisation_version=1.1.0
|
||||
klock_version=2.0.6
|
||||
ktor_version=1.5.2
|
||||
|
||||
gradle_github_release_plugin_version=2.2.12
|
||||
|
||||
library_version=0.8.0
|
||||
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.8.3-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,5 +1,4 @@
|
||||
apply plugin: 'maven-publish'
|
||||
apply plugin: 'signing'
|
||||
|
||||
task javadocsJar(type: Jar) {
|
||||
classifier = 'javadoc'
|
||||
@@ -39,6 +38,16 @@ publishing {
|
||||
}
|
||||
}
|
||||
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"
|
||||
@@ -52,8 +61,19 @@ publishing {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
sign publishing.publications
|
||||
|
||||
if (project.hasProperty("signing.gnupg.keyName")) {
|
||||
apply plugin: 'signing'
|
||||
|
||||
signing {
|
||||
useGpgCmd()
|
||||
|
||||
sign publishing.publications
|
||||
}
|
||||
|
||||
task signAll {
|
||||
tasks.withType(Sign).forEach {
|
||||
dependsOn(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1 +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","includeGpgSigning":true,"developers":[{"id":"InsanusMokrassar","name":"Ovsyannikov Alexey","eMail":"ovsyannikov.alexey95@gmail.com"}],"repositories":[{"name":"sonatype","url":"https://oss.sonatype.org/service/local/staging/deploy/maven2/"}]}}
|
||||
{"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'
|
||||
|
||||
enableFeaturePreview("VERSION_CATALOGS")
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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())
|
||||
|
||||
@@ -92,7 +92,7 @@ internal class RequestQuotaManager (
|
||||
quotaActions.send(callback)
|
||||
}
|
||||
}
|
||||
quotaActions.offer(callback)
|
||||
quotaActions.trySend(callback)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user