Skip to content

Commit bdda400

Browse files
committed
[Bug修复](master): 修复空路径判断异常
1 parent df7a131 commit bdda400

File tree

6 files changed

+28
-21
lines changed

6 files changed

+28
-21
lines changed

common_component/src/main/java/com/xyoye/common_component/config/PlayerConfigTable.kt

+4
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,8 @@ object PlayerConfigTable {
4848
//视频倍速
4949
@MMKVFiled
5050
val videoSpeed = 25
51+
52+
//自动播放下一集
53+
@MMKVFiled
54+
val autoPlayNext = true
5155
}

common_component/src/main/java/com/xyoye/common_component/source/factory/FTPSourceFactory.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.xyoye.common_component.source.factory
22

3+
import android.text.TextUtils
34
import com.xyoye.common_component.config.DanmuConfig
45
import com.xyoye.common_component.config.SubtitleConfig
56
import com.xyoye.common_component.extension.formatFileName
@@ -83,8 +84,8 @@ object FTPSourceFactory {
8384
extSources: List<FTPFile>
8485
): Pair<Int, String?> {
8586
//从播放记录读取弹幕
86-
if (history?.danmuPath != null) {
87-
return Pair(history.episodeId, history.danmuPath)
87+
if (TextUtils.isEmpty(history?.danmuPath).not()) {
88+
return Pair(history!!.episodeId, history.danmuPath)
8889
}
8990

9091
//匹配同文件夹内同名弹幕
@@ -112,8 +113,8 @@ object FTPSourceFactory {
112113
extSources: List<FTPFile>
113114
): String? {
114115
//从播放记录读取弹幕
115-
if (history?.subtitlePath != null) {
116-
return history.subtitlePath
116+
if (TextUtils.isEmpty(history?.subtitlePath).not()) {
117+
return history!!.subtitlePath
117118
}
118119

119120
//匹配同文件夹内同名字幕

common_component/src/main/java/com/xyoye/common_component/source/factory/LocalSourceFactory.kt

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
package com.xyoye.common_component.source.factory
22

3+
import android.text.TextUtils
34
import com.xyoye.common_component.config.DanmuConfig
45
import com.xyoye.common_component.config.SubtitleConfig
5-
import com.xyoye.common_component.database.DatabaseManager
66
import com.xyoye.common_component.extension.toMd5String
77
import com.xyoye.common_component.source.base.VideoSourceFactory
88
import com.xyoye.common_component.source.media.LocalMediaSource
@@ -45,8 +45,8 @@ object LocalSourceFactory {
4545

4646
private fun getVideoDanmu(video: VideoEntity, history: PlayHistoryEntity?): Pair<Int, String?> {
4747
//当前视频已绑定弹幕
48-
if (history?.danmuPath != null) {
49-
return Pair(history.episodeId, history.danmuPath)
48+
if (TextUtils.isEmpty(history?.danmuPath).not()) {
49+
return Pair(history!!.episodeId, history.danmuPath)
5050
}
5151
//从本地找同名弹幕
5252
if (DanmuConfig.isAutoLoadSameNameDanmu()) {
@@ -59,8 +59,8 @@ object LocalSourceFactory {
5959

6060
private suspend fun getVideoSubtitle(video: VideoEntity, history: PlayHistoryEntity?): String? {
6161
//当前视频已绑定字幕
62-
if (history?.subtitlePath != null) {
63-
return history.subtitlePath
62+
if (TextUtils.isEmpty(history?.subtitlePath).not()) {
63+
return history!!.subtitlePath
6464
}
6565
//自动加载本地同名字幕
6666
if (SubtitleConfig.isAutoLoadSameNameSubtitle()) {

common_component/src/main/java/com/xyoye/common_component/source/factory/RemoteSourceFactory.kt

+4-4
Original file line numberDiff line numberDiff line change
@@ -59,8 +59,8 @@ object RemoteSourceFactory {
5959
videoData: RemoteVideoData
6060
): Pair<Int, String?> {
6161
//从播放记录读取弹幕
62-
if (history?.danmuPath != null) {
63-
return Pair(history.episodeId, history.danmuPath)
62+
if (TextUtils.isEmpty(history?.danmuPath).not()) {
63+
return Pair(history!!.episodeId, history.danmuPath)
6464
}
6565

6666
//自动匹配同文件夹内同名弹幕
@@ -86,8 +86,8 @@ object RemoteSourceFactory {
8686
videoData: RemoteVideoData
8787
): String? {
8888
//从播放记录读取弹幕
89-
if (history?.subtitlePath != null) {
90-
return history.subtitlePath
89+
if (TextUtils.isEmpty(history?.subtitlePath).not()) {
90+
return history!!.subtitlePath
9191
}
9292

9393
//自动匹配同文件夹内同名字幕

common_component/src/main/java/com/xyoye/common_component/source/factory/SmbSourceFactory.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.xyoye.common_component.source.factory
22

3+
import android.text.TextUtils
34
import com.xyoye.common_component.config.DanmuConfig
45
import com.xyoye.common_component.config.SubtitleConfig
56
import com.xyoye.common_component.extension.toMd5String
@@ -71,8 +72,8 @@ object SmbSourceFactory {
7172
extSources: List<SMBFile>
7273
): Pair<Int, String?> {
7374
//从播放记录读取弹幕
74-
if (history?.danmuPath != null) {
75-
return Pair(history.episodeId, history.danmuPath)
75+
if (TextUtils.isEmpty(history?.danmuPath).not()) {
76+
return Pair(history!!.episodeId, history.danmuPath)
7677
}
7778

7879
//匹配同文件夹内同名弹幕
@@ -100,8 +101,8 @@ object SmbSourceFactory {
100101
extSources: List<SMBFile>
101102
): String? {
102103
//从播放记录读取弹幕
103-
if (history?.subtitlePath != null) {
104-
return history.subtitlePath
104+
if (TextUtils.isEmpty(history?.subtitlePath).not()) {
105+
return history!!.subtitlePath
105106
}
106107

107108
//匹配同文件夹内同名字幕

common_component/src/main/java/com/xyoye/common_component/source/factory/WebDavSourceFactory.kt

+5-4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.xyoye.common_component.source.factory
22

3+
import android.text.TextUtils
34
import com.xyoye.common_component.config.DanmuConfig
45
import com.xyoye.common_component.config.SubtitleConfig
56
import com.xyoye.common_component.extension.toMd5String
@@ -75,8 +76,8 @@ object WebDavSourceFactory {
7576
history: PlayHistoryEntity?
7677
): Pair<Int, String?> {
7778
//从播放记录读取弹幕
78-
if (history?.danmuPath != null) {
79-
return Pair(history.episodeId, history.danmuPath)
79+
if (TextUtils.isEmpty(history?.danmuPath).not()) {
80+
return Pair(history!!.episodeId, history.danmuPath)
8081
}
8182

8283
//匹配同文件夹内同名弹幕
@@ -102,8 +103,8 @@ object WebDavSourceFactory {
102103
history: PlayHistoryEntity?
103104
): String? {
104105
//从播放记录读取字幕
105-
if (history?.subtitlePath != null) {
106-
return history.subtitlePath
106+
if (TextUtils.isEmpty(history?.subtitlePath).not()) {
107+
return history!!.subtitlePath
107108
}
108109

109110
//匹配同文件夹内同名字幕

0 commit comments

Comments
 (0)