<commit_before>function getVideoUrl(url) {
    var type = 'youtube';
    var videoId = getUrlVars(url, 'v');

    if (url.indexOf('vimeo') != -1) {
        type = 'vimeo';
        var index = url.lastIndexOf('/');
        if (url.indexOf('#') != -1) {
            index = url.indexOf('#');
        }
        videoId = url.substring(index + 1, url.length);
    }

    if (url.indexOf('collegehumor') != -1) {
        type = 'collegehumor';
        videoId = url.replace('http://www.collegehumor.com/', '');
    }

    if (url.indexOf('dailymotion') != -1) {
        type = 'dailymotion';
        videoId = url.substr(0, url.indexOf('_')).replace('http://www.dailymotion.com/video/', '');
    }

    if (url.indexOf('ebaumsworld') != -1) {
        type = 'ebaumsworld';
        videoId = url.substr(0, url.lastIndexOf('/')).replace('http://www.ebaumsworld.com/video/watch/', '');
    }

    return getPluginPath(type, videoId);
}

function queueItem(url, callback) {
    var videoUrl = getVideoUrl(url);

    addItemToPlaylist(videoUrl, function(result) {
        callback(result);
    });
}

function getPluginPath(type, videoId) {
    switch (type) {
        case 'youtube':
        case 'vimeo':
            return 'plugin://plugin.video.' + type + '/?action=play_video&videoid=' + videoId;
        case 'collegehumor':
            return 'plugin://plugin.video.' + type + '/watch/' + encodeURIComponent(videoId) + '/';
        case 'dailymotion':
            return 'plugin://plugin.video.dailymotion_com/?url=' + videoId + '&mode=playVideo';
        case 'ebaumsworld':
            return 'plugin://plugin.video.ebaumsworld_com/?url=' + videoId + '&mode=playVideo';
        default:
            return '';
    }
}


function getUrlVars(url, attribute) {
    var vars = [], hash;
    var hashes = url.slice(url.indexOf('?') + 1).split('&');
    for (var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars[attribute];
}

function ajaxPost(data, callback) {
    var url = getURL();
    var fullPath = url + "/jsonrpc";

    jQuery.ajax({
        type: 'POST',
        url : fullPath,
        success: function(result) {
            callback(result);
        },
        contentType: "application/json",
        data : data,
        dataType: 'json'
    });
}
<commit_msg>Some prep to support SoundCloud<commit_after>function getPluginPath(url) {
    var type = 'youtube';
    var videoId = getUrlVars(url, 'v');

    if (url.indexOf('vimeo') != -1) {
        type = 'vimeo';
        var index = url.lastIndexOf('/');
        if (url.indexOf('#') != -1) {
            index = url.indexOf('#');
        }
        videoId = url.substring(index + 1, url.length);
    }

    if (url.indexOf('collegehumor') != -1) {
        type = 'collegehumor';
        videoId = url.replace('http://www.collegehumor.com/', '');
    }

    if (url.indexOf('dailymotion') != -1) {
        type = 'dailymotion';
        videoId = url.substr(0, url.indexOf('_')).replace('http://www.dailymotion.com/video/', '');
    }

    if (url.indexOf('ebaumsworld') != -1) {
        type = 'ebaumsworld';
        videoId = url.substr(0, url.lastIndexOf('/')).replace('http://www.ebaumsworld.com/video/watch/', '');
    }

    return buildPluginPath(type, videoId);
}

function queueItem(url, callback) {
    var videoUrl = getPluginPath(url);

    addItemToPlaylist(videoUrl, function(result) {
        callback(result);
    });
}

function buildPluginPath(type, videoId) {
    switch (type) {
        case 'youtube':
        case 'vimeo':
            return 'plugin://plugin.video.' + type + '/?action=play_video&videoid=' + videoId;

        case 'collegehumor':
            return 'plugin://plugin.video.' + type + '/watch/' + encodeURIComponent(videoId) + '/';

        case 'dailymotion':
        case 'ebaumsworld':
            return 'plugin://plugin.video.' + type + '_com/?url=' + videoId + '&mode=playVideo';

        default:
            return '';
    }
}

function getUrlVars(url, attribute) {
    var vars = [], hash;
    var hashes = url.slice(url.indexOf('?') + 1).split('&');
    for (var i = 0; i < hashes.length; i++) {
        hash = hashes[i].split('=');
        vars.push(hash[0]);
        vars[hash[0]] = hash[1];
    }
    return vars[attribute];
}

function ajaxPost(data, callback) {
    var url = getURL();
    var fullPath = url + "/jsonrpc";

    jQuery.ajax({
        type: 'POST',
        url : fullPath,
        success: function(result) {
            callback(result);
        },
        contentType: "application/json",
        data : data,
        dataType: 'json'
    });
}

function getSoundcloudId(url, callback) {
    jQuery.ajax({
        type: 'POST',
        url : 'http://soundcloud.com/oembed?url=' + url,
        success: function(result) {
            var iframetext = $(result).find("html").text();

            callback(result);
        }
    });
}

{'fraction_non_alphanumeric': 0.17868654311039484, 'fraction_numerical': 0.005237711522965351, 'mean_word_length': 2.2880794701986753, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 6, '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': '7440732', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1622, 'n_words': 305}