Skip to content

Commit

Permalink
fix: detekt lints
Browse files Browse the repository at this point in the history
  • Loading branch information
iyzana committed Apr 19, 2023
1 parent 47b2072 commit 494ec22
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
6 changes: 5 additions & 1 deletion backend/src/main/kotlin/de/randomerror/ytsync/Queue.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,12 @@ import kotlin.text.RegexOption.IGNORE_CASE

private val youtubeUrlRegex: Regex =
Regex("""https://(?:www\.)?youtu(?:\.be|be\.com)/(?:watch\?v=|embed/|shorts/)?([^?&]+)(?:.*)?""", IGNORE_CASE)

private const val FETCHER_CORE_POOL = 4
private const val FETCHER_MAX_POOL = 16
private const val FETCHER_KEEPALIVE_SECONDS = 60L
private val videoInfoFetcher: ExecutorService =
ThreadPoolExecutor(4, 16, 60L, SECONDS, LinkedBlockingQueue())
ThreadPoolExecutor(FETCHER_CORE_POOL, FETCHER_MAX_POOL, FETCHER_KEEPALIVE_SECONDS, SECONDS, LinkedBlockingQueue())

fun enqueue(session: Session, query: String): String {
val room = getRoom(session)
Expand Down
2 changes: 1 addition & 1 deletion backend/src/main/kotlin/de/randomerror/ytsync/VideoInfo.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fun fetchVideoInfo(query: String, youtubeId: String?): QueueItem? {
private fun fetchVideoInfoYouTubeOEmbed(query: String, youtubeId: String): QueueItem? {
val videoData = try {
URL("https://www.youtube.com/oembed?url=$query").readText()
} catch (e: FileNotFoundException) {
} catch (ignored: FileNotFoundException) {
return null
}
return try {
Expand Down

0 comments on commit 494ec22

Please sign in to comment.