Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,7 @@ dependencies {
// Extensions & Other Libs
implementation(libs.jsoup) // HTML Parser
implementation(libs.rhino) // Run JavaScript
implementation(libs.fuzzywuzzy) // Library/Ext Searching with Levenshtein Distance
implementation(libs.fuzzykot) // Library/Extension Matching
implementation(libs.safefile) // To Prevent the URI File Fu*kery
coreLibraryDesugaring(libs.desugar.jdk.libs.nio) // NIO Flavor Needed for NewPipeExtractor
implementation(libs.conscrypt.android) // To Fix SSL Fu*kery on Android 9
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import com.lagradost.cloudstream3.utils.Coroutines.threadSafeListOf
import com.lagradost.cloudstream3.utils.DataStoreHelper
import com.lagradost.cloudstream3.utils.UiText
import com.lagradost.cloudstream3.utils.txt
import me.xdrop.fuzzywuzzy.FuzzySearch
import java.net.URL
import java.security.SecureRandom
import java.util.Date
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.lagradost.cloudstream3.syncproviders

import androidx.annotation.WorkerThread
import com.github.terrakok.fuzzykot.Levenshtein
import com.lagradost.cloudstream3.ActorData
import com.lagradost.cloudstream3.NextAiring
import com.lagradost.cloudstream3.Score
Expand All @@ -11,7 +12,6 @@ import com.lagradost.cloudstream3.TvType
import com.lagradost.cloudstream3.ui.SyncWatchType
import com.lagradost.cloudstream3.ui.library.ListSorting
import com.lagradost.cloudstream3.utils.UiText
import me.xdrop.fuzzywuzzy.FuzzySearch
import java.util.Date

/**
Expand Down Expand Up @@ -138,7 +138,7 @@ abstract class SyncAPI : AuthAPI() {
ListSorting.Query ->
if (query != null) {
items.sortedBy {
-FuzzySearch.partialRatio(
-Levenshtein.partialRatio(
query.lowercase(), it.name.lowercase()
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import androidx.preference.PreferenceManager
import com.github.terrakok.fuzzykot.Levenshtein
import com.lagradost.cloudstream3.CommonActivity.showToast
import com.lagradost.cloudstream3.PROVIDER_STATUS_DOWN
import com.lagradost.cloudstream3.R
Expand All @@ -23,7 +24,6 @@ import com.lagradost.cloudstream3.utils.txt
import com.lagradost.cloudstream3.utils.Coroutines.ioSafe
import com.lagradost.cloudstream3.utils.Coroutines.main
import com.lagradost.cloudstream3.utils.Coroutines.runOnMainThread
import me.xdrop.fuzzywuzzy.FuzzySearch
import java.io.File

// String => repository url
Expand Down Expand Up @@ -246,7 +246,7 @@ class PluginsViewModel : ViewModel() {
this.sortedBy { it.plugin.second.name }
} else {
this.sortedBy {
-FuzzySearch.partialRatio(
-Levenshtein.partialRatio(
it.plugin.second.name.lowercase(),
query.lowercase()
)
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ desugar_jdk_libs_nio = "2.1.5"
dokkaGradlePlugin = "2.2.0"
espressoCore = "3.7.0"
fragmentKtx = "1.8.9"
fuzzywuzzy = "1.4.0"
fuzzykot = "1.0.0"
jacksonModuleKotlin = { strictly = "2.13.1" } # Later versions don't support minSdk <26 (Crashes on Android TV's and FireSticks)
json = "20251224"
jsoup = "1.22.1"
Expand Down Expand Up @@ -74,7 +74,7 @@ desugar_jdk_libs_nio = { module = "com.android.tools:desugar_jdk_libs_nio", vers
espresso-core = { module = "androidx.test.espresso:espresso-core", version.ref = "espressoCore" }
ext-junit = { module = "androidx.test.ext:junit", version.ref = "junitVersion" }
fragment-ktx = { module = "androidx.fragment:fragment-ktx", version.ref = "fragmentKtx" }
fuzzywuzzy = { module = "me.xdrop:fuzzywuzzy", version.ref = "fuzzywuzzy" }
fuzzykot = { module = "com.github.terrakok:fuzzykot", version.ref = "fuzzykot" }
jackson-module-kotlin = { module = "com.fasterxml.jackson.module:jackson-module-kotlin", version.ref = "jacksonModuleKotlin" }
json = { module = "org.json:json", version.ref = "json" }
jsoup = { module = "org.jsoup:jsoup", version.ref = "jsoup" }
Expand Down
2 changes: 1 addition & 1 deletion library/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ kotlin {
implementation(libs.nicehttp) // HTTP Lib
implementation(libs.jackson.module.kotlin) // JSON Parser
implementation(libs.kotlinx.coroutines.core)
implementation(libs.fuzzywuzzy) // Match Extractors
implementation(libs.fuzzykot) // Match Extractors
implementation(libs.jsoup) // HTML Parser
implementation(libs.rhino) // Run JavaScript
implementation(libs.newpipeextractor)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.lagradost.cloudstream3.utils

import com.fasterxml.jackson.annotation.JsonIgnore
import com.github.terrakok.fuzzykot.Levenshtein
import com.lagradost.cloudstream3.AudioFile
import com.lagradost.cloudstream3.IDownloadableMinimum
import com.lagradost.cloudstream3.SubtitleFile
Expand Down Expand Up @@ -310,7 +311,6 @@ import com.lagradost.cloudstream3.mvvm.logError
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.delay
import kotlinx.coroutines.ensureActive
import me.xdrop.fuzzywuzzy.FuzzySearch
import org.jsoup.Jsoup
import java.net.URI
import java.util.UUID
Expand Down Expand Up @@ -882,7 +882,7 @@ suspend fun loadExtractor(
// this is to match mirror domains - like example.com, example.net
for (index in extractorApis.lastIndex downTo 0) {
val extractor = extractorApis[index]
if (FuzzySearch.partialRatio(
if (Levenshtein.partialRatio(
extractor.mainUrl,
currentUrl
) > 80
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.lagradost.cloudstream3.utils

import me.xdrop.fuzzywuzzy.FuzzySearch
import com.github.terrakok.fuzzykot.Levenshtein
import java.util.Locale

// If you find a way to use SettingsGeneral getCurrentLocale()
Expand Down Expand Up @@ -112,8 +112,8 @@ object SubtitleHelper {

for (lang in languages) {
val score = maxOf(
FuzzySearch.ratio(lowLangName, lang.languageName.lowercase()),
FuzzySearch.ratio(
Levenshtein.ratio(lowLangName, lang.languageName.lowercase()),
Levenshtein.ratio(
lowLangName, lang.nativeName.lowercase()
)
)
Expand Down