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