Skip to content

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

fix(bangumi): imported items count missing (#2035)

華仔3608e808f125
diff --git a/lib/modules/bangumi/bangumi_collection.dart b/lib/modules/bangumi/bangumi_collection.dart
index 08b11be0..b51bfe1a 100644
--- a/lib/modules/bangumi/bangumi_collection.dart
+++ b/lib/modules/bangumi/bangumi_collection.dart
@@ -68,7 +68,7 @@ class BangumiCollection {
'rank': rank,
'score': score,
'total': 0,
- 'count': List<int>.filled(10, 0),
+ 'count': <int>[],
},
'info': '',
});
diff --git a/lib/pages/info/info_page.dart b/lib/pages/info/info_page.dart
index d2fb81c5..152ae49f 100644
--- a/lib/pages/info/info_page.dart
+++ b/lib/pages/info/info_page.dart
@@ -51,6 +51,14 @@ class _InfoPageState extends State<InfoPage> with TickerProviderStateMixin {
final inputBangumiIten = Modular.args.data as BangumiItem;
+ bool _needsBangumiInfoRefresh(BangumiItem bangumiItem) {
+ final votesCount = bangumiItem.votesCount;
+ final missingVoteDistribution = votesCount.isEmpty ||
+ bangumiItem.votes <= 0 ||
+ votesCount.length < 10;
+ return bangumiItem.summary == '' || missingVoteDistribution;
+ }
+
Future<void> loadCharacters() async {
if (charactersIsLoading) return;
setState(() {
@@ -150,8 +158,7 @@ class _InfoPageState extends State<InfoPage> with TickerProviderStateMixin {
// Because the gap between different bangumi API response is too large, sometimes we need to query the bangumi info again
// We need the type parameter to determine whether to attach the new data to the old data
// We can't generally replace the old data with the new data, because the old data contains images url, update them will cause the image to reload and flicker
- if (infoController.bangumiItem.summary == '' ||
- infoController.bangumiItem.votesCount.isEmpty) {
+ if (_needsBangumiInfoRefresh(infoController.bangumiItem)) {
queryBangumiInfoByID(infoController.bangumiItem.id, type: 'attach');
}
sourceTabController =