mirror of
https://github.com/stonega/tsacdop
synced 2025-02-01 16:16:49 +01:00
FIx bug, podcast image save wrong name.
This commit is contained in:
parent
1ea63a8ba5
commit
d10a12678c
@ -110,7 +110,8 @@ class _PodcastSettingState extends State<PodcastSetting> {
|
||||
connectTimeout: 30000,
|
||||
receiveTimeout: 90000,
|
||||
);
|
||||
|
||||
var dir = await getApplicationDocumentsDirectory();
|
||||
var filePath = "${dir.path}/${widget.podcastLocal.id}.png";
|
||||
var dio = Dio(options);
|
||||
String imageUrl;
|
||||
|
||||
@ -127,10 +128,7 @@ class _PodcastSettingState extends State<PodcastSetting> {
|
||||
developer.log(e.toString());
|
||||
if (mounted) setState(() => _coverStatus = RefreshCoverStatus.error);
|
||||
}
|
||||
if (imageUrl != null &&
|
||||
imageUrl.contains('http') &&
|
||||
(imageUrl != widget.podcastLocal.imageUrl ||
|
||||
!File(widget.podcastLocal.imageUrl).existsSync())) {
|
||||
if (imageUrl != null && imageUrl.contains('http')) {
|
||||
try {
|
||||
img.Image thumbnail;
|
||||
var imageResponse = await dio.get<List<int>>(imageUrl,
|
||||
@ -140,9 +138,10 @@ class _PodcastSettingState extends State<PodcastSetting> {
|
||||
var image = img.decodeImage(imageResponse.data);
|
||||
thumbnail = img.copyResize(image, width: 300);
|
||||
if (thumbnail != null) {
|
||||
var dir = await getApplicationDocumentsDirectory();
|
||||
File("${dir.path}/${widget.podcastLocal.id}.png")
|
||||
..writeAsBytesSync(img.encodePng(thumbnail));
|
||||
File(filePath)..writeAsBytesSync(img.encodePng(thumbnail));
|
||||
_dbHelper.updatePodcastImage(
|
||||
id: widget.podcastLocal.id, filePath: filePath);
|
||||
print('saved image');
|
||||
if (mounted) {
|
||||
setState(() => _coverStatus = RefreshCoverStatus.complete);
|
||||
}
|
||||
@ -325,9 +324,7 @@ class _PodcastSettingState extends State<PodcastSetting> {
|
||||
height: 18,
|
||||
width: 18,
|
||||
child: CustomPaint(
|
||||
painter: ListenedAllPainter(
|
||||
context.accentColor,
|
||||
stroke: 2),
|
||||
painter: ListenedAllPainter(context.accentColor, stroke: 2),
|
||||
),
|
||||
),
|
||||
SizedBox(width: 20),
|
||||
|
@ -656,13 +656,8 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
||||
}
|
||||
}
|
||||
var uuid = Uuid().v4();
|
||||
var imagePath = path.join(dir.path, 'uuid.png');
|
||||
try {
|
||||
File(imagePath).writeAsBytesSync(img.encodePng(thumbnail));
|
||||
} catch (e) {
|
||||
print(e);
|
||||
}
|
||||
//var imagePath = "${dir.path}/$uuid.png";
|
||||
File("${dir.path}/$uuid.png")..writeAsBytesSync(img.encodePng(thumbnail));
|
||||
var imagePath = "${dir.path}/$uuid.png";
|
||||
var primaryColor = await _getColor(File(imagePath));
|
||||
var author = p.itunes.author ?? p.author ?? '';
|
||||
var provider = p.generator ?? '';
|
||||
@ -675,7 +670,9 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
||||
description: p.description);
|
||||
|
||||
await dbHelper.savePodcastLocal(podcastLocal);
|
||||
|
||||
sendPort.send([item.title, item.url, 2, uuid, item.group]);
|
||||
|
||||
if (provider.contains('fireside')) {
|
||||
var data = FiresideData(uuid, link);
|
||||
try {
|
||||
@ -686,13 +683,6 @@ Future<void> subIsolateEntryPoint(SendPort sendPort) async {
|
||||
}
|
||||
await dbHelper.savePodcastRss(p, uuid);
|
||||
|
||||
// if (item.syncWithGpodder) {
|
||||
// final gpodder = Gpodder();
|
||||
// await gpodder.updateChange({
|
||||
// 'add': [item.url]
|
||||
// });
|
||||
// }
|
||||
|
||||
sendPort.send([item.title, item.url, 3, uuid]);
|
||||
|
||||
await Future.delayed(Duration(seconds: 2));
|
||||
|
Loading…
x
Reference in New Issue
Block a user