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