funkblubber/lib/funkblubber.dart

26 lines
651 B
Dart
Raw Normal View History

2023-01-26 16:35:58 -05:00
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']) {}
}