Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
dunkyl committed Aug 16, 2023
2 parents 4e4a686 + afb4dac commit 27e4f83
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 18 deletions.
10 changes: 3 additions & 7 deletions api-server/src/main/kotlin/club/speedrun/vods/Application.kt
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -34,7 +29,8 @@ val gdq = GDQMarathon()
val esa = ESAMarathon()
val hek = HEKMarathon()
val rpglb = RPGLBMarathon()
val marathons: List<Marathon> = listOf(gdq, esa, hek, rpglb)
val bsg = BSGMarathon()
val marathons: List<Marathon> = listOf(gdq, esa, hek, rpglb, bsg)
val rootDb = RootDatabase()
val srcDb = SrcDatabase()
val httpClient = HttpClient(OkHttp) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ abstract class Marathon(
}

get<EventList> { query ->
call.respond(getEventsData(query))
call.respond(getEventsData(query, query.skipLoad))
}

get<RunList> { query ->
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.*
Expand Down Expand Up @@ -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") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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() }
Expand Down
3 changes: 2 additions & 1 deletion kgdq/src/main/kotlin/dev/qixils/gdq/GDQ.kt
Original file line number Diff line number Diff line change
Expand Up @@ -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))
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
1 change: 0 additions & 1 deletion web/src/app.css
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,6 @@ sup {
.bid {
display: flex;
align-items: center;
position: relative;
}

.bid-body {
Expand Down

0 comments on commit 27e4f83

Please sign in to comment.