mirror of
https://github.com/bggRGjQaUbCoE/PiliPlus.git
synced 2026-04-23 12:10:33 +08:00
feat: video download
Signed-off-by: bggRGjQaUbCoE <githubaccount56556@proton.me>
This commit is contained in:
@@ -5,6 +5,7 @@ import 'package:PiliPlus/common/constants.dart';
|
||||
import 'package:PiliPlus/http/init.dart';
|
||||
import 'package:PiliPlus/utils/extension.dart';
|
||||
import 'package:PiliPlus/utils/global_data.dart';
|
||||
import 'package:PiliPlus/utils/path_utils.dart';
|
||||
import 'package:PiliPlus/utils/permission_handler.dart';
|
||||
import 'package:PiliPlus/utils/storage_pref.dart';
|
||||
import 'package:PiliPlus/utils/utils.dart';
|
||||
@@ -27,8 +28,7 @@ abstract class ImageUtils {
|
||||
static Future<void> onShareImg(String url) async {
|
||||
try {
|
||||
SmartDialog.showLoading();
|
||||
final path =
|
||||
'${await Utils.temporaryDirectory}/${Utils.getFileName(url)}';
|
||||
final path = '$tmpDirPath/${Utils.getFileName(url)}';
|
||||
final res = await Request().downloadFile(url.http2https, path);
|
||||
SmartDialog.dismiss();
|
||||
if (res.statusCode == 200) {
|
||||
@@ -113,11 +113,10 @@ abstract class ImageUtils {
|
||||
}
|
||||
if (!silentDownImg) SmartDialog.showLoading(msg: '正在下载');
|
||||
|
||||
String tmpPath = await Utils.temporaryDirectory;
|
||||
late String imageName = "cover_${Utils.getFileName(url)}";
|
||||
late String imagePath = '$tmpPath/$imageName';
|
||||
late String imagePath = '$tmpDirPath/$imageName';
|
||||
String videoName = "video_${Utils.getFileName(liveUrl)}";
|
||||
String videoPath = '$tmpPath/$videoName';
|
||||
String videoPath = '$tmpDirPath/$videoName';
|
||||
|
||||
final res = await Request().downloadFile(liveUrl.http2https, videoPath);
|
||||
if (res.statusCode != 200) throw '${res.statusCode}';
|
||||
@@ -189,7 +188,7 @@ abstract class ImageUtils {
|
||||
))?.file;
|
||||
|
||||
if (file == null) {
|
||||
final String filePath = '${await Utils.temporaryDirectory}/$name';
|
||||
final String filePath = '$tmpDirPath/$name';
|
||||
|
||||
final response = await Request().downloadFile(
|
||||
url.http2https,
|
||||
|
||||
Reference in New Issue
Block a user