mod: 字符替换、跳转播放

This commit is contained in:
guozhigq
2023-06-24 16:54:39 +08:00
parent f522886dc2
commit 7174eef890
8 changed files with 43 additions and 26 deletions

View File

@ -1,6 +1,7 @@
class Api { class Api {
// 推荐视频 // 推荐视频
// http://app.bilibili.com/x/v2/feed/index // static const String recommendList =
// 'https://app.bilibili.com/x/v2/feed/index?appkey=27eb53fc9058f8c3';
static const String recommendList = '/x/web-interface/index/top/feed/rcmd'; static const String recommendList = '/x/web-interface/index/top/feed/rcmd';
// 热门视频 // 热门视频

View File

@ -82,9 +82,14 @@ class Request {
//响应流上前后两次接受到数据的间隔,单位为毫秒。 //响应流上前后两次接受到数据的间隔,单位为毫秒。
receiveTimeout: const Duration(milliseconds: 12000), receiveTimeout: const Duration(milliseconds: 12000),
//Http请求头. //Http请求头.
// headers: { headers: {
// 'cookie': '', // 'cookie': '',
// }, "env": 'prod',
"app-key": 'android',
"x-bili-aurora-eid": 'UlMFQVcABlAH',
"x-bili-aurora-zone": 'sh001',
// "x-bili-mid": ''
},
); );
dio.options = options; dio.options = options;

View File

@ -1,4 +1,5 @@
import 'package:pilipala/utils/em.dart'; import 'package:pilipala/utils/em.dart';
import 'package:pilipala/utils/utils.dart';
class SearchVideoModel { class SearchVideoModel {
SearchVideoModel({this.list}); SearchVideoModel({this.list});
@ -86,25 +87,12 @@ class SearchVideoItemModel {
videoReview = json['video_review']; videoReview = json['video_review'];
pubdate = json['pubdate']; pubdate = json['pubdate'];
senddate = json['senddate']; senddate = json['senddate'];
duration = _dutation(json['duration']); duration = Utils.duration(json['duration']);
owner = Owner.fromJson(json); owner = Owner.fromJson(json);
stat = Stat.fromJson(json); stat = Stat.fromJson(json);
} }
} }
_dutation(String duration) {
List timeList = duration.split(':');
int len = timeList.length;
if (len == 2) {
return int.parse(timeList[0]) * 60 + int.parse(timeList[1]);
}
if (len == 3) {
return int.parse(timeList[0]) * 3600 +
int.parse(timeList[1]) * 60 +
timeList[2];
}
}
class Stat { class Stat {
Stat({ Stat({
this.view, this.view,

View File

@ -73,6 +73,7 @@ class HomeAppBar extends StatelessWidget {
src: userInfoCache.get('userInfoCache').face, src: userInfoCache.get('userInfoCache').face,
), ),
), ),
const SizedBox(width: 10),
] else ...[ ] else ...[
IconButton( IconButton(
onPressed: () => showModalBottomSheet( onPressed: () => showModalBottomSheet(

View File

@ -42,7 +42,7 @@ class MediaController extends GetxController {
} }
Future<dynamic> queryFavFolder() async { Future<dynamic> queryFavFolder() async {
if (!userLogin.value) { if (!userLogin.value || GStrorage.user.get(UserBoxKey.userMid) == null) {
return {'status': false, 'data': [], 'msg': '未登录'}; return {'status': false, 'data': [], 'msg': '未登录'};
} }
var res = await await UserHttp.userfavFolder( var res = await await UserHttp.userfavFolder(

View File

@ -119,9 +119,9 @@ class MediaPage extends StatelessWidget {
mediaController.favFolderData.value.count!; mediaController.favFolderData.value.count!;
bool flag = favFolderCount > favFolderList.length; bool flag = favFolderCount > favFolderList.length;
return Obx(() => ListView.builder( return Obx(() => ListView.builder(
itemCount: mediaController itemCount:
.favFolderData.value.list!.length + mediaController.favFolderData.value.list!.length +
(flag ? 1 : 0), (flag ? 1 : 0),
itemBuilder: (context, index) { itemBuilder: (context, index) {
if (flag && index == favFolderList.length) { if (flag && index == favFolderList.length) {
return Padding( return Padding(

View File

@ -2,6 +2,7 @@ import 'dart:developer';
import 'package:flutter/gestures.dart'; import 'package:flutter/gestures.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter_meedu_media_kit/meedu_player.dart';
import 'package:font_awesome_flutter/font_awesome_flutter.dart'; import 'package:font_awesome_flutter/font_awesome_flutter.dart';
import 'package:get/get.dart'; import 'package:get/get.dart';
import 'package:pilipala/common/widgets/network_img_layer.dart'; import 'package:pilipala/common/widgets/network_img_layer.dart';
@ -467,6 +468,9 @@ InlineSpan buildContent(BuildContext context, content) {
}); });
} }
// content.message = content.message.replaceAll(RegExp(r"\{vote:.*?\}"), ' '); // content.message = content.message.replaceAll(RegExp(r"\{vote:.*?\}"), ' ');
if (content.message.contains('&amp;')) {
content.message = content.message.replaceAll('&amp;', '&');
}
// 匹配表情 // 匹配表情
content.message.splitMapJoin( content.message.splitMapJoin(
RegExp(r"\[.*?\]"), RegExp(r"\[.*?\]"),
@ -584,10 +588,14 @@ InlineSpan buildContent(BuildContext context, content) {
style: TextStyle( style: TextStyle(
color: Theme.of(context).colorScheme.primary, color: Theme.of(context).colorScheme.primary,
), ),
// recognizer: TapGestureRecognizer() recognizer: TapGestureRecognizer()
// ..onTap = () => { ..onTap = () {
// print('time 点击'), Get.find<VideoDetailController>(tag: Get.arguments['heroTag'])
// }, .meeduPlayerController
.seekTo(
Duration(seconds: Utils.duration(matchStr)),
);
},
), ),
); );
return ''; return '';

View File

@ -142,4 +142,18 @@ class Utils {
static String makeHeroTag(v) { static String makeHeroTag(v) {
return v.toString() + Random().nextInt(9999).toString(); return v.toString() + Random().nextInt(9999).toString();
} }
static int duration(String duration) {
List timeList = duration.split(':');
int len = timeList.length;
if (len == 2) {
return int.parse(timeList[0]) * 60 + int.parse(timeList[1]);
}
if (len == 3) {
return int.parse(timeList[0]) * 3600 +
int.parse(timeList[1]) * 60 +
int.parse(timeList[2]);
}
return 0;
}
} }