feat: Implement folder for artist

This commit is contained in:
NaiJi ✨ 2023-01-30 02:55:35 +04:00
parent bfe08dc6fa
commit d0291e90a1
1 changed files with 11 additions and 3 deletions

View File

@ -26,7 +26,15 @@ Future<void> _downloadArtist(
final FunkObject object,
final String path,
) async {
final response = await Dio().get(
Response response = await Dio().get(
'https://${object.domain}/api/v1/artists/${object.id}/?'
'refresh=false',
);
final String pathAppend = response.data['name'];
await Directory('$path/$pathAppend').create();
response = await Dio().get(
'https://${object.domain}/api/v1/albums/?'
'artist=${object.id}&ordering=creation_date&'
'page=1&page_size=16&scope=all',
@ -39,7 +47,7 @@ Future<void> _downloadArtist(
id: albumResponse['id'].toString(),
kind: FunkEntity.album,
),
path,
'$path/$pathAppend',
);
}
}
@ -55,7 +63,7 @@ Future<void> _downloadAlbum(
);
final String pathAppend = response.data['results'][0]['album']['title'];
await Directory(pathAppend).create();
await Directory('$path/$pathAppend').create();
for (final songResponse in response.data['results']) {
final String songTitle = songResponse['title'];