feat: Implement artist downloading in Dart
This commit is contained in:
parent
f52fee6506
commit
bfe08dc6fa
|
@ -13,11 +13,37 @@ Future<void> download({
|
||||||
await _downloadAlbum(object, path);
|
await _downloadAlbum(object, path);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
case FunkEntity.artist:
|
||||||
|
await _downloadArtist(object, path);
|
||||||
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return;
|
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(
|
Future<void> _downloadAlbum(
|
||||||
final FunkObject object,
|
final FunkObject object,
|
||||||
final String path,
|
final String path,
|
||||||
|
|
Loading…
Reference in New Issue