Skip to content

Commit

Permalink
fix: bangumi history (#80)
Browse files Browse the repository at this point in the history
  • Loading branch information
MiaoMint authored Sep 26, 2023
1 parent 4e3cbd8 commit 7baee13
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
7 changes: 5 additions & 2 deletions lib/pages/watch/video_controller.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:dio/dio.dart';
Expand All @@ -22,6 +23,7 @@ import 'package:miru_app/utils/layout.dart';
import 'package:miru_app/utils/miru_directory.dart';
import 'package:window_manager/window_manager.dart';
import 'package:path/path.dart' as path;
import 'package:crypto/crypto.dart';

class VideoPlayerController extends GetxController {
final String title;
Expand Down Expand Up @@ -266,15 +268,16 @@ class VideoPlayerController extends GetxController {
Directory(coverDir).createSync(recursive: true);
final epName = playList[index.value].name;
final filename = '${title}_$epName';
final file = File(path.join(coverDir, filename));
final file = File(
path.join(coverDir, md5.convert(utf8.encode(filename)).toString()));
if (file.existsSync()) {
file.deleteSync(recursive: true);
}

player.screenshot().then((value) {
file.writeAsBytes(value!).then(
(value) async {
debugPrint("save..");
debugPrint("save.. ${value.path}");
await DatabaseUtils.putHistory(
History()
..url = detailUrl
Expand Down
2 changes: 1 addition & 1 deletion pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ packages:
source: hosted
version: "1.6.3"
crypto:
dependency: transitive
dependency: "direct main"
description:
name: crypto
sha256: ff625774173754681d66daaf4a448684fb04b78f902da9cb3d308c19cc5e8bab
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ dependencies:
xpath_selector_html_parser: ^3.0.1
device_info_plus: ^9.0.3
android_intent_plus: ^4.0.2
crypto: ^3.0.3


dev_dependencies:
Expand Down

0 comments on commit 7baee13

Please sign in to comment.