Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rockradio.com support #92

Open
snakecase opened this issue Aug 6, 2015 · 0 comments
Open

Rockradio.com support #92

snakecase opened this issue Aug 6, 2015 · 0 comments

Comments

@snakecase
Copy link

I'm not a developer myself so I don't know how to export src's to Chrome as extension ("Load unpacked extension" gives an error) to debug my code but if someone can I will be very grateful. So instead of commit I'll write it down:

manifest.json

"*://*.rockradio.com/*",

index.js

exports.rockradio    = require("./rockradio");

rockradio.js

"use strict";

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

rockradio.init("rockradio", "Rockradio"); // name, displayName

rockradio.test = function () {
    var domainTest = /rockradio\.com/i.test(document.location.hostname);
    var playerTest = $(".status") === "now playing" : "stopped";

    return domainTest && playerTest;
};

rockradio.scrape = function () {
    var artistsong = $(".title").text().split("-");
    var info = {
        artist:  artistsong.length > 1 ? $.trim(artistsong[1]) : "",
        title:  artistsong.length > 1 ? $.trim(artistsong[2]) : "",
        elapsed:  Utils.calculateDuration($(".elapsed").text()),
        stopped: $(".status") === "stopped",
    };

    return info;
};

module.exports = rockradio;

Other AudioAddict Network sites (http://www.radiotunes.com/ http://www.jazzradio.com/ http://www.di.fm/) use the same player so if someone want he can easily add them too.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant