Extension -> Userscript
This commit is contained in:
+11
-11
@@ -19,17 +19,17 @@ class Loader:
|
||||
providers = os.path.join(root, 'couchpotato', 'core', 'providers')
|
||||
|
||||
self.paths = {
|
||||
'core' : (0, 'couchpotato.core._base', os.path.join(core, '_base')),
|
||||
'plugin' : (1, 'couchpotato.core.plugins', os.path.join(core, 'plugins')),
|
||||
'notifications' : (20, 'couchpotato.core.notifications', os.path.join(core, 'notifications')),
|
||||
'downloaders' : (20, 'couchpotato.core.downloaders', os.path.join(core, 'downloaders')),
|
||||
'movie_provider' : (20, 'couchpotato.core.providers.movie', os.path.join(providers, 'movie')),
|
||||
'nzb_provider' : (20, 'couchpotato.core.providers.nzb', os.path.join(providers, 'nzb')),
|
||||
'torrent_provider' : (20, 'couchpotato.core.providers.torrent', os.path.join(providers, 'torrent')),
|
||||
'trailer_provider' : (20, 'couchpotato.core.providers.trailer', os.path.join(providers, 'trailer')),
|
||||
'subtitle_provider' : (20, 'couchpotato.core.providers.subtitle', os.path.join(providers, 'subtitle')),
|
||||
'metadata_provider' : (25, 'couchpotato.core.providers.metadata', os.path.join(providers, 'metadata')),
|
||||
'extension_provider' : (25, 'couchpotato.core.providers.extension', os.path.join(providers, 'extension')),
|
||||
'core': (0, 'couchpotato.core._base', os.path.join(core, '_base')),
|
||||
'plugin': (1, 'couchpotato.core.plugins', os.path.join(core, 'plugins')),
|
||||
'notifications': (20, 'couchpotato.core.notifications', os.path.join(core, 'notifications')),
|
||||
'downloaders': (20, 'couchpotato.core.downloaders', os.path.join(core, 'downloaders')),
|
||||
'movie_provider': (20, 'couchpotato.core.providers.movie', os.path.join(providers, 'movie')),
|
||||
'nzb_provider': (20, 'couchpotato.core.providers.nzb', os.path.join(providers, 'nzb')),
|
||||
'torrent_provider': (20, 'couchpotato.core.providers.torrent', os.path.join(providers, 'torrent')),
|
||||
'trailer_provider': (20, 'couchpotato.core.providers.trailer', os.path.join(providers, 'trailer')),
|
||||
'subtitle_provider': (20, 'couchpotato.core.providers.subtitle', os.path.join(providers, 'subtitle')),
|
||||
'metadata_provider': (25, 'couchpotato.core.providers.metadata', os.path.join(providers, 'metadata')),
|
||||
'userscript_provider': (25, 'couchpotato.core.providers.userscript', os.path.join(providers, 'userscript')),
|
||||
}
|
||||
|
||||
for type, tuple in self.paths.iteritems():
|
||||
|
||||
+5
-5
@@ -10,15 +10,15 @@ import os
|
||||
class Extension(Plugin):
|
||||
|
||||
def __init__(self):
|
||||
addApiView('extension', self.getExtension)
|
||||
addApiView('userscript', self.getExtension)
|
||||
|
||||
def getExtension(self):
|
||||
|
||||
params = {
|
||||
'includes': fireEvent('extension.get_includes', merge = True),
|
||||
'excludes': fireEvent('extension.get_excludes', merge = True),
|
||||
'includes': fireEvent('userscript.get_includes', merge = True),
|
||||
'excludes': fireEvent('userscript.get_excludes', merge = True),
|
||||
'version': self.getVersion(),
|
||||
'host': '%s%sextension.add_via_url/' % (request.host_url.rstrip('/'), url_for('api.index')),
|
||||
'host': '%s%userscript.add_via_url/' % (request.host_url.rstrip('/'), url_for('api.index')),
|
||||
}
|
||||
|
||||
template = open(os.path.join(os.path.dirname(__file__), 'template.js'), 'r').read()
|
||||
@@ -26,7 +26,7 @@ class Extension(Plugin):
|
||||
|
||||
def getVersion(self):
|
||||
|
||||
versions = fireEvent('extension.get_version')
|
||||
versions = fireEvent('userscript.get_version')
|
||||
|
||||
version = 0
|
||||
for v in versions:
|
||||
+1
-1
@@ -67,7 +67,7 @@ var osd = function(){
|
||||
var navbar, newElement;
|
||||
|
||||
var iFrame = create('iframe', {
|
||||
'src': cpLocation + "extension.add_via_url/?url=" + escape(document.location),
|
||||
'src': cpLocation + "userscript.add_via_url/?url=" + escape(document.location),
|
||||
'frameborder': 0,
|
||||
'scrolling': 'no'
|
||||
});
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
|
||||
|
||||
class AlloCine(ExtensionBase):
|
||||
class AlloCine(UserscriptBase):
|
||||
|
||||
includes = ['http://www.allocine.fr/film/*']
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
|
||||
|
||||
class AppleTrailers(ExtensionBase):
|
||||
class AppleTrailers(UserscriptBase):
|
||||
|
||||
includes = ['http://trailers.apple.com/trailers/*']
|
||||
|
||||
+5
-5
@@ -5,7 +5,7 @@ from couchpotato.core.plugins.base import Plugin
|
||||
log = CPLog(__name__)
|
||||
|
||||
|
||||
class ExtensionBase(Plugin):
|
||||
class UserscriptBase(Plugin):
|
||||
|
||||
version = 1
|
||||
|
||||
@@ -13,11 +13,11 @@ class ExtensionBase(Plugin):
|
||||
excludes = []
|
||||
|
||||
def __init__(self):
|
||||
addEvent('extension.add_via_url', self.addViaUrl)
|
||||
addEvent('extension.get_includes', self.getInclude)
|
||||
addEvent('extension.get_excludes', self.getExclude)
|
||||
addEvent('userscript.add_via_url', self.addViaUrl)
|
||||
addEvent('userscript.get_includes', self.getInclude)
|
||||
addEvent('userscript.get_excludes', self.getExclude)
|
||||
|
||||
addEvent('extension.get_version', self.getVersion)
|
||||
addEvent('userscript.get_version', self.getVersion)
|
||||
|
||||
def addViaUrl(self):
|
||||
pass
|
||||
+2
-2
@@ -1,9 +1,9 @@
|
||||
from beautifulsoup import BeautifulSoup
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
import re
|
||||
|
||||
|
||||
class IMDB(ExtensionBase):
|
||||
class IMDB(UserscriptBase):
|
||||
|
||||
includes = ['http*://*.imdb.com/title/tt*', 'http*://imdb.com/title/tt*']
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
|
||||
|
||||
class MovieMeter(ExtensionBase):
|
||||
class MovieMeter(UserscriptBase):
|
||||
|
||||
includes = ['http://*.moviemeter.nl/film/*', 'http://moviemeter.nl/film/*']
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
|
||||
|
||||
class ShareThe(ExtensionBase):
|
||||
class ShareThe(UserscriptBase):
|
||||
|
||||
includes = ['http://*.sharethe.tv/movies/*', 'http://sharethe.tv/movies/*']
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
|
||||
|
||||
class TMDB(ExtensionBase):
|
||||
class TMDB(UserscriptBase):
|
||||
|
||||
includes = ['http://www.themoviedb.org/movie/*']
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
|
||||
|
||||
class Trakt(ExtensionBase):
|
||||
class Trakt(UserscriptBase):
|
||||
|
||||
includes = ['http://trakt.tv/movie/*', 'http://*.trakt.tv/movie/*']
|
||||
excludes = ['http://trakt.tv/movie/*/*', 'http://*.trakt.tv/movie/*/*']
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
||||
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||
|
||||
|
||||
class WHiWA(ExtensionBase):
|
||||
class WHiWA(UserscriptBase):
|
||||
|
||||
includes = ['http://whiwa.net/stats/movie/*']
|
||||
|
||||
Reference in New Issue
Block a user