Fixed bug, downlaoded file play error.
This commit is contained in:
parent
626763850b
commit
e9e27d8cb6
|
@ -1177,12 +1177,6 @@ class DBHelper {
|
|||
list.first['is_new'],
|
||||
mediaId: list.first['media_id'],
|
||||
skipSeconds: list.first['skip_seconds']);
|
||||
if (episode.enclosureUrl != episode.mediaId &&
|
||||
!File(episode.mediaId.substring(7)).existsSync()) {
|
||||
final url = episode.enclosureUrl;
|
||||
await delDownloaded(url);
|
||||
episode = episode.copyWith(mediaId: url);
|
||||
}
|
||||
return episode;
|
||||
}
|
||||
}
|
||||
|
@ -1211,12 +1205,6 @@ class DBHelper {
|
|||
list.first['is_new'],
|
||||
mediaId: list.first['media_id'],
|
||||
skipSeconds: list.first['skip_seconds']);
|
||||
if (episode.enclosureUrl != episode.mediaId &&
|
||||
!File(episode.mediaId.substring(7)).existsSync()) {
|
||||
final url = episode.enclosureUrl;
|
||||
await delDownloaded(url);
|
||||
episode = episode.copyWith(mediaId: url);
|
||||
}
|
||||
return episode;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -151,7 +151,7 @@ class DownloadState extends ChangeNotifier {
|
|||
super.addListener(listener);
|
||||
}
|
||||
|
||||
_loadTasks() async {
|
||||
Future<void> _loadTasks() async {
|
||||
_episodeTasks = [];
|
||||
var dbHelper = DBHelper();
|
||||
var tasks = await FlutterDownloader.loadTasks();
|
||||
|
@ -161,10 +161,23 @@ class DownloadState extends ChangeNotifier {
|
|||
if (episode == null) {
|
||||
await FlutterDownloader.remove(
|
||||
taskId: task.taskId, shouldDeleteContent: true);
|
||||
} else {
|
||||
if (task.status == DownloadTaskStatus.complete) {
|
||||
var exist =
|
||||
await File(path.join(task.savedDir, task.filename)).exists();
|
||||
if (!exist) {
|
||||
await FlutterDownloader.remove(
|
||||
taskId: task.taskId, shouldDeleteContent: true);
|
||||
await dbHelper.delDownloaded(episode.enclosureUrl);
|
||||
} else {
|
||||
_episodeTasks.add(EpisodeTask(episode, task.taskId,
|
||||
progress: task.progress, status: task.status));
|
||||
}
|
||||
} else {
|
||||
_episodeTasks.add(EpisodeTask(episode, task.taskId,
|
||||
progress: task.progress, status: task.status));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
notifyListeners();
|
||||
|
|
Loading…
Reference in New Issue