mirror of
https://github.com/simon-ding/polaris.git
synced 2026-06-08 11:07:42 +08:00
feat: download per media feature
This commit is contained in:
@@ -8,6 +8,7 @@ class APIs {
|
||||
static final _baseUrl = baseUrl();
|
||||
static final searchUrl = "$_baseUrl/api/v1/media/search";
|
||||
static final editMediaUrl = "$_baseUrl/api/v1/media/edit";
|
||||
static final downloadAllUrl = "$_baseUrl/api/v1/media/downloadall/";
|
||||
static final settingsUrl = "$_baseUrl/api/v1/setting/do";
|
||||
static final settingsGeneralUrl = "$_baseUrl/api/v1/setting/general";
|
||||
static final watchlistTvUrl = "$_baseUrl/api/v1/media/tv/watchlist";
|
||||
|
||||
@@ -81,6 +81,16 @@ class SeriesDetailData
|
||||
}
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
|
||||
Future<void> downloadall() async {
|
||||
final dio = APIs.getDio();
|
||||
var resp = await dio.get(APIs.downloadAllUrl + id!);
|
||||
var sp = ServerResponse.fromJson(resp.data);
|
||||
if (sp.code != 0) {
|
||||
throw sp.message;
|
||||
}
|
||||
ref.invalidateSelf();
|
||||
}
|
||||
}
|
||||
|
||||
class SeriesDetails {
|
||||
|
||||
@@ -303,9 +303,13 @@ class _DetailCardState extends ConsumerState<DetailCard> {
|
||||
}
|
||||
|
||||
Widget downloadButton() {
|
||||
return IconButton(
|
||||
return LoadingIconButton(
|
||||
tooltip: widget.details.mediaType == "tv" ? "查找并下载所有监控剧集" : "查找并下载此电影",
|
||||
onPressed: () {},
|
||||
icon: const Icon(Icons.download_rounded));
|
||||
onPressed: () async{
|
||||
await ref
|
||||
.read(mediaDetailsProvider(widget.details.id.toString()).notifier)
|
||||
.downloadall();
|
||||
},
|
||||
icon: Icons.download_rounded);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user