Auto import static files

This commit is contained in:
Ruud
2011-08-03 22:02:19 +02:00
parent 5dd802bc31
commit cd82943279
11 changed files with 15 additions and 25 deletions
+1 -2
View File
@@ -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 = {
+5 -1
View File
@@ -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')
+1 -2
View File
@@ -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 = ''):
+1 -6
View 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):
+1 -3
View File
@@ -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):
+1 -3
View File
@@ -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):
+1 -1
View File
@@ -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',
},
],
}, {
+1 -1
View File
@@ -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'))
+1 -2
View File
@@ -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):
+1 -3
View File
@@ -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__)