feat: Implement folder for artist
This commit is contained in:
parent
bfe08dc6fa
commit
d0291e90a1
|
@ -26,7 +26,15 @@ Future<void> _downloadArtist(
|
||||||
final FunkObject object,
|
final FunkObject object,
|
||||||
final String path,
|
final String path,
|
||||||
) async {
|
) 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/?'
|
'https://${object.domain}/api/v1/albums/?'
|
||||||
'artist=${object.id}&ordering=creation_date&'
|
'artist=${object.id}&ordering=creation_date&'
|
||||||
'page=1&page_size=16&scope=all',
|
'page=1&page_size=16&scope=all',
|
||||||
|
@ -39,7 +47,7 @@ Future<void> _downloadArtist(
|
||||||
id: albumResponse['id'].toString(),
|
id: albumResponse['id'].toString(),
|
||||||
kind: FunkEntity.album,
|
kind: FunkEntity.album,
|
||||||
),
|
),
|
||||||
path,
|
'$path/$pathAppend',
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +63,7 @@ Future<void> _downloadAlbum(
|
||||||
);
|
);
|
||||||
|
|
||||||
final String pathAppend = response.data['results'][0]['album']['title'];
|
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']) {
|
for (final songResponse in response.data['results']) {
|
||||||
final String songTitle = songResponse['title'];
|
final String songTitle = songResponse['title'];
|
||||||
|
|
Loading…
Reference in New Issue