Userscript provider parsers
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from couchpotato.core.event import addEvent, fireEvent
|
||||
from couchpotato.core.helpers.variable import getImdb
|
||||
from couchpotato.core.logger import CPLog
|
||||
from couchpotato.core.plugins.base import Plugin
|
||||
from urlparse import urlparse
|
||||
@@ -42,7 +43,11 @@ class UserscriptBase(Plugin):
|
||||
return
|
||||
|
||||
def getMovie(self, url):
|
||||
return None
|
||||
data = self.urlopen(url)
|
||||
return self.getInfo(getImdb(data))
|
||||
|
||||
def getInfo(self, identifier):
|
||||
return fireEvent('movie.info', identifier = identifier, merge = True)
|
||||
|
||||
def getInclude(self):
|
||||
return self.includes
|
||||
|
||||
@@ -21,6 +21,4 @@ class IMDB(UserscriptBase):
|
||||
return 'IMDB url is a TV Show'
|
||||
|
||||
identifier = re.search('(?P<id>tt[0-9{7}]+)', url).group('id')
|
||||
movie = fireEvent('movie.info', identifier = identifier, merge = True)
|
||||
|
||||
return movie
|
||||
return fireEvent('movie.info', identifier = identifier, merge = True)
|
||||
|
||||
@@ -4,38 +4,3 @@ from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
class MovieMeter(UserscriptBase):
|
||||
|
||||
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;
|
||||
#
|
||||
#})();
|
||||
|
||||
@@ -4,37 +4,3 @@ from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
class ShareThe(UserscriptBase):
|
||||
|
||||
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;
|
||||
#
|
||||
#})();
|
||||
|
||||
@@ -1,31 +1,13 @@
|
||||
from couchpotato.core.event import fireEvent
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
import re
|
||||
|
||||
|
||||
class TMDB(UserscriptBase):
|
||||
|
||||
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;
|
||||
#
|
||||
#})();
|
||||
def getMovie(self, url):
|
||||
match = re.search('(?P<id>\d+)', url)
|
||||
movie = fireEvent('movie.info_by_tmdb', id = match.group('id'), merge = True)
|
||||
return self.getInfo(movie['imdb'])
|
||||
|
||||
@@ -5,33 +5,3 @@ class Trakt(UserscriptBase):
|
||||
|
||||
includes = ['http://trakt.tv/movie/*', 'http://*.trakt.tv/movie/*']
|
||||
excludes = ['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;
|
||||
#
|
||||
#})();
|
||||
|
||||
@@ -4,38 +4,3 @@ from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
class WHiWA(UserscriptBase):
|
||||
|
||||
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;
|
||||
#
|
||||
#})();
|
||||
|
||||
Reference in New Issue
Block a user