<commit_before>var NOW_PLAYING_URL = 'http://web.stevens.edu/wcpr/now_playing.json',
    delay_on_error = 1000;

function loadNowPlaying() {
    $.ajax({
        'method': 'get',
        'url': NOW_PLAYING_URL,
        'dataType': 'jsonp',
        'jsonpCallback': 'nowPlayingCallback',
        'success': function() {
            delay_on_error = 1000;  // reset delay in case we had errors
        },
        'error': function () {
            setTimeout(loadNowPlaying, delay_on_error);
            delay_on_error *= 2;  // double delay each time we have an error
        }
    });
}

function nowPlayingCallback(data) {
    var text_container = document.getElementById('now_playing'),
        progress_bar = document.getElementById('play_progress'),
        now = data['now'];

    // load current song into now playing
    text_container.innerHTML = now['artist'] + ' - '  + now['title'];

    // get progress bar ready to move
    var start_pieces = now['start'].split(':'),
        start_time = new Date();
    start_time = start_time.setHours(start_pieces[0], start_pieces[1], start_pieces[2]);
    if (start_time > Date.now())  {
        // account for when day rolls over.
        start_time.setDate(start_time.getDate() - 1);
    }

    var len_seconds = parseInt(now['len']),
        elapsed_seconds = (Date.now() - start_time) / 1000,
        percent_finished = elapsed_seconds / len_seconds * 100,
        remaining_seconds = len_seconds - elapsed_seconds;  // get time in seconds

    if (remaining_seconds <= 0) {
        // avoids if we grab now_playing.json while it's updating
        remaining_seconds = 0;
    }

    progress_bar.style.width = percent_finished + '%';
    progress_bar.style.transition = 'width 0s linear';
    setTimeout(function() {
        progress_bar.style.transition = 'width ' + remaining_seconds + 's linear';
        progress_bar.style.width = '100%';
    }, 10);  // wait so bar can load to initial point before starting to move

    // schedule next time to load what's playing
    setTimeout(loadNowPlaying, (remaining_seconds + 2) * 1000);
}


// On page load, start loading now playing info
loadNowPlaying();<commit_msg>Increase time between requests for now playing<commit_after>var NOW_PLAYING_URL = 'http://web.stevens.edu/wcpr/now_playing.json',
    delay_on_error = 1000;

function loadNowPlaying() {
    $.ajax({
        'method': 'get',
        'url': NOW_PLAYING_URL,
        'dataType': 'jsonp',
        'jsonpCallback': 'nowPlayingCallback',
        'success': function() {
            delay_on_error = 1000;  // reset delay in case we had errors
        },
        'error': function () {
            setTimeout(loadNowPlaying, delay_on_error);
            delay_on_error *= 2;  // double delay each time we have an error
        }
    });
}

function nowPlayingCallback(data) {
    var text_container = document.getElementById('now_playing'),
        progress_bar = document.getElementById('play_progress'),
        now = data['now'];

    // load current song into now playing
    text_container.innerHTML = now['artist'] + ' - '  + now['title'];

    // get progress bar ready to move
    var start_pieces = now['start'].split(':'),
        start_time = new Date();
    start_time = start_time.setHours(start_pieces[0], start_pieces[1], start_pieces[2]);
    if (start_time > Date.now())  {
        // account for when day rolls over.
        start_time.setDate(start_time.getDate() - 1);
    }

    var len_seconds = parseInt(now['len']),
        elapsed_seconds = (Date.now() - start_time) / 1000,
        percent_finished = elapsed_seconds / len_seconds * 100,
        remaining_seconds = len_seconds - elapsed_seconds;  // get time in seconds

    if (remaining_seconds <= 0) {
        // avoids if we grab now_playing.json while it's updating
        remaining_seconds = 0;
    }

    progress_bar.style.width = percent_finished + '%';
    progress_bar.style.transition = 'width 0s linear';
    setTimeout(function() {
        progress_bar.style.transition = 'width ' + remaining_seconds + 's linear';
        progress_bar.style.width = '100%';
    }, 10);  // wait so bar can load to initial point before starting to move

    // schedule next time to load what's playing
    setTimeout(loadNowPlaying, (remaining_seconds + 3) * 1000);
}


// On page load, start loading now playing info
loadNowPlaying();
{'fraction_non_alphanumeric': 0.1216, 'fraction_numerical': 0.015085714285714286, 'mean_word_length': 2.7887445887445885, 'pattern_counts': {'":': 0, '<': 5, '<?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': '751154', 'n_tokens_mistral': 1367, 'n_tokens_neox': 1267, 'n_words': 333}