feat: Add simple info log messages
This commit is contained in:
parent
f88268caf7
commit
23dcc4b74a
|
@ -8,6 +8,7 @@ Future<void> download({
|
||||||
required final FunkObject object,
|
required final FunkObject object,
|
||||||
final String path = '.',
|
final String path = '.',
|
||||||
}) async {
|
}) async {
|
||||||
|
console.info('Downloading');
|
||||||
switch (object.kind) {
|
switch (object.kind) {
|
||||||
case FunkEntity.album:
|
case FunkEntity.album:
|
||||||
await _downloadAlbum(object, path);
|
await _downloadAlbum(object, path);
|
||||||
|
@ -18,6 +19,7 @@ Future<void> download({
|
||||||
return;
|
return;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
console.info(' nothing...');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +35,7 @@ Future<void> _downloadArtist(
|
||||||
|
|
||||||
final String pathAppend = response.data['name'];
|
final String pathAppend = response.data['name'];
|
||||||
await Directory('$path/$pathAppend').create();
|
await Directory('$path/$pathAppend').create();
|
||||||
|
console.info('Artist: $pathAppend');
|
||||||
|
|
||||||
response = await Dio().get(
|
response = await Dio().get(
|
||||||
'https://${object.domain}/api/v1/albums/?'
|
'https://${object.domain}/api/v1/albums/?'
|
||||||
|
@ -64,6 +67,7 @@ Future<void> _downloadAlbum(
|
||||||
|
|
||||||
final String pathAppend = response.data['results'][0]['album']['title'];
|
final String pathAppend = response.data['results'][0]['album']['title'];
|
||||||
await Directory('$path/$pathAppend').create();
|
await Directory('$path/$pathAppend').create();
|
||||||
|
console.info('Album: $pathAppend');
|
||||||
|
|
||||||
for (final songResponse in response.data['results']) {
|
for (final songResponse in response.data['results']) {
|
||||||
final String songTitle = songResponse['title'];
|
final String songTitle = songResponse['title'];
|
||||||
|
@ -90,6 +94,7 @@ Future<void> _downloadSongObject(
|
||||||
followRedirects: false,
|
followRedirects: false,
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
console.info('- $path');
|
||||||
final File file = File(path);
|
final File file = File(path);
|
||||||
final accessFile = file.openSync(mode: FileMode.write);
|
final accessFile = file.openSync(mode: FileMode.write);
|
||||||
accessFile.writeFromSync(response.data);
|
accessFile.writeFromSync(response.data);
|
||||||
|
|
Loading…
Reference in New Issue