26 lines
651 B
Dart
26 lines
651 B
Dart
|
import 'dart:core';
|
||
|
import 'package:dio/dio.dart';
|
||
|
import 'package:funkblubber/funkentity.dart';
|
||
|
import 'package:funkblubber/console.dart' as console;
|
||
|
|
||
|
Future<void> download({required final FunkObject object}) async {
|
||
|
switch (object.kind) {
|
||
|
case FunkEntity.album:
|
||
|
await _downloadAlbum(object);
|
||
|
return;
|
||
|
|
||
|
default:
|
||
|
return;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
Future<void> _downloadAlbum(final FunkObject object) async {
|
||
|
final response = await Dio().get(
|
||
|
'https://${object.domain}/api/v1/tracks/?'
|
||
|
'album=${object.id}&ordering=creation_date&'
|
||
|
'page=1&page_size=16&scope=all',
|
||
|
);
|
||
|
|
||
|
for (final songResponse in response.data['results']) {}
|
||
|
}
|