diff --git a/couchpotato/core/plugins/extension/main.py b/couchpotato/core/plugins/extension/main.py
index 9992779..4e13e1a 100644
--- a/couchpotato/core/plugins/extension/main.py
+++ b/couchpotato/core/plugins/extension/main.py
@@ -1,9 +1,32 @@
+from couchpotato.api import addApiView
+from couchpotato.core.event import fireEvent
from couchpotato.core.plugins.base import Plugin
+from flask.helpers import url_for
+from flask.templating import render_template
class Extension(Plugin):
- auto_register_static = False
-
def __init__(self):
- self.registerStatic(__file__, add_to_head = False)
+ addApiView('extension.user.js', self.getExtension)
+
+ def getExtension(self):
+
+ params = {
+ 'includes': fireEvent('extension.get_includes', single = True),
+ 'excludes': fireEvent('extension.get_includes', single = True),
+ 'version': self.getVersion(),
+ 'host': '%s/extension.add_via_url' % url_for('api.index'),
+ }
+
+ return render_template('template.js', **params)
+
+ def getVersion(self):
+
+ versions = fireEvent('extension.get_version')
+
+ version = 0
+ for v in versions:
+ version += v
+
+ return version
diff --git a/couchpotato/core/plugins/extension/template.js b/couchpotato/core/plugins/extension/template.js
index 305d1f5..8b2a884 100644
--- a/couchpotato/core/plugins/extension/template.js
+++ b/couchpotato/core/plugins/extension/template.js
@@ -1,24 +1,16 @@
// ==UserScript==
// @name CouchPotato UserScript
-// @description Add movies to your CouchPotato via external sites like IMDB
-// @include http*://*.imdb.com/title/tt*
-// @include http*://imdb.com/title/tt*
-// @include ${host}*
-// @include http://*.sharethe.tv/movies/*
-// @include http://sharethe.tv/movies/*
-// @include http://*.moviemeter.nl/film/*
-// @include http://moviemeter.nl/film/*
-// @include http://whiwa.net/stats/movie/*
-// @include http://trailers.apple.com/trailers/*
-// @include http://www.themoviedb.org/movie/*
-// @include http://www.allocine.fr/film/*
-// @include http://trakt.tv/movie/*
-// @include http://*.trak.tv/movie/*
-// @exclude http://trak.tv/movie/*/*
-// @exclude http://*.trak.tv/movie/*/*
+// @description Add movies to your CouchPotato via external sites
+{% for include in includes %}
+// @include {{include}}
+{% endfor %}
+{% for exclude in excludes %}
+// @exclude {{exclude}}
+{% endfor %}
// ==/UserScript==
-var version = 7;
+var version = '{{version}}';
+var cpLocation = '{{host}}';
function create() {
switch (arguments.length) {
@@ -48,11 +40,11 @@ function create() {
if (typeof GM_addStyle == 'undefined'){
GM_addStyle = function(css) {
- var head = document.getElementsByTagName('head')[0], style = document
- .createElement('style');
- if (!head) {
- return
- }
+ var head = document.getElementsByTagName('head')[0],
+ style = document.createElement('style');
+ if (!head)
+ return;
+
style.type = 'text/css';
style.textContent = css;
head.appendChild(style);
@@ -61,329 +53,53 @@ if (typeof GM_addStyle == 'undefined'){
// Styles
GM_addStyle('\
- #mmPopup { opacity: 0.5; width:200px; font-family: "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif; -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; -moz-box-shadow: 0 0 20px rgba(0,0,0,0.5); -webkit-box-shadow: 0 0 20px rgba(0,0,0,0.5); position:fixed; z-index:9999; bottom:0; right:0; font-size:15px; margin: 0 20px; display: block; background:#f5f5f5; } \
- #mmPopup:hover { opacity: 1; } \
- #mmPopup a#addTo { cursor:pointer; text-align:center; text-decoration:none; color: #000; display:block; padding:15px 0 10px; } \
- #mmPopup a#closeBtn { cursor:pointer; float: right; padding:10px; } \
- #mmPopup a img { vertical-align: middle; } \
- #mmPopup a:hover { color:#000; } \
- #mmPopup iframe{ background:#f5f5f5; margin:6px; height:70px; width:188px; overflow:hidden; border:none; } \
+ #cpPopup { opacity: 0.5; width:200px; font-family: "Helvetica Neue", Helvetica, Arial, Geneva, sans-serif; -moz-border-radius-topleft: 6px; -moz-border-radius-topright: 6px; -webkit-border-top-left-radius: 6px; -webkit-border-top-right-radius: 6px; -moz-box-shadow: 0 0 20px rgba(0,0,0,0.5); -webkit-box-shadow: 0 0 20px rgba(0,0,0,0.5); position:fixed; z-index:9999; bottom:0; right:0; font-size:15px; margin: 0 20px; display: block; background:#f5f5f5; } \
+ #cpPopup:hover { opacity: 1; } \
+ #cpPopup a#addTo { cursor:pointer; text-align:center; text-decoration:none; color: #000; display:block; padding:15px 0 10px; } \
+ #cpPopup a#closeBtn { cursor:pointer; float: right; padding:10px; } \
+ #cpPopup a img { vertical-align: middle; } \
+ #cpPopup a:hover { color:#000; } \
+ #cpPopup iframe{ background:#f5f5f5; margin:6px; height:70px; width:188px; overflow:hidden; border:none; } \
');
-var cpLocation = '${host}';
-var movieImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAZCAYAAABQDyyRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+9JREFUeNrMVklIXFkUPVWWY5cDccIpMQ444YCi7UJ3KrpUxAkURRAFW6GdMCI0ooKuxIWCIkrc6FYMcYogrgxoEHFeRFRE42w5D/X73dv1i4pUOiGmkly4/u9779c979x7z3sKSZLwK02JX2y/BYCXwmeESybyGV0Mo6YQNTBzf38f09/fj7GxMRwcHPyQnTk5OSEpKQm5ublQqVTvxdCfXwIg9fT0YGBgAO7u7qipqUFAQACurq7Q29uLoaEhXhgdHY3q6mqo1WocHx+jpaUF8/PzPJeamor8/HwKhKWlJbS2tmJ/f5/nsrKyUFhYSK8vhG8+BmD2j7Dm5mZotVqcnp5ibW0N4eHhcHFxQUREBM7OznhsZ2cHu7u7iI2Nhb29PQOi8b29PaysrECpVCIqKgpubm4IDAzE7OwsLi8vsbW1hYyMDIrVK/yTUQDd3d2oqKjgjygFc3NzCAsLg7OzMyIjI3F+fo7V1VVsbm5ie3sbMTExsLW15acMYmFhAbe3twza1dUVwcHB0Gg0WF9fR15eHsXqNAZA3wUJCQkoKipiGilIQ0MDf2xmZsYUJicn87rp6Wmm+OLigpmglIWEhPDc4OAg+vr6cH19zSwUFBR8tVa4BhITE03aauPj4/QIE75gFMBPanmjAFT05ycxYNRU8svo6CiGh4fR2dkJoQvw8PBAXV0dfHx8cHNzw+MjIyO8Ni4uDpWVlbCxseGibWpqwuLiIs9lZ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0gO17/t5MN+HNfEvBf//M30NAKe7aRqUOIlfAAAAAElFTkSuQmCC'
-
-lib = (function(){
- var _public = {}
- _public.osd = function(id, year){
- var navbar, newElement;
-
- var iFrame = create('iframe', {
- src : cpLocation + "movie/imdbAdd/?id=" + id + '&year=' + year,
- frameborder : 0,
- scrolling : 'no'
- })
-
- var addToText = ''
- var popupId = 'mmPopup'
-
- var popup = create('div', {
- id : popupId,
- innerHTML : addToText
- });
- var addButton = create('a', {
- innerHTML: '
Add to CouchPotato',
- id: 'addTo',
- onclick: function(){
- popup.innerHTML = '';
- popup.appendChild(create('a', {
- innerHTML: '
',
- id: 'closeBtn',
- onclick: function(){
- popup.innerHTML = '';
- popup.appendChild(addButton);
- }
- }));
- popup.appendChild(iFrame);
- }
- })
- popup.appendChild(addButton);
-
- document.body.parentNode.insertBefore(popup, document.body);
- }
-
- _public.search = function(name, year){
-
- var imdb_id = 'tt1234567';
-
- lib.osd(imdb_id, year);
-
- return imdb_id;
- }
-
- return _public
-})();
-
-var CouchPotato = {}
-
-CouchPotato['imdb.com'] = (function(){
-
- function isMovie(){
- var series = document.getElementsByTagName('h5')
- for (var i = 0; i < series.length; i++) {
- if (series[i].innerHTML == 'Seasons:') {
- return false;
- }
- }
- return true;
- }
-
- function getId(){
- return 'tt' + location.href.replace(/[^\d+]+/g, '');
- }
-
- function getYear(){
- try {
- return document.getElementsByTagName('h1')[0].getElementsByTagName('a')[0].text;
- } catch (e) {
- var spans = document.getElementsByTagName('h1')[0].getElementsByTagName('span');
- var pattern = /^\((TV|Video) ([0-9]+)\)$/;
- for (var i = 0; i < spans.length; i++) {
- if (spans[i].innerHTML.search(pattern)) {
- return spans[i].innerHTML.match(pattern)[1];
+var movieImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAZCAYAAABQDyyRAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAA+9JREFUeNrMVklIXFkUPVWWY5cDccIpMQ444YCi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RRGxsb3JJeXl76td7e3vrPiIEPYmEEtdrk5CRR9V0AHB0dUVpaitDQUD0gOmGJEV0NUAEeGVxU3gn/CwLAS7qUSCYwUf2SOOSk4uJi+vdYuJtwtfA/6AQgpxR81N1WnIU//4EKbP7w8PBGPJ9REersTHTchaE8G3bBvs6fZHJLiwBW4vakJfr9/Py4JIx+IFNhAqf6em2QkT7hysfr/hVgAIhbr+v/xmSzAAAAAElFTkSuQmCC';
+var closeImg = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAACXBIWXMAAAsTAAALEwEAmpwYAAAABGdBTUEAALGOfPtRkwAAACBjSFJNAAB6JQAAgIMAAPn/AACA6QAAdTAAAOpgAAA6mAAAF2+SX8VGAAAA5ElEQVR42tRTQYoEIQwsl/2Bl3gQoY9eBKEf5kvyG8G7h4Z+S38gIu5lp5lZ2R7YPm1BDhZJSFWiGmPgDj5wE7cbfD4/mBkAHprUj9yTTyn9OsGIMSLG+Fxwxc8SiAi9d4QQHskjhIDeO4jorQcq5wwiQmsN3nt479FaAxEh5zxJmyZIKalSClprL1FKQUpJXZr4DBH52xqZeRhjICKw1sJaCxGBMQbMPN41GFpriAicc6i1otYK5xxEBFrraQuThGVZAADbtp2amXms6woAOI7j0gO17/t5MN+HNfEvBf//M30NAKe7aRqUOIlfAAAAAElFTkSuQmCC';
+
+var osd = function(){
+ var navbar, newElement;
+
+ var iFrame = create('iframe', {
+ 'src': cpLocation + "extension.add_via_url/?url=" + escape(document.location),
+ 'frameborder': 0,
+ 'scrolling': 'no'
+ });
+
+ var addToText = '';
+ var popupId = 'cpPopup';
+
+ var popup = create('div', {
+ 'id': popupId,
+ 'innerHTML': addToText
+ });
+ var addButton = create('a', {
+ 'innerHTML': '
Add to CouchPotato',
+ 'id': 'addTo',
+ 'onclick': function(){
+ popup.innerHTML = '';
+ popup.appendChild(create('a', {
+ 'innerHTML': '
',
+ 'id': 'closeBtn',
+ 'onclick': function(){
+ popup.innerHTML = '';
+ popup.appendChild(addButton);
}
- }
- }
- }
-
- var constructor = function(){
- if(isMovie()){
- lib.osd(getId(), getYear());
- }
- }
-
- return constructor;
+ }));
+ popup.appendChild(iFrame)
+ }
+ });
+ popup.appendChild(addButton);
-})();
+ document.body.parentNode.insertBefore(popup, document.body);
+};
-CouchPotato['sharethe.tv'] = (function(){
-
- function isMovie(){
- var pattern = /movies\/[^/]+\/?$/;
- matched = location.href.match(pattern);
- return null != matched;
- }
-
- function getId(){
- var pattern = /imdb\.com\/title\/tt(\d+)/;
- var html = document.getElementsByTagName('html')[0].innerHTML;
- var imdb_id = html.match(pattern)[1];
- return imdb_id;
-
- }
-
- function getYear(){
- var pattern = /(\d+)[^\d]*$/;
- var html = document.getElementsByTagName('html')[0].innerHTML;
- var year = html.match(pattern)[1];
- return year;
-
- }
-
- function constructor(){
- if(isMovie()){
- lib.osd(getId(), getYear());
- }
- }
-
- return constructor;
-
-})();
-
-CouchPotato['moviemeter.nl'] = (function(){
-
- function isMovie(){
- var pattern = /[^/]+\/?$/;
- var html = document.getElementsByTagName('h1')[0].innerHTML
- matched = location.href.match(pattern);
- return null != matched;
- }
-
- function getId(){
- var pattern = /imdb\.com\/title\/tt(\d+)/;
- var html = document.getElementsByTagName('html')[0].innerHTML;
- var imdb_id = html.match(pattern)[1];
- return imdb_id;
-
- }
-
- function getYear(){
- var pattern = /(\d+)[^\d]*$/;
- var html = document.getElementsByTagName('h1')[0].innerHTML;
- var year = html.match(pattern)[1];
- return year;
-
- }
-
- function constructor(){
- if(isMovie()){
- lib.osd(getId(), getYear());
- }
- }
-
- return constructor;
-
-})();
-
-CouchPotato['whiwa.net'] = (function(){
-
- function isMovie(){
- var pattern = /[^/]+\/?$/;
- var html = document.getElementsByTagName('h3')[0].innerHTML
- var matched = location.href.match(pattern);
- return null != matched;
- }
-
- function getId(){
- var pattern = /imdb\.com\/title\/tt(\d+)/;
- var html = document.getElementsByTagName('html')[0].innerHTML;
- var imdb_id = html.match(pattern)[1];
- return imdb_id;
-
- }
-
- function getYear(){
- var pattern = /(\d+)[^\d]*$/;
- var html = document.getElementsByTagName('h3')[0].innerHTML;
- var year = html.match(pattern)[1];
- return year;
-
- }
-
- function constructor(){
- if(isMovie()){
- lib.osd(getId(), getYear());
- }
- }
-
- return constructor;
-
-})();
-
-CouchPotato['trakt.tv'] = (function(){
-
- var imdb_input = null;
- var year_input = null;
-
- function isMovie(){
- imdb_input = document.getElementById("meta-imdb-id");
- year_input = document.getElementById("meta-year");
- return (null != imdb_input) && (null != year_input);
- }
-
- function getId(){
- return imdb_input.value.substr(2);
- }
-
- function getYear(){
- return year_input.value;
-
- }
-
- function constructor(){
- if(isMovie()){
- lib.osd(getId(), getYear());
- }
- }
-
- return constructor;
-
-})();
-
-CouchPotato['trailers.apple.com'] = (function(){
-
- function getId() {
- var name = document.title.substr(0, document.title.indexOf(" -")).replace(/ /g, "+");
- return lib.search(name, getYear())
-
- }
-
- function getYear(){
- var release_date = document.getElementById("view-showtimes").parentNode.innerHTML;
- var year = new RegExp("\\d{4}", release_date)
-
- return year;
- }
-
- function constructor(){
- getId();
- }
-
- return constructor;
-
-})();
-
-CouchPotato['themoviedb.org'] = (function(){
-
- var obj = this;
-
- function getId() {
-
- name = document.title.substr(0, document.title.indexOf("TMDb")-3).replace(/ /g, "+");
- lib.search(name, getYear())
-
- }
-
- function getYear(){
- var year = document.getElementById("year").innerHTML;
- year = year.substr(1, year.length-2);
- return year;
- }
-
- function constructor(){
- getId();
- }
-
- return constructor;
-
-})();
-
-CouchPotato['allocine.fr'] = (function(){
-
- function isMovie(){
- var pattern = /fichefilm_gen_cfilm=\d+?\.html$/;
- matched = location.href.match(pattern);
- return null != matched;
- }
-
- function getId() {
- var name = document.title.substr(0, document.title.indexOf(" -")).replace(/ /g, "+");
- lib.search(name, getYear())
- }
-
- function getYear(){
- var year = new RegExp("\\d{4}", document.title)
- return year;
- }
-
- function constructor(){
- if(isMovie()){
- lib.osd(getId(), getYear());
- }
- }
-
- return constructor;
-
-})();
-
-// Start
-(function(){
- for (var i in CouchPotato){
- GM_log(i);
- if(location.href.indexOf(i) != -1){
- new CouchPotato[i]();
- break;
- }
- }
-})();
+osd();
\ No newline at end of file
diff --git a/couchpotato/core/providers/extension/__init__.py b/couchpotato/core/providers/extension/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/couchpotato/core/providers/extension/allocine/__init__.py b/couchpotato/core/providers/extension/allocine/__init__.py
new file mode 100644
index 0000000..e451996
--- /dev/null
+++ b/couchpotato/core/providers/extension/allocine/__init__.py
@@ -0,0 +1,6 @@
+from .main import AlloCine
+
+def start():
+ return AlloCine()
+
+config = []
diff --git a/couchpotato/core/providers/extension/allocine/main.py b/couchpotato/core/providers/extension/allocine/main.py
new file mode 100644
index 0000000..11e357a
--- /dev/null
+++ b/couchpotato/core/providers/extension/allocine/main.py
@@ -0,0 +1,34 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+
+
+class AlloCine(ExtensionBase):
+
+ includes = ['http://www.allocine.fr/film/*']
+
+#CouchPotato['allocine.fr'] = (function(){
+#
+# function isMovie(){
+# var pattern = /fichefilm_gen_cfilm=\d+?\.html$/;
+# matched = location.href.match(pattern);
+# return null != matched;
+# }
+#
+# function getId() {
+# var name = document.title.substr(0, document.title.indexOf(" -")).replace(/ /g, "+");
+# lib.search(name, getYear())
+# }
+#
+# function getYear(){
+# var year = new RegExp("\\d{4}", document.title)
+# return year;
+# }
+#
+# function constructor(){
+# if(isMovie()){
+# lib.osd(getId(), getYear());
+# }
+# }
+#
+# return constructor;
+#
+#})();
diff --git a/couchpotato/core/providers/extension/appletrailers/__init__.py b/couchpotato/core/providers/extension/appletrailers/__init__.py
new file mode 100644
index 0000000..e8078f4
--- /dev/null
+++ b/couchpotato/core/providers/extension/appletrailers/__init__.py
@@ -0,0 +1,6 @@
+from .main import AppleTrailers
+
+def start():
+ return AppleTrailers()
+
+config = []
diff --git a/couchpotato/core/providers/extension/appletrailers/main.py b/couchpotato/core/providers/extension/appletrailers/main.py
new file mode 100644
index 0000000..f77db06
--- /dev/null
+++ b/couchpotato/core/providers/extension/appletrailers/main.py
@@ -0,0 +1,29 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+
+
+class AppleTrailers(ExtensionBase):
+
+ includes = ['http://trailers.apple.com/trailers/*']
+
+#CouchPotato['trailers.apple.com'] = (function(){
+#
+# function getId() {
+# var name = document.title.substr(0, document.title.indexOf(" -")).replace(/ /g, "+");
+# return lib.search(name, getYear())
+#
+# }
+#
+# function getYear(){
+# var release_date = document.getElementById("view-showtimes").parentNode.innerHTML;
+# var year = new RegExp("\\d{4}", release_date)
+#
+# return year;
+# }
+#
+# function constructor(){
+# getId();
+# }
+#
+# return constructor;
+#
+#})();
diff --git a/couchpotato/core/providers/extension/base.py b/couchpotato/core/providers/extension/base.py
new file mode 100644
index 0000000..d80e993
--- /dev/null
+++ b/couchpotato/core/providers/extension/base.py
@@ -0,0 +1,32 @@
+from couchpotato.core.event import addEvent
+from couchpotato.core.logger import CPLog
+from couchpotato.core.plugins.base import Plugin
+
+log = CPLog(__name__)
+
+
+class ExtensionBase(Plugin):
+
+ version = 1
+
+ includes = []
+ excludes = []
+
+ def __init__(self):
+ addEvent('extension.add_via_url', self.addViaUrl)
+ addEvent('extension.get_includes', self.getInclude)
+ addEvent('extension.get_excludes', self.getExclude)
+
+ addEvent('extension.get_version', self.getVersion)
+
+ def addViaUrl(self):
+ pass
+
+ def getInclude(self):
+ return self.includes
+
+ def getExclude(self):
+ return self.excludes
+
+ def getVersion(self):
+ return self.version
diff --git a/couchpotato/core/providers/extension/imdb/__init__.py b/couchpotato/core/providers/extension/imdb/__init__.py
new file mode 100644
index 0000000..f10505d
--- /dev/null
+++ b/couchpotato/core/providers/extension/imdb/__init__.py
@@ -0,0 +1,6 @@
+from .main import IMDB
+
+def start():
+ return IMDB()
+
+config = []
diff --git a/couchpotato/core/providers/extension/imdb/main.py b/couchpotato/core/providers/extension/imdb/main.py
new file mode 100644
index 0000000..ea0bdcb
--- /dev/null
+++ b/couchpotato/core/providers/extension/imdb/main.py
@@ -0,0 +1,82 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+from imdb.parser.http.bsouplxml._bsoup import SoupStrainer, BeautifulSoup
+import re
+
+
+class IMDB(ExtensionBase):
+
+ includes = ['http*://*.imdb.com/title/tt*', 'http*://imdb.com/title/tt*']
+
+ def getMovie(self, url):
+
+ data = self.urlopen(url)
+
+ html = BeautifulSoup(data)
+ headers = html.findAll('h5')
+
+ # Don't add TV show
+ for head in headers:
+ if 'seasons' in head.lower():
+ return False
+
+ return {
+ 'id': re.search('(?Ptt[0-9{7}]+)', url).group('id'),
+ 'year': self.getYear(html)
+ }
+
+ def getYear(self, html):
+
+ headers = html.findAll('h1')
+
+ tv_pattern = '/^\((TV|Video) ([0-9]+)\)$/';
+
+ try:
+ year = headers[0].findAll('a').text
+ return year
+ except:
+ pass
+
+ for head in headers:
+ match = re.search(tv_pattern, head)
+ if match:
+ return match[1]
+
+#CouchPotato['imdb.com'] = (function(){
+#
+# function isMovie(){
+# var series = document.getElementsByTagName('h5')
+# for (var i = 0; i < series.length; i++) {
+# if (series[i].innerHTML == 'Seasons:') {
+# return false;
+# }
+# }
+# return true;
+# }
+#
+# function getId(){
+# return 'tt' + location.href.replace(/[^\d+]+/g, '');
+# }
+#
+# function getYear(){
+# try {
+# return document.getElementsByTagName('h1')[0].getElementsByTagName('a')[0].text;
+# } catch (e) {
+# var spans = document.getElementsByTagName('h1')[0].getElementsByTagName('span');
+# var pattern = /^\((TV|Video) ([0-9]+)\)$/;
+# for (var i = 0; i < spans.length; i++) {
+# if (spans[i].innerHTML.search(pattern)) {
+# return spans[i].innerHTML.match(pattern)[1];
+# }
+# }
+# }
+# }
+#
+# var constructor = function(){
+# if(isMovie()){
+# lib.osd(getId(), getYear());
+# }
+# }
+#
+# return constructor;
+#
+#})();
diff --git a/couchpotato/core/providers/extension/moviemeter/__init__.py b/couchpotato/core/providers/extension/moviemeter/__init__.py
new file mode 100644
index 0000000..5e3813c
--- /dev/null
+++ b/couchpotato/core/providers/extension/moviemeter/__init__.py
@@ -0,0 +1,6 @@
+from .main import MovieMeter
+
+def start():
+ return MovieMeter()
+
+config = []
diff --git a/couchpotato/core/providers/extension/moviemeter/main.py b/couchpotato/core/providers/extension/moviemeter/main.py
new file mode 100644
index 0000000..7c45aba
--- /dev/null
+++ b/couchpotato/core/providers/extension/moviemeter/main.py
@@ -0,0 +1,41 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+
+
+class MovieMeter(ExtensionBase):
+
+ includes = ['http://*.moviemeter.nl/film/*', 'http://moviemeter.nl/film/*']
+
+#CouchPotato['moviemeter.nl'] = (function(){
+#
+# function isMovie(){
+# var pattern = /[^/]+\/?$/;
+# var html = document.getElementsByTagName('h1')[0].innerHTML
+# matched = location.href.match(pattern);
+# return null != matched;
+# }
+#
+# function getId(){
+# var pattern = /imdb\.com\/title\/tt(\d+)/;
+# var html = document.getElementsByTagName('html')[0].innerHTML;
+# var imdb_id = html.match(pattern)[1];
+# return imdb_id;
+#
+# }
+#
+# function getYear(){
+# var pattern = /(\d+)[^\d]*$/;
+# var html = document.getElementsByTagName('h1')[0].innerHTML;
+# var year = html.match(pattern)[1];
+# return year;
+#
+# }
+#
+# function constructor(){
+# if(isMovie()){
+# lib.osd(getId(), getYear());
+# }
+# }
+#
+# return constructor;
+#
+#})();
diff --git a/couchpotato/core/providers/extension/sharethe/__init__.py b/couchpotato/core/providers/extension/sharethe/__init__.py
new file mode 100644
index 0000000..7661f76
--- /dev/null
+++ b/couchpotato/core/providers/extension/sharethe/__init__.py
@@ -0,0 +1,6 @@
+from .main import ShareThe
+
+def start():
+ return ShareThe()
+
+config = []
diff --git a/couchpotato/core/providers/extension/sharethe/main.py b/couchpotato/core/providers/extension/sharethe/main.py
new file mode 100644
index 0000000..0cfe968
--- /dev/null
+++ b/couchpotato/core/providers/extension/sharethe/main.py
@@ -0,0 +1,40 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+
+
+class ShareThe(ExtensionBase):
+
+ includes = ['http://*.sharethe.tv/movies/*', 'http://sharethe.tv/movies/*']
+
+#CouchPotato['sharethe.tv'] = (function(){
+#
+# function isMovie(){
+# var pattern = /movies\/[^/]+\/?$/;
+# matched = location.href.match(pattern);
+# return null != matched;
+# }
+#
+# function getId(){
+# var pattern = /imdb\.com\/title\/tt(\d+)/;
+# var html = document.getElementsByTagName('html')[0].innerHTML;
+# var imdb_id = html.match(pattern)[1];
+# return imdb_id;
+#
+# }
+#
+# function getYear(){
+# var pattern = /(\d+)[^\d]*$/;
+# var html = document.getElementsByTagName('html')[0].innerHTML;
+# var year = html.match(pattern)[1];
+# return year;
+#
+# }
+#
+# function constructor(){
+# if(isMovie()){
+# lib.osd(getId(), getYear());
+# }
+# }
+#
+# return constructor;
+#
+#})();
diff --git a/couchpotato/core/providers/extension/tmdb/__init__.py b/couchpotato/core/providers/extension/tmdb/__init__.py
new file mode 100644
index 0000000..be33372
--- /dev/null
+++ b/couchpotato/core/providers/extension/tmdb/__init__.py
@@ -0,0 +1,6 @@
+from .main import TMDB
+
+def start():
+ return TMDB()
+
+config = []
diff --git a/couchpotato/core/providers/extension/tmdb/main.py b/couchpotato/core/providers/extension/tmdb/main.py
new file mode 100644
index 0000000..133a7c6
--- /dev/null
+++ b/couchpotato/core/providers/extension/tmdb/main.py
@@ -0,0 +1,31 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+
+
+class TMDB(ExtensionBase):
+
+ includes = ['http://www.themoviedb.org/movie/*']
+
+#CouchPotato['themoviedb.org'] = (function(){
+#
+# var obj = this;
+#
+# function getId() {
+#
+# name = document.title.substr(0, document.title.indexOf("TMDb")-3).replace(/ /g, "+");
+# lib.search(name, getYear())
+#
+# }
+#
+# function getYear(){
+# var year = document.getElementById("year").innerHTML;
+# year = year.substr(1, year.length-2);
+# return year;
+# }
+#
+# function constructor(){
+# getId();
+# }
+#
+# return constructor;
+#
+#})();
diff --git a/couchpotato/core/providers/extension/trakt/__init__.py b/couchpotato/core/providers/extension/trakt/__init__.py
new file mode 100644
index 0000000..ff67c1e
--- /dev/null
+++ b/couchpotato/core/providers/extension/trakt/__init__.py
@@ -0,0 +1,6 @@
+from .main import Trakt
+
+def start():
+ return Trakt()
+
+config = []
diff --git a/couchpotato/core/providers/extension/trakt/main.py b/couchpotato/core/providers/extension/trakt/main.py
new file mode 100644
index 0000000..4f2ed31
--- /dev/null
+++ b/couchpotato/core/providers/extension/trakt/main.py
@@ -0,0 +1,37 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+
+
+class Trakt(ExtensionBase):
+
+ includes = ['http://trakt.tv/movie/*', 'http://*.trakt.tv/movie/*']
+ included = ['http://trakt.tv/movie/*/*', 'http://*.trakt.tv/movie/*/*']
+
+#CouchPotato['trakt.tv'] = (function(){
+#
+# var imdb_input = null;
+# var year_input = null;
+#
+# function isMovie(){
+# imdb_input = document.getElementById("meta-imdb-id");
+# year_input = document.getElementById("meta-year");
+# return (null != imdb_input) && (null != year_input);
+# }
+#
+# function getId(){
+# return imdb_input.value.substr(2);
+# }
+#
+# function getYear(){
+# return year_input.value;
+#
+# }
+#
+# function constructor(){
+# if(isMovie()){
+# lib.osd(getId(), getYear());
+# }
+# }
+#
+# return constructor;
+#
+#})();
diff --git a/couchpotato/core/providers/extension/whiwa/__init__.py b/couchpotato/core/providers/extension/whiwa/__init__.py
new file mode 100644
index 0000000..6577ae3
--- /dev/null
+++ b/couchpotato/core/providers/extension/whiwa/__init__.py
@@ -0,0 +1,6 @@
+from .main import WHiWA
+
+def start():
+ return WHiWA()
+
+config = []
diff --git a/couchpotato/core/providers/extension/whiwa/main.py b/couchpotato/core/providers/extension/whiwa/main.py
new file mode 100644
index 0000000..57a6a67
--- /dev/null
+++ b/couchpotato/core/providers/extension/whiwa/main.py
@@ -0,0 +1,41 @@
+from couchpotato.core.providers.extension.base import ExtensionBase
+
+
+class WHiWA(ExtensionBase):
+
+ includes = ['http://whiwa.net/stats/movie/*']
+
+#CouchPotato['whiwa.net'] = (function(){
+#
+# function isMovie(){
+# var pattern = /[^/]+\/?$/;
+# var html = document.getElementsByTagName('h3')[0].innerHTML
+# var matched = location.href.match(pattern);
+# return null != matched;
+# }
+#
+# function getId(){
+# var pattern = /imdb\.com\/title\/tt(\d+)/;
+# var html = document.getElementsByTagName('html')[0].innerHTML;
+# var imdb_id = html.match(pattern)[1];
+# return imdb_id;
+#
+# }
+#
+# function getYear(){
+# var pattern = /(\d+)[^\d]*$/;
+# var html = document.getElementsByTagName('h3')[0].innerHTML;
+# var year = html.match(pattern)[1];
+# return year;
+#
+# }
+#
+# function constructor(){
+# if(isMovie()){
+# lib.osd(getId(), getYear());
+# }
+# }
+#
+# return constructor;
+#
+#})();