mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-06 10:07:45 +08:00
feat: add download button
This commit is contained in:
@@ -61,11 +61,16 @@ func (s *Server) moveCompletedTask(id int) (err error) {
|
||||
defer func () {
|
||||
if err != nil {
|
||||
s.db.SetHistoryStatus(r.ID, history.StatusFail)
|
||||
s.db.SetEpisodeStatus(r.EpisodeID, episode.StatusMissing)
|
||||
if r.EpisodeID != 0 {
|
||||
s.db.SetEpisodeStatus(r.EpisodeID, episode.StatusMissing)
|
||||
}
|
||||
|
||||
} else {
|
||||
delete(s.tasks, r.ID)
|
||||
s.db.SetHistoryStatus(r.ID, history.StatusSuccess)
|
||||
s.db.SetEpisodeStatus(r.EpisodeID, episode.StatusDownloaded)
|
||||
if r.EpisodeID != 0 {
|
||||
s.db.SetEpisodeStatus(r.EpisodeID, episode.StatusDownloaded)
|
||||
}
|
||||
|
||||
torrent.Remove()
|
||||
}
|
||||
|
||||
@@ -178,6 +178,7 @@ class _MovieDetailsPageState extends ConsumerState<MovieDetailsPage> {
|
||||
DataColumn(label: Text("大小")),
|
||||
DataColumn(label: Text("seeders")),
|
||||
DataColumn(label: Text("peers")),
|
||||
DataColumn(label: Text("操作"))
|
||||
],
|
||||
rows: List.generate(v.length, (i) {
|
||||
final torrent = v[i];
|
||||
@@ -186,6 +187,15 @@ class _MovieDetailsPageState extends ConsumerState<MovieDetailsPage> {
|
||||
DataCell(Text("${torrent.size?.readableFileSize()}")),
|
||||
DataCell(Text("${torrent.seeders}")),
|
||||
DataCell(Text("${torrent.peers}")),
|
||||
DataCell(IconButton.filledTonal(
|
||||
icon: const Icon(Icons.download),
|
||||
onPressed: () async {
|
||||
await ref
|
||||
.read(movieTorrentsDataProvider(this.id)
|
||||
.notifier)
|
||||
.download(torrent.link!);
|
||||
},
|
||||
))
|
||||
]);
|
||||
}),
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user