Skip to content

基于自定义规则的番剧采集APP,支持流媒体在线观看,支持弹幕,支持实时超分辨率。

fix plugin search status

Predidit636ed87c4ea1
diff --git a/lib/pages/video/video_page.dart b/lib/pages/video/video_page.dart
index 48e27315..517b453f 100644
--- a/lib/pages/video/video_page.dart
+++ b/lib/pages/video/video_page.dart
@@ -172,7 +172,7 @@ class _VideoPageState extends State<VideoPage>
itemCount: videoPageController.logLines.length,
itemBuilder: (context, index) {
return Text(
- videoPageController.logLines[index],
+ videoPageController.logLines.isEmpty ? '' : videoPageController.logLines[index],
style: const TextStyle(
color: Colors.white,
),
diff --git a/lib/plugins/plugins.dart b/lib/plugins/plugins.dart
index fbce4617..7364ed58 100644
--- a/lib/plugins/plugins.dart
+++ b/lib/plugins/plugins.dart
@@ -105,7 +105,7 @@ class Plugin {
return data;
}
- queryBangumi(String keyword) async {
+ queryBangumi(String keyword, {bool shouldRethrow = false}) async {
String queryURL = searchURL.replaceAll('@keyword', keyword);
dynamic resp;
List<SearchItem> searchItems = [];
@@ -122,20 +122,19 @@ class Plugin {
'Content-Type': 'application/x-www-form-urlencoded',
};
resp = await Request().post(postUri.toString(),
- options: Options(headers: httpHeaders), data: queryParams);
+ options: Options(headers: httpHeaders), data: queryParams, shouldRethrow: shouldRethrow);
} else {
var httpHeaders = {
'referer': baseUrl + '/',
};
resp =
- await Request().get(queryURL, options: Options(headers: httpHeaders));
+ await Request().get(queryURL, options: Options(headers: httpHeaders), shouldRethrow: shouldRethrow);
}
var htmlString = resp.data.toString();
var htmlElement = parse(htmlString).documentElement!;
htmlElement.queryXPath(searchList).nodes.forEach((element) {
- // debugPrint('调试输出 ${element.queryXPath(searchName).node!.text}');
try {
SearchItem searchItem = SearchItem(
name: element.queryXPath(searchName).node!.text ?? '',
diff --git a/lib/request/query_manager.dart b/lib/request/query_manager.dart
index eb8d89ab..471f6336 100644
--- a/lib/request/query_manager.dart
+++ b/lib/request/query_manager.dart
@@ -21,7 +21,7 @@ class QueryManager {
for (Plugin plugin in pluginsController.pluginList) {
if (_isCancelled) return;
- plugin.queryBangumi(keyword).then((result) {
+ plugin.queryBangumi(keyword, shouldRethrow: true).then((result) {
if (_isCancelled) return;
infoController.pluginSearchStatus[plugin.name] = 'success';
diff --git a/lib/request/request.dart b/lib/request/request.dart
index 016bfa6f..bda43f0a 100644
--- a/lib/request/request.dart
+++ b/lib/request/request.dart
@@ -100,7 +100,7 @@ class Request {
};
}
- get(url, {data, options, cancelToken, extra}) async {
+ get(url, {data, options, cancelToken, extra, bool shouldRethrow = false}) async {
Response response;
final Options options = Options();
ResponseType resType = ResponseType.json;
@@ -121,6 +121,9 @@ class Request {
);
return response;
} on DioException catch (e) {
+ if (shouldRethrow) {
+ rethrow;
+ }
Response errResponse = Response(
data: {
'message': await ApiInterceptor.dioError(e)
@@ -132,7 +135,7 @@ class Request {
}
}
- post(url, {data, queryParameters, options, cancelToken, extra}) async {
+ post(url, {data, queryParameters, options, cancelToken, extra, bool shouldRethrow = false}) async {
// print('post-data: $data');
Response response;
try {
@@ -146,6 +149,9 @@ class Request {
// print('post success: ${response.data}');
return response;
} on DioException catch (e) {
+ if (shouldRethrow) {
+ rethrow;
+ }
Response errResponse = Response(
data: {
'message': await ApiInterceptor.dioError(e)