mirror of
https://github.com/d-fi/d-fi-core.git
synced 2025-07-27 15:44:26 +02:00
Document API changes in README
This commit is contained in:
parent
376d4cd19c
commit
e689a5296e
11
README.md
11
README.md
@ -34,13 +34,16 @@ try {
|
||||
const track = await api.getTrackInfo(song_id);
|
||||
|
||||
// Parse download URL for 128kbps
|
||||
const url = api.getTrackDownloadUrl(track, 1);
|
||||
const url = await api.getTrackDownloadUrl(track, 1);
|
||||
|
||||
// Download encrypted track
|
||||
// Download track
|
||||
const {data} = await axios.get(url, {responseType: 'arraybuffer'});
|
||||
|
||||
// Decrypt track
|
||||
const decryptedTrack = api.decryptDownload(data, track.SNG_ID);
|
||||
// Decrypt track if needed
|
||||
let decryptedTrack = data;
|
||||
if (api.isTrackEncrypted(url)) {
|
||||
decryptedTrack = api.decryptDownload(data, track.SNG_ID);
|
||||
}
|
||||
|
||||
// Add id3 metadata
|
||||
const trackWithMetadata = await api.addTrackTags(decryptedTrack, track, 500);
|
||||
|
Loading…
x
Reference in New Issue
Block a user