Skip to content

Commit

Permalink
Add SubtitleOperationUrlHook
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsvanvelzen committed Feb 8, 2025
1 parent f83a162 commit df5509a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import org.jellyfin.openapi.hooks.api.BinaryOperationUrlHook
import org.jellyfin.openapi.hooks.api.ClientLogOperationUrlHook
import org.jellyfin.openapi.hooks.api.LargeOperationRequestModelHook
import org.jellyfin.openapi.hooks.api.PlayStateServiceNameHook
import org.jellyfin.openapi.hooks.api.SubtitleOperationUrlHook
import org.jellyfin.openapi.hooks.model.DotNetDescriptionHook
import org.jellyfin.openapi.hooks.model.ImageMapsHook
import org.jellyfin.openapi.hooks.model.LiveTVModelsHook
Expand All @@ -17,6 +18,7 @@ val hooksModule = module {

single { BinaryOperationUrlHook() } bind OperationUrlHook::class
single { ClientLogOperationUrlHook() } bind OperationUrlHook::class
single { SubtitleOperationUrlHook() } bind OperationUrlHook::class

single { LargeOperationRequestModelHook() } bind OperationRequestModelHook::class

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.jellyfin.openapi.hooks.api

import org.jellyfin.openapi.constants.Strings
import org.jellyfin.openapi.hooks.OperationUrlHook
import org.jellyfin.openapi.model.ApiService
import org.jellyfin.openapi.model.ApiServiceOperation

class SubtitleOperationUrlHook : OperationUrlHook {
override fun shouldOperationBuildUrlFun(api: ApiService, operation: ApiServiceOperation) =
api.name == "Subtitle${Strings.API_SERVICE_SUFFIX}" && operation.name.startsWith("getSubtitle")
}

0 comments on commit df5509a

Please sign in to comment.