mirror of
https://github.com/lizongying/my-tv.git
synced 2026-10-26 22:26:29 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4c1db33b3 | ||
|
|
e55584c910 | ||
|
|
cf8d7f00a8 | ||
|
|
bcfca9e28c | ||
|
|
31ec13eed7 | ||
|
|
5a78913407 | ||
|
|
bb38cf5033 | ||
|
|
51d9c4c2a7 | ||
|
|
70da1d8241 | ||
|
|
ef17427f64 | ||
|
|
c1143afb4e | ||
|
|
68f158e556 | ||
|
|
4ef95d60c4 | ||
|
|
b782d1f841 | ||
|
|
7e57aa8c03 |
@@ -37,6 +37,13 @@ jobs:
|
||||
# override default build-tools version (29.0.3) -- optional
|
||||
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
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
@@ -47,6 +54,7 @@ jobs:
|
||||
release_name: Release ${{ github.ref }}
|
||||
draft: false
|
||||
prerelease: false
|
||||
body_path: history.md
|
||||
|
||||
- name: Upload Release Asset
|
||||
uses: actions/upload-release-asset@v1
|
||||
@@ -56,4 +64,19 @@ jobs:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }}
|
||||
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"'"
|
||||
}'
|
||||
+195
-158
@@ -1,236 +1,273 @@
|
||||
## 更新日志
|
||||
## 更新日誌
|
||||
|
||||
### v1.9.8(通用)
|
||||
### v2.1.2
|
||||
|
||||
* 优化在线升级
|
||||
* 优化可能状态错误的问题
|
||||
*
|
||||
|
||||
### v1.9.6(通用)
|
||||
### v2.1.1
|
||||
|
||||
* 优化在线升级
|
||||
* 优化可能状态错误的问题
|
||||
* 平衡聲音
|
||||
|
||||
### v1.9.4(通用)
|
||||
### v2.1.0
|
||||
|
||||
* 修复默认时间不显示问题
|
||||
* 设置页居中
|
||||
* 频道号和时间对齐
|
||||
|
||||
### v1.9.2(通用)
|
||||
|
||||
* 修复一个重试的错误
|
||||
|
||||
### v1.9.0(通用)
|
||||
|
||||
* 减少视频播放失败情况
|
||||
* 全面屏手机居中显示
|
||||
|
||||
### v1.8.8(通用)
|
||||
|
||||
* 样式优化
|
||||
|
||||
### v1.8.6(通用)
|
||||
|
||||
* 增加错误显示
|
||||
* 节目预告优化
|
||||
* 频道列表页单击切换频道
|
||||
|
||||
### v1.8.4(通用)
|
||||
|
||||
* 解決部分情況下打開後黑屏问题
|
||||
* 延长频道信息显示时间,增加信息显示长度
|
||||
* 调整频道列表间距
|
||||
* 其他样式优化
|
||||
|
||||
### v1.8.2(通用)
|
||||
|
||||
* 修复无法播放问题
|
||||
* 恢復播放
|
||||
|
||||
### 以下已不可用
|
||||
|
||||
### v2.0.9
|
||||
|
||||
* 修復部分設備閃退的問題
|
||||
* 修復設置頁可能顯示不全的問題
|
||||
|
||||
### v2.0.5
|
||||
|
||||
* 設置頁增加恢復默認按鈕,目前只用於同步系統時間
|
||||
|
||||
### v2.0.4
|
||||
|
||||
* 修復不能播放的問題
|
||||
* 包含國際頻道
|
||||
|
||||
### v2.0.3
|
||||
|
||||
* 修復不能播放的問題
|
||||
* 不包含國際頻道
|
||||
|
||||
### v2.0.0
|
||||
|
||||
* 解決卡頓問題
|
||||
* 解決網格樣式時,點擊空白處不退出的問題
|
||||
* 解決頻道列表樣式切換可能不生效的問題
|
||||
|
||||
### v1.9.8(通用)
|
||||
|
||||
* 優化在線升級
|
||||
* 優化可能狀態錯誤的問題
|
||||
|
||||
### v1.9.6(通用)
|
||||
|
||||
* 優化在線升級
|
||||
* 優化可能狀態錯誤的問題
|
||||
|
||||
### v1.9.4(通用)
|
||||
|
||||
* 修復默認時間不顯示問題
|
||||
* 設置頁居中
|
||||
* 頻道號和時間對齊
|
||||
|
||||
### v1.9.2(通用)
|
||||
|
||||
* 修復一個重試的錯誤
|
||||
|
||||
### v1.9.0(通用)
|
||||
|
||||
* 減少視頻播放失敗情況
|
||||
* 全面屏手機居中顯示
|
||||
|
||||
### v1.8.8(通用)
|
||||
|
||||
* 樣式優化
|
||||
|
||||
### v1.8.6(通用)
|
||||
|
||||
* 增加錯誤顯示
|
||||
* 節目預告優化
|
||||
* 頻道列表頁單擊切換頻道
|
||||
|
||||
### v1.8.4(通用)
|
||||
|
||||
* 解決部分情況下打開後黑屏問題
|
||||
* 延長頻道信息顯示時間,增加信息顯示長度
|
||||
* 調整頻道列表間距
|
||||
* 其他樣式優化
|
||||
|
||||
### v1.8.2(通用)
|
||||
|
||||
* 修復無法播放問題
|
||||
|
||||
### v1.8.0(通用)
|
||||
|
||||
* 修复返回键无法退出问题
|
||||
* 设置中增加退出按钮
|
||||
* 修改非电视上的样式
|
||||
* 修复低版本闪退问题
|
||||
* 修復返回鍵無法退出問題
|
||||
* 設置中增加退出按鈕
|
||||
* 修改非電視上的樣式
|
||||
* 修復低版本閃退問題
|
||||
|
||||
### v1.7.8(通用)
|
||||
|
||||
* 修复播放过程中的卡顿问题
|
||||
* 增加时间显示
|
||||
* 频道号优化
|
||||
* 遥控器左键打开频道列表
|
||||
* 遥控器右键打开设置菜单
|
||||
* 频道列表空白处点击隐藏频道列表
|
||||
* 修復播放過程中的卡頓問題
|
||||
* 增加時間顯示
|
||||
* 頻道號優化
|
||||
* 遙控器左鍵打開頻道列表
|
||||
* 遙控器右鍵打開設置菜單
|
||||
* 頻道列表空白處點擊隱藏頻道列表
|
||||
|
||||
### v1.7.6(通用)
|
||||
|
||||
* 临时去掉部分频道,提高频道的可用性
|
||||
* 部分频道增加节目单
|
||||
* 臨時去掉部分頻道,提高頻道的可用性
|
||||
* 部分頻道增加節目單
|
||||
|
||||
### v1.7.5(安卓5及以上专用)
|
||||
### v1.7.5(安卓5及以上專用)
|
||||
|
||||
* 修复播放过程中的卡顿问题
|
||||
* 增加时间显示
|
||||
* 频道号优化
|
||||
* 设置中增加退出按钮
|
||||
* 修復播放過程中的卡頓問題
|
||||
* 增加時間顯示
|
||||
* 頻道號優化
|
||||
* 設置中增加退出按鈕
|
||||
|
||||
### v1.7.4(通用)
|
||||
|
||||
* 修复368
|
||||
* 修復368
|
||||
|
||||
### v1.7.3(安卓5及以上专用)
|
||||
### v1.7.3(安卓5及以上專用)
|
||||
|
||||
* 临时去掉部分频道,提高频道的可用性
|
||||
* 部分频道增加节目单
|
||||
* 遥控器左键进入节目列表
|
||||
* 遥控器右键进入菜单
|
||||
* 臨時去掉部分頻道,提高頻道的可用性
|
||||
* 部分頻道增加節目單
|
||||
* 遙控器左鍵進入節目列表
|
||||
* 遙控器右鍵進入菜單
|
||||
|
||||
### v1.7.2(通用)
|
||||
|
||||
* 支持节目列表网格样式和行样式切换,软件重启后生效
|
||||
* 节目列表样式变更
|
||||
* 支持節目列表網格樣式和行樣式切換,軟件重啟後生效
|
||||
* 節目列表樣式變更
|
||||
|
||||
### v1.7.1(安卓5及以上专用)
|
||||
### v1.7.1(安卓5及以上專用)
|
||||
|
||||
* 解决设置页更新闪退的问题
|
||||
* 凤凰卫视回归
|
||||
* 解决368问题
|
||||
* 解決設置頁更新閃退的問題
|
||||
* 鳳凰衛視回歸
|
||||
* 解決368問題
|
||||
|
||||
### v1.7.0(通用)
|
||||
|
||||
* 网络请求优化
|
||||
* 網絡請求優化
|
||||
|
||||
### v1.6.9(安卓5及以上专用)
|
||||
### v1.6.9(安卓5及以上專用)
|
||||
|
||||
* 去掉港澳台和国际频道
|
||||
* 解决部分情况下3、6、8等频道无法播放的问题
|
||||
* 解决部分情况下启动后黑屏问题
|
||||
* 去掉港澳台和國際頻道
|
||||
* 解決部分情況下3、6、8等頻道無法播放的問題
|
||||
* 解決部分情況下啟動後黑屏問題
|
||||
|
||||
### v1.6.8(通用)
|
||||
|
||||
* 修复部分设备崩溃的问题
|
||||
* 修复部分设备凤凰卫视无法播放的问题
|
||||
* 修復部分設備崩潰的問題
|
||||
* 修復部分設備鳳凰衛視無法播放的問題
|
||||
|
||||
### v1.6.7(安卓5及以上专用)
|
||||
### v1.6.7(安卓5及以上專用)
|
||||
|
||||
* 手机双击打开配置
|
||||
* 自动更新
|
||||
* 手機雙擊打開配置
|
||||
* 自動更新
|
||||
|
||||
### v1.6.6(通用)
|
||||
|
||||
* 更新重庆卫视图标
|
||||
* 凤凰卫视增强画质
|
||||
* 凤凰卫视增加EPG
|
||||
* 更新重慶衛視圖標
|
||||
* 鳳凰衛視增強畫質
|
||||
* 鳳凰衛視增加EPG
|
||||
|
||||
### v1.6.5(安卓5及以上专用)
|
||||
### v1.6.5(安卓5及以上專用)
|
||||
|
||||
* 增加CETV1图标
|
||||
* 稳定性提升
|
||||
* 增加CETV1圖標
|
||||
* 穩定性提升
|
||||
|
||||
### v1.6.4(通用)
|
||||
|
||||
* 增加CETV1
|
||||
* 增加凤凰卫视
|
||||
* 默认关闭开机启动
|
||||
* 增加鳳凰衛視
|
||||
* 默認關閉開機啟動
|
||||
|
||||
### v1.6.3(安卓5及以上专用)
|
||||
### v1.6.3(安卓5及以上專用)
|
||||
|
||||
* 增加CETV1
|
||||
* 凤凰卫视增强画质
|
||||
* 默认关闭开机启动
|
||||
* 延迟菜单自动关闭时间
|
||||
* 解决一些可能导致首次打开时黑屏的问题
|
||||
* 鳳凰衛視增強畫質
|
||||
* 默認關閉開機啟動
|
||||
* 延遲菜單自動關閉時間
|
||||
* 解決一些可能導致首次打開時黑屏的問題
|
||||
|
||||
### v1.6.2(通用)
|
||||
|
||||
* 修复按键无效的问题
|
||||
* 新的频道列表样式
|
||||
* 修復按鍵無效的問題
|
||||
* 新的頻道列表樣式
|
||||
|
||||
### v1.6.1(安卓5及以上专用)
|
||||
### v1.6.1(安卓5及以上專用)
|
||||
|
||||
* 增加凤凰卫视
|
||||
* 增加鳳凰衛視
|
||||
|
||||
### v1.6.0(通用)
|
||||
|
||||
* 通用(春晚緊急修復)
|
||||
|
||||
### v1.5.9(安卓5及以上专用)
|
||||
### v1.5.9(安卓5及以上專用)
|
||||
|
||||
* 解决天猫魔盒闪退问题
|
||||
* 解決天貓魔盒閃退問題
|
||||
|
||||
### v1.5.8(通用)
|
||||
|
||||
* 修复央视6画质差的问题
|
||||
* 增加兵团卫视
|
||||
* 播放失败重试
|
||||
* 修復央視6畫質差的問題
|
||||
* 增加兵團衛視
|
||||
* 播放失敗重試
|
||||
|
||||
### v1.5.7(安卓5及以上专用)
|
||||
### v1.5.7(安卓5及以上專用)
|
||||
|
||||
* 修复播放失败的问题
|
||||
* 修復播放失敗的問題
|
||||
|
||||
### v1.5.6(通用)
|
||||
|
||||
* 解决部分设备系统时间不对导致播放失败的问题
|
||||
* 解決部分設備系統時間不對導致播放失敗的問題
|
||||
|
||||
### v1.5.5(安卓5及以上专用)
|
||||
### v1.5.5(安卓5及以上專用)
|
||||
|
||||
* 修复播放失败的问题
|
||||
* 修复APP恢复后频道号、频道列表不自动消失的问题
|
||||
* 修復播放失敗的問題
|
||||
* 修復APP恢復後頻道號、頻道列表不自動消失的問題
|
||||
|
||||
### v1.5.4(通用)
|
||||
|
||||
* 修复播放失败的问题
|
||||
* 修復播放失敗的問題
|
||||
|
||||
### v1.5.3(安卓5及以上专用)
|
||||
### v1.5.3(安卓5及以上專用)
|
||||
|
||||
* 修复部分情况下APP切换后无法继续播放的问题
|
||||
* 优化重试逻辑
|
||||
* 修復部分情況下APP切換後無法繼續播放的問題
|
||||
* 優化重試邏輯
|
||||
|
||||
### v1.5.2(通用)
|
||||
|
||||
* 修复APP恢复后频道号、频道列表不自动消失的问题
|
||||
* 修復APP恢復後頻道號、頻道列表不自動消失的問題
|
||||
|
||||
### v1.5.1(安卓5及以上专用)
|
||||
### v1.5.1(安卓5及以上專用)
|
||||
|
||||
* 性能优化
|
||||
* 性能優化
|
||||
|
||||
### v1.5.0(通用)
|
||||
|
||||
* 修复部分情况下APP切换后无法继续播放的问题
|
||||
* 修復部分情況下APP切換後無法繼續播放的問題
|
||||
|
||||
### v1.4.9(安卓5及以上专用)
|
||||
### v1.4.9(安卓5及以上專用)
|
||||
|
||||
* 同步v1.4.8
|
||||
|
||||
### v1.4.8(通用)
|
||||
|
||||
* 频道号从1开始,CCTV5+为18
|
||||
* 頻道號從1開始,CCTV5+為18
|
||||
* 提高CCTV6清晰度
|
||||
* 增加天津卫视、新疆卫视
|
||||
* 增加天津衛視、新疆衛視
|
||||
|
||||
### v1.4.7(安卓5及以上专用)
|
||||
### v1.4.7(安卓5及以上專用)
|
||||
|
||||
* 修复部分用户CCTV13播放过程中卡住的问题
|
||||
* 调整CCTV的频道顺序
|
||||
* 修復部分用戶CCTV13播放過程中卡住的問題
|
||||
* 調整CCTV的頻道順序
|
||||
|
||||
### v1.4.6(通用)
|
||||
|
||||
* 10以下频道不再需要先按0
|
||||
* 10以下頻道不再需要先按0
|
||||
|
||||
### v1.4.5(安卓5及以上专用)
|
||||
### v1.4.5(安卓5及以上專用)
|
||||
|
||||
* 数字选台配置
|
||||
* 數字選台配置
|
||||
|
||||
### v1.4.4(通用)
|
||||
|
||||
* 优化图标显示
|
||||
* 增加换台反转
|
||||
* 優化圖標顯示
|
||||
* 增加換台反轉
|
||||
|
||||
### v1.4.3(安卓5及以上专用)
|
||||
### v1.4.3(安卓5及以上專用)
|
||||
|
||||
* 支持频道反转配置
|
||||
* 支持頻道反轉配置
|
||||
|
||||
### v1.4.2(通用)
|
||||
|
||||
@@ -238,40 +275,40 @@
|
||||
|
||||
### v1.4.1
|
||||
|
||||
* 解决部分用户无法打开菜单的问题
|
||||
* 解決部分用戶無法打開菜單的問題
|
||||
|
||||
### v1.4.0
|
||||
|
||||
* 解决极个别高版本机型黑屏问题
|
||||
* 解決極個別高版本機型黑屏問題
|
||||
|
||||
### v1.3.9
|
||||
|
||||
* 提高稳定性
|
||||
* 提高连接速度
|
||||
* 提高穩定性
|
||||
* 提高連接速度
|
||||
|
||||
### v1.3.4
|
||||
|
||||
* 部分错误会提示用户
|
||||
* 菜单3秒钟后自动关闭
|
||||
* 部分錯誤會提示用戶
|
||||
* 菜單3秒鐘後自動關閉
|
||||
|
||||
### v1.3.3
|
||||
|
||||
* 部分错误会提示用户
|
||||
* 菜单3秒钟后自动关闭
|
||||
* 部分錯誤會提示用戶
|
||||
* 菜單3秒鐘後自動關閉
|
||||
|
||||
### v1.3.2
|
||||
|
||||
* 增加重试,减少因网络问题导致的播放失败
|
||||
* 优化横幅banner
|
||||
* 增加重試,減少因網絡問題導致的播放失敗
|
||||
* 優化橫幅banner
|
||||
|
||||
### v1.3.1
|
||||
|
||||
* 增加CCTV 8K 超高清频道
|
||||
* 增加国际频道栏目
|
||||
* 增加CCTV 8K 超高清頻道
|
||||
* 增加國際頻道欄目
|
||||
|
||||
### v1.3.0
|
||||
|
||||
* 处理368可能失败的情形
|
||||
* 處理368可能失敗的情形
|
||||
|
||||
### v1.2.9
|
||||
|
||||
@@ -283,32 +320,32 @@
|
||||
|
||||
### v1.2.7
|
||||
|
||||
* 此版本是为了测试安卓6.0以下版本,如之前可以正常运行,请勿安装。
|
||||
* 此版本是為了測試安卓6.0以下版本,如之前可以正常運行,請勿安裝。
|
||||
|
||||
### v1.2.6
|
||||
|
||||
* 支持安卓4.2
|
||||
* 解决部分频道无法播放的问题
|
||||
* 修复切换时有时没有恢复播放的问题
|
||||
* 左右键不再切换源
|
||||
* 增大频道信息标题尺寸,缩小与节目信息的间隔
|
||||
* 解決部分頻道無法播放的問題
|
||||
* 修復切換時有時沒有恢復播放的問題
|
||||
* 左右鍵不再切換源
|
||||
* 增大頻道信息標題尺寸,縮小與節目信息的間隔
|
||||
|
||||
### v1.2.5
|
||||
|
||||
* 美化频道信息显示
|
||||
* 优化节目单获取
|
||||
* 美化頻道信息顯示
|
||||
* 優化節目單獲取
|
||||
|
||||
### v1.2.4
|
||||
|
||||
* 改变换台滑动方向,上一个频道下滑,下一个频道上滑
|
||||
* 软件退出时,退出播放器
|
||||
* 播放相同的频道,不再重复加载
|
||||
* 暂时移除部分频道
|
||||
* 改變換台滑動方向,上一個頻道下滑,下一個頻道上滑
|
||||
* 軟件退出時,退出播放器
|
||||
* 播放相同的頻道,不再重複加載
|
||||
* 暫時移除部分頻道
|
||||
|
||||
### v1.2.3
|
||||
|
||||
* 固定视频比列为16:9
|
||||
* 隐藏全面屏底部的小横条
|
||||
* 移除移动专区
|
||||
* 修复一个闪退问题
|
||||
* 更换图标和应用名
|
||||
* 固定視頻比例為16:9
|
||||
* 隱藏全面屏底部的小橫條
|
||||
* 移除移動專區
|
||||
* 修復一個閃退問題
|
||||
* 更換圖標和應用名
|
||||
@@ -14,6 +14,6 @@ gen-version:
|
||||
git describe --tags --always
|
||||
git describe --tags --always | sed 's/v/ /g' | sed 's/\./ /g' | sed 's/-/ /g' | awk '{print ($$1*16777216)+($$2*65536)+($$3*256)+$$4}'
|
||||
|
||||
#make gen v=v1.1.3
|
||||
#make gen v=v2.0.0
|
||||
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
|
||||
@@ -26,7 +26,7 @@
|
||||
## TODO
|
||||
|
||||
* 音量不同
|
||||
* 大湾区卫视、广东4k超高清、广东珠江、三沙卫视
|
||||
* 大湾区卫视、广东4k超高清、广东珠江、三沙卫视、翡翠
|
||||
* CHC高清三个电影频道
|
||||
* 地方频道
|
||||
* 收藏夹
|
||||
@@ -35,7 +35,6 @@
|
||||
* 亮度调节
|
||||
* 音量调节
|
||||
* 軟解
|
||||
* 自動更新
|
||||
|
||||
## 版权说明
|
||||
|
||||
|
||||
@@ -4,3 +4,4 @@
|
||||
/CMakeFiles/
|
||||
/Makefile
|
||||
/src/main/cpp/native.c
|
||||
/src/main/cpp/aes.c
|
||||
|
||||
+3
-1
@@ -21,7 +21,9 @@ if (IS_SO_BUILD)
|
||||
SHARED
|
||||
|
||||
# Provides a relative path to your source file(s).
|
||||
src/main/cpp/native.c)
|
||||
src/main/cpp/native.c
|
||||
src/main/cpp/aes.c
|
||||
)
|
||||
|
||||
# 设置编译输出路径
|
||||
set_target_properties(
|
||||
|
||||
+45
-9
@@ -26,6 +26,7 @@ android {
|
||||
cmake {
|
||||
arguments "-DIS_SO_BUILD=${project.hasProperty('IS_SO_BUILD') ? project.IS_SO_BUILD : true}"
|
||||
|
||||
// abiFilters "armeabi-v7a", "arm64-v8a", "x86", "x86_64"
|
||||
abiFilters "armeabi-v7a", "arm64-v8a"
|
||||
}
|
||||
}
|
||||
@@ -77,10 +78,9 @@ static def VersionCode() {
|
||||
def replace = [v: "", ".": " ", "-": " "]
|
||||
def arr = (process.text.trim().replace(replace) + " 0").split(" ")
|
||||
def versionCode = arr[0].toInteger() * 16777216 + arr[1].toInteger() * 65536 + arr[2].toInteger() * 256 + arr[3].toInteger()
|
||||
println("VersionCode $versionCode")
|
||||
return versionCode
|
||||
} catch (ignored) {
|
||||
return 0
|
||||
return 1
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,19 +88,35 @@ static def VersionName() {
|
||||
try {
|
||||
def process = "git describe --tags --always".execute()
|
||||
process.waitFor()
|
||||
return process.text.trim() - "v"
|
||||
def versionName = process.text.trim() - "v"
|
||||
if (versionName.isEmpty()) {
|
||||
versionName = "1.0.0"
|
||||
}
|
||||
return versionName
|
||||
} catch (ignored) {
|
||||
return "1.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
def gson_version = "2.10.1"
|
||||
def failureaccess_version = "1.0.2"
|
||||
def guava_version = "33.2.1-android"
|
||||
|
||||
dependencies {
|
||||
|
||||
// minSdk17
|
||||
def media3_version = "1.2.1"
|
||||
|
||||
implementation "androidx.media3:media3-ui:$media3_version"
|
||||
|
||||
// For media playback using ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer:$media3_version"
|
||||
implementation("com.google.guava:failureaccess:$failureaccess_version")
|
||||
implementation("com.google.guava:guava:$guava_version")
|
||||
implementation("androidx.media3:media3-common:$media3_version") {
|
||||
exclude group: 'com.google.guava', module: 'guava'
|
||||
exclude group: 'com.google.guava', module: 'failureaccess'
|
||||
}
|
||||
implementation("androidx.media3:media3-exoplayer:$media3_version")
|
||||
|
||||
// For HLS playback support with ExoPlayer
|
||||
implementation "androidx.media3:media3-exoplayer-hls:$media3_version"
|
||||
@@ -109,12 +125,17 @@ dependencies {
|
||||
def retrofit2_version = "2.6.4"
|
||||
|
||||
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:$gson_version")
|
||||
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:retrofit:$retrofit2_version"
|
||||
|
||||
implementation 'com.github.bumptech.glide:glide:4.11.0'
|
||||
|
||||
implementation("androidx.work:work-runtime-ktx:2.9.0")
|
||||
implementation 'androidx.core:core-ktx:1.11.0-beta02'
|
||||
implementation 'androidx.multidex:multidex:2.0.1'
|
||||
implementation 'androidx.leanback:leanback:1.2.0-alpha02'
|
||||
@@ -124,9 +145,24 @@ dependencies {
|
||||
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.6.2"
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.8.0-RC")
|
||||
|
||||
implementation 'com.google.android.exoplayer:exoplayer-ui:2.13.3'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-core:2.13.3'
|
||||
implementation 'com.google.android.exoplayer:exoplayer-hls:2.13.3'
|
||||
|
||||
implementation 'javax.annotation:javax.annotation-api:1.3.2'
|
||||
}
|
||||
|
||||
configurations.configureEach {
|
||||
resolutionStrategy {
|
||||
force("com.google.code.gson:gson:$gson_version")
|
||||
force "com.google.guava:failureaccess:$failureaccess_version"
|
||||
force "com.google.guava:guava:$guava_version"
|
||||
eachDependency { details ->
|
||||
if (details.requested.group == 'com.google.code.gson') {
|
||||
details.useVersion "$gson_version"
|
||||
}
|
||||
if (details.requested.group == 'com.google.guava' && details.requested.name == 'failureaccess') {
|
||||
details.useVersion "$failureaccess_version"
|
||||
}
|
||||
if (details.requested.group == 'com.google.guava' && details.requested.name == 'guava') {
|
||||
details.useVersion "$guava_version"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Vendored
+7
-1
@@ -18,4 +18,10 @@
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
-keep class com.google.gson.** { *; }
|
||||
-dontwarn com.google.gson.**
|
||||
|
||||
-keep class com.google.guava.** { *; }
|
||||
-dontwarn com.google.guava.**
|
||||
@@ -10,12 +10,13 @@
|
||||
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.POST_NOTIFICATIONS" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
|
||||
<uses-permission android:name="android.permission.REQUEST_INSTALL_PACKAGES" />
|
||||
|
||||
<application
|
||||
android:name=".MyTvApplication"
|
||||
android:name=".MyTVApplication"
|
||||
android:allowBackup="true"
|
||||
android:banner="@drawable/banner"
|
||||
android:icon="@drawable/logo"
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,9 @@
|
||||
#ifndef AES_H
|
||||
#define AES_H
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
void init();
|
||||
void encode(const char *in, size_t size, char *out);
|
||||
|
||||
#endif
|
||||
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
Binary file not shown.
Executable
BIN
Binary file not shown.
@@ -34,7 +34,7 @@ class CardAdapter(
|
||||
val inflater = LayoutInflater.from(parent.context)
|
||||
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.height = application.px2Px(binding.card.layoutParams.height)
|
||||
|
||||
@@ -28,7 +28,7 @@ class ChannelFragment : Fragment() {
|
||||
_binding = ChannelBinding.inflate(inflater, container, false)
|
||||
_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.height = application.px2Px(binding.channel.layoutParams.height)
|
||||
|
||||
@@ -3,13 +3,37 @@ package com.lizongying.mytv
|
||||
import android.app.AlertDialog
|
||||
import android.app.Dialog
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.lizongying.mytv.databinding.ConfirmationBinding
|
||||
|
||||
class ConfirmationFragment(
|
||||
private val listener: ConfirmationListener,
|
||||
private val message: String,
|
||||
private val update: Boolean
|
||||
) : DialogFragment() {
|
||||
//
|
||||
// private var _binding: ConfirmationBinding? = null
|
||||
// private val binding get() = _binding!!
|
||||
//
|
||||
// override fun onCreateView(
|
||||
// inflater: LayoutInflater, container: ViewGroup?,
|
||||
// savedInstanceState: Bundle?
|
||||
// ): View {
|
||||
// _binding = ConfirmationBinding.inflate(inflater, container, false)
|
||||
// return binding.root
|
||||
// }
|
||||
//
|
||||
// fun updateProgress(progress: Int) {
|
||||
// binding.progressBar.progress = progress
|
||||
// }
|
||||
//
|
||||
// override fun onDestroyView() {
|
||||
// super.onDestroyView()
|
||||
// _binding = null
|
||||
// }
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return activity?.let {
|
||||
|
||||
@@ -19,7 +19,7 @@ class ErrorFragment : Fragment() {
|
||||
): View {
|
||||
_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.height = application.px2Px(binding.logo.layoutParams.height)
|
||||
|
||||
@@ -29,7 +29,7 @@ class InfoFragment : Fragment() {
|
||||
): View {
|
||||
_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.height = application.px2Px(binding.info.layoutParams.height)
|
||||
|
||||
@@ -7,10 +7,10 @@ import androidx.recyclerview.widget.RecyclerView
|
||||
|
||||
class ItemDecoration(context: Context) : RecyclerView.ItemDecoration() {
|
||||
|
||||
private var application: MyTvApplication
|
||||
private var application: MyTVApplication
|
||||
|
||||
init {
|
||||
application = context.applicationContext as MyTvApplication
|
||||
application = context.applicationContext as MyTVApplication
|
||||
}
|
||||
|
||||
override fun getItemOffsets(
|
||||
|
||||
@@ -17,7 +17,7 @@ class LoadingFragment : Fragment() {
|
||||
): View {
|
||||
_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.height = application.px2Px(binding.bar.layoutParams.height)
|
||||
|
||||
@@ -8,6 +8,7 @@ import android.util.Log
|
||||
import android.view.GestureDetector
|
||||
import android.view.KeyEvent
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
import android.view.View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
import android.view.View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
@@ -25,7 +26,7 @@ import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.launch
|
||||
|
||||
|
||||
class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
class MainActivity : FragmentActivity(), Request.RequestListener, OnSharedPreferenceChangeListener {
|
||||
|
||||
private var ready = 0
|
||||
private val playerFragment = PlayerFragment()
|
||||
@@ -44,13 +45,13 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
|
||||
private val handler = Handler()
|
||||
private val delayHideMain: Long = 10000
|
||||
private val delayHideSetting: Long = 10000
|
||||
private val delayHideSetting: Long = 15000
|
||||
|
||||
init {
|
||||
Utils.setRequestListener(this)
|
||||
}
|
||||
|
||||
private fun syncTime() {
|
||||
fun syncTime() {
|
||||
lifecycleScope.launch(Dispatchers.IO) {
|
||||
val utilsJob = async(start = CoroutineStart.LAZY) { Utils.init() }
|
||||
utilsJob.start()
|
||||
@@ -59,9 +60,6 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
Request.setRequestListener(this)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
|
||||
val lp = window.attributes
|
||||
@@ -70,6 +68,17 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
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_FULLSCREEN)
|
||||
window.decorView.systemUiVisibility =
|
||||
@@ -82,6 +91,10 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
// window.navigationBarColor = Color.TRANSPARENT
|
||||
// }
|
||||
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
Request.setRequestListener(this)
|
||||
|
||||
if (savedInstanceState == null) {
|
||||
val transaction = supportFragmentManager.beginTransaction()
|
||||
.add(R.id.main_browse_fragment, playerFragment)
|
||||
@@ -122,6 +135,8 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
// Log.i(TAG, "net ${Build.VERSION.SDK_INT}")
|
||||
// ready++
|
||||
// }
|
||||
|
||||
SP.setOnSharedPreferenceChangeListener(this)
|
||||
}
|
||||
|
||||
fun showInfoFragment(tvViewModel: TVViewModel) {
|
||||
@@ -358,8 +373,6 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
private val hideSetting = Runnable {
|
||||
if (settingFragment.isVisible) {
|
||||
settingFragment.dismiss()
|
||||
showTime()
|
||||
mainFragment.changeMenu()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,7 +512,7 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
}
|
||||
|
||||
KeyEvent.KEYCODE_UNKNOWN -> {
|
||||
showSetting()
|
||||
// showSetting()
|
||||
return true
|
||||
}
|
||||
|
||||
@@ -612,4 +625,12 @@ class MainActivity : FragmentActivity(), Request.RequestListener {
|
||||
private companion object {
|
||||
const val TAG = "MainActivity"
|
||||
}
|
||||
|
||||
override fun onSharedPreferenceChanged(key: String) {
|
||||
Log.i(TAG, "$key changed")
|
||||
when (key) {
|
||||
SP.KEY_GRID -> mainFragment.changeMenu()
|
||||
SP.KEY_TIME -> showTime()
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,10 @@ package com.lizongying.mytv
|
||||
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.GestureDetector
|
||||
import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
@@ -40,15 +42,18 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
|
||||
private var lastVideoUrl = ""
|
||||
|
||||
private lateinit var application: MyTvApplication
|
||||
private lateinit var application: MyTVApplication
|
||||
|
||||
private lateinit var gestureDetector: GestureDetector
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
val context = requireContext()
|
||||
_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.height = application.shouldHeightPx()
|
||||
@@ -57,9 +62,19 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
hideSelf()
|
||||
}
|
||||
|
||||
gestureDetector = GestureDetector(context, GestureListener())
|
||||
|
||||
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() {
|
||||
requireActivity().supportFragmentManager.beginTransaction()
|
||||
.hide(this)
|
||||
@@ -134,6 +149,21 @@ class MainFragment : Fragment(), CardAdapter.ItemListener {
|
||||
hideSelf()
|
||||
}
|
||||
|
||||
itemBinding.items.addOnItemTouchListener(object : RecyclerView.OnItemTouchListener {
|
||||
override fun onInterceptTouchEvent(rv: RecyclerView, e: MotionEvent): Boolean {
|
||||
gestureDetector.onTouchEvent(e)
|
||||
return false
|
||||
}
|
||||
|
||||
override fun onTouchEvent(rv: RecyclerView, e: MotionEvent) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
|
||||
override fun onRequestDisallowInterceptTouchEvent(disallowIntercept: Boolean) {
|
||||
TODO("Not yet implemented")
|
||||
}
|
||||
})
|
||||
|
||||
val layoutParamsHeader =
|
||||
itemBinding.header.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsHeader.topMargin = application.px2Px(itemBinding.header.marginTop)
|
||||
|
||||
+11
-1
@@ -5,10 +5,13 @@ import android.content.Context
|
||||
import android.content.res.Resources
|
||||
import android.util.DisplayMetrics
|
||||
import android.view.WindowManager
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.lifecycle.ViewModelStore
|
||||
import androidx.multidex.MultiDex
|
||||
import com.lizongying.mytv.models.MyViewModel
|
||||
|
||||
|
||||
class MyTvApplication : Application() {
|
||||
class MyTVApplication : Application() {
|
||||
private lateinit var displayMetrics: DisplayMetrics
|
||||
private lateinit var realDisplayMetrics: DisplayMetrics
|
||||
|
||||
@@ -23,6 +26,8 @@ class MyTvApplication : Application() {
|
||||
private var density = 2.0f
|
||||
private var scale = 1.0f
|
||||
|
||||
lateinit var myViewModel: MyViewModel
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
@@ -60,6 +65,11 @@ class MyTvApplication : Application() {
|
||||
|
||||
deviation = width - Resources.getSystem().displayMetrics.widthPixels
|
||||
scale = Resources.getSystem().displayMetrics.scaledDensity
|
||||
|
||||
myViewModel = ViewModelProvider(
|
||||
ViewModelStore(),
|
||||
ViewModelProvider.NewInstanceFactory()
|
||||
)[MyViewModel::class.java]
|
||||
}
|
||||
|
||||
fun getDisplayMetrics(): DisplayMetrics {
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
|
||||
interface OnSharedPreferenceChangeListener {
|
||||
fun onSharedPreferenceChanged(key: String)
|
||||
}
|
||||
@@ -3,8 +3,6 @@ package com.lizongying.mytv
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.SurfaceHolder
|
||||
import android.view.SurfaceView
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.ViewTreeObserver
|
||||
@@ -17,45 +15,37 @@ import androidx.media3.common.VideoSize
|
||||
import androidx.media3.common.util.UnstableApi
|
||||
import androidx.media3.exoplayer.ExoPlayer
|
||||
import androidx.media3.ui.PlayerView
|
||||
import com.google.android.exoplayer2.SimpleExoPlayer
|
||||
import com.lizongying.mytv.databinding.PlayerBinding
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
|
||||
|
||||
class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
class PlayerFragment : Fragment() {
|
||||
|
||||
private var _binding: PlayerBinding? = null
|
||||
private var playerView: PlayerView? = null
|
||||
private var tvViewModel: TVViewModel? = null
|
||||
private val aspectRatio = 16f / 9f
|
||||
|
||||
|
||||
private lateinit var surfaceView: SurfaceView
|
||||
private lateinit var surfaceHolder: SurfaceHolder
|
||||
private var exoPlayer: SimpleExoPlayer? = null
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = PlayerBinding.inflate(inflater, container, false)
|
||||
|
||||
if (Utils.isTmallDevice()) {
|
||||
_binding!!.playerView.visibility = View.GONE
|
||||
surfaceView = _binding!!.surfaceView
|
||||
surfaceHolder = surfaceView.holder
|
||||
surfaceHolder.addCallback(this)
|
||||
} else {
|
||||
_binding!!.surfaceView.visibility = View.GONE
|
||||
playerView = _binding!!.playerView
|
||||
}
|
||||
playerView = _binding!!.playerView
|
||||
|
||||
playerView?.viewTreeObserver?.addOnGlobalLayoutListener(object :
|
||||
ViewTreeObserver.OnGlobalLayoutListener {
|
||||
@OptIn(UnstableApi::class)
|
||||
override fun onGlobalLayout() {
|
||||
playerView!!.viewTreeObserver.removeOnGlobalLayoutListener(this)
|
||||
|
||||
// val renderersFactory = context?.let { DefaultRenderersFactory(it) }
|
||||
// renderersFactory?.setExtensionRendererMode(DefaultRenderersFactory.EXTENSION_RENDERER_MODE_ON)
|
||||
|
||||
playerView!!.player = activity?.let {
|
||||
ExoPlayer.Builder(it)
|
||||
// .setRenderersFactory(renderersFactory!!)
|
||||
.build()
|
||||
}
|
||||
playerView!!.player?.playWhenReady = true
|
||||
@@ -103,10 +93,7 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
playerView?.player?.run {
|
||||
setMediaItem(MediaItem.fromUri(tvViewModel.getVideoUrlCurrent()))
|
||||
prepare()
|
||||
}
|
||||
exoPlayer?.run {
|
||||
setMediaItem(com.google.android.exoplayer2.MediaItem.fromUri(tvViewModel.getVideoUrlCurrent()))
|
||||
prepare()
|
||||
volume = tvViewModel.getTV().volume
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,11 +105,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
playerView!!.player?.prepare()
|
||||
playerView!!.player?.play()
|
||||
}
|
||||
if (exoPlayer?.isPlaying == false) {
|
||||
Log.i(TAG, "replay")
|
||||
exoPlayer?.prepare()
|
||||
exoPlayer?.play()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
@@ -135,9 +117,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
if (playerView != null && playerView!!.player?.isPlaying == true) {
|
||||
playerView!!.player?.stop()
|
||||
}
|
||||
if (exoPlayer?.isPlaying == true) {
|
||||
exoPlayer?.stop()
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
@@ -145,7 +124,6 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
if (playerView != null) {
|
||||
playerView!!.player?.release()
|
||||
}
|
||||
exoPlayer?.release()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
@@ -156,16 +134,4 @@ class PlayerFragment : Fragment(), SurfaceHolder.Callback {
|
||||
companion object {
|
||||
private const val TAG = "PlayerFragment"
|
||||
}
|
||||
|
||||
override fun surfaceCreated(holder: SurfaceHolder) {
|
||||
exoPlayer = SimpleExoPlayer.Builder(requireContext()).build()
|
||||
exoPlayer?.setVideoSurfaceHolder(surfaceHolder)
|
||||
exoPlayer?.playWhenReady = true
|
||||
}
|
||||
|
||||
override fun surfaceChanged(holder: SurfaceHolder, format: Int, width: Int, height: Int) {
|
||||
}
|
||||
|
||||
override fun surfaceDestroyed(holder: SurfaceHolder) {
|
||||
}
|
||||
}
|
||||
@@ -13,12 +13,12 @@ object SP {
|
||||
// If use channel num to select channel or not
|
||||
private const val KEY_CHANNEL_NUM = "channel_num"
|
||||
|
||||
private const val KEY_TIME = "time"
|
||||
const val KEY_TIME = "time"
|
||||
|
||||
// If start app on device boot or not
|
||||
private const val KEY_BOOT_STARTUP = "boot_startup"
|
||||
|
||||
private const val KEY_GRID = "grid"
|
||||
const val KEY_GRID = "grid"
|
||||
|
||||
// Position in list of the selected channel item
|
||||
private const val KEY_POSITION = "position"
|
||||
@@ -28,6 +28,8 @@ object SP {
|
||||
|
||||
private lateinit var sp: SharedPreferences
|
||||
|
||||
private var listener: OnSharedPreferenceChangeListener? = null
|
||||
|
||||
/**
|
||||
* The method must be invoked as early as possible(At least before using the keys)
|
||||
*/
|
||||
@@ -35,6 +37,10 @@ object SP {
|
||||
sp = context.getSharedPreferences(SP_FILE_NAME, Context.MODE_PRIVATE)
|
||||
}
|
||||
|
||||
fun setOnSharedPreferenceChangeListener(listener: OnSharedPreferenceChangeListener) {
|
||||
this.listener = listener
|
||||
}
|
||||
|
||||
var channelReversal: Boolean
|
||||
get() = sp.getBoolean(KEY_CHANNEL_REVERSAL, false)
|
||||
set(value) = sp.edit().putBoolean(KEY_CHANNEL_REVERSAL, value).apply()
|
||||
@@ -45,7 +51,12 @@ object SP {
|
||||
|
||||
var time: Boolean
|
||||
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
|
||||
get() = sp.getBoolean(KEY_BOOT_STARTUP, false)
|
||||
@@ -53,7 +64,12 @@ object SP {
|
||||
|
||||
var grid: Boolean
|
||||
get() = sp.getBoolean(KEY_GRID, false)
|
||||
set(value) = sp.edit().putBoolean(KEY_GRID, value).apply()
|
||||
set(value) {
|
||||
if (value != this.grid) {
|
||||
sp.edit().putBoolean(KEY_GRID, value).apply()
|
||||
listener?.onSharedPreferenceChanged(KEY_GRID)
|
||||
}
|
||||
}
|
||||
|
||||
var itemPosition: Int
|
||||
get() = sp.getInt(KEY_POSITION, 0)
|
||||
|
||||
@@ -6,14 +6,18 @@ import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.View.GONE
|
||||
import android.view.View.VISIBLE
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.widget.Toast
|
||||
import androidx.core.app.ActivityCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.view.isVisible
|
||||
import androidx.core.view.marginEnd
|
||||
import androidx.core.view.marginTop
|
||||
import androidx.fragment.app.DialogFragment
|
||||
import com.lizongying.mytv.api.YSP
|
||||
import com.lizongying.mytv.databinding.SettingBinding
|
||||
|
||||
|
||||
@@ -97,7 +101,14 @@ class SettingFragment : DialogFragment() {
|
||||
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 =
|
||||
application.px2Px(binding.content.layoutParams.width)
|
||||
@@ -108,51 +119,41 @@ class SettingFragment : DialogFragment() {
|
||||
application.px2Px(binding.content.paddingBottom)
|
||||
)
|
||||
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
|
||||
layoutParamsVersion.topMargin = application.px2Px(binding.version.marginTop)
|
||||
binding.version.layoutParams = layoutParamsVersion
|
||||
|
||||
binding.checkVersion.textSize = application.px2PxFont(binding.checkVersion.textSize)
|
||||
binding.checkVersion.textSize = textSize
|
||||
val layoutParamsCheckVersion =
|
||||
binding.checkVersion.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsCheckVersion.marginEnd = application.px2Px(binding.checkVersion.marginEnd)
|
||||
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 =
|
||||
application.px2PxFont(binding.switchChannelReversal.textSize)
|
||||
val layoutParamsChannelReversal =
|
||||
val layoutParamsChannelSwitch =
|
||||
binding.switchChannelReversal.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsChannelReversal.topMargin =
|
||||
layoutParamsChannelSwitch.topMargin =
|
||||
application.px2Px(binding.switchChannelReversal.marginTop)
|
||||
binding.switchChannelReversal.layoutParams = layoutParamsChannelReversal
|
||||
|
||||
binding.switchChannelNum.textSize = application.px2PxFont(binding.switchChannelNum.textSize)
|
||||
val layoutParamsChannelNum =
|
||||
binding.switchChannelNum.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsChannelNum.topMargin = application.px2Px(binding.switchChannelNum.marginTop)
|
||||
binding.switchChannelNum.layoutParams = layoutParamsChannelNum
|
||||
binding.switchChannelReversal.textSize = textSize
|
||||
binding.switchChannelReversal.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchTime.textSize = application.px2PxFont(binding.switchTime.textSize)
|
||||
val layoutParamsTime = binding.switchTime.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsTime.topMargin = application.px2Px(binding.switchTime.marginTop)
|
||||
binding.switchTime.layoutParams = layoutParamsTime
|
||||
binding.switchChannelNum.textSize = textSize
|
||||
binding.switchChannelNum.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchBootStartup.textSize =
|
||||
application.px2PxFont(binding.switchBootStartup.textSize)
|
||||
val layoutParamsBootStartup =
|
||||
binding.switchBootStartup.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsBootStartup.topMargin = application.px2Px(binding.switchBootStartup.marginTop)
|
||||
binding.switchBootStartup.layoutParams = layoutParamsBootStartup
|
||||
binding.switchTime.textSize = textSize
|
||||
binding.switchTime.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchGrid.textSize = application.px2PxFont(binding.switchGrid.textSize)
|
||||
val layoutParamsGrid = binding.switchGrid.layoutParams as ViewGroup.MarginLayoutParams
|
||||
layoutParamsGrid.topMargin = application.px2Px(binding.switchGrid.marginTop)
|
||||
binding.switchGrid.layoutParams = layoutParamsGrid
|
||||
binding.switchBootStartup.textSize = textSize
|
||||
binding.switchBootStartup.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.switchGrid.textSize = textSize
|
||||
binding.switchGrid.layoutParams = layoutParamsChannelSwitch
|
||||
|
||||
binding.appreciate.layoutParams.width =
|
||||
application.px2Px(binding.appreciate.layoutParams.width)
|
||||
@@ -161,6 +162,23 @@ class SettingFragment : DialogFragment() {
|
||||
requireActivity().finishAffinity()
|
||||
}
|
||||
|
||||
// val myViewModel = application.myViewModel
|
||||
// application.myViewModel.downloadProgress.observe(viewLifecycleOwner) { _ ->
|
||||
// val downloadProgress = myViewModel.downloadProgress.value
|
||||
// if (downloadProgress != null) {
|
||||
// if (downloadProgress == 100) {
|
||||
// binding.progressBar.visibility = GONE
|
||||
// } else {
|
||||
// if (!binding.progressBar.isVisible) {
|
||||
// binding.progressBar.visibility = VISIBLE
|
||||
// }
|
||||
// binding.progressBar.progress = downloadProgress
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
updateManager = UpdateManager(context, context.appVersionCode)
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -197,7 +215,7 @@ class SettingFragment : DialogFragment() {
|
||||
PERMISSIONS_REQUEST_CODE
|
||||
)
|
||||
} else {
|
||||
UpdateManager(context, context.appVersionCode).checkAndUpdate()
|
||||
updateManager.checkAndUpdate()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -216,8 +234,7 @@ class SettingFragment : DialogFragment() {
|
||||
}
|
||||
}
|
||||
if (allPermissionsGranted) {
|
||||
val context = requireContext()
|
||||
UpdateManager(context, context.appVersionCode).checkAndUpdate()
|
||||
updateManager.checkAndUpdate()
|
||||
} else {
|
||||
Toast.makeText(context, "权限授权失败", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
|
||||
@@ -24,7 +24,7 @@ class TimeFragment : Fragment() {
|
||||
): View {
|
||||
_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.height = application.px2Px(binding.time.layoutParams.height)
|
||||
|
||||
@@ -1,26 +1,17 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.app.DownloadManager
|
||||
import android.app.DownloadManager.Request
|
||||
import android.content.BroadcastReceiver
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.IntentFilter
|
||||
import android.database.Cursor
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.Log
|
||||
import androidx.fragment.app.FragmentActivity
|
||||
import androidx.work.OneTimeWorkRequestBuilder
|
||||
import androidx.work.WorkManager
|
||||
import androidx.work.workDataOf
|
||||
import com.lizongying.mytv.api.ApiClient
|
||||
import com.lizongying.mytv.requests.ReleaseRequest
|
||||
import com.lizongying.mytv.requests.ReleaseResponse
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.launch
|
||||
import java.io.File
|
||||
|
||||
|
||||
class UpdateManager(
|
||||
@@ -32,17 +23,15 @@ class UpdateManager(
|
||||
private var releaseRequest = ReleaseRequest()
|
||||
private var release: ReleaseResponse? = null
|
||||
|
||||
private var downloadReceiver: DownloadReceiver? = null
|
||||
|
||||
fun checkAndUpdate() {
|
||||
CoroutineScope(Dispatchers.Main).launch {
|
||||
var text = "版本获取失败"
|
||||
var update = false
|
||||
try {
|
||||
release = releaseRequest.getRelease()
|
||||
Log.i(TAG, "versionCode $versionCode ${release?.version_code}")
|
||||
if (release?.version_code != null) {
|
||||
if (release?.version_code!! > versionCode) {
|
||||
val code = release?.version_code
|
||||
if (code != null) {
|
||||
if (code.toLong() >= versionCode) {
|
||||
text = "最新版本:${release?.version_name}"
|
||||
update = true
|
||||
} else {
|
||||
@@ -61,171 +50,24 @@ class UpdateManager(
|
||||
dialog.show((context as FragmentActivity).supportFragmentManager, TAG)
|
||||
}
|
||||
|
||||
private fun startDownload(release: ReleaseResponse) {
|
||||
private fun startDownload(context: Context, release: ReleaseResponse) {
|
||||
val versionName = release.version_name
|
||||
val apkName = "my-tv"
|
||||
val apkFileName = "$apkName-${release.version_name}.apk"
|
||||
Log.i(TAG, "apkFileName $apkFileName")
|
||||
val downloadManager =
|
||||
context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val request =
|
||||
Request(Uri.parse("${ApiClient.DOWNLOAD_HOST}${release.version_name}/$apkName-${release.version_name}.apk"))
|
||||
Log.i(
|
||||
TAG,
|
||||
"url ${Uri.parse("${ApiClient.DOWNLOAD_HOST}${release.version_name}/$apkName-${release.version_name}.apk")}"
|
||||
)
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)?.mkdirs()
|
||||
Log.i(TAG, "save dir ${Environment.DIRECTORY_DOWNLOADS}")
|
||||
request.setDestinationInExternalFilesDir(
|
||||
context,
|
||||
Environment.DIRECTORY_DOWNLOADS,
|
||||
apkFileName
|
||||
)
|
||||
request.setTitle("${context.resources.getString(R.string.app_name)} ${release.version_name}")
|
||||
request.setNotificationVisibility(Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
|
||||
request.setAllowedOverRoaming(false)
|
||||
request.setMimeType("application/vnd.android.package-archive")
|
||||
|
||||
// 获取下载任务的引用
|
||||
val downloadReference = downloadManager.enqueue(request)
|
||||
|
||||
downloadReceiver = DownloadReceiver(context, apkFileName, downloadReference)
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
context.registerReceiver(
|
||||
downloadReceiver,
|
||||
IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE),
|
||||
Context.RECEIVER_NOT_EXPORTED,
|
||||
val downloadUrl =
|
||||
"${ApiClient.DOWNLOAD_HOST}${release.version_name}/$apkName-${release.version_name}.apk"
|
||||
Log.i(TAG, "downloadUrl: $downloadUrl")
|
||||
val downloadRequest = OneTimeWorkRequestBuilder<UpdateWorker>()
|
||||
.setInputData(
|
||||
workDataOf(
|
||||
"VERSION_NAME" to versionName,
|
||||
"APK_FILENAME" to apkFileName,
|
||||
"DOWNLOAD_URL" to downloadUrl
|
||||
)
|
||||
)
|
||||
} else {
|
||||
context.registerReceiver(
|
||||
downloadReceiver,
|
||||
IntentFilter(DownloadManager.ACTION_DOWNLOAD_COMPLETE)
|
||||
)
|
||||
}
|
||||
.build()
|
||||
|
||||
getDownloadProgress(context, downloadReference) { progress ->
|
||||
println("Download progress: $progress%")
|
||||
}
|
||||
}
|
||||
|
||||
private fun getDownloadProgress(
|
||||
context: Context,
|
||||
downloadId: Long,
|
||||
progressListener: (Int) -> Unit
|
||||
) {
|
||||
val downloadManager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val handler = Handler(Looper.getMainLooper())
|
||||
val intervalMillis: Long = 1000
|
||||
|
||||
handler.post(object : Runnable {
|
||||
override fun run() {
|
||||
Log.i(TAG, "search")
|
||||
val query = DownloadManager.Query().setFilterById(downloadId)
|
||||
val cursor: Cursor = downloadManager.query(query)
|
||||
cursor.use {
|
||||
if (it.moveToFirst()) {
|
||||
val bytesDownloadedIndex =
|
||||
it.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)
|
||||
val bytesTotalIndex =
|
||||
it.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)
|
||||
|
||||
// 检查列名是否存在
|
||||
if (bytesDownloadedIndex != -1 && bytesTotalIndex != -1) {
|
||||
val bytesDownloaded = it.getInt(bytesDownloadedIndex)
|
||||
val bytesTotal = it.getInt(bytesTotalIndex)
|
||||
|
||||
if (bytesTotal != -1) {
|
||||
val progress = (bytesDownloaded * 100L / bytesTotal).toInt()
|
||||
progressListener(progress)
|
||||
if (progress == 100) {
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// handler.postDelayed(this, intervalMillis)
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
private class DownloadReceiver(
|
||||
private val context: Context,
|
||||
private val apkFileName: String,
|
||||
private val downloadReference: Long
|
||||
) : BroadcastReceiver() {
|
||||
override fun onReceive(context: Context, intent: Intent) {
|
||||
val reference = intent.getLongExtra(DownloadManager.EXTRA_DOWNLOAD_ID, -1)
|
||||
Log.i(TAG, "reference $reference")
|
||||
|
||||
if (reference == downloadReference) {
|
||||
val downloadManager =
|
||||
context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val query = DownloadManager.Query().setFilterById(downloadReference)
|
||||
val cursor = downloadManager.query(query)
|
||||
if (cursor != null && cursor.moveToFirst()) {
|
||||
val statusIndex = cursor.getColumnIndex(DownloadManager.COLUMN_STATUS)
|
||||
if (statusIndex < 0) {
|
||||
Log.i(TAG, "Download failure")
|
||||
return
|
||||
}
|
||||
val status = cursor.getInt(statusIndex)
|
||||
|
||||
val progressIndex =
|
||||
cursor.getColumnIndex(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR)
|
||||
if (progressIndex < 0) {
|
||||
Log.i(TAG, "Download failure")
|
||||
return
|
||||
}
|
||||
val progress = cursor.getInt(progressIndex)
|
||||
|
||||
val totalSizeIndex =
|
||||
cursor.getColumnIndex(DownloadManager.COLUMN_TOTAL_SIZE_BYTES)
|
||||
val totalSize = cursor.getInt(totalSizeIndex)
|
||||
|
||||
cursor.close()
|
||||
|
||||
when (status) {
|
||||
DownloadManager.STATUS_SUCCESSFUL -> {
|
||||
installNewVersion()
|
||||
}
|
||||
|
||||
DownloadManager.STATUS_FAILED -> {
|
||||
// Handle download failure
|
||||
Log.i(TAG, "Download failure")
|
||||
}
|
||||
|
||||
else -> {
|
||||
// Update UI with download progress
|
||||
val percentage = progress * 100 / totalSize
|
||||
Log.i(TAG, "Download progress: $percentage%")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun installNewVersion() {
|
||||
val apkFile = File(
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
apkFileName
|
||||
)
|
||||
Log.i(TAG, "apkFile $apkFile")
|
||||
|
||||
if (apkFile.exists()) {
|
||||
val apkUri = Uri.parse("file://$apkFile")
|
||||
Log.i(TAG, "apkUri $apkUri")
|
||||
val installIntent = Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(apkUri, "application/vnd.android.package-archive")
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
|
||||
context.startActivity(installIntent)
|
||||
} else {
|
||||
Log.e(TAG, "APK file does not exist!")
|
||||
}
|
||||
}
|
||||
WorkManager.getInstance(context).enqueue(downloadRequest)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@@ -234,16 +76,9 @@ class UpdateManager(
|
||||
|
||||
override fun onConfirm() {
|
||||
Log.i(TAG, "onConfirm $release")
|
||||
release?.let { startDownload(it) }
|
||||
release?.let { startDownload(context, it) }
|
||||
}
|
||||
|
||||
override fun onCancel() {
|
||||
}
|
||||
|
||||
fun destroy() {
|
||||
if (downloadReceiver != null) {
|
||||
context.unregisterReceiver(downloadReceiver)
|
||||
Log.i(TAG, "destroy downloadReceiver")
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
package com.lizongying.mytv
|
||||
|
||||
import android.app.DownloadManager
|
||||
import android.app.NotificationChannel
|
||||
import android.app.NotificationManager
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Build
|
||||
import android.os.Environment
|
||||
import android.util.Log
|
||||
import androidx.core.app.NotificationCompat
|
||||
import androidx.core.content.FileProvider
|
||||
import androidx.work.CoroutineWorker
|
||||
import androidx.work.WorkerParameters
|
||||
import com.lizongying.mytv.models.MyViewModel
|
||||
import kotlinx.coroutines.Dispatchers
|
||||
import kotlinx.coroutines.withContext
|
||||
import java.io.File
|
||||
|
||||
class UpdateWorker(context: Context, params: WorkerParameters) : CoroutineWorker(context, params) {
|
||||
|
||||
private lateinit var notificationManager: NotificationManager
|
||||
private lateinit var notificationBuilder: NotificationCompat.Builder
|
||||
|
||||
private lateinit var myViewModel: MyViewModel
|
||||
|
||||
override suspend fun doWork(): Result {
|
||||
val downloadUrl = inputData.getString("DOWNLOAD_URL") ?: return Result.failure()
|
||||
val apkFileName = inputData.getString("APK_FILENAME") ?: return Result.failure()
|
||||
val versionName = inputData.getString("VERSION_NAME") ?: return Result.failure()
|
||||
|
||||
showNotification(applicationContext)
|
||||
|
||||
val app = applicationContext as MyTVApplication
|
||||
myViewModel = app.myViewModel
|
||||
|
||||
return withContext(Dispatchers.IO) {
|
||||
try {
|
||||
downloadAndInstall(applicationContext, downloadUrl, apkFileName, versionName)
|
||||
Result.success()
|
||||
} catch (e: Exception) {
|
||||
Result.failure()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun showNotification(context: Context) {
|
||||
notificationManager =
|
||||
context.getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
|
||||
notificationBuilder = NotificationCompat.Builder(context, "download_channel").apply {
|
||||
setSmallIcon(android.R.drawable.stat_sys_download)
|
||||
setContentTitle("Downloading Update")
|
||||
setContentText("Download in progress")
|
||||
priority = NotificationCompat.PRIORITY_LOW
|
||||
setOngoing(true)
|
||||
setProgress(100, 0, false)
|
||||
}
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
val channel = NotificationChannel(
|
||||
"download_channel",
|
||||
"Download Updates",
|
||||
NotificationManager.IMPORTANCE_LOW
|
||||
)
|
||||
notificationManager.createNotificationChannel(channel)
|
||||
}
|
||||
|
||||
notificationManager.notify(1, notificationBuilder.build())
|
||||
}
|
||||
|
||||
private fun downloadAndInstall(
|
||||
context: Context,
|
||||
downloadUrl: String,
|
||||
apkFileName: String,
|
||||
versionName: String
|
||||
) {
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS)?.mkdirs()
|
||||
Log.i(TAG, "save dir ${Environment.DIRECTORY_DOWNLOADS}")
|
||||
val request = DownloadManager.Request(Uri.parse(downloadUrl)).apply {
|
||||
setTitle("${context.resources.getString(R.string.app_name)} $versionName Downloading")
|
||||
setDescription("Downloading the latest version of the app")
|
||||
setDestinationInExternalFilesDir(context, Environment.DIRECTORY_DOWNLOADS, apkFileName)
|
||||
|
||||
setNotificationVisibility(DownloadManager.Request.VISIBILITY_VISIBLE_NOTIFY_COMPLETED)
|
||||
// setAllowedOverRoaming(false)
|
||||
setMimeType("application/vnd.android.package-archive")
|
||||
}
|
||||
|
||||
val manager = context.getSystemService(Context.DOWNLOAD_SERVICE) as DownloadManager
|
||||
val downloadId = manager.enqueue(request)
|
||||
|
||||
var downloading = true
|
||||
while (downloading) {
|
||||
val query = DownloadManager.Query().setFilterById(downloadId)
|
||||
val cursor = manager.query(query)
|
||||
if (cursor.moveToFirst()) {
|
||||
val bytesDownloaded =
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_BYTES_DOWNLOADED_SO_FAR))
|
||||
val bytesTotal =
|
||||
cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_TOTAL_SIZE_BYTES))
|
||||
|
||||
if (bytesTotal > 0) {
|
||||
val progress = (bytesDownloaded * 100L / bytesTotal).toInt()
|
||||
Log.i(TAG, "progress $progress")
|
||||
// myViewModel.setDownloadProgress(progress)
|
||||
notificationBuilder.setProgress(100, progress, false)
|
||||
notificationManager.notify(1, notificationBuilder.build())
|
||||
}
|
||||
|
||||
when (cursor.getInt(cursor.getColumnIndexOrThrow(DownloadManager.COLUMN_STATUS))) {
|
||||
DownloadManager.STATUS_SUCCESSFUL -> downloading = false
|
||||
DownloadManager.STATUS_FAILED -> {
|
||||
downloading = false
|
||||
throw Exception("Download failed")
|
||||
}
|
||||
}
|
||||
}
|
||||
cursor.close()
|
||||
}
|
||||
|
||||
notificationBuilder.setContentText("Download complete")
|
||||
.setProgress(0, 0, false)
|
||||
.setOngoing(false)
|
||||
notificationManager.notify(1, notificationBuilder.build())
|
||||
|
||||
val apkFile = File(
|
||||
context.getExternalFilesDir(Environment.DIRECTORY_DOWNLOADS),
|
||||
apkFileName
|
||||
)
|
||||
|
||||
if (apkFile.exists()) {
|
||||
val apkUri: Uri = if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
FileProvider.getUriForFile(context, context.packageName + ".fileprovider", apkFile)
|
||||
.apply {
|
||||
Intent.FLAG_GRANT_READ_URI_PERMISSION
|
||||
}
|
||||
} else {
|
||||
Uri.parse("file://${apkFile.absolutePath}")
|
||||
// Uri.fromFile(apkFile)
|
||||
}
|
||||
// val apkUri = Uri.parse("file://$apkFile")
|
||||
Log.i(TAG, "apkUri $apkUri")
|
||||
val installIntent = Intent(Intent.ACTION_VIEW).apply {
|
||||
setDataAndType(apkUri, "application/vnd.android.package-archive")
|
||||
addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION or Intent.FLAG_ACTIVITY_NEW_TASK)
|
||||
}
|
||||
|
||||
context.startActivity(installIntent)
|
||||
} else {
|
||||
Log.e(TAG, "APK file does not exist!")
|
||||
}
|
||||
}
|
||||
|
||||
companion object {
|
||||
private const val TAG = "UpdateWorker"
|
||||
}
|
||||
}
|
||||
@@ -3,6 +3,7 @@ package com.lizongying.mytv.api
|
||||
|
||||
import android.os.Build
|
||||
import android.util.Log
|
||||
import com.google.gson.Gson
|
||||
import com.lizongying.mytv.jce.JceConverterFactory
|
||||
import com.lizongying.mytv.requests.ReleaseService
|
||||
import okhttp3.ConnectionSpec
|
||||
@@ -24,17 +25,19 @@ class ApiClient {
|
||||
private val protoUrl = "https://capi.yangshipin.cn/"
|
||||
private val traceUrl = "https://btrace.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 jceUrl = "https://jacc.ysp.cctv.cn/"
|
||||
private val fUrl = "https://m.fengshows.com/"
|
||||
|
||||
private var okHttpClient = getUnsafeOkHttpClient()
|
||||
private var gson = Gson()
|
||||
|
||||
val yspApiService: YSPApiService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(yspUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPApiService::class.java)
|
||||
}
|
||||
|
||||
@@ -42,7 +45,7 @@ class ApiClient {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(myUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPTokenService::class.java)
|
||||
}
|
||||
|
||||
@@ -50,7 +53,7 @@ class ApiClient {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(HOST)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(ReleaseService::class.java)
|
||||
}
|
||||
|
||||
@@ -66,7 +69,7 @@ class ApiClient {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(traceUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPBtraceService::class.java)
|
||||
}
|
||||
|
||||
@@ -74,15 +77,23 @@ class ApiClient {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(trace2Url)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPBtraceService::class.java)
|
||||
}
|
||||
|
||||
val yspToken2Service: YSPApiService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(tokenUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPApiService::class.java)
|
||||
}
|
||||
|
||||
val yspBtraceService3: YSPBtraceService by lazy {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(trace3Url)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(YSPBtraceService::class.java)
|
||||
}
|
||||
|
||||
@@ -98,7 +109,7 @@ class ApiClient {
|
||||
Retrofit.Builder()
|
||||
.baseUrl(fUrl)
|
||||
.client(okHttpClient)
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create(gson))
|
||||
.build().create(FAuthService::class.java)
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,8 @@ class Encryptor {
|
||||
|
||||
external fun encrypt(t: String, e: String, r: String, n: String, i: String): String
|
||||
|
||||
external fun encrypt2(t: String): String
|
||||
|
||||
external fun hash(data: ByteArray): ByteArray?
|
||||
|
||||
external fun hash2(data: ByteArray): ByteArray?
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
data class KvcollectRequest(
|
||||
val BossId: Int = 2727,
|
||||
val Pwd: Int = 1424084450,
|
||||
val BossId: Int = 99150,
|
||||
val Pwd: Int = 1999332929,
|
||||
val cdn: String = "waibao",
|
||||
val cmd: Int = 263,
|
||||
val defn: String = "fhd",
|
||||
val downspeed: Double = 10.0,
|
||||
val downspeed: Int = 10,
|
||||
val durl: String = "", //
|
||||
val errcode: String = "",
|
||||
val fact1: String = "ysp_pc_live_b",
|
||||
val firstreport: Int = 0,
|
||||
val fplayerver: String = "100",
|
||||
val fplayerver: String = "180",
|
||||
val ftime: String = "", //
|
||||
val geturltime: Int = 0,
|
||||
val guid: String = "", //
|
||||
@@ -39,17 +39,17 @@ data class KvcollectRequest(
|
||||
|
||||
|
||||
data class KvcollectRequest2(
|
||||
val BossId: Int = 2727,
|
||||
val Pwd: Int = 1424084450,
|
||||
val BossId: Int = 99150,
|
||||
val Pwd: Int = 1999332929,
|
||||
val cdn: String = "waibao",
|
||||
val cmd: Int = 263,
|
||||
val defn: String = "fhd",
|
||||
val downspeed: String = "10",
|
||||
val downspeed: Int = 10,
|
||||
val durl: String = "", //
|
||||
val errcode: String = "",
|
||||
val fact1: String = "ysp_pc_live_b",
|
||||
val firstreport: Int = 0,
|
||||
val fplayerver: String = "100",
|
||||
val fplayerver: String = "180",
|
||||
val ftime: String = "", //
|
||||
val geturltime: Int = 0,
|
||||
val guid: String = "", //
|
||||
@@ -68,9 +68,9 @@ data class KvcollectRequest2(
|
||||
val sRef: String = "",
|
||||
val sUrl: String = "", //
|
||||
val sdtfrom: String = "ysp_pc_01",
|
||||
val seq: Int = 9, //
|
||||
val seq: Int = 0, //
|
||||
var signature: String = "",
|
||||
val url: String = "", //
|
||||
val viewid: String = "", //
|
||||
val _dc: Double = 0.0,
|
||||
val _dc: String = "",
|
||||
)
|
||||
@@ -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,
|
||||
)
|
||||
}
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.lizongying.mytv.api
|
||||
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.lizongying.mytv.SP
|
||||
import com.lizongying.mytv.Utils.getDateTimestamp
|
||||
import com.lizongying.mytv.models.TVViewModel
|
||||
import java.security.MessageDigest
|
||||
import kotlin.math.floor
|
||||
import kotlin.random.Random
|
||||
|
||||
@@ -52,6 +54,14 @@ object YSP {
|
||||
|
||||
private var appid = "ysp_pc"
|
||||
var token = ""
|
||||
var token2 = ""
|
||||
|
||||
var yspsdkinput = ""
|
||||
var openapi_signature = ""
|
||||
var yspticket = ""
|
||||
|
||||
var nseqId = 1
|
||||
var nrequest_id = ""
|
||||
|
||||
private var encryptor = Encryptor()
|
||||
|
||||
@@ -75,10 +85,45 @@ object YSP {
|
||||
|
||||
cKey =
|
||||
encryptor.encrypt(cnlid, timeStr, appVer, guid, platform)
|
||||
randStr = getRand()
|
||||
signature = getSignature()
|
||||
yspticket = encryptor.encrypt2("$livepid&$timeStr&$guid&519748109").lowercase()
|
||||
|
||||
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 {
|
||||
livepid = tvModel.getTV().pid
|
||||
|
||||
@@ -92,7 +137,7 @@ object YSP {
|
||||
return """pid=$livepid&guid=$guid&appid=$appid&rand_str=$randStr&signature=$signature"""
|
||||
}
|
||||
|
||||
private fun getTimeStr(): String {
|
||||
fun getTimeStr(): String {
|
||||
return getDateTimestamp().toString()
|
||||
}
|
||||
|
||||
@@ -106,6 +151,7 @@ object YSP {
|
||||
var guid = SP.guid
|
||||
if (guid.length < 18) {
|
||||
guid = generateGuid()
|
||||
this.guid = guid
|
||||
SP.guid = guid
|
||||
}
|
||||
return guid
|
||||
|
||||
@@ -2,9 +2,11 @@ package com.lizongying.mytv.api
|
||||
|
||||
import retrofit2.Call
|
||||
import retrofit2.http.Body
|
||||
import retrofit2.http.GET
|
||||
import retrofit2.http.Header
|
||||
import retrofit2.http.Headers
|
||||
import retrofit2.http.POST
|
||||
import retrofit2.http.Query
|
||||
|
||||
|
||||
interface YSPApiService {
|
||||
@@ -18,6 +20,12 @@ interface YSPApiService {
|
||||
fun getLiveInfo(
|
||||
@Header("cookie") cookie: String,
|
||||
@Header("Yspplayertoken") token: String,
|
||||
@Header("Yspsdkinput") Yspsdkinput: String,
|
||||
@Header("yspsdksign") yspsdksign: String,
|
||||
@Header("Yspticket") Yspticket: String,
|
||||
@Header("Seqid") Seqid: String,
|
||||
@Header("Request-Id") RequestId: String,
|
||||
@Header("Yspappid") Yspappid: String="519748109",
|
||||
@Body request: LiveInfoRequest,
|
||||
): Call<LiveInfo>
|
||||
|
||||
@@ -32,4 +40,20 @@ interface YSPApiService {
|
||||
@Header("cookie") cookie: String,
|
||||
@Body request: AuthRequest,
|
||||
): 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>
|
||||
}
|
||||
@@ -87,8 +87,8 @@ interface YSPBtraceService {
|
||||
"referer: https://www.yangshipin.cn/",
|
||||
)
|
||||
fun kvcollect3(
|
||||
@Field("BossId") BossId: String = "9141",
|
||||
@Field("Pwd") Pwd: String = "1137850982",
|
||||
@Field("BossId") BossId: String = "9150",
|
||||
@Field("Pwd") Pwd: String = "1999332929",
|
||||
@Field("prog") prog: String = "", //
|
||||
@Field("playno") playno: String = "", //
|
||||
@Field("guid") guid: String = "", //
|
||||
@@ -102,7 +102,7 @@ interface YSPBtraceService {
|
||||
@Field("firstreport") firstreport: String = "-",
|
||||
@Field("sUrl") sUrl: String = "", //
|
||||
@Field("sRef") sRef: String = "-",
|
||||
@Field("fplayerver") fplayerver: String = "100",
|
||||
@Field("fplayerver") fplayerver: String = "180",
|
||||
@Field("livepid") livepid: String = "",
|
||||
@Field("viewid") viewid: String = "",
|
||||
@Field("seq") seq: String = "",
|
||||
@@ -118,8 +118,8 @@ interface YSPBtraceService {
|
||||
@Field("_dc") _dc: String = "",
|
||||
@Field("live_type") live_type: String = "-",
|
||||
@Field("ftime") ftime: String = "",
|
||||
@Field("url") url: String = "",
|
||||
@Field("rand_str") rand_str: String = "", //
|
||||
@Field("signature") signature: String = "",
|
||||
// @Field("url") url: String = "",
|
||||
// @Field("rand_str") rand_str: String = "", //
|
||||
// @Field("signature") signature: String = "",
|
||||
): Call<Void>
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.lizongying.mytv.models
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
|
||||
class MyViewModel : ViewModel() {
|
||||
private var _downloadProgress = MutableLiveData<Int>()
|
||||
val downloadProgress: LiveData<Int>
|
||||
get() = _downloadProgress
|
||||
|
||||
fun setDownloadProgress(progress: Int) {
|
||||
_downloadProgress.value = progress
|
||||
}
|
||||
|
||||
init {
|
||||
_downloadProgress.value = 0
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ data class TV(
|
||||
var programType: ProgramType,
|
||||
var needToken: Boolean = false,
|
||||
var mustToken: Boolean = false,
|
||||
var volume: Float = 0.1F,
|
||||
) : Serializable {
|
||||
|
||||
override fun toString(): String {
|
||||
|
||||
@@ -21,7 +21,8 @@ object TVList {
|
||||
"2022576801",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -34,7 +35,8 @@ object TVList {
|
||||
"2022576701",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -47,7 +49,8 @@ object TVList {
|
||||
"2022576501",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = true
|
||||
mustToken = true,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -60,7 +63,8 @@ object TVList {
|
||||
"2022576601",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -73,7 +77,8 @@ object TVList {
|
||||
"2022576401",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -86,7 +91,8 @@ object TVList {
|
||||
"2013693901",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = true
|
||||
mustToken = true,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -99,7 +105,8 @@ object TVList {
|
||||
"2022576201",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -112,7 +119,8 @@ object TVList {
|
||||
"2022576101",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = true
|
||||
mustToken = true,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -125,7 +133,8 @@ object TVList {
|
||||
"2022576001",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -138,7 +147,8 @@ object TVList {
|
||||
"2022573001",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -151,7 +161,8 @@ object TVList {
|
||||
"2022575901",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -164,7 +175,8 @@ object TVList {
|
||||
"2022575801",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -177,7 +189,8 @@ object TVList {
|
||||
"2022575701",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -190,7 +203,8 @@ object TVList {
|
||||
"2022575601",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -203,7 +217,8 @@ object TVList {
|
||||
"2022575501",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -216,7 +231,8 @@ object TVList {
|
||||
"2022575401",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -229,7 +245,8 @@ object TVList {
|
||||
"2022575301",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -242,7 +259,8 @@ object TVList {
|
||||
"2022576301",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -255,7 +273,8 @@ object TVList {
|
||||
"2022575201",
|
||||
ProgramType.Y_PROTO,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -268,7 +287,8 @@ object TVList {
|
||||
"2020603421",
|
||||
ProgramType.Y_JCE,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.8F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -738,7 +758,8 @@ object TVList {
|
||||
"2019927403",
|
||||
ProgramType.Y_JCE,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -751,7 +772,8 @@ object TVList {
|
||||
"2022606701",
|
||||
ProgramType.Y_JCE,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.8F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -764,7 +786,8 @@ object TVList {
|
||||
"2022823801",
|
||||
ProgramType.Y_JCE,
|
||||
true,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.6F
|
||||
),
|
||||
),
|
||||
"港澳台" to listOf(
|
||||
@@ -779,7 +802,8 @@ object TVList {
|
||||
"",
|
||||
ProgramType.F,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.7F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -792,7 +816,8 @@ object TVList {
|
||||
"",
|
||||
ProgramType.F,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.7F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -805,7 +830,8 @@ object TVList {
|
||||
"",
|
||||
ProgramType.F,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.7F
|
||||
),
|
||||
),
|
||||
"国际" to listOf(
|
||||
@@ -820,7 +846,8 @@ object TVList {
|
||||
"2022575001",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -833,7 +860,8 @@ object TVList {
|
||||
"2022574901",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -846,7 +874,8 @@ object TVList {
|
||||
"2022574801",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -859,7 +888,8 @@ object TVList {
|
||||
"2022574601",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -872,7 +902,8 @@ object TVList {
|
||||
"2022571701",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
TV(
|
||||
0,
|
||||
@@ -885,7 +916,8 @@ object TVList {
|
||||
"2022574701",
|
||||
ProgramType.Y_PROTO,
|
||||
false,
|
||||
mustToken = false
|
||||
mustToken = false,
|
||||
0.5F
|
||||
),
|
||||
)
|
||||
)
|
||||
|
||||
@@ -18,6 +18,7 @@ import com.lizongying.mytv.api.KvcollectRequest
|
||||
import com.lizongying.mytv.api.KvcollectRequest2
|
||||
import com.lizongying.mytv.api.LiveInfo
|
||||
import com.lizongying.mytv.api.LiveInfoRequest
|
||||
import com.lizongying.mytv.api.Token2
|
||||
import com.lizongying.mytv.api.YSP
|
||||
import com.lizongying.mytv.api.YSPApiService
|
||||
import com.lizongying.mytv.api.YSPBtraceService
|
||||
@@ -42,6 +43,7 @@ import kotlin.random.Random
|
||||
object Request {
|
||||
private const val TAG = "Request"
|
||||
private var yspTokenService: YSPTokenService = ApiClient().yspTokenService
|
||||
private var yspToken2Service: YSPApiService = ApiClient().yspToken2Service
|
||||
private var yspApiService: YSPApiService = ApiClient().yspApiService
|
||||
private var yspBtraceService: YSPBtraceService = ApiClient().yspBtraceService
|
||||
private var yspBtraceService2: YSPBtraceService = ApiClient().yspBtraceService2
|
||||
@@ -56,6 +58,7 @@ object Request {
|
||||
|
||||
private var needAuth = true
|
||||
private var needToken = false
|
||||
private var needToken2 = true
|
||||
|
||||
private val handler = Handler(Looper.getMainLooper())
|
||||
private lateinit var btraceRunnable: BtraceRunnable
|
||||
@@ -74,6 +77,7 @@ object Request {
|
||||
}
|
||||
|
||||
private var call: Call<LiveInfo>? = null
|
||||
private var callToken: Call<Token2>? = null
|
||||
private var callAuth: Call<Auth>? = null
|
||||
private var callInfo: Call<Info>? = null
|
||||
private var callFAuth: Call<FAuth>? = null
|
||||
@@ -84,11 +88,117 @@ object Request {
|
||||
private fun cancelCall() {
|
||||
call?.cancel()
|
||||
callAuth?.cancel()
|
||||
callToken?.cancel()
|
||||
callInfo?.cancel()
|
||||
callFAuth?.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) {
|
||||
cancelCall()
|
||||
|
||||
@@ -103,11 +213,11 @@ object Request {
|
||||
val liveInfo = response.body()
|
||||
|
||||
if (liveInfo?.data?.token != null) {
|
||||
Log.i(TAG, "token ${liveInfo.data.token}")
|
||||
Log.i(TAG, "auth ${liveInfo.data.token}")
|
||||
YSP.token = liveInfo.data.token
|
||||
fetchVideo(tvModel, cookie)
|
||||
} else {
|
||||
Log.e(TAG, "$title token error")
|
||||
Log.e(TAG, "$title auth error")
|
||||
if (tvModel.retryTimes < tvModel.retryMaxTimes) {
|
||||
tvModel.retryTimes++
|
||||
if (tvModel.getTV().needToken) {
|
||||
@@ -206,8 +316,14 @@ object Request {
|
||||
val request = LiveInfoRequest(data)
|
||||
call = request.let {
|
||||
yspApiService.getLiveInfo(
|
||||
"guid=${YSP.getGuid()}; $cookie",
|
||||
"guid=${YSP.getGuid()}; gr_user_id=1; $cookie; newLogin=1; nseqId=${YSP.nseqId}; nrequest-id=${YSP.nrequest_id}",
|
||||
YSP.token,
|
||||
YSP.yspsdkinput,
|
||||
YSP.openapi_signature,
|
||||
YSP.yspticket,
|
||||
"${YSP.nseqId}",
|
||||
YSP.nrequest_id,
|
||||
"519748109",
|
||||
it
|
||||
)
|
||||
}
|
||||
@@ -392,6 +508,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) {
|
||||
cancelCall()
|
||||
if (tvModel.needGetToken) {
|
||||
@@ -447,7 +623,7 @@ object Request {
|
||||
})
|
||||
} else {
|
||||
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)
|
||||
}
|
||||
}
|
||||
@@ -569,19 +745,42 @@ object Request {
|
||||
if (token == "") {
|
||||
tvModel.needGetToken = true
|
||||
}
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel)
|
||||
if (needToken2) {
|
||||
if (needAuth) {
|
||||
fetchToken(tvModel)
|
||||
} else {
|
||||
fetchAuth(tvModel)
|
||||
}
|
||||
} else {
|
||||
fetchVideo(tvModel)
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel)
|
||||
} else {
|
||||
fetchVideo(tvModel)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
val cookie =
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; updateProtocol=1; deviceModel=120"
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
"versionName=99.99.99; versionCode=999999; vplatform=109; platformVersion=Chrome; deviceModel=124"
|
||||
|
||||
if (needToken2) {
|
||||
if (needAuth) {
|
||||
fetchToken(tvModel, cookie)
|
||||
} else {
|
||||
fetchAuth(tvModel, cookie)
|
||||
}
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
if (needAuth) {
|
||||
fetchAuth(tvModel, cookie)
|
||||
} else {
|
||||
fetchVideo(tvModel, cookie)
|
||||
}
|
||||
}
|
||||
//
|
||||
// if (needAuth) {
|
||||
// fetchAuth(tvModel, cookie)
|
||||
// } else {
|
||||
// fetchVideo(tvModel, cookie)
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -700,7 +899,7 @@ object Request {
|
||||
seq = tvModel.seq,
|
||||
durl = url,
|
||||
url = url,
|
||||
_dc = randomNumber,
|
||||
// _dc = "",
|
||||
)
|
||||
|
||||
val e =
|
||||
@@ -732,7 +931,7 @@ object Request {
|
||||
val guid = YSP.getGuid()
|
||||
val pid = tvModel.getTV().pid
|
||||
val sid = tvModel.getTV().sid
|
||||
val randomNumber = Random.nextDouble()
|
||||
// val randomNumber = Random.nextDouble()
|
||||
val url = tvModel.getTV().videoUrl.first()
|
||||
|
||||
val r = KvcollectRequest2(
|
||||
@@ -747,12 +946,12 @@ object Request {
|
||||
seq = tvModel.seq,
|
||||
durl = url,
|
||||
url = url,
|
||||
_dc = randomNumber,
|
||||
_dc = "",
|
||||
)
|
||||
|
||||
val e =
|
||||
"BossId=${r.BossId}&Pwd=${r.Pwd}&_dc=${r._dc}&cdn=${r.cdn}&cmd=${r.cmd}&defn=${r.defn}&downspeed=${r.downspeed}&durl=${r.durl}&errcode=${r.errcode}&fact1=${r.fact1}&firstreport=${r.firstreport}&fplayerver=${r.fplayerver}&ftime=${r.ftime}&geturltime=${r.geturltime}&guid=${r.guid}&hc_openid=${r.hc_openid}&hh_ua=${r.hh_ua}&live_type=${r.live_type}&livepid=${r.livepid}&login_type=${r.login_type}&open_id=${r.open_id}&openid=${r.openid}&platform=${r.platform}&playno=${r.playno}&prd=${r.prd}&prog=${r.prog}&rand_str=${r.rand_str}&sRef=${r.sRef}&sUrl=${r.sUrl}&sdtfrom=${r.sdtfrom}&seq=${r.seq}&url=${r.url}&viewid=${r.viewid}"
|
||||
r.signature = YSP.getAuthSignature(e)
|
||||
// val e =
|
||||
// "BossId=${r.BossId}&Pwd=${r.Pwd}&_dc=${r._dc}&cdn=${r.cdn}&cmd=${r.cmd}&defn=${r.defn}&downspeed=${r.downspeed}&durl=${r.durl}&errcode=${r.errcode}&fact1=${r.fact1}&firstreport=${r.firstreport}&fplayerver=${r.fplayerver}&ftime=${r.ftime}&geturltime=${r.geturltime}&guid=${r.guid}&hc_openid=${r.hc_openid}&hh_ua=${r.hh_ua}&live_type=${r.live_type}&livepid=${r.livepid}&login_type=${r.login_type}&open_id=${r.open_id}&openid=${r.openid}&platform=${r.platform}&playno=${r.playno}&prd=${r.prd}&prog=${r.prog}&rand_str=${r.rand_str}&sRef=${r.sRef}&sUrl=${r.sUrl}&sdtfrom=${r.sdtfrom}&seq=${r.seq}&url=${r.url}&viewid=${r.viewid}"
|
||||
// r.signature = YSP.getAuthSignature(e)
|
||||
|
||||
callBtracePage = yspBtraceService3.kvcollect3(
|
||||
guid = r.guid,
|
||||
@@ -761,18 +960,18 @@ object Request {
|
||||
livepid = r.livepid,
|
||||
sUrl = r.sUrl,
|
||||
playno = r.playno,
|
||||
rand_str = r.rand_str,
|
||||
// rand_str = r.rand_str,
|
||||
ftime = r.ftime,
|
||||
seq = "${r.seq}",
|
||||
durl = r.durl,
|
||||
url = r.url,
|
||||
// url = r.url,
|
||||
_dc = "${r._dc}",
|
||||
signature = r.signature
|
||||
// signature = r.signature
|
||||
)
|
||||
callBtracePage?.enqueue(object : Callback<Void> {
|
||||
override fun onResponse(call: Call<Void>, response: Response<Void>) {
|
||||
if (response.isSuccessful) {
|
||||
Log.d(TAG, "$title kvcollect success")
|
||||
Log.i(TAG, "$title kvcollect success")
|
||||
} else {
|
||||
Log.e(TAG, "$title kvcollect status error")
|
||||
}
|
||||
|
||||
@@ -0,0 +1,24 @@
|
||||
<!-- res/layout/fragment_progress_dialog.xml -->
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:padding="20dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/start_update"
|
||||
tools:text="开始更新">
|
||||
</Button>
|
||||
<androidx.core.widget.ContentLoadingProgressBar
|
||||
android:id="@+id/progressBar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:indeterminate="false"
|
||||
android:max="100"
|
||||
android:progress="0"
|
||||
android:progressDrawable="@android:drawable/progress_horizontal" />
|
||||
</LinearLayout>
|
||||
@@ -6,15 +6,6 @@
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/black"
|
||||
android:keepScreenOn="true">
|
||||
|
||||
<SurfaceView
|
||||
android:id="@+id/surface_view"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_gravity="center"
|
||||
app:resize_mode="fill"
|
||||
app:use_controller="false" />
|
||||
|
||||
<androidx.media3.ui.PlayerView
|
||||
android:id="@+id/player_view"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
@@ -1,18 +1,22 @@
|
||||
<?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:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
>
|
||||
<LinearLayout
|
||||
<ScrollView
|
||||
android:id="@+id/container"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
android:layout_height="match_parent"
|
||||
android:fillViewport="true"
|
||||
>
|
||||
<LinearLayout
|
||||
android:id="@+id/content"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="20dp"
|
||||
android:paddingBottom="20dp"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:background="@drawable/rounded_dark_left"
|
||||
@@ -55,6 +59,22 @@
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<!-- <androidx.core.widget.ContentLoadingProgressBar-->
|
||||
<!-- android:id="@+id/progressBar"-->
|
||||
<!-- android:layout_width="match_parent"-->
|
||||
<!-- android:layout_height="wrap_content"-->
|
||||
<!-- android:indeterminate="false"-->
|
||||
<!-- android:max="100"-->
|
||||
<!-- android:progress="0"-->
|
||||
<!-- android:visibility="gone"-->
|
||||
<!-- android:progressDrawable="@android:drawable/progress_horizontal" />-->
|
||||
<Button
|
||||
android:id="@+id/clear"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="14sp"
|
||||
android:text="@string/clear"
|
||||
/>
|
||||
<Button
|
||||
android:id="@+id/exit"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -98,11 +118,11 @@
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
<ImageView
|
||||
android:id="@+id/appreciate"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/appreciate"
|
||||
android:background="@drawable/rounded_white_right" />
|
||||
</LinearLayout>
|
||||
</FrameLayout>
|
||||
</ScrollView>
|
||||
<ImageView
|
||||
android:id="@+id/appreciate"
|
||||
android:layout_width="300dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/appreciate"
|
||||
android:background="@drawable/rounded_white_right" />
|
||||
</LinearLayout>
|
||||
@@ -6,5 +6,7 @@
|
||||
<string name="title_boot_startup">开机自启</string>
|
||||
<string name="title_grid">频道列表采用网格样式</string>
|
||||
<string name="title_time">显示时间</string>
|
||||
<string name="clear">恢复默认</string>
|
||||
<string name="exit">退出应用</string>
|
||||
<string name="start_update">开始更新</string>
|
||||
</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": 17369088, "version_name": "v1.9.8"}
|
||||
{"version_code": 33620480, "version_name": "v2.1.2"}
|
||||
|
||||
Reference in New Issue
Block a user