<commit_before>import http from '../http';

import albumInfo from './album';
import artistInfo from './artist';

export default {
    /**
     * Get extra song information (lyrics, artist info, album info).
     *
     * @param  {Object}     song
     * @param  {?Function}  cb
     */
    fetch(song, cb = null) {
        // Check if the song's info has been retrieved before.
        if (song.infoRetrieved) {
            cb && cb();

            return;
        }

        http.get(`${song.id}/info`, response => {
            const data = response.data;

            song.lyrics = data.lyrics;

            data.artist_info && artistInfo.merge(song.album.artist, data.artist_info);
            data.album_info && albumInfo.merge(song.album, data.album_info);

            song.infoRetrieved = true;

            cb && cb();
        });
    },
};
<commit_msg>Fix the artist loading & info bug<commit_after>import http from '../http';

import albumInfo from './album';
import artistInfo from './artist';

export default {
    /**
     * Get extra song information (lyrics, artist info, album info).
     *
     * @param  {Object}     song
     * @param  {?Function}  cb
     */
    fetch(song, cb = null) {
        // Check if the song's info has been retrieved before.
        if (song.infoRetrieved) {
            cb && cb();

            return;
        }

        http.get(`${song.id}/info`, response => {
            const data = response.data;

            song.lyrics = data.lyrics;

            data.artist_info && artistInfo.merge(song.artist, data.artist_info);
            data.album_info && albumInfo.merge(song.album, data.album_info);

            song.infoRetrieved = true;

            cb && cb();
        });
    },
};

{'fraction_non_alphanumeric': 0.13463751438434982, 'fraction_numerical': 0.0, 'mean_word_length': 1.823051948051948, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2127425', 'n_tokens_mistral': 531, 'n_tokens_neox': 500, 'n_words': 131}