|
|
|
@ -13,11 +13,37 @@ Future<void> download({
|
|
|
|
|
await _downloadAlbum(object, path);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
case FunkEntity.artist:
|
|
|
|
|
await _downloadArtist(object, path);
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _downloadArtist(
|
|
|
|
|
final FunkObject object,
|
|
|
|
|
final String path,
|
|
|
|
|
) async {
|
|
|
|
|
final response = await Dio().get(
|
|
|
|
|
'https://${object.domain}/api/v1/albums/?'
|
|
|
|
|
'artist=${object.id}&ordering=creation_date&'
|
|
|
|
|
'page=1&page_size=16&scope=all',
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
for (final albumResponse in response.data['results']) {
|
|
|
|
|
_downloadAlbum(
|
|
|
|
|
FunkObject(
|
|
|
|
|
domain: object.domain,
|
|
|
|
|
id: albumResponse['id'].toString(),
|
|
|
|
|
kind: FunkEntity.album,
|
|
|
|
|
),
|
|
|
|
|
path,
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Future<void> _downloadAlbum(
|
|
|
|
|
final FunkObject object,
|
|
|
|
|
final String path,
|
|
|
|
|