Add src:local search alias for Local Source (#2928)

This commit is contained in:
MajorTanya
2026-02-05 20:15:34 +01:00
committed by GitHub
parent b543bc089a
commit cf93afab45
2 changed files with 10 additions and 1 deletions
+1
View File
@@ -16,6 +16,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
- Display author & artist name in MAL search results ([@MajorTanya](https://github.com/MajorTanya)) ([#2833](https://github.com/mihonapp/mihon/pull/2833))
- Add filter options to Updates tab ([@MajorTanya](https://github.com/MajorTanya)) ([#2851](https://github.com/mihonapp/mihon/pull/2851))
- Add `src:` prefix to search the library by source ID ([@MajorTanya](https://github.com/MajorTanya)) ([#2927](https://github.com/mihonapp/mihon/pull/2927))
- Add `src:local` as a way to search for Local Source entries ([@MajorTanya](https://github.com/MajorTanya)) ([#2928](https://github.com/mihonapp/mihon/pull/2928))
### Improved
- Minimize memory usage by reducing in-memory cover cache size ([@Lolle2000la](https://github.com/Lolle2000la)) ([#2266](https://github.com/mihonapp/mihon/pull/2266))
@@ -3,9 +3,12 @@ package eu.kanade.tachiyomi.ui.library
import eu.kanade.tachiyomi.source.getNameForMangaInfo
import tachiyomi.domain.library.model.LibraryManga
import tachiyomi.domain.source.service.SourceManager
import tachiyomi.source.local.LocalSource
import uy.kohesive.injekt.Injekt
import uy.kohesive.injekt.api.get
private const val LOCAL_SOURCE_ID_ALIAS = "local"
data class LibraryItem(
val libraryManga: LibraryManga,
val downloadCount: Long = -1,
@@ -28,7 +31,12 @@ data class LibraryItem(
if (constraint.startsWith("id:", true)) {
return id == constraint.substringAfter("id:").toLongOrNull()
} else if (constraint.startsWith("src:", true)) {
return source.id == constraint.substringAfter("src:").toLongOrNull()
val querySource = constraint.substringAfter("src:")
return if (querySource.equals(LOCAL_SOURCE_ID_ALIAS, ignoreCase = true)) {
source.id == LocalSource.ID
} else {
source.id == querySource.toLongOrNull()
}
}
return libraryManga.manga.title.contains(constraint, true) ||
(libraryManga.manga.author?.contains(constraint, true) ?: false) ||