You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

27 lines
708 B

from couchpotato.api import addApiView
from couchpotato.environment import Env
from flask.helpers import send_from_directory
import os.path
class Plugin():
def conf(self, attr):
return Env.setting(attr, self.__class__.__name__.lower())
def registerStatic(self, file_path):
class_name = self.__class__.__name__.lower()
self.plugin_file = file_path
path = class_name + '.static/'
addApiView(path + '<path:file>', self.showStatic, static = True)
return path
def showStatic(self, file = ''):
plugin_dir = os.path.dirname(self.plugin_file)
dir = os.path.join(plugin_dir, 'static')
return send_from_directory(dir, file)