<commit_before>var song_details = {};
var cache = LastFMCache();
var lastfm = new LastFM({
    apiKey: '<KEY>',
    apiSecret: 'a67ac7517161be33a08b473c64800ab3',
    cache : cache
});

var session;
console.log( localStorage.username );
console.log( localStorage.password );
if( localStorage.username != null && localStorage.password != null )
{
    lastfm.auth.getMobileSession( { username:localStorage.username, password:localStorage.password }, { success: function( data ) {
            console.log( data.session );
            session = data.session;
            console.log( "Successful Auth" );
            listenForSongs();
        }, error: function( data ) {
            console.log( "Couldn't auth. Check user/password" );
        }
     } );
}
else
{
    console.log( "Need to enter credentials in options page" );
}

function scrobble()
{
    if( song_details.title && song_details.title != "" &&
        song_details.artist && song_details.artist != "" &&
        song_details.album && song_details.album != "" && session != null )
    {
        lastfm.track.scrobble( { track:song_details.title,
            artist:song_details.artist, album:song_details.album,
            timestamp:song_details.start_time }, session );
    }
}

function playingstatus()
{
    if( session != null )
        lastfm.track.updateNowPlaying( { track:song_details.title,
            artist:song_details.artist,
            album:song_details.album }, session );
}

function listenForSongs() {
    chrome.extension.onRequest.addListener(
        function( request, sender, sendResponse ) {
            switch( request.type )
            {
                case "playing_song":
                    scrobble();//Scrobble previous song if any
                    //Verify new song
                    //Update infos and set last.fm playing status
                    console.log( request );
                    song_details.title = request.title;
                    song_details.album = request.album;<commit_msg>Don't scrobble for stuff < 30 secs<commit_after>var song_details = {};
var cache = LastFMCache();
var lastfm = new LastFM({
    apiKey: '<KEY>',
    apiSecret: 'a67ac7517161be33a08b473c64800ab3',
    cache : cache
});

var session;
console.log( localStorage.username );
console.log( localStorage.password );
if( localStorage.username != null && localStorage.password != null )
{
    lastfm.auth.getMobileSession( { username:localStorage.username, password:<PASSWORD> }, { success: function( data ) {
            console.log( data.session );
            session = data.session;
            console.log( "Successful Auth" );
            listenForSongs();
        }, error: function( data ) {
            console.log( "Couldn't auth. Check user/password" );
        }
     } );
}
else
{
    console.log( "Need to enter credentials in options page" );
}

function scrobble()
{
    var now_time = parseInt(new Date().getTime() / 1000.0);
    if( song_details.title && song_details.title != "" &&
        song_details.artist && song_details.artist != "" &&
        song_details.album && song_details.album != "" && session != null
        && now_time - song_details.start_time > 30 )
    {
        lastfm.track.scrobble( { track:song_details.title,
            artist:song_details.artist, album:song_details.album,
            timestamp:song_details.start_time }, session );
    }
}

function playingstatus()
{
    if( session != null )
        lastfm.track.updateNowPlaying( { track:song_details.title,
            artist:song_details.artist,
            album:song_details.album }, session );
}

function listenForSongs() {
    chrome.extension.onRequest.addListener(
        function( request, sender, sendResponse ) {
            switch( request.type )
            {
                case "playing_song":
                    scrobble();//Scrobble previous song if any
                    //Verify new song
                    //Update infos and set last.fm playing status
                    console.log( request );
                    song_details.title = request.title;
                    song_details.album = request.album;
{'fraction_non_alphanumeric': 0.11848800581536224, 'fraction_numerical': 0.012842258299006542, 'mean_word_length': 2.3024, 'pattern_counts': {'":': 2, '<': 7, '<?xml version=': 0, '>': 7, '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': '2520461', 'n_tokens_mistral': 1214, 'n_tokens_neox': 1148, 'n_words': 244}