mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-06-28 21:30:18 +08:00
tweak
This commit is contained in:
@@ -207,13 +207,7 @@ class RenderViewPointProgressBar
|
||||
),
|
||||
),
|
||||
)
|
||||
..pushStyle(
|
||||
ui.TextStyle(
|
||||
color: Colors.white,
|
||||
fontSize: size,
|
||||
height: 1,
|
||||
),
|
||||
)
|
||||
..pushStyle(.new(color: Colors.white, fontSize: size, height: 1))
|
||||
..addText(title);
|
||||
return builder.build()
|
||||
..layout(const ui.ParagraphConstraints(width: double.infinity));
|
||||
|
||||
@@ -19,7 +19,6 @@ import 'package:PiliPlus/models/common/sponsor_block/segment_model.dart';
|
||||
import 'package:PiliPlus/models/common/sponsor_block/segment_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/audio_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/source_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/subtitle_pref_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_decode_type.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_quality.dart';
|
||||
import 'package:PiliPlus/models/common/video/video_type.dart';
|
||||
@@ -1050,16 +1049,14 @@ class VideoDetailController extends GetxController
|
||||
|
||||
RxList<Subtitle> subtitles = RxList<Subtitle>();
|
||||
final Map<int, ({bool isData, String id})> vttSubtitles = {};
|
||||
late final RxInt vttSubtitlesIndex = (-1).obs;
|
||||
late final RxBool showVP = true.obs;
|
||||
late final RxList<ViewPointSegment> viewPointList = <ViewPointSegment>[].obs;
|
||||
late final vttSubtitlesIndex = (-1).obs;
|
||||
late final showVP = true.obs;
|
||||
late final viewPointList = <ViewPointSegment>[].obs;
|
||||
|
||||
// 设定字幕轨道
|
||||
Future<void> setSubtitle(int index) async {
|
||||
if (index <= 0) {
|
||||
await plPlayerController.videoPlayerController?.setSubtitleTrack(
|
||||
SubtitleTrack.no(),
|
||||
);
|
||||
await plPlayerController.videoPlayerController?.setSubtitleTrack(.no());
|
||||
vttSubtitlesIndex.value = index;
|
||||
return;
|
||||
}
|
||||
@@ -1136,9 +1133,9 @@ class VideoDetailController extends GetxController
|
||||
);
|
||||
if (res case Success(:final response)) {
|
||||
// interactive video
|
||||
late final introCtr = Get.find<UgcIntroController>(tag: heroTag);
|
||||
if (isUgc && graphVersion == null) {
|
||||
try {
|
||||
final introCtr = Get.find<UgcIntroController>(tag: heroTag);
|
||||
if (introCtr.videoDetail.value.rights?.isSteinGate == 1) {
|
||||
graphVersion = response.interaction?.graphVersion;
|
||||
getSteinEdgeInfo();
|
||||
@@ -1150,22 +1147,18 @@ class VideoDetailController extends GetxController
|
||||
|
||||
if (isUgc && continuePlayingPart) {
|
||||
continuePlayingPart = false;
|
||||
try {
|
||||
UgcIntroController ugcIntroController = Get.find<UgcIntroController>(
|
||||
tag: heroTag,
|
||||
);
|
||||
if ((ugcIntroController.videoDetail.value.pages?.length ?? 0) > 1 &&
|
||||
response.lastPlayCid != null &&
|
||||
response.lastPlayCid != 0) {
|
||||
if (response.lastPlayCid != cid.value) {
|
||||
int index = ugcIntroController.videoDetail.value.pages!
|
||||
.indexWhere((item) => item.cid == response.lastPlayCid);
|
||||
final lastCid = response.lastPlayCid;
|
||||
if (lastCid != null && lastCid != 0 && lastCid != cid.value) {
|
||||
try {
|
||||
final pages = introCtr.videoDetail.value.pages;
|
||||
if (pages != null && pages.length > 1) {
|
||||
final index = pages.indexWhere((item) => item.cid == lastCid);
|
||||
if (index != -1) {
|
||||
onAddItem(index);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (_) {}
|
||||
} catch (_) {}
|
||||
}
|
||||
}
|
||||
|
||||
if (plPlayerController.showViewPoints &&
|
||||
@@ -1184,16 +1177,14 @@ class VideoDetailController extends GetxController
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
if (response.subtitle?.subtitles?.isNotEmpty == true) {
|
||||
subtitles.value = response.subtitle!.subtitles!;
|
||||
|
||||
if (response.subtitle?.subtitles case final sub? when (sub.isNotEmpty)) {
|
||||
subtitles.value = sub;
|
||||
final idx = switch (Pref.subtitlePreferenceV2) {
|
||||
SubtitlePrefType.off => 0,
|
||||
SubtitlePrefType.on => 1,
|
||||
SubtitlePrefType.withoutAi =>
|
||||
subtitles.first.lan.startsWith('ai') ? 0 : 1,
|
||||
SubtitlePrefType.auto =>
|
||||
!subtitles.first.lan.startsWith('ai') ||
|
||||
.off => 0,
|
||||
.on => 1,
|
||||
.withoutAi => sub.first.lan.startsWith('ai') ? 0 : 1,
|
||||
.auto =>
|
||||
!sub.first.lan.startsWith('ai') ||
|
||||
(PlatformUtils.isMobile &&
|
||||
(await FlutterVolumeController.getVolume() ?? 0.0) <=
|
||||
0.0)
|
||||
|
||||
@@ -110,7 +110,7 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
}
|
||||
}
|
||||
final isCurr = currentIndex == index;
|
||||
return _buildItem(theme, segment, isCurr);
|
||||
return _buildItem(theme.colorScheme, segment, isCurr);
|
||||
},
|
||||
);
|
||||
if (_isNested) {
|
||||
@@ -122,8 +122,11 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
return child;
|
||||
}
|
||||
|
||||
Widget _buildItem(ThemeData theme, ViewPointSegment segment, bool isCurr) {
|
||||
final theme = Theme.of(context);
|
||||
Widget _buildItem(
|
||||
ColorScheme colorScheme,
|
||||
ViewPointSegment segment,
|
||||
bool isCurr,
|
||||
) {
|
||||
return Material(
|
||||
type: MaterialType.transparency,
|
||||
child: InkWell(
|
||||
@@ -137,18 +140,11 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
}
|
||||
: null,
|
||||
child: Padding(
|
||||
padding: const EdgeInsets.symmetric(
|
||||
horizontal: Style.safeSpace,
|
||||
vertical: 5,
|
||||
),
|
||||
padding: const .symmetric(horizontal: Style.safeSpace, vertical: 5),
|
||||
child: Row(
|
||||
crossAxisAlignment: CrossAxisAlignment.start,
|
||||
children: [
|
||||
NetworkImgLayer(
|
||||
src: segment.url,
|
||||
width: 140.8,
|
||||
height: 88,
|
||||
),
|
||||
NetworkImgLayer(src: segment.url, width: 140.8, height: 88),
|
||||
const SizedBox(width: 10),
|
||||
Expanded(
|
||||
child: Column(
|
||||
@@ -163,14 +159,14 @@ class _ViewPointsPageState extends State<ViewPointsPage>
|
||||
style: isCurr
|
||||
? TextStyle(
|
||||
fontWeight: FontWeight.bold,
|
||||
color: theme.colorScheme.primary,
|
||||
color: colorScheme.primary,
|
||||
)
|
||||
: null,
|
||||
),
|
||||
Text(
|
||||
'${segment.from != null ? DurationUtils.formatDuration(segment.from) : ''} - '
|
||||
'${segment.to != null ? DurationUtils.formatDuration(segment.to) : ''}',
|
||||
style: TextStyle(color: theme.colorScheme.outline),
|
||||
style: TextStyle(color: colorScheme.outline),
|
||||
),
|
||||
],
|
||||
),
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
import 'dart:convert' show ascii, base64;
|
||||
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
import 'package:flutter_sortable_wrap/sortable_utils.dart';
|
||||
import 'package:uuid/v4.dart';
|
||||
|
||||
abstract final class IdUtils {
|
||||
@@ -24,12 +25,6 @@ abstract final class IdUtils {
|
||||
static final avRegexExact = RegExp(r'^av(\d+)$', caseSensitive: false);
|
||||
static final digitOnlyRegExp = RegExp(r'^\d+$');
|
||||
|
||||
static void swap<T>(List<T> list, int idx1, int idx2) {
|
||||
final idx1Value = list[idx1];
|
||||
list[idx1] = list[idx2];
|
||||
list[idx2] = idx1Value;
|
||||
}
|
||||
|
||||
/// av转bv
|
||||
static String av2bv(int aid) {
|
||||
final bytes = ['B', 'V', '1', '0', '0', '0', '0', '0', '0', '0', '0', '0'];
|
||||
@@ -40,18 +35,18 @@ abstract final class IdUtils {
|
||||
tmp ~/= BASE;
|
||||
}
|
||||
|
||||
swap(bytes, 3, 9);
|
||||
swap(bytes, 4, 7);
|
||||
bytes
|
||||
..swap(3, 9)
|
||||
..swap(4, 7);
|
||||
|
||||
return bytes.join();
|
||||
}
|
||||
|
||||
/// bv转av
|
||||
static int bv2av(String bvid) {
|
||||
final bvidArr = bvid.codeUnits.sublist(3);
|
||||
|
||||
swap(bvidArr, 0, 6);
|
||||
swap(bvidArr, 1, 4);
|
||||
final bvidArr = bvid.codeUnits.sublist(3)
|
||||
..swap(0, 6)
|
||||
..swap(1, 4);
|
||||
|
||||
final tmp = bvidArr.fold(0, (pre, char) => pre * BASE + invData[char]!);
|
||||
return (tmp & MASK_CODE) ^ XOR_CODE;
|
||||
|
||||
Reference in New Issue
Block a user