pull/1296/head
gedoor 3 years ago
parent bd0de92869
commit ef2b0f9cd1
  1. 1
      app/src/main/java/io/legado/app/model/AudioPlay.kt
  2. 9
      app/src/main/java/io/legado/app/model/analyzeRule/AnalyzeUrl.kt
  3. 4
      app/src/main/java/io/legado/app/service/AudioPlayService.kt

@ -37,7 +37,6 @@ object AudioPlay {
durChapter?.let { durChapter?.let {
context.startService<AudioPlayService> { context.startService<AudioPlayService> {
action = IntentAction.play action = IntentAction.play
} }
} }
} }

@ -314,6 +314,9 @@ class AnalyzeUrl(
} }
} }
/**
* 访问网站,返回StrResponse
*/
suspend fun getStrResponse( suspend fun getStrResponse(
jsStr: String? = null, jsStr: String? = null,
sourceRegex: String? = null, sourceRegex: String? = null,
@ -349,6 +352,9 @@ class AnalyzeUrl(
} }
} }
/**
* 访问网站,返回ByteArray
*/
suspend fun getByteArray(): ByteArray { suspend fun getByteArray(): ByteArray {
judgmentConcurrent() judgmentConcurrent()
setCookie(source?.getStoreUrl()) setCookie(source?.getStoreUrl())
@ -369,6 +375,9 @@ class AnalyzeUrl(
}.bytes() }.bytes()
} }
/**
* 上传文件
*/
suspend fun upload(fileName: String, file: ByteArray, contentType: String): StrResponse { suspend fun upload(fileName: String, file: ByteArray, contentType: String): StrResponse {
return getProxyClient(proxy).newCallStrResponse(retry) { return getProxyClient(proxy).newCallStrResponse(retry) {
url(url) url(url)

@ -115,6 +115,9 @@ class AudioPlayService : BaseService(),
postEvent(EventBus.AUDIO_STATE, Status.STOP) postEvent(EventBus.AUDIO_STATE, Status.STOP)
} }
/**
* 播放音频
*/
private fun play() { private fun play() {
upNotification() upNotification()
if (requestFocus()) { if (requestFocus()) {
@ -122,7 +125,6 @@ class AudioPlayService : BaseService(),
AudioPlay.status = Status.STOP AudioPlay.status = Status.STOP
postEvent(EventBus.AUDIO_STATE, Status.STOP) postEvent(EventBus.AUDIO_STATE, Status.STOP)
upPlayProgressJob?.cancel() upPlayProgressJob?.cancel()
exoPlayer.clearMediaItems()
val analyzeUrl = val analyzeUrl =
AnalyzeUrl( AnalyzeUrl(
url, url,

Loading…
Cancel
Save