<commit_before>$(function(){
  var osascript = require('node-osascript');

  osascript.execute('tell application "Spotify"\n set currentArtist to artist of current track as string\n set currentSong to name of current track as string\n return {currentSong, currentArtist}\n end tell', function(err, result, raw) {
    song_title = JSON.stringify(result[0]).slice(1, -1);
    song_artist = JSON.stringify(result[1]).slice(1, -1);
    if (song_title.indexOf("(") != -1) {
      song_title = song_title.substring(0, song_title.indexOf("("));
    }
    document.title = song_title + ": " + song_artist;
    regex_title = song_title.replace(/\./g, '').replace(/\s/g, '').toLowerCase();
    regex_artist = song_artist.replace(/\$/g, 's').replace(/\./g, '').replace(/\s/g, '').toLowerCase();
    document.getElementById('lyrics').src = "http://www.azlyrics.com/lyrics/" + regex_artist + "/" + regex_title + ".html";
  });
});<commit_msg>Script.js: Add loop for refreshing on new songs<commit_after>$(function(){
  var osascript = require('node-osascript');

  var last_song;
  
//  while(true) {
//    osascript.execute('tell application "Spotify"\n set currentArtist to artist of current track as string\n set currentSong to name of current track as string\n return {currentSong, currentArtist}\n end tell', function(err, result, raw) {
//      song_title = JSON.stringify(result[0]).slice(1, -1);
//      song_artist = JSON.stringify(result[1]).slice(1, -1);
//      last_song = song_title;
//
  //    if (song_title != last_song) {
  //      if (song_title.indexOf("(") != -1) {
  //        song_title = song_title.substring(0, song_title.indexOf("("));
  //      }
  //      document.title = song_title + ": " + song_artist;
  //      regex_title = song_title.replace(/\./g, '').replace(/\s/g, '').toLowerCase();
  //      regex_artist = song_artist.replace(/\$/g, 's').replace(/\./g, '').replace(/\s/g, '').toLowerCase();
  //      document.getElementById('lyrics').src = "http://www.azlyrics.com/lyrics/" + regex_artist + "/" + regex_title + ".html";
  //    };
  //  });
  //};
  setInterval( function() {
    osascript.execute('tell application "Spotify"\n set currentArtist to artist of current track as string\n set currentSong to name of current track as string\n return {currentSong, currentArtist}\n end tell', function(err, result, raw) {
      song_title = JSON.stringify(result[0]).slice(1, -1);
      song_artist = JSON.stringify(result[1]).slice(1, -1);
      if (song_title.indexOf("(") != -1) {
        song_title = song_title.substring(0, song_title.indexOf("("));
      }
      if (document.title != song_title + ": " + song_artist) {
        document.title = song_title + ": " + song_artist;
        regex_title = song_title.replace(/\./g, '').replace(/\s/g, '').toLowerCase();
        regex_artist = song_artist.replace(/\$/g, 's').replace(/\./g, '').replace(/\s/g, '').toLowerCase();
        document.getElementById('lyrics').src = "http://www.azlyrics.com/lyrics/" + regex_artist + "/" + regex_title + ".html";
      };
    });
  }, 1000);
});
{'fraction_non_alphanumeric': 0.1960143743874551, 'fraction_numerical': 0.00914733747141457, 'mean_word_length': 3.2825174825174823, 'pattern_counts': {'":': 4, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 3, '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': '2038011', 'n_tokens_mistral': 1033, 'n_tokens_neox': 1022, 'n_words': 204}