Auto import static files
This commit is contained in:
1 parent
5dd802bc31
commit
cd82943279
11 files changed
+15
-25
No files matched your search
@@ -19,8 +19,7 @@ class CoreNotifier(Plugin):
|
|||||||
|
|
||||||
addApiView('core_notifier.listener', self.listener)
|
addApiView('core_notifier.listener', self.listener)
|
||||||
|
|
||||||
static = self.registerStatic(__file__)
|
self.registerStatic(__file__)
|
||||||
fireEvent('register_script', static + 'notification.js')
|
|
||||||
|
|
||||||
def notify(self, message = '', data = {}):
|
def notify(self, message = '', data = {}):
|
||||||
self.add(data = {
|
self.add(data = {
|
||||||
|
|||||||
@@ -1,6 +1,9 @@
|
|||||||
from couchpotato import addView
|
from couchpotato import addView
|
||||||
|
from couchpotato.core.event import fireEvent
|
||||||
|
from couchpotato.core.helpers.variable import getExt
|
||||||
from couchpotato.environment import Env
|
from couchpotato.environment import Env
|
||||||
from flask.helpers import send_from_directory
|
from flask.helpers import send_from_directory
|
||||||
|
import glob
|
||||||
import os.path
|
import os.path
|
||||||
import re
|
import re
|
||||||
|
|
||||||
@@ -25,7 +28,8 @@ class Plugin():
|
|||||||
path = 'static/' + class_name + '/'
|
path = 'static/' + class_name + '/'
|
||||||
addView(path + '<path:file>', self.showStatic, static = True)
|
addView(path + '<path:file>', self.showStatic, static = True)
|
||||||
|
|
||||||
return path
|
for file in glob.glob(os.path.join(self.plugin_path, 'static', '*')):
|
||||||
|
fireEvent('register_script' if getExt(file) in 'js' else 'register_style', path + os.path.basename(file))
|
||||||
|
|
||||||
def showStatic(self, file = ''):
|
def showStatic(self, file = ''):
|
||||||
dir = os.path.join(self.plugin_path, 'static')
|
dir = os.path.join(self.plugin_path, 'static')
|
||||||
|
|||||||
@@ -25,8 +25,7 @@ class FileManager(Plugin):
|
|||||||
|
|
||||||
addApiView('file.cache/<path:file>', self.showImage)
|
addApiView('file.cache/<path:file>', self.showImage)
|
||||||
|
|
||||||
path = self.registerStatic(__file__)
|
self.registerStatic(__file__)
|
||||||
fireEvent('register_script', path + 'file.js')
|
|
||||||
|
|
||||||
def showImage(self, file = ''):
|
def showImage(self, file = ''):
|
||||||
|
|
||||||
|
|||||||
@@ -19,12 +19,7 @@ class MoviePlugin(Plugin):
|
|||||||
addApiView('movie.edit', self.edit)
|
addApiView('movie.edit', self.edit)
|
||||||
addApiView('movie.delete', self.delete)
|
addApiView('movie.delete', self.delete)
|
||||||
|
|
||||||
path = self.registerStatic(__file__)
|
self.registerStatic(__file__)
|
||||||
fireEvent('register_script', path + 'search.js')
|
|
||||||
fireEvent('register_style', path + 'search.css')
|
|
||||||
fireEvent('register_script', path + 'movie.js')
|
|
||||||
fireEvent('register_style', path + 'movie.css')
|
|
||||||
fireEvent('register_script', path + 'list.js')
|
|
||||||
|
|
||||||
def list(self):
|
def list(self):
|
||||||
|
|
||||||
|
|||||||
@@ -17,9 +17,7 @@ class ProfilePlugin(Plugin):
|
|||||||
addApiView('profile.save', self.save)
|
addApiView('profile.save', self.save)
|
||||||
addApiView('profile.delete', self.delete)
|
addApiView('profile.delete', self.delete)
|
||||||
|
|
||||||
path = self.registerStatic(__file__)
|
self.registerStatic(__file__)
|
||||||
fireEvent('register_script', path + 'profile.js')
|
|
||||||
fireEvent('register_style', path + 'profile.css')
|
|
||||||
|
|
||||||
def all(self):
|
def all(self):
|
||||||
|
|
||||||
|
|||||||
@@ -33,9 +33,7 @@ class QualityPlugin(Plugin):
|
|||||||
addEvent('quality.guess', self.guess)
|
addEvent('quality.guess', self.guess)
|
||||||
addEvent('app.load', self.fill)
|
addEvent('app.load', self.fill)
|
||||||
|
|
||||||
path = self.registerStatic(__file__)
|
self.registerStatic(__file__)
|
||||||
fireEvent('register_script', path + 'quality.js')
|
|
||||||
fireEvent('register_style', path + 'quality.css')
|
|
||||||
|
|
||||||
def all(self):
|
def all(self):
|
||||||
|
|
||||||
|
|||||||
@@ -176,7 +176,7 @@ class Renamer(Plugin):
|
|||||||
break
|
break
|
||||||
|
|
||||||
for file in release.files:
|
for file in release.files:
|
||||||
log.info('Removing "%s"' % file.path)
|
log.info('Removing (not really) "%s"' % file.path)
|
||||||
|
|
||||||
# Rename
|
# Rename
|
||||||
for src in rename_files:
|
for src in rename_files:
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ config = [{
|
|||||||
{
|
{
|
||||||
'name': 'ignored_words',
|
'name': 'ignored_words',
|
||||||
'label': 'Ignored words',
|
'label': 'Ignored words',
|
||||||
'default': '',
|
'default': 'german, dutch, french, danish, swedish, dubbed, swesub, korsub',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
}, {
|
}, {
|
||||||
|
|||||||
@@ -46,7 +46,6 @@ class Searcher(Plugin):
|
|||||||
|
|
||||||
successful = False
|
successful = False
|
||||||
for type in movie['profile']['types']:
|
for type in movie['profile']['types']:
|
||||||
print type
|
|
||||||
|
|
||||||
has_better_quality = 0
|
has_better_quality = 0
|
||||||
default_title = movie['library']['titles'][0]['title']
|
default_title = movie['library']['titles'][0]['title']
|
||||||
@@ -89,6 +88,7 @@ class Searcher(Plugin):
|
|||||||
|
|
||||||
for nzb in sorted_results:
|
for nzb in sorted_results:
|
||||||
successful = fireEvent('download', data = nzb, movie = movie, single = True)
|
successful = fireEvent('download', data = nzb, movie = movie, single = True)
|
||||||
|
print successful
|
||||||
|
|
||||||
if successful:
|
if successful:
|
||||||
log.info('Downloading of %s successful.' % nzb.get('name'))
|
log.info('Downloading of %s successful.' % nzb.get('name'))
|
||||||
|
|||||||
@@ -26,8 +26,7 @@ class StatusPlugin(Plugin):
|
|||||||
addEvent('status.all', self.all)
|
addEvent('status.all', self.all)
|
||||||
addEvent('app.load', self.fill)
|
addEvent('app.load', self.fill)
|
||||||
|
|
||||||
path = self.registerStatic(__file__)
|
self.registerStatic(__file__)
|
||||||
fireEvent('register_script', path + 'status.js')
|
|
||||||
|
|
||||||
def all(self):
|
def all(self):
|
||||||
|
|
||||||
|
|||||||
@@ -8,6 +8,4 @@ log = CPLog(__name__)
|
|||||||
class Wizard(Plugin):
|
class Wizard(Plugin):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
path = self.registerStatic(__file__)
|
self.registerStatic(__file__)
|
||||||
fireEvent('register_script', path + 'spotlight.js')
|
|
||||||
fireEvent('register_script', path + 'wizard.js')
|
|
||||||
Reference in new issue
Block a user