Skip to content

Commit

Permalink
MediaSelector: 只聚合 BT 源
Browse files Browse the repository at this point in the history
  • Loading branch information
Him188 committed Sep 23, 2024
1 parent 11c50ef commit e54ac69
Showing 1 changed file with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ package me.him188.ani.app.ui.subject.episode.mediaFetch
import androidx.compose.runtime.Immutable
import androidx.compose.runtime.Stable
import me.him188.ani.datasources.api.Media
import me.him188.ani.datasources.api.source.MediaSourceKind

@Immutable // only after build
class MediaGroup @MediaGroupBuilderApi internal constructor(
Expand All @@ -38,11 +39,18 @@ internal annotation class MediaGroupBuilderApi
@OptIn(MediaGroupBuilderApi::class)
object MediaGrouper {
fun getGroupId(media: Media): String {
var title = media.originalTitle
if (title.startsWith('[')) {
title = title.substringAfter(']')
return when (media.kind) {
MediaSourceKind.BitTorrent -> {
var title = media.originalTitle
if (title.startsWith('[')) {
title = title.substringAfter(']')
}
return title
}

MediaSourceKind.WEB,
MediaSourceKind.LocalCache -> media.mediaId
}
return title
}

fun getItemIdWithinGroup(media: Media): String {
Expand Down

0 comments on commit e54ac69

Please sign in to comment.