Extension -> Userscript
This commit is contained in:
1 parent
ff9a5971c4
commit
d79a25bb5b
22 files changed
+38
-38
No files matched your search
+11
-11
@@ -19,17 +19,17 @@ class Loader:
|
|||||||
providers = os.path.join(root, 'couchpotato', 'core', 'providers')
|
providers = os.path.join(root, 'couchpotato', 'core', 'providers')
|
||||||
|
|
||||||
self.paths = {
|
self.paths = {
|
||||||
'core' : (0, 'couchpotato.core._base', os.path.join(core, '_base')),
|
'core': (0, 'couchpotato.core._base', os.path.join(core, '_base')),
|
||||||
'plugin' : (1, 'couchpotato.core.plugins', os.path.join(core, 'plugins')),
|
'plugin': (1, 'couchpotato.core.plugins', os.path.join(core, 'plugins')),
|
||||||
'notifications' : (20, 'couchpotato.core.notifications', os.path.join(core, 'notifications')),
|
'notifications': (20, 'couchpotato.core.notifications', os.path.join(core, 'notifications')),
|
||||||
'downloaders' : (20, 'couchpotato.core.downloaders', os.path.join(core, 'downloaders')),
|
'downloaders': (20, 'couchpotato.core.downloaders', os.path.join(core, 'downloaders')),
|
||||||
'movie_provider' : (20, 'couchpotato.core.providers.movie', os.path.join(providers, 'movie')),
|
'movie_provider': (20, 'couchpotato.core.providers.movie', os.path.join(providers, 'movie')),
|
||||||
'nzb_provider' : (20, 'couchpotato.core.providers.nzb', os.path.join(providers, 'nzb')),
|
'nzb_provider': (20, 'couchpotato.core.providers.nzb', os.path.join(providers, 'nzb')),
|
||||||
'torrent_provider' : (20, 'couchpotato.core.providers.torrent', os.path.join(providers, 'torrent')),
|
'torrent_provider': (20, 'couchpotato.core.providers.torrent', os.path.join(providers, 'torrent')),
|
||||||
'trailer_provider' : (20, 'couchpotato.core.providers.trailer', os.path.join(providers, 'trailer')),
|
'trailer_provider': (20, 'couchpotato.core.providers.trailer', os.path.join(providers, 'trailer')),
|
||||||
'subtitle_provider' : (20, 'couchpotato.core.providers.subtitle', os.path.join(providers, 'subtitle')),
|
'subtitle_provider': (20, 'couchpotato.core.providers.subtitle', os.path.join(providers, 'subtitle')),
|
||||||
'metadata_provider' : (25, 'couchpotato.core.providers.metadata', os.path.join(providers, 'metadata')),
|
'metadata_provider': (25, 'couchpotato.core.providers.metadata', os.path.join(providers, 'metadata')),
|
||||||
'extension_provider' : (25, 'couchpotato.core.providers.extension', os.path.join(providers, 'extension')),
|
'userscript_provider': (25, 'couchpotato.core.providers.userscript', os.path.join(providers, 'userscript')),
|
||||||
}
|
}
|
||||||
|
|
||||||
for type, tuple in self.paths.iteritems():
|
for type, tuple in self.paths.iteritems():
|
||||||
|
|||||||
File renamed without changes.
+5
-5
@@ -10,15 +10,15 @@ import os
|
|||||||
class Extension(Plugin):
|
class Extension(Plugin):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
addApiView('extension', self.getExtension)
|
addApiView('userscript', self.getExtension)
|
||||||
|
|
||||||
def getExtension(self):
|
def getExtension(self):
|
||||||
|
|
||||||
params = {
|
params = {
|
||||||
'includes': fireEvent('extension.get_includes', merge = True),
|
'includes': fireEvent('userscript.get_includes', merge = True),
|
||||||
'excludes': fireEvent('extension.get_excludes', merge = True),
|
'excludes': fireEvent('userscript.get_excludes', merge = True),
|
||||||
'version': self.getVersion(),
|
'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()
|
template = open(os.path.join(os.path.dirname(__file__), 'template.js'), 'r').read()
|
||||||
@@ -26,7 +26,7 @@ class Extension(Plugin):
|
|||||||
|
|
||||||
def getVersion(self):
|
def getVersion(self):
|
||||||
|
|
||||||
versions = fireEvent('extension.get_version')
|
versions = fireEvent('userscript.get_version')
|
||||||
|
|
||||||
version = 0
|
version = 0
|
||||||
for v in versions:
|
for v in versions:
|
||||||
+1
-1
@@ -67,7 +67,7 @@ var osd = function(){
|
|||||||
var navbar, newElement;
|
var navbar, newElement;
|
||||||
|
|
||||||
var iFrame = create('iframe', {
|
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,
|
'frameborder': 0,
|
||||||
'scrolling': 'no'
|
'scrolling': 'no'
|
||||||
});
|
});
|
||||||
File renamed without changes.
File renamed without changes.
+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/*']
|
includes = ['http://www.allocine.fr/film/*']
|
||||||
|
|
||||||
File renamed without changes.
+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/*']
|
includes = ['http://trailers.apple.com/trailers/*']
|
||||||
|
|
||||||
+5
-5
@@ -5,7 +5,7 @@ from couchpotato.core.plugins.base import Plugin
|
|||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
|
|
||||||
|
|
||||||
class ExtensionBase(Plugin):
|
class UserscriptBase(Plugin):
|
||||||
|
|
||||||
version = 1
|
version = 1
|
||||||
|
|
||||||
@@ -13,11 +13,11 @@ class ExtensionBase(Plugin):
|
|||||||
excludes = []
|
excludes = []
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
addEvent('extension.add_via_url', self.addViaUrl)
|
addEvent('userscript.add_via_url', self.addViaUrl)
|
||||||
addEvent('extension.get_includes', self.getInclude)
|
addEvent('userscript.get_includes', self.getInclude)
|
||||||
addEvent('extension.get_excludes', self.getExclude)
|
addEvent('userscript.get_excludes', self.getExclude)
|
||||||
|
|
||||||
addEvent('extension.get_version', self.getVersion)
|
addEvent('userscript.get_version', self.getVersion)
|
||||||
|
|
||||||
def addViaUrl(self):
|
def addViaUrl(self):
|
||||||
pass
|
pass
|
||||||
File renamed without changes.
+2
-2
@@ -1,9 +1,9 @@
|
|||||||
from beautifulsoup import BeautifulSoup
|
from beautifulsoup import BeautifulSoup
|
||||||
from couchpotato.core.providers.extension.base import ExtensionBase
|
from couchpotato.core.providers.userscript.base import UserscriptBase
|
||||||
import re
|
import re
|
||||||
|
|
||||||
|
|
||||||
class IMDB(ExtensionBase):
|
class IMDB(UserscriptBase):
|
||||||
|
|
||||||
includes = ['http*://*.imdb.com/title/tt*', 'http*://imdb.com/title/tt*']
|
includes = ['http*://*.imdb.com/title/tt*', 'http*://imdb.com/title/tt*']
|
||||||
|
|
||||||
File renamed without changes.
+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/*']
|
includes = ['http://*.moviemeter.nl/film/*', 'http://moviemeter.nl/film/*']
|
||||||
|
|
||||||
File renamed without changes.
+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/*']
|
includes = ['http://*.sharethe.tv/movies/*', 'http://sharethe.tv/movies/*']
|
||||||
|
|
||||||
File renamed without changes.
+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/*']
|
includes = ['http://www.themoviedb.org/movie/*']
|
||||||
|
|
||||||
File renamed without changes.
+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/*']
|
includes = ['http://trakt.tv/movie/*', 'http://*.trakt.tv/movie/*']
|
||||||
excludes = ['http://trakt.tv/movie/*/*', 'http://*.trakt.tv/movie/*/*']
|
excludes = ['http://trakt.tv/movie/*/*', 'http://*.trakt.tv/movie/*/*']
|
||||||
File renamed without changes.
+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/*']
|
includes = ['http://whiwa.net/stats/movie/*']
|
||||||
|
|
||||||
Reference in new issue
Block a user