Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

在线源资源太多不容易查找 #1508

Open
Him188 opened this issue Jan 15, 2025 · 2 comments
Open

在线源资源太多不容易查找 #1508

Him188 opened this issue Jan 15, 2025 · 2 comments
Labels
M 重要优先级 s: media selector 子系统: 资源选择器
Milestone

Comments

@Him188
Copy link
Member

Him188 commented Jan 15, 2025

可以把在线源也 group 起来,点卡片左下角切换源。

@Him188 Him188 added M 重要优先级 s: media selector 子系统: 资源选择器 labels Jan 15, 2025
@Him188 Him188 added this to the 4.4.0 milestone Jan 15, 2025
@Him188 Him188 changed the title 在线源资源太多不容易 在线源资源太多不容易查找 Jan 15, 2025
@Him188
Copy link
Member Author

Him188 commented Jan 17, 2025

把在线源也 group 起来,点卡片左下角切换源

实现了一下, 但我实际测试体验并不好:

  • 点击左下角会有上十个项目, 不容易记得自己测试到哪一个了
  • 选择一个之后, 会记忆这个线路名称 (记忆 alliance), 导致 group 的左下角里只有一个项目了, 无法选择 (其他源的) 其他线路.

综合考虑不采用这个方法.

Subject: [PATCH] f
---
Index: app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaGroup.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaGroup.kt b/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaGroup.kt
--- a/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaGroup.kt	(revision 653de44ab3492bead120928facfdb1f907146b9e)
+++ b/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaGroup.kt	(date 1737072954250)
@@ -49,6 +49,7 @@
 object MediaGrouper {
     fun getGroupId(media: Media): String {
         return when (media.kind) {
+            MediaSourceKind.WEB,
             MediaSourceKind.BitTorrent -> {
                 var title = media.originalTitle
                 if (title.startsWith('[')) {
@@ -57,7 +58,6 @@
                 return title
             }
 
-            MediaSourceKind.WEB,
             MediaSourceKind.LocalCache -> media.mediaId
         }
     }
Index: app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaSelectorItem.kt
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaSelectorItem.kt b/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaSelectorItem.kt
--- a/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaSelectorItem.kt	(revision 653de44ab3492bead120928facfdb1f907146b9e)
+++ b/app/shared/src/commonMain/kotlin/ui/subject/episode/mediaFetch/MediaSelectorItem.kt	(date 1737073447234)
@@ -50,11 +50,12 @@
 import me.him188.ani.app.domain.media.selector.UnsafeOriginalMediaAccess
 import me.him188.ani.app.platform.currentAniBuildConfig
 import me.him188.ani.app.tools.formatDateTime
-import me.him188.ani.app.ui.foundation.theme.weaken
 import me.him188.ani.app.ui.media.renderSubtitleLanguage
 import me.him188.ani.app.ui.settings.rendering.MediaSourceIcon
 import me.him188.ani.app.ui.settings.rendering.MediaSourceIcons
 import me.him188.ani.datasources.api.Media
+import me.him188.ani.datasources.api.source.MediaSourceInfo
+import me.him188.ani.datasources.api.source.MediaSourceKind
 import me.him188.ani.datasources.api.topic.FileSize
 
 
@@ -264,9 +265,10 @@
     var showMenu by rememberSaveable { mutableStateOf(false) }
     ExposedDropdownMenuBox(showMenu, { showMenu = it }, modifier) {
         val currentItem = groupState.selectedItem ?: group.first.original
-        val currentSourceInfo by mediaSourceInfoProvider.rememberMediaSourceInfo(currentItem.mediaSourceId)
+        val currentSourceInfo = mediaSourceInfoProvider.rememberMediaSourceInfo(currentItem.mediaSourceId).value
+
         TextField(
-            value = currentSourceInfo?.displayName ?: "未知",
+            value = renderMediaSourceDisplay(currentSourceInfo, currentItem),
             onValueChange = {},
             Modifier
                 .widthIn(min = 48.dp) // override default
@@ -298,7 +300,7 @@
                 val item = maybeExcluded.original
                 val sourceInfo by mediaSourceInfoProvider.rememberMediaSourceInfo(item.mediaSourceId)
                 DropdownMenuItem(
-                    text = { Text(sourceInfo?.displayName ?: "未知") },
+                    text = { renderMediaSourceDisplay(sourceInfo, item) },
                     leadingIcon = { MediaSourceIcon(sourceInfo, Modifier.size(24.dp)) },
                     onClick = {
                         groupState.selectedItem = item
@@ -311,3 +313,17 @@
         }
     }
 }
+
+private fun renderMediaSourceDisplay(
+    currentSourceInfo: MediaSourceInfo?,
+    currentItem: Media
+) = if (currentSourceInfo == null) {
+    "未知"
+} else {
+    if (currentItem.kind == MediaSourceKind.WEB) {
+        // WEB 源, 显示线路名称
+        "${currentSourceInfo.displayName} ${currentItem.properties.alliance}"
+    } else {
+        currentSourceInfo.displayName
+    }
+}

@Him188
Copy link
Member Author

Him188 commented Jan 17, 2025

考虑提供一个更高信息密度的 UI 视图. 例如考虑去除那些没用的 (而且占一行的) labels. 字幕语言实际上可以用过滤方式完成

@Him188 Him188 modified the milestones: 4.4.0, 4.5.0 Jan 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
M 重要优先级 s: media selector 子系统: 资源选择器
Projects
None yet
Development

No branches or pull requests

1 participant