Skip to content
Merged
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
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-bin.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 8 additions & 4 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand All @@ -80,10 +80,10 @@ do
esac
done

APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

APP_NAME="Gradle"
# This is normally unused
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
Expand Down Expand Up @@ -143,12 +143,16 @@ fi
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
case $MAX_FD in #(
max*)
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
MAX_FD=$( ulimit -H -n ) ||
warn "Could not query maximum file descriptor limit"
esac
case $MAX_FD in #(
'' | soft) :;; #(
*)
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
# shellcheck disable=SC3045
ulimit -n "$MAX_FD" ||
warn "Could not set maximum file descriptor limit to $MAX_FD"
esac
Expand Down
1 change: 1 addition & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
@rem This is normally unused
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

Expand Down
22 changes: 11 additions & 11 deletions manami-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -101,25 +101,25 @@ repositories {

dependencies {
api(kotlin("stdlib-jdk8"))
api("io.github.manamiproject:modb-core:7.2.8")
api("io.github.manamiproject:modb-db-parser:3.2.10")
api("io.github.manamiproject:modb-core:8.0.0-beta.6")
api("io.github.manamiproject:modb-db-parser:4.0.0-beta.2")

implementation(platform(kotlin("bom", "1.7.10")))
implementation(kotlin("reflect"))
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("io.github.manamiproject:modb-anidb:3.1.14")
implementation("io.github.manamiproject:modb-anilist:4.1.12")
implementation("io.github.manamiproject:modb-anime-planet:3.3.15")
implementation("io.github.manamiproject:modb-anisearch:1.2.17")
implementation("io.github.manamiproject:modb-kitsu:3.1.12")
implementation("io.github.manamiproject:modb-livechart:1.1.14")
implementation("io.github.manamiproject:modb-mal:3.1.12")
implementation("io.github.manamiproject:modb-notify:3.2.12")
implementation("io.github.manamiproject:modb-anidb:4.0.0-beta.3")
implementation("io.github.manamiproject:modb-anilist:5.0.0-beta.2")
implementation("io.github.manamiproject:modb-anime-planet:4.0.0-beta.2")
implementation("io.github.manamiproject:modb-anisearch:2.0.0-beta.2")
implementation("io.github.manamiproject:modb-kitsu:4.0.0-beta.2")
implementation("io.github.manamiproject:modb-livechart:2.0.0-beta.2")
implementation("io.github.manamiproject:modb-mal:4.0.0-beta.2")
implementation("io.github.manamiproject:modb-notify:4.0.0-beta.2")
implementation("ch.qos.logback:logback-classic:1.4.4")
implementation("org.apache.commons:commons-lang3:3.12.0")
implementation("org.apache.commons:commons-text:1.10.0")

testImplementation("io.github.manamiproject:modb-test:1.3.10")
testImplementation("io.github.manamiproject:modb-test:1.4.0-beta.5")
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ internal class DefaultAnimeCache(
animeDownloader = AnisearchDownloader(config = AnisearchConfig),
relationsDownloader = AnisearchDownloader(config = AnisearchRelationsConfig),
relationsDir = anisearchRelationsDir,
converter = AnisearchConverter(relationsDir = anisearchRelationsDir)
converter = AnisearchConverter(relationsDir = anisearchRelationsDir),
),
KitsuCacheLoader(),
SimpleCacheLoader(
Expand All @@ -75,7 +75,7 @@ internal class DefaultAnimeCache(
animeDownloader = NotifyDownloader(config = NotifyConfig),
relationsDownloader = NotifyDownloader(config = NotifyRelationsConfig),
relationsDir = notifyRelationsDir,
converter = NotifyConverter(relationsDir = notifyRelationsDir)
converter = NotifyConverter(relationsDir = notifyRelationsDir),
),
),
eventBus: EventBus = SimpleEventBus,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import io.github.manamiproject.modb.core.downloader.Downloader
import io.github.manamiproject.modb.core.extensions.writeToFile
import io.github.manamiproject.modb.core.logging.LoggerDelegate
import io.github.manamiproject.modb.core.models.Anime
import kotlinx.coroutines.runBlocking
import java.net.URI
import java.nio.file.Path
import kotlin.io.path.deleteIfExists
Expand All @@ -27,8 +28,8 @@ internal class DependentCacheLoader(

loadRelations(id)

val result = animeDownloader.download(id)
val anime = converter.convert(result)
val result = runBlocking { animeDownloader.download(id) }
val anime = runBlocking { converter.convert(result) }

relationsDir.resolve("$id.${config.fileSuffix()}").deleteIfExists()

Expand All @@ -37,7 +38,7 @@ internal class DependentCacheLoader(

override fun hostname(): Hostname = config.hostname()

private fun loadRelations(id: AnimeId) {
private fun loadRelations(id: AnimeId) = runBlocking {
relationsDownloader.download(id).writeToFile(relationsDir.resolve("$id.${config.fileSuffix()}"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ internal class KitsuCacheLoader(
private val relationsDir: Path = tempFolder.resolve("relations").createDirectory(),
private val tagsDir: Path = tempFolder.resolve("tags").createDirectory(),
private val converter: AnimeConverter = KitsuConverter(
relationsDir = relationsDir,
tagsDir = tagsDir
)
relationsDir = relationsDir,
tagsDir = tagsDir,
),
) : CacheLoader {

@OptIn(DelicateCoroutinesApi::class)
Expand All @@ -47,8 +47,8 @@ internal class KitsuCacheLoader(
job2.join()
}

val result = animeDownloader.download(id)
val anime = converter.convert(result)
val result = runBlocking { animeDownloader.download(id) }
val anime = runBlocking { converter.convert(result) }

relationsDir.resolve("$id.${kitsuConfig.fileSuffix()}").deleteIfExists()
tagsDir.resolve("$id.${kitsuConfig.fileSuffix()}").deleteIfExists()
Expand All @@ -58,11 +58,11 @@ internal class KitsuCacheLoader(

override fun hostname(): Hostname = kitsuConfig.hostname()

private fun loadRelations(id: AnimeId) {
private fun loadRelations(id: AnimeId) = runBlocking {
relationsDownloader.download(id).writeToFile(relationsDir.resolve("$id.${kitsuConfig.fileSuffix()}"))
}

private fun loadTags(id: AnimeId) {
private fun loadTags(id: AnimeId) = runBlocking {
tagsDownloader.download(id).writeToFile(tagsDir.resolve("$id.${kitsuConfig.fileSuffix()}"))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@ import io.github.manamiproject.modb.core.converter.AnimeConverter
import io.github.manamiproject.modb.core.downloader.Downloader
import io.github.manamiproject.modb.core.logging.LoggerDelegate
import io.github.manamiproject.modb.core.models.Anime
import kotlinx.coroutines.runBlocking
import java.net.URI

internal class SimpleCacheLoader(
private val config: MetaDataProviderConfig,
private val downloader: Downloader,
private val converter: AnimeConverter
private val config: MetaDataProviderConfig,
private val downloader: Downloader,
private val converter: AnimeConverter,
) : CacheLoader {

override fun hostname(): Hostname = config.hostname()
Expand All @@ -20,8 +21,8 @@ internal class SimpleCacheLoader(
log.debug { "Loading anime from [$uri]" }

val id = config.extractAnimeId(uri)
val rawContent = downloader.download(id)
return converter.convert(rawContent)
val rawContent = runBlocking { downloader.download(id) }
return runBlocking { converter.convert(rawContent) }
}

private companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import io.github.manamiproject.modb.core.models.Anime
import io.github.manamiproject.modb.dbparser.AnimeDatabaseJsonStringParser
import io.github.manamiproject.modb.dbparser.DatabaseFileParser
import io.github.manamiproject.modb.dbparser.ExternalResourceParser
import kotlinx.coroutines.runBlocking
import java.net.URI

internal class AnimeCachePopulator(
Expand All @@ -21,7 +22,7 @@ internal class AnimeCachePopulator(
override fun populate(cache: Cache<URI, CacheEntry<Anime>>) {
log.info {"Populating cache with anime from [$uri]." }

val parsedAnime = parser.parse(uri.toURL())
val parsedAnime = runBlocking { parser.parse(uri.toURL()) }

parsedAnime.forEach { anime ->
anime.sources.forEach { source ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,21 +10,24 @@ import io.github.manamiproject.modb.core.models.Anime
import io.github.manamiproject.modb.dbparser.DatabaseFileParser
import io.github.manamiproject.modb.dbparser.DeadEntriesJsonStringParser
import io.github.manamiproject.modb.dbparser.ExternalResourceParser
import kotlinx.coroutines.runBlocking
import java.net.URI
import java.net.URL

internal class DeadEntriesCachePopulator(
private val config: MetaDataProviderConfig,
private val url: URL,
private val parser: ExternalResourceParser<AnimeId> = DatabaseFileParser(fileParser = DeadEntriesJsonStringParser())
private val config: MetaDataProviderConfig,
private val url: URL,
private val parser: ExternalResourceParser<AnimeId> = DatabaseFileParser(fileParser = DeadEntriesJsonStringParser()),
) : CachePopulator<URI, CacheEntry<Anime>> {

override fun populate(cache: Cache<URI, CacheEntry<Anime>>) {
log.info { "Populating cache with dead entries from [${config.hostname()}]" }

parser.parse(url).forEach { animeId ->
val source = config.buildAnimeLink(animeId)
cache.populate(source, DeadEntry())
runBlocking {
parser.parse(url).forEach { animeId ->
val source = config.buildAnimeLink(animeId)
cache.populate(source, DeadEntry())
}
}

log.info { "Finished populating cache with dead entries from [${config.hostname()}]" }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ import io.github.manamiproject.manami.app.state.snapshot.Snapshot
import io.github.manamiproject.modb.core.logging.LoggerDelegate

internal class GenericReversibleCommand(
private val state: State = InternalState,
private val commandHistory: CommandHistory = DefaultCommandHistory,
private val command: Command,
private val state: State = InternalState,
private val commandHistory: CommandHistory = DefaultCommandHistory,
private val command: Command,
) : ReversibleCommand {

private var snapshot: StatefulSnapshot = Uninitialized
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ internal class EventfulList<T>(

constructor(listType: EventListType, vararg values: T) : this(
listType = listType,
list = values.toMutableList()
list = values.toMutableList(),
)

override fun add(element: T): Boolean {
Expand All @@ -28,7 +28,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = ADDED,
obj = setOf(element)
obj = setOf(element),
)
)
}
Expand All @@ -49,7 +49,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = ADDED,
obj = setOf(element)
obj = setOf(element),
)
)
}
Expand All @@ -66,7 +66,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = ADDED,
obj = elements.toSet()
obj = elements.toSet(),
)
)
}
Expand All @@ -85,7 +85,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = ADDED,
obj = elements.toSet()
obj = elements.toSet(),
)
)
}
Expand All @@ -105,7 +105,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = REMOVED,
obj = setOf(element)
obj = setOf(element),
)
)
}
Expand All @@ -124,7 +124,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = REMOVED,
obj = elementsToRemove.toSet()
obj = elementsToRemove.toSet(),
)
)
}
Expand All @@ -141,7 +141,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = REMOVED,
obj = setOf(returnValue)
obj = setOf(returnValue),
)
)

Expand All @@ -159,7 +159,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = REMOVED,
obj = elementsBeingRemoved.toSet()
obj = elementsBeingRemoved.toSet(),
)
)
}
Expand All @@ -178,7 +178,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = REMOVED,
obj = elementsToBeRemoved.toSet()
obj = elementsToBeRemoved.toSet(),
)
)
}
Expand All @@ -196,14 +196,14 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = REMOVED,
obj = setOf(replacedValue)
obj = setOf(replacedValue),
)
)
eventBus.post(
ListChangedEvent(
list = listType,
type = ADDED,
obj = setOf(element)
obj = setOf(element),
)
)
}
Expand All @@ -220,7 +220,7 @@ internal class EventfulList<T>(
ListChangedEvent(
list = listType,
type = REMOVED,
obj = list.toSet()
obj = list.toSet(),
)
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import io.github.manamiproject.manami.app.state.InternalState
import io.github.manamiproject.manami.app.state.State

internal class CmdNewFile(
private val state: State = InternalState,
private val commandHistory: CommandHistory = DefaultCommandHistory,
private val state: State = InternalState,
private val commandHistory: CommandHistory = DefaultCommandHistory,
) : Command {

override fun execute(): Boolean {
Expand Down
Loading