Skip to content

Commit

Permalink
[Bug修复](master): 修复空路径判断异常
Browse files Browse the repository at this point in the history
  • Loading branch information
xyoye committed Jan 29, 2022
1 parent df7a131 commit bdda400
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,8 @@ object PlayerConfigTable {
//视频倍速
@MMKVFiled
val videoSpeed = 25

//自动播放下一集
@MMKVFiled
val autoPlayNext = true
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xyoye.common_component.source.factory

import android.text.TextUtils
import com.xyoye.common_component.config.DanmuConfig
import com.xyoye.common_component.config.SubtitleConfig
import com.xyoye.common_component.extension.formatFileName
Expand Down Expand Up @@ -83,8 +84,8 @@ object FTPSourceFactory {
extSources: List<FTPFile>
): Pair<Int, String?> {
//从播放记录读取弹幕
if (history?.danmuPath != null) {
return Pair(history.episodeId, history.danmuPath)
if (TextUtils.isEmpty(history?.danmuPath).not()) {
return Pair(history!!.episodeId, history.danmuPath)
}

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

//匹配同文件夹内同名字幕
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.xyoye.common_component.source.factory

import android.text.TextUtils
import com.xyoye.common_component.config.DanmuConfig
import com.xyoye.common_component.config.SubtitleConfig
import com.xyoye.common_component.database.DatabaseManager
import com.xyoye.common_component.extension.toMd5String
import com.xyoye.common_component.source.base.VideoSourceFactory
import com.xyoye.common_component.source.media.LocalMediaSource
Expand Down Expand Up @@ -45,8 +45,8 @@ object LocalSourceFactory {

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

private suspend fun getVideoSubtitle(video: VideoEntity, history: PlayHistoryEntity?): String? {
//当前视频已绑定字幕
if (history?.subtitlePath != null) {
return history.subtitlePath
if (TextUtils.isEmpty(history?.subtitlePath).not()) {
return history!!.subtitlePath
}
//自动加载本地同名字幕
if (SubtitleConfig.isAutoLoadSameNameSubtitle()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ object RemoteSourceFactory {
videoData: RemoteVideoData
): Pair<Int, String?> {
//从播放记录读取弹幕
if (history?.danmuPath != null) {
return Pair(history.episodeId, history.danmuPath)
if (TextUtils.isEmpty(history?.danmuPath).not()) {
return Pair(history!!.episodeId, history.danmuPath)
}

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

//自动匹配同文件夹内同名字幕
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xyoye.common_component.source.factory

import android.text.TextUtils
import com.xyoye.common_component.config.DanmuConfig
import com.xyoye.common_component.config.SubtitleConfig
import com.xyoye.common_component.extension.toMd5String
Expand Down Expand Up @@ -71,8 +72,8 @@ object SmbSourceFactory {
extSources: List<SMBFile>
): Pair<Int, String?> {
//从播放记录读取弹幕
if (history?.danmuPath != null) {
return Pair(history.episodeId, history.danmuPath)
if (TextUtils.isEmpty(history?.danmuPath).not()) {
return Pair(history!!.episodeId, history.danmuPath)
}

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

//匹配同文件夹内同名字幕
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.xyoye.common_component.source.factory

import android.text.TextUtils
import com.xyoye.common_component.config.DanmuConfig
import com.xyoye.common_component.config.SubtitleConfig
import com.xyoye.common_component.extension.toMd5String
Expand Down Expand Up @@ -75,8 +76,8 @@ object WebDavSourceFactory {
history: PlayHistoryEntity?
): Pair<Int, String?> {
//从播放记录读取弹幕
if (history?.danmuPath != null) {
return Pair(history.episodeId, history.danmuPath)
if (TextUtils.isEmpty(history?.danmuPath).not()) {
return Pair(history!!.episodeId, history.danmuPath)
}

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

//匹配同文件夹内同名字幕
Expand Down

0 comments on commit bdda400

Please sign in to comment.