mirror of
https://github.com/lizongying/my-tv.git
synced 2026-10-30 16:16:33 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
31ec13eed7 | ||
|
|
5a78913407 | ||
|
|
bb38cf5033 | ||
|
|
51d9c4c2a7 | ||
|
|
70da1d8241 | ||
|
|
ef17427f64 | ||
|
|
c1143afb4e | ||
|
|
68f158e556 | ||
|
|
4ef95d60c4 | ||
|
|
b782d1f841 |
@@ -37,6 +37,13 @@ jobs:
|
|||||||
# override default build-tools version (29.0.3) -- optional
|
# override default build-tools version (29.0.3) -- optional
|
||||||
BUILD_TOOLS_VERSION: "34.0.0"
|
BUILD_TOOLS_VERSION: "34.0.0"
|
||||||
|
|
||||||
|
- name: Get History
|
||||||
|
id: get_history
|
||||||
|
run: |
|
||||||
|
chmod +x history.sh
|
||||||
|
output=$(./history.sh)
|
||||||
|
echo "$output" > history.md
|
||||||
|
|
||||||
- name: Create Release
|
- name: Create Release
|
||||||
id: create_release
|
id: create_release
|
||||||
uses: actions/create-release@v1
|
uses: actions/create-release@v1
|
||||||
@@ -47,6 +54,7 @@ jobs:
|
|||||||
release_name: Release ${{ github.ref }}
|
release_name: Release ${{ github.ref }}
|
||||||
draft: false
|
draft: false
|
||||||
prerelease: false
|
prerelease: false
|
||||||
|
body_path: history.md
|
||||||
|
|
||||||
- name: Upload Release Asset
|
- name: Upload Release Asset
|
||||||
uses: actions/upload-release-asset@v1
|
uses: actions/upload-release-asset@v1
|
||||||
@@ -56,4 +64,19 @@ jobs:
|
|||||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||||
asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }}
|
asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }}
|
||||||
asset_name: my-tv-${{ github.ref_name }}.apk
|
asset_name: my-tv-${{ github.ref_name }}.apk
|
||||||
asset_content_type: application/vnd.android.package-archive
|
asset_content_type: application/vnd.android.package-archive
|
||||||
|
|
||||||
|
- name: Gitee Create Release
|
||||||
|
run: |
|
||||||
|
latest_commit=$(git rev-parse HEAD)
|
||||||
|
history=$(cat history.md)
|
||||||
|
curl -v POST https://gitee.com/api/v5/repos/${{ github.repository }}/releases \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-d '{
|
||||||
|
"access_token": "${{ secrets.GITEE_ACCESS_TOKEN}}",
|
||||||
|
"tag_name": "${{ github.ref_name }}",
|
||||||
|
"name": "Release ${{ github.ref_name }}",
|
||||||
|
"body": "'"$history"'",
|
||||||
|
"prerelease": false,
|
||||||
|
"target_commitish": "'"$latest_commit"'"
|
||||||
|
}'
|
||||||
+19
@@ -1,5 +1,24 @@
|
|||||||
## 更新日志
|
## 更新日志
|
||||||
|
|
||||||
|
### v2.0.8
|
||||||
|
|
||||||
|
* 修复部分设备闪退的问题
|
||||||
|
* 修复设置页可能显示不全的问题
|
||||||
|
|
||||||
|
### v2.0.5
|
||||||
|
|
||||||
|
* 设置页增加恢复默认按钮,目前只用于同步系统时间
|
||||||
|
|
||||||
|
### v2.0.4
|
||||||
|
|
||||||
|
* 修复不能播放的问题
|
||||||
|
* 包含国际频道
|
||||||
|
|
||||||
|
### v2.0.3
|
||||||
|
|
||||||
|
* 修复不能播放的问题
|
||||||
|
* 不包含国际频道
|
||||||
|
|
||||||
### v2.0.0
|
### v2.0.0
|
||||||
|
|
||||||
* 解决卡顿问题
|
* 解决卡顿问题
|
||||||
|
|||||||
@@ -16,4 +16,4 @@ gen-version:
|
|||||||
|
|
||||||
#make gen v=v2.0.0
|
#make gen v=v2.0.0
|
||||||
gen:
|
gen:
|
||||||
echo $(v) | sed 's/v/ /g' | sed 's/\./ /g' | sed 's/-/ /g' | awk '{print "{\"version_code\": " ($$1*16777216)+($$2*65536)+($$3*256)+$$4 ", \"version_name\": \"" "$(v)" "\"}"}' > version.json
|
echo $(v) | sed 's/v/ /g' | sed 's/\./ /g' | sed 's/-/ /g' | awk '{print "{\"version_code\": " ($$1*16777216)+($$2*65536)+($$3*256)+$$4 ", \"version_name\": \"" "v$(v)" "\"}"}' > version.json
|
||||||
+6
-2
@@ -89,7 +89,7 @@ static def VersionName() {
|
|||||||
process.waitFor()
|
process.waitFor()
|
||||||
def versionName = process.text.trim() - "v"
|
def versionName = process.text.trim() - "v"
|
||||||
if (versionName.isEmpty()) {
|
if (versionName.isEmpty()) {
|
||||||
versionName = "1.0.0"
|
versionName = "1.0.0"
|
||||||
}
|
}
|
||||||
return versionName
|
return versionName
|
||||||
} catch (ignored) {
|
} catch (ignored) {
|
||||||
@@ -114,7 +114,11 @@ dependencies {
|
|||||||
def retrofit2_version = "2.6.4"
|
def retrofit2_version = "2.6.4"
|
||||||
|
|
||||||
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
|
implementation 'com.google.protobuf:protobuf-kotlin:3.25.1'
|
||||||
implementation "com.squareup.retrofit2:converter-gson:$retrofit2_version"
|
// Gson 2.10.1 and older: API level 19
|
||||||
|
implementation("com.google.code.gson:gson:2.10.1")
|
||||||
|
implementation("com.squareup.retrofit2:converter-gson:$retrofit2_version") {
|
||||||
|
exclude group: 'com.google.code.gson', module: 'gson'
|
||||||
|
}
|
||||||
implementation "com.squareup.retrofit2:converter-protobuf:$retrofit2_version"
|
implementation "com.squareup.retrofit2:converter-protobuf:$retrofit2_version"
|
||||||
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
|
implementation "com.squareup.retrofit2:retrofit:$retrofit2_version"
|
||||||
|
|
||||||
|
|||||||
@@ -15,7 +15,7 @@
|
|||||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||||
|
|
||||||
<application
|
<application
|
||||||
android:name=".MyTvApplication"
|
android:name=".MyTVApplication"
|
||||||
android:allowBackup="true"
|
android:allowBackup="true"
|
||||||
android:banner="@drawable/banner"
|
android:banner="@drawable/banner"
|
||||||
android:icon="@drawable/logo"
|
android:icon="@drawable/logo"
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
@@ -34,7 +34,7 @@ class CardAdapter(
|
|||||||
val inflater = LayoutInflater.from(parent.context)
|
val inflater = LayoutInflater.from(parent.context)
|
||||||
val binding = CardBinding.inflate(inflater, parent, false)
|
val binding = CardBinding.inflate(inflater, parent, false)
|
||||||
|
|
||||||
val application = mainFragment.requireActivity().applicationContext as MyTvApplication
|
val application = mainFragment.requireActivity().applicationContext as MyTVApplication
|
||||||
|
|
||||||
binding.card.layoutParams.width = application.px2Px(binding.card.layoutParams.width)
|
binding.card.layoutParams.width = application.px2Px(binding.card.layoutParams.width)
|
||||||
binding.card.layoutParams.height = application.px2Px(binding.card.layoutParams.height)
|
binding.card.layoutParams.height = application.px2Px(binding.card.layoutParams.height)
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ class ChannelFragment : Fragment() {
|
|||||||
_binding = ChannelBinding.inflate(inflater, container, false)
|
_binding = ChannelBinding.inflate(inflater, container, false)
|
||||||
_binding!!.root.visibility = View.GONE
|
_binding!!.root.visibility = View.GONE
|
||||||
|
|
||||||
val application = requireActivity().applicationContext as MyTvApplication
|
val application = requireActivity().applicationContext as MyTVApplication
|
||||||
|
|
||||||
binding.channel.layoutParams.width = application.px2Px(binding.channel.layoutParams.width)
|
binding.channel.layoutParams.width = application.px2Px(binding.channel.layoutParams.width)
|
||||||
binding.channel.layoutParams.height = application.px2Px(binding.channel.layoutParams.height)
|
binding.channel.layoutParams.height = application.px2Px(binding.channel.layoutParams.height)
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ class ErrorFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
_binding = ErrorBinding.inflate(inflater, container, false)
|
_binding = ErrorBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
val application = requireActivity().applicationContext as MyTvApplication
|
val application = requireActivity().applicationContext as MyTVApplication
|
||||||
|
|
||||||
binding.logo.layoutParams.width = application.px2Px(binding.logo.layoutParams.width)
|
binding.logo.layoutParams.width = application.px2Px(binding.logo.layoutParams.width)
|
||||||
binding.logo.layoutParams.height = application.px2Px(binding.logo.layoutParams.height)
|
binding.logo.layoutParams.height = application.px2Px(binding.logo.layoutParams.height)
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ class InfoFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
_binding = InfoBinding.inflate(inflater, container, false)
|
_binding = InfoBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
val application = requireActivity().applicationContext as MyTvApplication
|
val application = requireActivity().applicationContext as MyTVApplication
|
||||||
|
|
||||||
binding.info.layoutParams.width = application.px2Px(binding.info.layoutParams.width)
|
binding.info.layoutParams.width = application.px2Px(binding.info.layoutParams.width)
|
||||||
binding.info.layoutParams.height = application.px2Px(binding.info.layoutParams.height)
|
binding.info.layoutParams.height = application.px2Px(binding.info.layoutParams.height)
|
||||||
|
|||||||
@@ -7,10 +7,10 @@ import androidx.recyclerview.widget.RecyclerView
|
|||||||
|
|
||||||
class ItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
|
class ItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
|
||||||
|
|
||||||
private var application: MyTvApplication
|
private var application: MyTVApplication
|
||||||
|
|
||||||
init {
|
init {
|
||||||
application = context.applicationContext as MyTvApplication
|
application = context.applicationContext as MyTVApplication
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getItemOffsets(
|
override fun getItemOffsets(
|
||||||
|
|||||||
@@ -17,7 +17,7 @@ class LoadingFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
_binding = LoadingBinding.inflate(inflater, container, false)
|
_binding = LoadingBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
val application = requireActivity().applicationContext as MyTvApplication
|
val application = requireActivity().applicationContext as MyTVApplication
|
||||||
|
|
||||||
binding.bar.layoutParams.width = application.px2Px(binding.bar.layoutParams.width)
|
binding.bar.layoutParams.width = application.px2Px(binding.bar.layoutParams.width)
|
||||||
binding.bar.layoutParams.height = application.px2Px(binding.bar.layoutParams.height)
|
binding.bar.layoutParams.height = application.px2Px(binding.bar.layoutParams.height)
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.util.Log
|
|||||||
import android.view.GestureDetector
|
import android.view.GestureDetector
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
|
import android.view.View
|
||||||
import android.view.View.SYSTEM_UI_FLAG_FULLSCREEN
|
import android.view.View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||||
import android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
import android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||||
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||||
@@ -44,13 +45,13 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
|
|||||||
|
|
||||||
private val handler = Handler()
|
private val handler = Handler()
|
||||||
private val delayHideMain: Long = 10000
|
private val delayHideMain: Long = 10000
|
||||||
private val delayHideSetting: Long = 10000
|
private val delayHideSetting: Long = 15000
|
||||||
|
|
||||||
init {
|
init {
|
||||||
Utils.setRequestListener(this)
|
Utils.setRequestListener(this)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun syncTime() {
|
fun syncTime() {
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val utilsJob = async(start = CoroutineStart.LAZY) { Utils.init() }
|
val utilsJob = async(start = CoroutineStart.LAZY) { Utils.init() }
|
||||||
utilsJob.start()
|
utilsJob.start()
|
||||||
@@ -59,9 +60,6 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
|
|||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
setContentView(R.layout.activity_main)
|
|
||||||
|
|
||||||
Request.setRequestListener(this)
|
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||||
val lp = window.attributes
|
val lp = window.attributes
|
||||||
@@ -70,6 +68,17 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
|
|||||||
window.setAttributes(lp)
|
window.setAttributes(lp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
window.decorView.apply {
|
||||||
|
systemUiVisibility =
|
||||||
|
SYSTEM_UI_FLAG_FULLSCREEN or
|
||||||
|
SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or
|
||||||
|
View.SYSTEM_UI_FLAG_LAYOUT_STABLE or
|
||||||
|
SYSTEM_UI_FLAG_HIDE_NAVIGATION or
|
||||||
|
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or
|
||||||
|
View.SYSTEM_UI_FLAG_IMMERSIVE
|
||||||
|
}
|
||||||
|
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
|
||||||
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
window.addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN)
|
||||||
window.decorView.systemUiVisibility =
|
window.decorView.systemUiVisibility =
|
||||||
@@ -82,6 +91,10 @@ class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPrefer
|
|||||||
// window.navigationBarColor = Color.TRANSPARENT
|
// window.navigationBarColor = Color.TRANSPARENT
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
setContentView(R.layout.activity_main)
|
||||||
|
|
||||||
|
Request.setRequestListener(this)
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
val transaction = supportFragmentManager.beginTransaction()
|
val transaction = supportFragmentManager.beginTransaction()
|
||||||
.add(R.id.main_browse_fragment, playerFragment)
|
.add(R.id.main_browse_fragment, playerFragment)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.lizongying.mytv
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
|
import android.view.GestureDetector
|
||||||
import android.view.KeyEvent
|
import android.view.KeyEvent
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
@@ -41,15 +42,18 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
|||||||
|
|
||||||
private var lastVideoUrl = ""
|
private var lastVideoUrl = ""
|
||||||
|
|
||||||
private lateinit var application: MyTvApplication
|
private lateinit var application: MyTVApplication
|
||||||
|
|
||||||
|
private lateinit var gestureDetector: GestureDetector
|
||||||
|
|
||||||
override fun onCreateView(
|
override fun onCreateView(
|
||||||
inflater: LayoutInflater, container: ViewGroup?,
|
inflater: LayoutInflater, container: ViewGroup?,
|
||||||
savedInstanceState: Bundle?
|
savedInstanceState: Bundle?
|
||||||
): View {
|
): View {
|
||||||
|
val context = requireContext()
|
||||||
_binding = MenuBinding.inflate(inflater, container, false)
|
_binding = MenuBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
application = requireActivity().applicationContext as MyTvApplication
|
application = requireActivity().applicationContext as MyTVApplication
|
||||||
|
|
||||||
binding.menu.layoutParams.width = application.shouldWidthPx()
|
binding.menu.layoutParams.width = application.shouldWidthPx()
|
||||||
binding.menu.layoutParams.height = application.shouldHeightPx()
|
binding.menu.layoutParams.height = application.shouldHeightPx()
|
||||||
@@ -58,9 +62,19 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
|||||||
hideSelf()
|
hideSelf()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gestureDetector = GestureDetector(context, GestureListener())
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private inner class GestureListener : GestureDetector.SimpleOnGestureListener() {
|
||||||
|
override fun onSingleTapConfirmed(e: MotionEvent): Boolean {
|
||||||
|
Log.i(TAG, "onSingleTapConfirmed")
|
||||||
|
hideSelf()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun hideSelf() {
|
private fun hideSelf() {
|
||||||
requireActivity().supportFragmentManager.beginTransaction()
|
requireActivity().supportFragmentManager.beginTransaction()
|
||||||
.hide(this)
|
.hide(this)
|
||||||
@@ -137,7 +151,7 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
|||||||
|
|
||||||
itemBinding.items.addOnItemTouchListener(object : RecyclerView.OnItemTouchListener {
|
itemBinding.items.addOnItemTouchListener(object : RecyclerView.OnItemTouchListener {
|
||||||
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
|
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
|
||||||
hideSelf()
|
gestureDetector.onTouchEvent(e)
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -8,7 +8,7 @@ import android.view.WindowManager
|
|||||||
import androidx.multidex.MultiDex
|
import androidx.multidex.MultiDex
|
||||||
|
|
||||||
|
|
||||||
class MyTvApplication : Application() {
|
class MyTVApplication : Application() {
|
||||||
private lateinit var displayMetrics: DisplayMetrics
|
private lateinit var displayMetrics: DisplayMetrics
|
||||||
private lateinit var realDisplayMetrics: DisplayMetrics
|
private lateinit var realDisplayMetrics: DisplayMetrics
|
||||||
|
|
||||||
@@ -51,7 +51,12 @@ object SP {
|
|||||||
|
|
||||||
var time: Boolean
|
var time: Boolean
|
||||||
get() = sp.getBoolean(KEY_TIME, true)
|
get() = sp.getBoolean(KEY_TIME, true)
|
||||||
set(value) = sp.edit().putBoolean(KEY_TIME, value).apply()
|
set(value) {
|
||||||
|
if (value != this.time) {
|
||||||
|
sp.edit().putBoolean(KEY_TIME, value).apply()
|
||||||
|
listener?.onSharedPreferenceChanged(KEY_TIME)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var bootStartup: Boolean
|
var bootStartup: Boolean
|
||||||
get() = sp.getBoolean(KEY_BOOT_STARTUP, false)
|
get() = sp.getBoolean(KEY_BOOT_STARTUP, false)
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import androidx.core.content.ContextCompat
|
|||||||
import androidx.core.view.marginEnd
|
import androidx.core.view.marginEnd
|
||||||
import androidx.core.view.marginTop
|
import androidx.core.view.marginTop
|
||||||
import androidx.fragment.app.DialogFragment
|
import androidx.fragment.app.DialogFragment
|
||||||
|
import com.lizongying.mytv.api.YSP
|
||||||
import com.lizongying.mytv.databinding.SettingBinding
|
import com.lizongying.mytv.databinding.SettingBinding
|
||||||
|
|
||||||
|
|
||||||
@@ -97,7 +98,14 @@ class SettingFragment : DialogFragment() {
|
|||||||
requestInstallPermissions()
|
requestInstallPermissions()
|
||||||
}
|
}
|
||||||
|
|
||||||
val application = requireActivity().applicationContext as MyTvApplication
|
binding.clear.setOnClickListener {
|
||||||
|
(requireActivity() as MainActivity).syncTime()
|
||||||
|
SP.guid = ""
|
||||||
|
YSP.getGuid()
|
||||||
|
}
|
||||||
|
|
||||||
|
val application = requireActivity().applicationContext as MyTVApplication
|
||||||
|
val textSize = application.px2PxFont(binding.switchChannelReversal.textSize)
|
||||||
|
|
||||||
binding.content.layoutParams.width =
|
binding.content.layoutParams.width =
|
||||||
application.px2Px(binding.content.layoutParams.width)
|
application.px2Px(binding.content.layoutParams.width)
|
||||||
@@ -108,51 +116,41 @@ class SettingFragment : DialogFragment() {
|
|||||||
application.px2Px(binding.content.paddingBottom)
|
application.px2Px(binding.content.paddingBottom)
|
||||||
)
|
)
|
||||||
binding.name.textSize = application.px2PxFont(binding.name.textSize)
|
binding.name.textSize = application.px2PxFont(binding.name.textSize)
|
||||||
binding.version.textSize = application.px2PxFont(binding.version.textSize)
|
binding.version.textSize = textSize
|
||||||
val layoutParamsVersion = binding.version.layoutParams as ViewGroup.MarginLayoutParams
|
val layoutParamsVersion = binding.version.layoutParams as ViewGroup.MarginLayoutParams
|
||||||
layoutParamsVersion.topMargin = application.px2Px(binding.version.marginTop)
|
layoutParamsVersion.topMargin = application.px2Px(binding.version.marginTop)
|
||||||
binding.version.layoutParams = layoutParamsVersion
|
binding.version.layoutParams = layoutParamsVersion
|
||||||
|
|
||||||
binding.checkVersion.textSize = application.px2PxFont(binding.checkVersion.textSize)
|
binding.checkVersion.textSize = textSize
|
||||||
val layoutParamsCheckVersion =
|
val layoutParamsCheckVersion =
|
||||||
binding.checkVersion.layoutParams as ViewGroup.MarginLayoutParams
|
binding.checkVersion.layoutParams as ViewGroup.MarginLayoutParams
|
||||||
layoutParamsCheckVersion.marginEnd = application.px2Px(binding.checkVersion.marginEnd)
|
layoutParamsCheckVersion.marginEnd = application.px2Px(binding.checkVersion.marginEnd)
|
||||||
binding.checkVersion.layoutParams = layoutParamsCheckVersion
|
binding.checkVersion.layoutParams = layoutParamsCheckVersion
|
||||||
|
|
||||||
binding.versionName.textSize = application.px2PxFont(binding.versionName.textSize)
|
binding.versionName.textSize = textSize
|
||||||
|
|
||||||
binding.exit.textSize = application.px2PxFont(binding.exit.textSize)
|
binding.clear.textSize = textSize
|
||||||
|
binding.exit.textSize = textSize
|
||||||
|
|
||||||
binding.switchChannelReversal.textSize =
|
val layoutParamsChannelSwitch =
|
||||||
application.px2PxFont(binding.switchChannelReversal.textSize)
|
|
||||||
val layoutParamsChannelReversal =
|
|
||||||
binding.switchChannelReversal.layoutParams as ViewGroup.MarginLayoutParams
|
binding.switchChannelReversal.layoutParams as ViewGroup.MarginLayoutParams
|
||||||
layoutParamsChannelReversal.topMargin =
|
layoutParamsChannelSwitch.topMargin =
|
||||||
application.px2Px(binding.switchChannelReversal.marginTop)
|
application.px2Px(binding.switchChannelReversal.marginTop)
|
||||||
binding.switchChannelReversal.layoutParams = layoutParamsChannelReversal
|
|
||||||
|
|
||||||
binding.switchChannelNum.textSize = application.px2PxFont(binding.switchChannelNum.textSize)
|
binding.switchChannelReversal.textSize = textSize
|
||||||
val layoutParamsChannelNum =
|
binding.switchChannelReversal.layoutParams = layoutParamsChannelSwitch
|
||||||
binding.switchChannelNum.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
layoutParamsChannelNum.topMargin = application.px2Px(binding.switchChannelNum.marginTop)
|
|
||||||
binding.switchChannelNum.layoutParams = layoutParamsChannelNum
|
|
||||||
|
|
||||||
binding.switchTime.textSize = application.px2PxFont(binding.switchTime.textSize)
|
binding.switchChannelNum.textSize = textSize
|
||||||
val layoutParamsTime = binding.switchTime.layoutParams as ViewGroup.MarginLayoutParams
|
binding.switchChannelNum.layoutParams = layoutParamsChannelSwitch
|
||||||
layoutParamsTime.topMargin = application.px2Px(binding.switchTime.marginTop)
|
|
||||||
binding.switchTime.layoutParams = layoutParamsTime
|
|
||||||
|
|
||||||
binding.switchBootStartup.textSize =
|
binding.switchTime.textSize = textSize
|
||||||
application.px2PxFont(binding.switchBootStartup.textSize)
|
binding.switchTime.layoutParams = layoutParamsChannelSwitch
|
||||||
val layoutParamsBootStartup =
|
|
||||||
binding.switchBootStartup.layoutParams as ViewGroup.MarginLayoutParams
|
|
||||||
layoutParamsBootStartup.topMargin = application.px2Px(binding.switchBootStartup.marginTop)
|
|
||||||
binding.switchBootStartup.layoutParams = layoutParamsBootStartup
|
|
||||||
|
|
||||||
binding.switchGrid.textSize = application.px2PxFont(binding.switchGrid.textSize)
|
binding.switchBootStartup.textSize = textSize
|
||||||
val layoutParamsGrid = binding.switchGrid.layoutParams as ViewGroup.MarginLayoutParams
|
binding.switchBootStartup.layoutParams = layoutParamsChannelSwitch
|
||||||
layoutParamsGrid.topMargin = application.px2Px(binding.switchGrid.marginTop)
|
|
||||||
binding.switchGrid.layoutParams = layoutParamsGrid
|
binding.switchGrid.textSize = textSize
|
||||||
|
binding.switchGrid.layoutParams = layoutParamsChannelSwitch
|
||||||
|
|
||||||
binding.appreciate.layoutParams.width =
|
binding.appreciate.layoutParams.width =
|
||||||
application.px2Px(binding.appreciate.layoutParams.width)
|
application.px2Px(binding.appreciate.layoutParams.width)
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ class TimeFragment : Fragment() {
|
|||||||
): View {
|
): View {
|
||||||
_binding = TimeBinding.inflate(inflater, container, false)
|
_binding = TimeBinding.inflate(inflater, container, false)
|
||||||
|
|
||||||
val application = requireActivity().applicationContext as MyTvApplication
|
val application = requireActivity().applicationContext as MyTVApplication
|
||||||
|
|
||||||
binding.time.layoutParams.width = application.px2Px(binding.time.layoutParams.width)
|
binding.time.layoutParams.width = application.px2Px(binding.time.layoutParams.width)
|
||||||
binding.time.layoutParams.height = application.px2Px(binding.time.layoutParams.height)
|
binding.time.layoutParams.height = application.px2Px(binding.time.layoutParams.height)
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ class ApiClient {
|
|||||||
private val protoUrl = "https://capi.yangshipin.cn/"
|
private val protoUrl = "https://capi.yangshipin.cn/"
|
||||||
private val traceUrl = "https://btrace.yangshipin.cn/"
|
private val traceUrl = "https://btrace.yangshipin.cn/"
|
||||||
private val trace2Url = "https://aatc-api.yangshipin.cn/"
|
private val trace2Url = "https://aatc-api.yangshipin.cn/"
|
||||||
|
private val tokenUrl = "https://h5access.yangshipin.cn/"
|
||||||
private val trace3Url = "https://dtrace.ysp.cctv.cn/"
|
private val trace3Url = "https://dtrace.ysp.cctv.cn/"
|
||||||
private val jceUrl = "https://jacc.ysp.cctv.cn/"
|
private val jceUrl = "https://jacc.ysp.cctv.cn/"
|
||||||
private val fUrl = "https://m.fengshows.com/"
|
private val fUrl = "https://m.fengshows.com/"
|
||||||
@@ -78,6 +79,14 @@ class ApiClient {
|
|||||||
.build().create(YSPBtraceService::class.java)
|
.build().create(YSPBtraceService::class.java)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
val yspToken2Service: YSPApiService by lazy {
|
||||||
|
Retrofit.Builder()
|
||||||
|
.baseUrl(tokenUrl)
|
||||||
|
.client(okHttpClient)
|
||||||
|
.addConverterFactory(GsonConverterFactory.create())
|
||||||
|
.build().create(YSPApiService::class.java)
|
||||||
|
}
|
||||||
|
|
||||||
val yspBtraceService3: YSPBtraceService by lazy {
|
val yspBtraceService3: YSPBtraceService by lazy {
|
||||||
Retrofit.Builder()
|
Retrofit.Builder()
|
||||||
.baseUrl(trace3Url)
|
.baseUrl(trace3Url)
|
||||||
@@ -157,7 +166,7 @@ class ApiClient {
|
|||||||
val sslContext = SSLContext.getInstance("SSL")
|
val sslContext = SSLContext.getInstance("SSL")
|
||||||
sslContext.init(null, trustAllCerts, java.security.SecureRandom())
|
sslContext.init(null, trustAllCerts, java.security.SecureRandom())
|
||||||
|
|
||||||
val proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("10.0.2.2", 8888))
|
// val proxy = Proxy(Proxy.Type.HTTP, InetSocketAddress("10.0.2.2", 8888))
|
||||||
|
|
||||||
val builder = OkHttpClient.Builder()
|
val builder = OkHttpClient.Builder()
|
||||||
.sslSocketFactory(sslContext.socketFactory, trustAllCerts[0] as X509TrustManager)
|
.sslSocketFactory(sslContext.socketFactory, trustAllCerts[0] as X509TrustManager)
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package com.lizongying.mytv.api
|
||||||
|
|
||||||
|
data class Token2(
|
||||||
|
val ret: Int?,
|
||||||
|
val msg: String?,
|
||||||
|
val data: Data,
|
||||||
|
) {
|
||||||
|
data class Data(
|
||||||
|
val token: String,
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import android.content.Context
|
|||||||
import com.lizongying.mytv.SP
|
import com.lizongying.mytv.SP
|
||||||
import com.lizongying.mytv.Utils.getDateTimestamp
|
import com.lizongying.mytv.Utils.getDateTimestamp
|
||||||
import com.lizongying.mytv.models.TVViewModel
|
import com.lizongying.mytv.models.TVViewModel
|
||||||
|
import java.security.MessageDigest
|
||||||
import kotlin.math.floor
|
import kotlin.math.floor
|
||||||
import kotlin.random.Random
|
import kotlin.random.Random
|
||||||
|
|
||||||
@@ -52,6 +53,13 @@ object YSP {
|
|||||||
|
|
||||||
private var appid = "ysp_pc"
|
private var appid = "ysp_pc"
|
||||||
var token = ""
|
var token = ""
|
||||||
|
var token2 = ""
|
||||||
|
|
||||||
|
var yspsdkinput = ""
|
||||||
|
var openapi_signature = ""
|
||||||
|
|
||||||
|
var nseqId = 1
|
||||||
|
var nrequest_id = ""
|
||||||
|
|
||||||
private var encryptor = Encryptor()
|
private var encryptor = Encryptor()
|
||||||
|
|
||||||
@@ -75,10 +83,43 @@ object YSP {
|
|||||||
|
|
||||||
cKey =
|
cKey =
|
||||||
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
|
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
|
||||||
|
randStr = getRand()
|
||||||
signature = getSignature()
|
signature = getSignature()
|
||||||
return """{"cnlid":"$cnlid","livepid":"$livepid","stream":"$stream","guid":"$guid","cKey":"$cKey","adjust":$adjust,"sphttps":"$sphttps","platform":"$platform","cmd":"$cmd","encryptVer":"$encryptVer","dtype":"$dtype","devid":"$devid","otype":"$otype","appVer":"$appVer","app_version":"$appVersion","rand_str":"$randStr","channel":"$channel","defn":"$defn","signature":"$signature"}"""
|
return """{"cnlid":"$cnlid","livepid":"$livepid","stream":"$stream","guid":"$guid","cKey":"$cKey","adjust":$adjust,"sphttps":"$sphttps","platform":"$platform","cmd":"$cmd","encryptVer":"$encryptVer","dtype":"$dtype","devid":"$devid","otype":"$otype","appVer":"$appVer","app_version":"$appVersion","rand_str":"$randStr","channel":"$channel","defn":"$defn","signature":"$signature"}"""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun getTokenData(tvModel: TVViewModel) {
|
||||||
|
livepid = tvModel.getTV().pid
|
||||||
|
cnlid = tvModel.getTV().sid
|
||||||
|
defn = "fhd"
|
||||||
|
|
||||||
|
randStr = getRand()
|
||||||
|
|
||||||
|
if (tvModel.retryTimes > 0) {
|
||||||
|
guid = newGuid()
|
||||||
|
}
|
||||||
|
|
||||||
|
cKey =
|
||||||
|
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
|
||||||
|
|
||||||
|
yspsdkinput =
|
||||||
|
md("adjust=$adjust&app_version=$appVersion&appVer=$appVer&channel=$channel&cKey=$cKey&cmd=$cmd&cnlid=$cnlid&defn=$defn&devid=$devid&dtype=$dtype&encryptVer=$encryptVer&guid=$guid&livepid=$livepid&otype=$otype&platform=$platform&sphttps=$sphttps&stream=$stream")
|
||||||
|
|
||||||
|
nseqId++
|
||||||
|
|
||||||
|
nrequest_id = "999999" + getRand() + getTimeStr()
|
||||||
|
|
||||||
|
openapi_signature =
|
||||||
|
md("yspappid:519748109;host:www.yangshipin.cn;protocol:https:;token:$token2;input:$yspsdkinput-$guid-$nseqId-$nrequest_id;")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun md(str: String): String {
|
||||||
|
val md = MessageDigest.getInstance("MD5")
|
||||||
|
md.update(str.toByteArray())
|
||||||
|
val digest = md.digest()
|
||||||
|
return digest.let { it -> it.joinToString("") { "%02x".format(it) } }
|
||||||
|
}
|
||||||
|
|
||||||
fun getAuthData(tvModel: TVViewModel): String {
|
fun getAuthData(tvModel: TVViewModel): String {
|
||||||
livepid = tvModel.getTV().pid
|
livepid = tvModel.getTV().pid
|
||||||
|
|
||||||
@@ -92,7 +133,7 @@ object YSP {
|
|||||||
return """pid=$livepid&guid=$guid&appid=$appid&rand_str=$randStr&signature=$signature"""
|
return """pid=$livepid&guid=$guid&appid=$appid&rand_str=$randStr&signature=$signature"""
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun getTimeStr(): String {
|
fun getTimeStr(): String {
|
||||||
return getDateTimestamp().toString()
|
return getDateTimestamp().toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -106,6 +147,7 @@ object YSP {
|
|||||||
var guid = SP.guid
|
var guid = SP.guid
|
||||||
if (guid.length < 18) {
|
if (guid.length < 18) {
|
||||||
guid = generateGuid()
|
guid = generateGuid()
|
||||||
|
this.guid = guid
|
||||||
SP.guid = guid
|
SP.guid = guid
|
||||||
}
|
}
|
||||||
return guid
|
return guid
|
||||||
|
|||||||
@@ -2,9 +2,11 @@ package com.lizongying.mytv.api
|
|||||||
|
|
||||||
import retrofit2.Call
|
import retrofit2.Call
|
||||||
import retrofit2.http.Body
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.GET
|
||||||
import retrofit2.http.Header
|
import retrofit2.http.Header
|
||||||
import retrofit2.http.Headers
|
import retrofit2.http.Headers
|
||||||
import retrofit2.http.POST
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
|
||||||
interface YSPApiService {
|
interface YSPApiService {
|
||||||
@@ -18,6 +20,11 @@ interface YSPApiService {
|
|||||||
fun getLiveInfo(
|
fun getLiveInfo(
|
||||||
@Header("cookie") cookie: String,
|
@Header("cookie") cookie: String,
|
||||||
@Header("Yspplayertoken") token: String,
|
@Header("Yspplayertoken") token: String,
|
||||||
|
@Header("Yspsdkinput") Yspsdkinput: String,
|
||||||
|
@Header("yspsdksign") yspsdksign: String,
|
||||||
|
@Header("Seqid") Seqid: String,
|
||||||
|
@Header("Request-Id") RequestId: String,
|
||||||
|
@Header("Yspappid") Yspappid: String="519748109",
|
||||||
@Body request: LiveInfoRequest,
|
@Body request: LiveInfoRequest,
|
||||||
): Call<LiveInfo>
|
): Call<LiveInfo>
|
||||||
|
|
||||||
@@ -32,4 +39,20 @@ interface YSPApiService {
|
|||||||
@Header("cookie") cookie: String,
|
@Header("cookie") cookie: String,
|
||||||
@Body request: AuthRequest,
|
@Body request: AuthRequest,
|
||||||
): Call<Auth>
|
): Call<Auth>
|
||||||
|
|
||||||
|
@GET("web/open/token")
|
||||||
|
@Headers(
|
||||||
|
"content-type: application/json",
|
||||||
|
"referer: https://www.yangshipin.cn/",
|
||||||
|
"user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36"
|
||||||
|
)
|
||||||
|
fun getToken(
|
||||||
|
@Header("cookie") cookie: String,
|
||||||
|
@Query("yspappid") yspappid: String = "519748109",
|
||||||
|
@Query("guid") guid: String = "",
|
||||||
|
@Query("vappid") vappid: String = "59306155",
|
||||||
|
@Query("vsecret") vsecret: String = "b42702bf7309a179d102f3d51b1add2fda0bc7ada64cb801",
|
||||||
|
@Query("raw") raw: String = "1",
|
||||||
|
@Query("ts") ts: String = "",
|
||||||
|
): Call<Token2>
|
||||||
}
|
}
|
||||||
@@ -18,6 +18,7 @@ import com.lizongying.mytv.api.KvcollectRequest
|
|||||||
import com.lizongying.mytv.api.KvcollectRequest2
|
import com.lizongying.mytv.api.KvcollectRequest2
|
||||||
import com.lizongying.mytv.api.LiveInfo
|
import com.lizongying.mytv.api.LiveInfo
|
||||||
import com.lizongying.mytv.api.LiveInfoRequest
|
import com.lizongying.mytv.api.LiveInfoRequest
|
||||||
|
import com.lizongying.mytv.api.Token2
|
||||||
import com.lizongying.mytv.api.YSP
|
import com.lizongying.mytv.api.YSP
|
||||||
import com.lizongying.mytv.api.YSPApiService
|
import com.lizongying.mytv.api.YSPApiService
|
||||||
import com.lizongying.mytv.api.YSPBtraceService
|
import com.lizongying.mytv.api.YSPBtraceService
|
||||||
@@ -42,6 +43,7 @@ import kotlin.random.Random
|
|||||||
object Request {
|
object Request {
|
||||||
private const val TAG = "Request"
|
private const val TAG = "Request"
|
||||||
private var yspTokenService: YSPTokenService = ApiClient().yspTokenService
|
private var yspTokenService: YSPTokenService = ApiClient().yspTokenService
|
||||||
|
private var yspToken2Service: YSPApiService = ApiClient().yspToken2Service
|
||||||
private var yspApiService: YSPApiService = ApiClient().yspApiService
|
private var yspApiService: YSPApiService = ApiClient().yspApiService
|
||||||
private var yspBtraceService: YSPBtraceService = ApiClient().yspBtraceService
|
private var yspBtraceService: YSPBtraceService = ApiClient().yspBtraceService
|
||||||
private var yspBtraceService2: YSPBtraceService = ApiClient().yspBtraceService2
|
private var yspBtraceService2: YSPBtraceService = ApiClient().yspBtraceService2
|
||||||
@@ -56,6 +58,7 @@ object Request {
|
|||||||
|
|
||||||
private var needAuth = true
|
private var needAuth = true
|
||||||
private var needToken = false
|
private var needToken = false
|
||||||
|
private var needToken2 = true
|
||||||
|
|
||||||
private val handler = Handler(Looper.getMainLooper())
|
private val handler = Handler(Looper.getMainLooper())
|
||||||
private lateinit var btraceRunnable: BtraceRunnable
|
private lateinit var btraceRunnable: BtraceRunnable
|
||||||
@@ -74,6 +77,7 @@ object Request {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private var call: Call<LiveInfo>? = null
|
private var call: Call<LiveInfo>? = null
|
||||||
|
private var callToken: Call<Token2>? = null
|
||||||
private var callAuth: Call<Auth>? = null
|
private var callAuth: Call<Auth>? = null
|
||||||
private var callInfo: Call<Info>? = null
|
private var callInfo: Call<Info>? = null
|
||||||
private var callFAuth: Call<FAuth>? = null
|
private var callFAuth: Call<FAuth>? = null
|
||||||
@@ -84,11 +88,117 @@ object Request {
|
|||||||
private fun cancelCall() {
|
private fun cancelCall() {
|
||||||
call?.cancel()
|
call?.cancel()
|
||||||
callAuth?.cancel()
|
callAuth?.cancel()
|
||||||
|
callToken?.cancel()
|
||||||
callInfo?.cancel()
|
callInfo?.cancel()
|
||||||
callFAuth?.cancel()
|
callFAuth?.cancel()
|
||||||
callPage?.cancel()
|
callPage?.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun fetchToken(tvModel: TVViewModel, cookie: String) {
|
||||||
|
cancelCall()
|
||||||
|
|
||||||
|
val title = tvModel.getTV().title
|
||||||
|
|
||||||
|
callToken = yspToken2Service.getToken("guid=${YSP.getGuid()}; $cookie", "519748109", YSP.getGuid(), "59306155", "b42702bf7309a179d102f3d51b1add2fda0bc7ada64cb801" ,"1", YSP.getTimeStr())
|
||||||
|
callToken?.enqueue(object : Callback<Token2> {
|
||||||
|
override fun onResponse(call: Call<Token2>, response: Response<Token2>) {
|
||||||
|
if (response.isSuccessful) {
|
||||||
|
val liveInfo = response.body()
|
||||||
|
|
||||||
|
if (liveInfo?.data?.token != null) {
|
||||||
|
Log.i(TAG, "token ${liveInfo.data.token}")
|
||||||
|
YSP.token2 = liveInfo.data.token
|
||||||
|
|
||||||
|
YSP.getTokenData(tvModel)
|
||||||
|
|
||||||
|
fetchAuth(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "$title token error")
|
||||||
|
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||||
|
tvModel.retryTimes++
|
||||||
|
if (tvModel.getTV().needToken) {
|
||||||
|
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||||
|
tvModel.tokenYSPRetryTimes++
|
||||||
|
tvModel.needGetToken = true
|
||||||
|
fetchToken(tvModel)
|
||||||
|
} else {
|
||||||
|
if (!tvModel.getTV().mustToken) {
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
val err = "错误"
|
||||||
|
Log.e(TAG, "$title $err")
|
||||||
|
tvModel.setErrInfo(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val err = "认证结果错误"
|
||||||
|
Log.e(TAG, "$title $err")
|
||||||
|
tvModel.setErrInfo(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "$title token status error")
|
||||||
|
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||||
|
tvModel.retryTimes++
|
||||||
|
if (tvModel.getTV().needToken) {
|
||||||
|
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||||
|
tvModel.tokenYSPRetryTimes++
|
||||||
|
tvModel.needGetToken = true
|
||||||
|
fetchToken(tvModel)
|
||||||
|
} else {
|
||||||
|
if (!tvModel.getTV().mustToken) {
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
val err = "错误"
|
||||||
|
Log.e(TAG, "$title $err")
|
||||||
|
tvModel.setErrInfo(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val err = "认证状态错误"
|
||||||
|
Log.e(TAG, "$title $err")
|
||||||
|
tvModel.setErrInfo(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(call: Call<Token2>, t: Throwable) {
|
||||||
|
Log.e(TAG, "$title token request error $t")
|
||||||
|
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||||
|
tvModel.retryTimes++
|
||||||
|
if (tvModel.getTV().needToken) {
|
||||||
|
if (needToken && tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||||
|
tvModel.tokenYSPRetryTimes++
|
||||||
|
tvModel.needGetToken = true
|
||||||
|
fetchToken(tvModel)
|
||||||
|
} else {
|
||||||
|
if (!tvModel.getTV().mustToken) {
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
val err = "错误"
|
||||||
|
Log.e(TAG, "$title $err")
|
||||||
|
tvModel.setErrInfo(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
val err = "认证请求错误"
|
||||||
|
Log.e(TAG, "$title $err")
|
||||||
|
tvModel.setErrInfo(err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
private fun fetchAuth(tvModel: TVViewModel, cookie: String) {
|
private fun fetchAuth(tvModel: TVViewModel, cookie: String) {
|
||||||
cancelCall()
|
cancelCall()
|
||||||
|
|
||||||
@@ -103,11 +213,11 @@ object Request {
|
|||||||
val liveInfo = response.body()
|
val liveInfo = response.body()
|
||||||
|
|
||||||
if (liveInfo?.data?.token != null) {
|
if (liveInfo?.data?.token != null) {
|
||||||
Log.i(TAG, "token ${liveInfo.data.token}")
|
Log.i(TAG, "auth ${liveInfo.data.token}")
|
||||||
YSP.token = liveInfo.data.token
|
YSP.token = liveInfo.data.token
|
||||||
fetchVideo(tvModel, cookie)
|
fetchVideo(tvModel, cookie)
|
||||||
} else {
|
} else {
|
||||||
Log.e(TAG, "$title token error")
|
Log.e(TAG, "$title auth error")
|
||||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||||
tvModel.retryTimes++
|
tvModel.retryTimes++
|
||||||
if (tvModel.getTV().needToken) {
|
if (tvModel.getTV().needToken) {
|
||||||
@@ -206,8 +316,13 @@ object Request {
|
|||||||
val request = LiveInfoRequest(data)
|
val request = LiveInfoRequest(data)
|
||||||
call = request.let {
|
call = request.let {
|
||||||
yspApiService.getLiveInfo(
|
yspApiService.getLiveInfo(
|
||||||
"guid=${YSP.getGuid()}; $cookie",
|
"guid=${YSP.getGuid()}; gr_user_id=261eecf2-0ce4-4316-a6a1-7171e3de7389; $cookie; newLogin=1; nseqId=${YSP.nseqId}; nrequest-id=${YSP.nrequest_id}",
|
||||||
YSP.token,
|
YSP.token,
|
||||||
|
YSP.yspsdkinput,
|
||||||
|
YSP.openapi_signature,
|
||||||
|
"${YSP.nseqId}",
|
||||||
|
YSP.nrequest_id,
|
||||||
|
"519748109",
|
||||||
it
|
it
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@@ -392,6 +507,66 @@ object Request {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun fetchToken(tvModel: TVViewModel) {
|
||||||
|
cancelCall()
|
||||||
|
if (tvModel.needGetToken) {
|
||||||
|
callInfo = yspTokenService.getInfo("")
|
||||||
|
callInfo?.enqueue(object : Callback<Info> {
|
||||||
|
override fun onResponse(call: Call<Info>, response: Response<Info>) {
|
||||||
|
if (response.isSuccessful && response.body()?.data?.token != null) {
|
||||||
|
token = response.body()?.data?.token!!
|
||||||
|
Log.i(TAG, "info success $token")
|
||||||
|
tvModel.needGetToken = false
|
||||||
|
tvModel.tokenYSPRetryTimes = 0
|
||||||
|
val cookie =
|
||||||
|
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109;yspopenid=$openid; vusession=$token"
|
||||||
|
fetchAuth(tvModel, cookie)
|
||||||
|
} else if (response.code() == 304) {
|
||||||
|
tvModel.needGetToken = false
|
||||||
|
tvModel.tokenYSPRetryTimes = 0
|
||||||
|
val cookie =
|
||||||
|
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109; yspopenid=$openid; vusession=$token"
|
||||||
|
fetchVideo(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
Log.e(TAG, "info status error")
|
||||||
|
if (tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||||
|
tvModel.tokenYSPRetryTimes++
|
||||||
|
fetchToken(tvModel)
|
||||||
|
} else {
|
||||||
|
if (!tvModel.getTV().mustToken) {
|
||||||
|
val cookie =
|
||||||
|
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109"
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFailure(call: Call<Info>, t: Throwable) {
|
||||||
|
Log.e(TAG, "info request error $t")
|
||||||
|
if (tvModel.tokenYSPRetryTimes < tvModel.tokenYSPRetryMaxTimes) {
|
||||||
|
tvModel.tokenYSPRetryTimes++
|
||||||
|
fetchAuth(tvModel)
|
||||||
|
} else {
|
||||||
|
if (!tvModel.getTV().mustToken) {
|
||||||
|
val cookie =
|
||||||
|
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109"
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
// TODO
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
} else {
|
||||||
|
val cookie =
|
||||||
|
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; appid=1400421205; yspappid=519748109;yspopenid=$openid; vusession=$token"
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private fun fetchAuth(tvModel: TVViewModel) {
|
private fun fetchAuth(tvModel: TVViewModel) {
|
||||||
cancelCall()
|
cancelCall()
|
||||||
if (tvModel.needGetToken) {
|
if (tvModel.needGetToken) {
|
||||||
@@ -447,7 +622,7 @@ object Request {
|
|||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
val cookie =
|
val cookie =
|
||||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=120; appid=1400421205; yspappid=519748109;yspopenid=$openid; vusession=$token"
|
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124; yspopenid=$openid; vusession=$token"
|
||||||
fetchAuth(tvModel, cookie)
|
fetchAuth(tvModel, cookie)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -569,19 +744,42 @@ object Request {
|
|||||||
if (token == "") {
|
if (token == "") {
|
||||||
tvModel.needGetToken = true
|
tvModel.needGetToken = true
|
||||||
}
|
}
|
||||||
if (needAuth) {
|
if (needToken2) {
|
||||||
fetchAuth(tvModel)
|
if (needAuth) {
|
||||||
|
fetchToken(tvModel)
|
||||||
|
} else {
|
||||||
|
fetchAuth(tvModel)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fetchVideo(tvModel)
|
if (needAuth) {
|
||||||
|
fetchAuth(tvModel)
|
||||||
|
} else {
|
||||||
|
fetchVideo(tvModel)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val cookie =
|
val cookie =
|
||||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; updateProtocol=1; deviceModel=120"
|
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124"
|
||||||
if (needAuth) {
|
|
||||||
fetchAuth(tvModel, cookie)
|
if (needToken2) {
|
||||||
|
if (needAuth) {
|
||||||
|
fetchToken(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
fetchAuth(tvModel, cookie)
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
fetchVideo(tvModel, cookie)
|
if (needAuth) {
|
||||||
|
fetchAuth(tvModel, cookie)
|
||||||
|
} else {
|
||||||
|
fetchVideo(tvModel, cookie)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
//
|
||||||
|
// if (needAuth) {
|
||||||
|
// fetchAuth(tvModel, cookie)
|
||||||
|
// } else {
|
||||||
|
// fetchVideo(tvModel, cookie)
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,18 +1,22 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:id="@+id/setting"
|
android:id="@+id/setting"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
>
|
>
|
||||||
<LinearLayout
|
<ScrollView
|
||||||
|
android:id="@+id/container"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content">
|
android:layout_height="match_parent"
|
||||||
|
android:fillViewport="true"
|
||||||
|
>
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/content"
|
android:id="@+id/content"
|
||||||
android:layout_width="300dp"
|
android:layout_width="300dp"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingTop="20dp"
|
android:paddingTop="20dp"
|
||||||
|
android:paddingBottom="20dp"
|
||||||
android:paddingLeft="10dp"
|
android:paddingLeft="10dp"
|
||||||
android:paddingRight="10dp"
|
android:paddingRight="10dp"
|
||||||
android:background="@drawable/rounded_dark_left"
|
android:background="@drawable/rounded_dark_left"
|
||||||
@@ -55,6 +59,13 @@
|
|||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
<Button
|
||||||
|
android:id="@+id/clear"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:text="@string/clear"
|
||||||
|
/>
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/exit"
|
android:id="@+id/exit"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -98,11 +109,11 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
<ImageView
|
</ScrollView>
|
||||||
android:id="@+id/appreciate"
|
<ImageView
|
||||||
android:layout_width="300dp"
|
android:id="@+id/appreciate"
|
||||||
android:layout_height="wrap_content"
|
android:layout_width="300dp"
|
||||||
android:src="@drawable/appreciate"
|
android:layout_height="wrap_content"
|
||||||
android:background="@drawable/rounded_white_right" />
|
android:src="@drawable/appreciate"
|
||||||
</LinearLayout>
|
android:background="@drawable/rounded_white_right" />
|
||||||
</FrameLayout>
|
</LinearLayout>
|
||||||
@@ -6,5 +6,6 @@
|
|||||||
<string name="title_boot_startup">开机自启</string>
|
<string name="title_boot_startup">开机自启</string>
|
||||||
<string name="title_grid">频道列表采用网格样式</string>
|
<string name="title_grid">频道列表采用网格样式</string>
|
||||||
<string name="title_time">显示时间</string>
|
<string name="title_time">显示时间</string>
|
||||||
|
<string name="clear">恢复默认</string>
|
||||||
<string name="exit">退出应用</string>
|
<string name="exit">退出应用</string>
|
||||||
</resources>
|
</resources>
|
||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
in_changelog=false
|
||||||
|
|
||||||
|
while IFS= read -r line; do
|
||||||
|
if [[ "$line" == "## "* ]]; then
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $in_changelog == false ]] && [[ "$line" == "### "* ]]; then
|
||||||
|
in_changelog=true
|
||||||
|
continue
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ $in_changelog == true ]] && [[ "$line" == "### "* ]]; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "$line"
|
||||||
|
done < HISTORY.md
|
||||||
+1
-1
@@ -1 +1 @@
|
|||||||
{"version_code": 33554432, "version_name": "v2.0.0"}
|
{"version_code": 33556480, "version_name": "v2.0.8"}
|
||||||
|
|||||||
Reference in New Issue
Block a user