CouchPotato Script Injector

Injects the CouchPotato automation script on IMDB movie pages

Du musst eine Erweiterung wie Tampermonkey, Greasemonkey oder Violentmonkey installieren, um dieses Skript zu installieren.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Violentmonkey to install this script.

You will need to install an extension such as Tampermonkey or Userscripts to install this script.

You will need to install an extension such as Tampermonkey to install this script.

Sie müssten eine Skript Manager Erweiterung installieren damit sie dieses Skript installieren können

(Ich habe schon ein Skript Manager, Lass mich es installieren!)

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install an extension such as Stylus to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

You will need to install a user style manager extension to install this style.

(I already have a user style manager, let me install it!)

// ==UserScript==
// @name         CouchPotato Script Injector
// @namespace    http://www.tampermonkey.net
// @version      0.1
// @description  Injects the CouchPotato automation script on IMDB movie pages
// @author       GCandez
// @match        http://www.imdb.com/title/*
// @grant        none
// ==/UserScript==

//CONFIGURATION


var apiAdress = ''; //The adress for the CouchPotato API (e.g. http://localhost:8080/api)
var apiKey = ''; //The key for the CouchPotato API


(function(){
    //CHECK IF CURRENT PAGE IS MOVIE PAGE
    var element = document.querySelector('meta[property="og:type"]');
    var content = element && element.getAttribute("content");
    var isMovie = content == "video.movie";
    
    if(!isMovie){
        return;
    }
    
    //IS MOVIE, INJECT SCRIPT
    var apiAdressAndKey = apiAdress + '/' + apiKey;
    
    var script = document.createElement('script');
        script.type = 'text/javascript';
        script.src = apiAdressAndKey + '/userscript.bookmark/?host=' + apiAdressAndKey + '/userscript.get/5ssselO1/&r=' + Math.random() * 99999999;

    document.body.appendChild(script);
})();