From 9b869a92ec387e6a8f6906cb6341bc46bcf9be8c Mon Sep 17 00:00:00 2001 From: Lexi Larkin Date: Sun, 13 Aug 2023 22:55:28 -0400 Subject: [PATCH 1/3] feat: BSG --- .../src/main/kotlin/club/speedrun/vods/Application.kt | 10 +++------- .../kotlin/club/speedrun/vods/marathon/Marathon.kt | 4 ++++ .../main/kotlin/club/speedrun/vods/plugins/Routing.kt | 2 +- kgdq/src/main/kotlin/dev/qixils/gdq/GDQ.kt | 3 ++- web/src/app.css | 1 - 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api-server/src/main/kotlin/club/speedrun/vods/Application.kt b/api-server/src/main/kotlin/club/speedrun/vods/Application.kt index 3110fc2c..0fc11edf 100644 --- a/api-server/src/main/kotlin/club/speedrun/vods/Application.kt +++ b/api-server/src/main/kotlin/club/speedrun/vods/Application.kt @@ -1,11 +1,6 @@ package club.speedrun.vods -import club.speedrun.vods.marathon.ESAMarathon -import club.speedrun.vods.marathon.GDQMarathon -import club.speedrun.vods.marathon.GdqDatabase -import club.speedrun.vods.marathon.HEKMarathon -import club.speedrun.vods.marathon.Marathon -import club.speedrun.vods.marathon.RPGLBMarathon +import club.speedrun.vods.marathon.* import club.speedrun.vods.plugins.configureHTTP import club.speedrun.vods.plugins.configureMonitoring import club.speedrun.vods.plugins.configureOAuth @@ -34,7 +29,8 @@ val gdq = GDQMarathon() val esa = ESAMarathon() val hek = HEKMarathon() val rpglb = RPGLBMarathon() -val marathons: List = listOf(gdq, esa, hek, rpglb) +val bsg = BSGMarathon() +val marathons: List = listOf(gdq, esa, hek, rpglb, bsg) val rootDb = RootDatabase() val srcDb = SrcDatabase() val httpClient = HttpClient(OkHttp) { diff --git a/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt b/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt index 1150ef74..b5aba25b 100644 --- a/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt +++ b/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt @@ -369,6 +369,10 @@ class RPGLBMarathon : Marathon(RPGLB(), "rpglb", "RPG Limit Break", "https://rpg override fun getDonationUrl(event: EventData): String = "https://rpglimitbreak.com/tracker/ui/donate/${event.short}" override fun getScheduleUrl(event: EventData): String = "https://rpglimitbreak.com/tracker/runs/${event.id}" } +class BSGMarathon : Marathon(BSG(), "bsg", "Benelux Speedrunner Gathering", "https://bsgmarathon.com/") { + override fun getDonationUrl(event: EventData): String = "https://tracker.bsgmarathon.com/ui/donate/${event.short}" + override fun getScheduleUrl(event: EventData): String = "https://oengus.io/marathon/${event.short.lowercase()}/schedule" // this is so icky +} suspend fun Event.horaroSchedule(): FullSchedule? { if (horaroEvent == null || horaroSchedule == null) return null diff --git a/api-server/src/main/kotlin/club/speedrun/vods/plugins/Routing.kt b/api-server/src/main/kotlin/club/speedrun/vods/plugins/Routing.kt index 402205af..0a47f2d5 100644 --- a/api-server/src/main/kotlin/club/speedrun/vods/plugins/Routing.kt +++ b/api-server/src/main/kotlin/club/speedrun/vods/plugins/Routing.kt @@ -4,7 +4,6 @@ package club.speedrun.vods.plugins import club.speedrun.vods.* import club.speedrun.vods.marathon.* -import dev.qixils.gdq.models.Run import io.ktor.http.* import io.ktor.server.application.* import io.ktor.server.locations.* @@ -83,6 +82,7 @@ fun Application.configureRouting() { route("/esa", esa.route()) route("/hek", hek.route()) route("/rpglb", rpglb.route()) + route("/bsg", bsg.route()) } route("/v2") { diff --git a/kgdq/src/main/kotlin/dev/qixils/gdq/GDQ.kt b/kgdq/src/main/kotlin/dev/qixils/gdq/GDQ.kt index 1f392b90..c2303ec1 100644 --- a/kgdq/src/main/kotlin/dev/qixils/gdq/GDQ.kt +++ b/kgdq/src/main/kotlin/dev/qixils/gdq/GDQ.kt @@ -560,4 +560,5 @@ open class ESA( } class HEK : ESA("https://hekathon.esamarathon.com/search/") -class RPGLB : GDQ("https://tracker.rpglimitbreak.com/search/", ModelType.ALL.minus(ModelType.HEADSET)) \ No newline at end of file +class RPGLB : GDQ("https://tracker.rpglimitbreak.com/search/", ModelType.ALL.minus(ModelType.HEADSET)) +class BSG : GDQ("https://tracker.bsgmarathon.com/search/") // shockingly using a fresh fork of the GDQ tracker instead of ESA's ancient fork \ No newline at end of file diff --git a/web/src/app.css b/web/src/app.css index 170912b3..de819e7e 100644 --- a/web/src/app.css +++ b/web/src/app.css @@ -333,7 +333,6 @@ sup { .bid { display: flex; align-items: center; - position: relative; } .bid-body { From a10076dd39192663eef7071e52a6d93f42d9e998 Mon Sep 17 00:00:00 2001 From: Lexi Larkin Date: Wed, 16 Aug 2023 19:04:37 -0400 Subject: [PATCH 2/3] feat: add skipLoad param to EventList endpoint --- .../src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt b/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt index b5aba25b..6320c0e7 100644 --- a/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt +++ b/api-server/src/main/kotlin/club/speedrun/vods/marathon/Marathon.kt @@ -318,7 +318,7 @@ abstract class Marathon( } get { query -> - call.respond(getEventsData(query)) + call.respond(getEventsData(query, query.skipLoad)) } get { query -> @@ -348,7 +348,7 @@ abstract class Marathon( data class Organization(val stats: Boolean = true) @Location("/events") -data class EventList(val id: String? = null) // TODO: move to subroute +data class EventList(val id: String? = null, val skipLoad: Boolean = false) // TODO: move to subroute @Location("/runs") data class RunList(val id: String? = null, val event: String? = null, val runner: Int? = null) From afb4dac951280b4eaf10696b8ebab42d49c8d4f6 Mon Sep 17 00:00:00 2001 From: Lexi Larkin Date: Wed, 16 Aug 2023 19:14:51 -0400 Subject: [PATCH 3/3] fix: don't override run start times fixes esoteric/IRL runs slowly having their "start time" drift later into the day as they swap back and forth between OBS scenes fixes #126 --- .../kotlin/club/speedrun/vods/rabbit/RabbitManager.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/api-server/src/main/kotlin/club/speedrun/vods/rabbit/RabbitManager.kt b/api-server/src/main/kotlin/club/speedrun/vods/rabbit/RabbitManager.kt index fdde6411..8af36957 100644 --- a/api-server/src/main/kotlin/club/speedrun/vods/rabbit/RabbitManager.kt +++ b/api-server/src/main/kotlin/club/speedrun/vods/rabbit/RabbitManager.kt @@ -8,11 +8,7 @@ import com.github.twitch4j.helix.domain.StreamList import com.github.twitch4j.helix.domain.Video import com.github.twitch4j.helix.domain.VideoList import com.netflix.hystrix.HystrixCommand -import com.rabbitmq.client.CancelCallback -import com.rabbitmq.client.Channel -import com.rabbitmq.client.ConnectionFactory -import com.rabbitmq.client.DeliverCallback -import com.rabbitmq.client.Delivery +import com.rabbitmq.client.* import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.runBlocking @@ -129,7 +125,8 @@ class DeliverHandler( val runStart = sceneChanged.time.instant logger.info("Updating start time of run ${status.currentRun} to ${sceneChanged.time.iso}") val overrides = db.getOrCreateRunOverrides(null, status.currentRun) - overrides.startTime = runStart + if (overrides.startTime == null) + overrides.startTime = runStart // Fetching stream's video (should always be the latest video) val stream = streams.await().streams.firstOrNull() ?: return@coroutineScope val videos = async { twitch.videos(userId = stream.userId, type = Video.Type.ARCHIVE, limit = 1).execute() }