<commit_before>"use strict";

var $      = require("jquery");
var Plugin = require("../modules/Plugin");
var Utils  = require("../modules/Utilities");
var sony   = Object.create(Plugin);

sony.init("sony", "Sony Music Unlimited",
        /music\.sonyentertainmentnetwork\.com/i);

sony.test = function () {
    var domainTest, pathnameTest;

    domainTest = this.hostre.test(document.location.hostname);
    pathnameTest = !/\.html$/.test(document.location.pathname);
    return domainTest && pathnameTest;
};

sony.scrape = function () {

    // Player has not been rendered yet
    if ($(".GEKKVSQBLV").length === 0) {
        return {stopped: true};
    }

    var xy = $("#PlayerPlayPause").css("background-position");
    // Paused: "-433px -25px" or "-387px -62px"
    // Playing: "-479px -25px" or "-433px -62px"
    var stopped = xy === "-433px -25px" || xy === "-387px -62px";
    var elapsed = $("#PlayerPosition").text();

    // No track has started yet
    if (stopped && elapsed === "0:00") {
        return {stopped: true};
    }

    return {
        artist:   $(".GEKKVSQBCY .gwt-InlineLabel").text(),
        elapsed:  Utils.calculateDuration(elapsed),
        duration: Utils.calculateDuration($("#PlayerDuration").text()),
        stopped:  stopped,
        album:    $(".GEKKVSQBH- .gwt-InlineLabel").text(),
        title:    $(".GEKKVSQBP- .gwt-InlineLabel").text()
    };
};

module.exports = sony;<commit_msg>Don't use semi-random CSS selectors in Sony Music Unlimited.<commit_after>"use strict";

var $      = require("jquery");
var Plugin = require("../modules/Plugin");
var Utils  = require("../modules/Utilities");
var sony   = Object.create(Plugin);

sony.init("sony", "Sony Music Unlimited",
        /music\.sonyentertainmentnetwork\.com/i);

sony.test = function () {
    var domainTest, pathnameTest;

    domainTest = this.hostre.test(document.location.hostname);
    pathnameTest = !/\.html$/.test(document.location.pathname);
    return domainTest && pathnameTest;
};

sony.scrape = function () {
    var player = $("#PlayerPlayPause").parent().parent();
    // Player has not been rendered yet
    if (player.length === 0) {
        return {stopped: true};
    }

    var xy = $("#PlayerPlayPause").css("background-position");
    // Paused: "-433px -25px" or "-387px -62px"
    // Playing: "-479px -25px" or "-433px -62px"
    var stopped = xy === "-433px -25px" || xy === "-387px -62px";
    var elapsed = $("#PlayerPosition").text();

    // No track has started yet
    if (stopped && elapsed === "0:00") {
        return {stopped: true};
    }

    var playerLabels = player.find('.gwt-InlineLabel');

    return {
        artist:   playerLabels[2].innerText,
        elapsed:  Utils.calculateDuration(elapsed),
        duration: Utils.calculateDuration($("#PlayerDuration").text()),
        stopped:  stopped,
        album:    playerLabels[1].innerText,
        title:    playerLabels[0].innerText,
    };
};

module.exports = sony;
{'fraction_non_alphanumeric': 0.17568021498152503, 'fraction_numerical': 0.023849512932482365, 'mean_word_length': 2.882659713168188, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '318545', 'n_tokens_mistral': 1012, 'n_tokens_neox': 952, 'n_words': 210}