Skip to content

Commit

Permalink
fix channel number did not disappear
Browse files Browse the repository at this point in the history
  • Loading branch information
lizongying committed Feb 4, 2024
1 parent 1714633 commit 4fb27ba
Show file tree
Hide file tree
Showing 11 changed files with 135 additions and 99 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,18 @@

## 更新日志

### v1.5.2(通用版)

* 修复APP恢复后频道号、频道列表不自动消失的问题

### v1.5.1(高版本专用)

* 性能优化

### v1.5.0(通用版)

* 修复部分情况下APP切换后无法继续播放的问题

### v1.4.9(高版本专用)

* 同步v1.4.8
Expand Down Expand Up @@ -86,6 +94,22 @@
adb install my-tv.apk
```

## TODO

* 音量不同
* 大湾区卫视、广东4k超高清、广东珠江
* CETV教育频道
* CHC高清三个电影频道
* 地方频道
* 收藏夹
* 自定义源
* 凤凰卫视、凤凰资讯台
* 海外
* 1.5.0 无法安装,1.5.1 可以安装
* 获取系统时间
* 选中的图标比例能否相差更大
* 自动重连

## 赞赏

![image](./screenshots/appreciate.jpeg)
4 changes: 2 additions & 2 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ plugins {

android {
namespace 'com.lizongying.mytv'
compileSdk 33
compileSdk 34

viewBinding {
enabled = true
Expand Down Expand Up @@ -90,7 +90,7 @@ static def VersionName() {
}

dependencies {
def media3_version = "1.1.1"
def media3_version = "1.2.1"

implementation "androidx.media3:media3-ui:$media3_version"

Expand Down
Binary file modified app/src/main/cpp/arm64-v8a/libnative.so
Binary file not shown.
7 changes: 7 additions & 0 deletions app/src/main/java/com/lizongying/mytv/ChannelFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,13 @@ class ChannelFragment : Fragment() {
}
}

override fun onResume() {
super.onResume()
if (view?.visibility == View.VISIBLE) {
handler.postDelayed(hideRunnable, delay)
}
}

override fun onPause() {
super.onPause()
handler.removeCallbacks(hideRunnable)
Expand Down
5 changes: 4 additions & 1 deletion app/src/main/java/com/lizongying/mytv/MainActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ class MainActivity : FragmentActivity() {
}

override fun onFling(
e1: MotionEvent,
e1: MotionEvent?,
e2: MotionEvent,
velocityX: Float,
velocityY: Float
Expand Down Expand Up @@ -495,6 +495,9 @@ class MainActivity : FragmentActivity() {
override fun onResume() {
Log.i(TAG, "onResume")
super.onResume()
if (!mainFragment.isHidden){
handler.postDelayed(hideMain, delayHideMain)
}
}

override fun onPause() {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/lizongying/mytv/MainFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ class MainFragment : BrowseSupportFragment() {
val cardPresenter = CardPresenter(viewLifecycleOwner)

var idx: Long = 0
TVList.init(requireContext())
context?.let { TVList.init(it) }
for ((k, v) in TVList.list) {
val listRowAdapter = ArrayObjectAdapter(cardPresenter)
for ((idx2, v1) in v.withIndex()) {
Expand Down
24 changes: 13 additions & 11 deletions app/src/main/java/com/lizongying/mytv/Request.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ class Request {
private var tokenRunnable: TokenRunnable = TokenRunnable()

private val regex = Regex("""des_key = "([^"]+).+var des_iv = "([^"]+)""")
private val input =
"""{"mver":"1","subver":"1.2","host":"www.yangshipin.cn/#/tv/home?pid=","referer":"","canvas":"YSPANGLE(Apple,AppleM1Pro,OpenGL4.1)"}""".toByteArray()

private var mapping = mapOf(
"CCTV4K" to "CCTV4K 超高清",
Expand Down Expand Up @@ -134,7 +136,7 @@ class Request {
keyBytes + byteArrayOf(0, 0, 0, 0, 0, 0, 0, 0),
ivBytes
).uppercase()
Log.d(TAG, "$title url $url")
// Log.d(TAG, "$title url $url")
tvModel.addVideoUrl(url)
tvModel.allReady()
tvModel.retryTimes = 0
Expand Down Expand Up @@ -202,7 +204,7 @@ class Request {
}

override fun onFailure(call: Call<LiveInfo>, t: Throwable) {
Log.e(TAG, "$title request error")
Log.e(TAG, "$title request error $t")
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
tvModel.retryTimes++
if (tvModel.getTV().needToken) {
Expand Down Expand Up @@ -231,7 +233,7 @@ class Request {
token = response.body()?.data?.token!!
Log.i(TAG, "info success $token")
val cookie =
"vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; yspappid=519748109;yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"
fetchVideo(tvModel, cookie)
} else {
Log.e(TAG, "info status error")
Expand All @@ -240,7 +242,8 @@ class Request {
fetchVideo(tvModel)
} else {
if (!tvModel.getTV().mustToken) {
val cookie = "vplatform=109"
val cookie =
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; yspappid=519748109"
fetchVideo(tvModel, cookie)
}
}
Expand All @@ -254,15 +257,16 @@ class Request {
fetchVideo(tvModel)
} else {
if (!tvModel.getTV().mustToken) {
val cookie = "vplatform=109"
val cookie =
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; yspappid=519748109"
fetchVideo(tvModel, cookie)
}
}
}
})
} else {
val cookie =
"vplatform=109; yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; yspappid=519748109;yspopenid=vu0-8lgGV2LW9QjDeuBFsX8yMnzs37Q3_HZF6XyVDpGR_I; vusession=$token"
fetchVideo(tvModel, cookie)
}
}
Expand All @@ -271,7 +275,8 @@ class Request {
if (tvModel.getTV().needToken) {
fetchVideo(tvModel)
} else {
val cookie = "vplatform=109"
val cookie =
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; yspappid=519748109"
fetchVideo(tvModel, cookie)
}
}
Expand Down Expand Up @@ -412,15 +417,12 @@ class Request {
}

private fun encryptTripleDES(key: ByteArray, iv: ByteArray): String {
val plaintext =
"""{"mver":"1","subver":"1.2","host":"www.yangshipin.cn/#/tv/home?pid=","referer":"","canvas":"YSPANGLE(Apple,AppleM1Pro,OpenGL4.1)"}"""
return try {
val keySpec = SecretKeySpec(key, "DESede")
val ivSpec = IvParameterSpec(iv)
val cipher = Cipher.getInstance("DESede/CBC/PKCS5Padding")
cipher.init(Cipher.ENCRYPT_MODE, keySpec, ivSpec)
val encryptedBytes = cipher.doFinal(plaintext.toByteArray())
return encryptedBytes.let { it -> it.joinToString("") { "%02x".format(it) } }
return cipher.doFinal(input).let { it -> it.joinToString("") { "%02x".format(it) } }
} catch (e: Exception) {
e.printStackTrace()
""
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/com/lizongying/mytv/TVList.kt
Original file line number Diff line number Diff line change
Expand Up @@ -7,31 +7,31 @@ import java.io.File

object TVList {
lateinit var list: Map<String, List<TV>>
private val channels = "channels.json"

fun init(context: Context){
if(::list.isInitialized){
fun init(context: Context) {
if (::list.isInitialized) {
return
}
synchronized(this){
if(::list.isInitialized){
synchronized(this) {
if (::list.isInitialized) {
return
}
list = setupTV(context)
}
}


private fun setupTV(context:Context): Map<String, List<TV>> {
private fun setupTV(context: Context): Map<String, List<TV>> {
val map: MutableMap<String, MutableList<TV>> = mutableMapOf()
val appDirectory = Utils.getAppDirectory(context)

//检查当前目录下是否存在channels.json
var file = File(appDirectory, "channels.json")
val file = File(appDirectory, channels)
if (!file.exists()) {
//不存在则从assets中拷贝
file = File(appDirectory, "channels.json")
file.createNewFile()
context.assets.open("channels.json").use { input ->
context.resources.openRawResource(R.raw.channels).use { input ->
file.outputStream().use { output ->
input.copyTo(output)
}
Expand All @@ -42,7 +42,7 @@ object TVList {
val json = file.readText()
//防止类型擦除
val type = object : TypeToken<Array<TV>>() {}.type
Gson().fromJson<Array<TV>>(json, type).forEach {
Gson().fromJson<Array<TV>>(json, type)?.forEach {
if (map.containsKey(it.channel)) {
map[it.channel]?.add(it)
} else {
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/lizongying/mytv/Utils.kt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ object Utils {
* @param context 应用环境信息
* @return 服务器地址
*/
fun getServerUrl(context: Context): String {
private fun getServerUrl(context: Context): String {
return context.resources.getString(R.string.server_url)
}
}
Loading

4 comments on commit 4fb27ba

@hlh2518
Copy link

@hlh2518 hlh2518 commented on 4fb27ba Feb 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

播放几分钟后还是卡住、重新切换频道后又正常,播放几分钟后又卡住

@thehellstarrecords
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hellstar is a bold and edgy clothing brand known for its cutting-edge designs and high-quality materials. Specializing in urban streetwear and contemporary fashion, hellstar clothing brand combines a rebellious spirit with urban sophistication, appealing to trendsetters and fashion enthusiasts alike.

@thehellstarrecords
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inheriting a timeshare can present several challenges. Financially, you may face ongoing maintenance fees and special assessments, which can be substantial. Legally, transferring ownership involves navigating complex contract terms and potential probate issues. Additionally, you may encounter difficulties if the timeshare's market Challenges of timeshare inheritance has declined. Understanding these challenges and seeking legal and financial advice is crucial to managing timeshare inheritance effectively.

@thehellstarrecords
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To exit an Ocean Canyon Properties contract, start by reviewing the agreement for cancellation clauses or a rescission period. Contact the company to discuss your options, and consider seeking legal advice for guidance how to get out of ocean canyon properties contract. You might also explore reputable timeshare exit companies or negotiate directly with Ocean Canyon Properties for a resolution. Understanding your rights and options is crucial.

Please sign in to comment.