sora: fix indexing

This commit is contained in:
hexated 2023-03-12 23:12:15 +07:00
parent dd4da22ab0
commit b9013ae3d8
3 changed files with 8 additions and 20 deletions

View file

@ -1,5 +1,5 @@
// use an integer for version numbers // use an integer for version numbers
version = 102 version = 103
cloudstream { cloudstream {

View file

@ -2521,7 +2521,7 @@ object SoraExtractor : SoraStream() {
season, season,
episode, episode,
true true
) ) && media.name?.contains("XXX") == false
} }
files?.map { file -> files?.map { file ->
@ -2795,12 +2795,6 @@ class FileMoonIn : Filesim() {
override val name = "FileMoon" override val name = "FileMoon"
} }
data class TitleSlug(
val dotSlug: String? = null,
val spaceSlug: String? = null,
val slashSlug: String? = null,
)
data class FDMovieIFrame( data class FDMovieIFrame(
val link: String, val link: String,
val quality: String, val quality: String,

View file

@ -774,13 +774,9 @@ fun getEpisodeSlug(
} }
} }
fun getTitleSlug(title: String? = null): TitleSlug { fun getTitleSlug(title: String? = null): Pair<String?, String?> {
val slug = title.createSlug() val slug = title.createSlug()
return TitleSlug( return slug?.replace("-", "\\W") to title?.replace(" ", "_")
slug?.replace("-", "."),
slug?.replace("-", " "),
slug?.replace("-", "_"),
)
} }
fun getIndexQuery( fun getIndexQuery(
@ -837,17 +833,15 @@ fun matchingIndex(
episode: Int?, episode: Int?,
include720: Boolean = false include720: Boolean = false
): Boolean { ): Boolean {
val (dotSlug, spaceSlug, slashSlug) = getTitleSlug(title) val (wSlug, dwSlug) = getTitleSlug(title)
val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode) val (seasonSlug, episodeSlug) = getEpisodeSlug(season, episode)
return (if (season == null) { return (if (season == null) {
mediaName?.contains("$year") == true mediaName?.contains(Regex("(?i)(?:$wSlug|$dwSlug).*$year")) == true
} else { } else {
mediaName?.contains(Regex("(?i)S${seasonSlug}.?E${episodeSlug}")) == true mediaName?.contains(Regex("(?i)(?:$wSlug|$dwSlug).*S${seasonSlug}.?E${episodeSlug}")) == true
}) && mediaName?.contains( }) && mediaName?.contains(
if (include720) Regex("(?i)(2160p|1080p|720p)") else Regex("(?i)(2160p|1080p)") if (include720) Regex("(?i)(2160p|1080p|720p)") else Regex("(?i)(2160p|1080p)")
) == true && ((mediaMimeType in mimeType) || mediaName.contains(Regex("\\.mkv|\\.mp4|\\.avi"))) && (mediaName.contains( ) == true && ((mediaMimeType in mimeType) || mediaName.contains(Regex("\\.mkv|\\.mp4|\\.avi")))
title?.replace(" ", "_").toString()
) || mediaName.contains(Regex("(?i)($dotSlug|$spaceSlug|$slashSlug)")))
} }
suspend fun getConfig(): BaymoviesConfig { suspend fun getConfig(): BaymoviesConfig {