Skip to content

Commit

Permalink
更改 aid cid 数据类型 int -> long
Browse files Browse the repository at this point in the history
  • Loading branch information
aaa1115910 committed May 14, 2024
1 parent 75321a3 commit 8511f43
Show file tree
Hide file tree
Showing 48 changed files with 178 additions and 177 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ class RemoteControllerPanelDemoActivity : ComponentActivity() {
companion object {
fun actionStart(
context: Context,
avid: Int,
cid: Int,
avid: Long,
cid: Long,
title: String,
partTitle: String,
played: Int,
Expand Down Expand Up @@ -70,8 +70,8 @@ fun RemoteControllerPanelDemoScreen(
Prefs.showedRemoteControllerPanelDemo = true
VideoPlayerV3Activity.actionStart(
context = context,
avid = intent.getIntExtra("avid", 0),
cid = intent.getIntExtra("cid", 0),
avid = intent.getLongExtra("avid", 0),
cid = intent.getLongExtra("cid", 0),
title = intent.getStringExtra("title") ?: "",
partTitle = intent.getStringExtra("partTitle") ?: "",
played = intent.getIntExtra("played", 0),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import dev.aaa1115910.bv.ui.theme.BVTheme
class VideoInfoActivity : ComponentActivity() {
companion object {
fun actionStart(
context: Context, aid: Int,
context: Context, aid: Long,
fromSeason: Boolean = false,
proxyArea: ProxyArea = ProxyArea.MainLand
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ class VideoPlayerActivity : ComponentActivity() {
private val logger = KotlinLogging.logger { }
fun actionStart(
context: Context,
avid: Int,
cid: Int,
avid: Long,
cid: Long,
title: String,
partTitle: String,
played: Int,
Expand Down Expand Up @@ -70,8 +70,8 @@ class VideoPlayerActivity : ComponentActivity() {
playerViewModel.preparePlayer(player)

if (intent.hasExtra("avid")) {
val aid = intent.getIntExtra("avid", 170001)
val cid = intent.getIntExtra("cid", 170001)
val aid = intent.getLongExtra("avid", 170001)
val cid = intent.getLongExtra("cid", 170001)
val title = intent.getStringExtra("title") ?: "Unknown Title"
val partTitle = intent.getStringExtra("partTitle") ?: "Unknown Part Title"
val played = intent.getIntExtra("played", 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ class VideoPlayerV3Activity : ComponentActivity() {
private val logger = KotlinLogging.logger { }
fun actionStart(
context: Context,
avid: Int,
cid: Int,
avid: Long,
cid: Long,
title: String,
partTitle: String,
played: Int,
Expand Down Expand Up @@ -106,8 +106,8 @@ class VideoPlayerV3Activity : ComponentActivity() {

private fun getParamsFromIntent() {
if (intent.hasExtra("avid")) {
val aid = intent.getIntExtra("avid", 170001)
val cid = intent.getIntExtra("cid", 170001)
val aid = intent.getLongExtra("avid", 170001)
val cid = intent.getLongExtra("cid", 170001)
val title = intent.getStringExtra("title") ?: "Unknown Title"
val partTitle = intent.getStringExtra("partTitle") ?: "Unknown Part Title"
val played = intent.getIntExtra("played", 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ fun VideoPlayerController(
availableVideoCodec: List<VideoCodec> = emptyList(),
availableSubtitle: List<VideoMoreInfo.SubtitleItem> = emptyList(),
availableVideoList: List<VideoListItem> = emptyList(),
currentVideoCid: Int = 0,
currentVideoCid: Long = 0,
currentResolution: Int? = null,
currentVideoCodec: VideoCodec = VideoCodec.AVC,
currentVideoAspectRatio: VideoAspectRatio = VideoAspectRatio.Default,
Expand Down Expand Up @@ -472,7 +472,7 @@ data class VideoPlayerControllerData(
val availableSubtitle: List<VideoMoreInfo.SubtitleItem> = emptyList(),
val availableSubtitleTracks: List<Subtitle> = emptyList(),
val availableVideoList: List<VideoListItem> = emptyList(),
val currentVideoCid: Int = 0,
val currentVideoCid: Long = 0,
val currentResolution: Int? = null,
val currentVideoCodec: VideoCodec = VideoCodec.AVC,
val currentVideoAspectRatio: VideoAspectRatio = VideoAspectRatio.Default,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import dev.aaa1115910.bv.util.requestFocus
fun VideoListController(
modifier: Modifier = Modifier,
show: Boolean,
currentCid: Int,
currentCid: Long,
videoList: List<VideoListItem>,
onPlayNewVideo: (VideoListItem) -> Unit
) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package dev.aaa1115910.bv.entity.carddata
import dev.aaa1115910.bv.util.formatMinSec

data class VideoCardData(
val avid: Int,
val avid: Long,
val title: String,
val cover: String,
val upName: String,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ class VideoInfoRepository {
}

data class VideoListItem(
val aid: Int,
val cid: Int,
val aid: Long,
val cid: Long,
val epid: Int? = null,
val seasonId: Int? = null,
val title: String,
Expand Down
24 changes: 12 additions & 12 deletions app/src/main/kotlin/dev/aaa1115910/bv/screen/SeasonInfoScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,10 @@ fun SeasonInfoScreen(

val defaultFocusRequester = remember { FocusRequester() }

val onClickVideo: (avid: Int, cid: Int, epid: Int, episodeTitle: String, startTime: Int) -> Unit =
val onClickVideo: (avid: Long, cid: Long, epid: Int, episodeTitle: String, startTime: Int) -> Unit =
{ avid, cid, epid, episodeTitle, startTime ->
logger.debug { "onClickVideo: [avid=$avid, cid=$cid, epid=$epid, episodeTitle=$episodeTitle, startTime=$startTime]" }
if (cid != 0) {
if (cid != 0L) {
launchPlayerActivity(
context = context,
avid = avid,
Expand Down Expand Up @@ -290,8 +290,8 @@ fun SeasonInfoScreen(
seasonCount = seasonData!!.seasons.size,
onPlay = {
logger.fInfo { "Click play button" }
var playAid = -1
var playCid = -1
var playAid = -1L
var playCid = -1L
val playEpid: Int
var episodeList: List<Episode> = emptyList()
if (lastPlayProgress == null) {
Expand All @@ -300,7 +300,7 @@ fun SeasonInfoScreen(
playAid = seasonData?.episodes?.first()?.aid ?: -1
playCid = seasonData?.episodes?.first()?.cid ?: -1
playEpid = seasonData?.episodes?.first()?.id ?: -1
if (playCid == -1) {
if (playCid == -1L) {
R.string.season_no_feature_film.toast(context)
} else {
episodeList = seasonData?.episodes ?: emptyList()
Expand All @@ -318,7 +318,7 @@ fun SeasonInfoScreen(
episodeList = seasonData?.episodes ?: emptyList()
}
}
if (playCid == -1) {
if (playCid == -1L) {
seasonData?.sections?.forEach { section ->
section.episodes.forEach {
if (it.id == playEpid) {
Expand All @@ -329,15 +329,15 @@ fun SeasonInfoScreen(
}
}
}
if (playCid == -1) {
if (playCid == -1L) {
logger.fInfo { "Can't find cid" }
"无法判断最后播放的剧集".toast(context)
}
}

logger.fInfo { "Play aid: $playAid, cid: $playCid" }

if (playCid != -1) {
if (playCid != -1L) {
onClickVideo(
playAid,
playCid,
Expand Down Expand Up @@ -733,7 +733,7 @@ fun SeasonEpisodesDialog(
lastPlayedId: Int = 0,
lastPlayedTime: Int = 0,
onHideDialog: () -> Unit,
onClick: (avid: Int, cid: Int, epid: Int, episodeTitle: String, startTime: Int) -> Unit
onClick: (avid: Long, cid: Long, epid: Int, episodeTitle: String, startTime: Int) -> Unit
) {
val scope = rememberCoroutineScope()

Expand Down Expand Up @@ -840,7 +840,7 @@ fun SeasonEpisodesDialog(
duration = episode.duration,
onClick = {
onClick(
episode.aid.toInt(),
episode.aid,
episode.cid,
episode.id,
episode.longTitle,
Expand All @@ -864,7 +864,7 @@ fun SeasonEpisodeRow(
episodes: List<Episode>,
lastPlayedId: Int = 0,
lastPlayedTime: Int = 0,
onClick: (avid: Int, cid: Int, epid: Int, episodeTitle: String, startTime: Int) -> Unit
onClick: (avid: Long, cid: Long, epid: Int, episodeTitle: String, startTime: Int) -> Unit
) {
val focusRestorerModifiers = createCustomInitialFocusRestorerModifiers()
var hasFocus by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -940,7 +940,7 @@ fun SeasonEpisodeRow(
duration = episode.duration,
onClick = {
onClick(
episode.aid.toInt(),
episode.aid,
episode.cid,
episode.id,
episode.longTitle,
Expand Down
21 changes: 11 additions & 10 deletions app/src/main/kotlin/dev/aaa1115910/bv/screen/VideoInfoScreen.kt
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ import androidx.compose.runtime.LaunchedEffect
import androidx.compose.runtime.derivedStateOf
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableIntStateOf
import androidx.compose.runtime.mutableLongStateOf
import androidx.compose.runtime.mutableStateListOf
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
Expand Down Expand Up @@ -150,7 +151,7 @@ fun VideoInfoScreen(
var showFollowButton by remember { mutableStateOf(false) }
var isFollowing by remember { mutableStateOf(false) }

var lastPlayedCid by remember { mutableIntStateOf(0) }
var lastPlayedCid by remember { mutableLongStateOf(0) }
var lastPlayedTime by remember { mutableIntStateOf(0) }

var tip by remember { mutableStateOf("Loading") }
Expand Down Expand Up @@ -225,7 +226,7 @@ fun VideoInfoScreen(
}
}

val fetchFavoriteData: (Int) -> Unit = { avid ->
val fetchFavoriteData: (Long) -> Unit = { avid ->
scope.launch(Dispatchers.IO) {
runCatching {
val favoriteFolderMetadataListResult =
Expand Down Expand Up @@ -303,7 +304,7 @@ fun VideoInfoScreen(

LaunchedEffect(Unit) {
if (intent.hasExtra("aid")) {
val aid = intent.getIntExtra("aid", 170001)
val aid = intent.getLongExtra("aid", 170001)
fromSeason = intent.getBooleanExtra("fromSeason", false)
proxyArea = ProxyArea.entries[intent.getIntExtra("proxyArea", 0)]
//获取视频信息
Expand Down Expand Up @@ -1069,10 +1070,10 @@ private fun VideoPartRowButton(
fun VideoPartRow(
modifier: Modifier = Modifier,
pages: List<VideoPage>,
lastPlayedCid: Int = 0,
lastPlayedCid: Long = 0,
lastPlayedTime: Int = 0,
enablePartListDialog: Boolean = false,
onClick: (cid: Int) -> Unit
onClick: (cid: Long) -> Unit
) {
val focusRestorerModifiers = createCustomInitialFocusRestorerModifiers()
var hasFocus by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -1138,10 +1139,10 @@ fun VideoUgcSeasonRow(
modifier: Modifier = Modifier,
title: String,
episodes: List<Episode>,
lastPlayedCid: Int = 0,
lastPlayedCid: Long = 0,
lastPlayedTime: Int = 0,
enableUgcListDialog: Boolean = false,
onClick: (avid: Int, cid: Int) -> Unit
onClick: (avid: Long, cid: Long) -> Unit
) {
val focusRestorerModifiers = createCustomInitialFocusRestorerModifiers()
var hasFocus by remember { mutableStateOf(false) }
Expand Down Expand Up @@ -1209,7 +1210,7 @@ private fun VideoPartListDialog(
title: String,
pages: List<VideoPage>,
onHideDialog: () -> Unit,
onClick: (cid: Int) -> Unit
onClick: (cid: Long) -> Unit
) {
val scope = rememberCoroutineScope()

Expand Down Expand Up @@ -1318,7 +1319,7 @@ private fun VideoUgcListDialog(
title: String,
episodes: List<Episode>,
onHideDialog: () -> Unit,
onClick: (avid: Int, cid: Int) -> Unit
onClick: (avid: Long, cid: Long) -> Unit
) {
val scope = rememberCoroutineScope()

Expand Down Expand Up @@ -1453,7 +1454,7 @@ fun VideoPartRowPreview() {
for (i in 0..10) {
pages.add(
VideoPage(
cid = 1000 + i,
cid = 1000L + i,
index = i,
title = "这可能是我这辈子距离梅西最近的一次",
duration = 10,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ fun UserInfoScreen(
favoriteItems.forEach { favoriteItem ->
favorites.add(
VideoCardData(
avid = favoriteItem.id.toInt(),
avid = favoriteItem.id,
title = favoriteItem.title,
cover = favoriteItem.cover,
upName = favoriteItem.upper.name,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import dev.aaa1115910.bv.entity.proxy.ProxyArea

fun launchPlayerActivity(
context: Context,
avid: Int,
cid: Int,
avid: Long,
cid: Long,
title: String,
partTitle: String,
played: Int,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,8 @@ class PlayerViewModel(
var showLogs by mutableStateOf(false)
var showBuffering by mutableStateOf(false)

private var currentAid = 0
var currentCid = 0
private var currentAid = 0L
var currentCid = 0L

companion object {
private val logger = KotlinLogging.logger { }
Expand All @@ -119,8 +119,8 @@ class PlayerViewModel(
}

fun loadPlayUrl(
avid: Int,
cid: Int,
avid: Long,
cid: Long,
epid: Int? = null,
seasonId: Int? = null
) {
Expand All @@ -147,8 +147,8 @@ class PlayerViewModel(
}

private suspend fun loadPlayUrl(
avid: Int,
cid: Int,
avid: Long,
cid: Long,
fnval: Int = 4048,
qn: Int = 80,
fnver: Int = 0,
Expand Down Expand Up @@ -295,7 +295,7 @@ class PlayerViewModel(
}
}

suspend fun loadDanmaku(cid: Int) {
suspend fun loadDanmaku(cid: Long) {
runCatching {
val danmakuXmlData = BiliHttpApi.getDanmakuXml(cid = cid, sessData = Prefs.sessData)

Expand Down Expand Up @@ -358,7 +358,7 @@ class PlayerViewModel(
if (!fromSeason) {
logger.info { "Send heartbeat: [avid=$currentAid, cid=$currentCid, time=$time]" }
BiliHttpApi.sendHeartbeat(
avid = currentAid.toLong(),
avid = currentAid,
cid = currentCid,
playedTime = time,
csrf = Prefs.biliJct,
Expand All @@ -367,7 +367,7 @@ class PlayerViewModel(
} else {
logger.info { "Send heartbeat: [avid=$currentAid, cid=$currentCid, epid=$epid, sid=$seasonId, time=$time]" }
BiliHttpApi.sendHeartbeat(
avid = currentAid.toLong(),
avid = currentAid,
cid = currentCid,
playedTime = time,
type = 4,
Expand Down
Loading

0 comments on commit 8511f43

Please sign in to comment.