本文整理汇总了Python中SearchModule.resource_path方法的典型用法代码示例。如果您正苦于以下问题:Python SearchModule.resource_path方法的具体用法?Python SearchModule.resource_path怎么用?Python SearchModule.resource_path使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SearchModule
的用法示例。
在下文中一共展示了SearchModule.resource_path方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import resource_path [as 别名]
def __init__(self):
import urlparse
cfgsets = config_settings.CfgSettings()
self.cgen = cfgsets.cgen
self.logsdir = SearchModule.resource_path('logs/nzbmegasearch.log')
self.scriptsdir = SearchModule.resource_path('get_stats.sh')
self.cfg_urlidx = []
self.excludeurls= ['http://ftdworld.net', 'https://nzbx.co']
if(cfgsets.cfg is not None):
self.config = cfgsets.cfg
for i in xrange(len(self.config)):
if(self.config[i]['builtin'] == 0):
self.cfg_urlidx.append(i)
示例2: __init__
# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import resource_path [as 别名]
def __init__(self, conf, cgen):
self.trendsdir = SearchModule.resource_path('logs/')
self.timeout = cgen['default_timeout']
self.movie_trend = []
self.movie_trend_ts = 0
self.show_trend = []
self.show_trend_ts = 0
self.sugg_info = []
self.active_trend = 1
self.trends_refreshrate = cgen['trends_refreshrate']
self.detached_trendpolling = cgen['large_server']
self.best_k = cgen['trends_qty']
self.cgen = cgen
self.logic_expr = re.compile("(?:^|\s)([-+])(\w+)")
self.predb_info = []
self.tvrage_rqheaders = {
'Connection': 'keep-alive;' ,
'Cache-Control': 'max-age=0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'User-Agent': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/537.17 (KHTML, like Gecko) Chrome/24.0.1312.52 Safari/537.17',
'Referer': 'http://services.tvrage.com/info.php?page=main',
'Accept-Encoding': 'gzip,deflate,sdch',
'Accept-Language': 'en-US,en;q=0.8',
'Accept-Charset': 'ISO-8859-1,utf-8;q=0.7,*;q=0.3'
}
if(int(cgen['general_trend']) == 0):
self.active_trend = 0
示例3: pollsuggestions
# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import resource_path [as 别名]
import threading
from SuggestionModule import SuggestionResponses
import config_settings
import SearchModule
import logging
import logging.handlers
import time
DEBUGFLAG = True
motd = '\n\n~*~ ~*~ NZBMegasearcH detached trend ~*~ ~*~'
print motd
#~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
cfgsets = config_settings.CfgSettings()
logsdir = SearchModule.resource_path('logs/')
logging.basicConfig(filename=logsdir+'nzbmegasearch_detachedtrend.log',level=logging.INFO,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
log = logging.getLogger(__name__)
handler = logging.handlers.RotatingFileHandler(logsdir+'nzbmegasearch_detachedtrend.log', maxBytes=cfgsets.cgen['log_size'], backupCount=cfgsets.cgen['log_backupcount'])
log.addHandler(handler)
log.info(motd)
cfgsets.cgen['trends'] = 1
cfgsets.cgen['search_suggestions'] = 1
cfgsets.cgen['large_server'] = False
sugg = SuggestionResponses(cfgsets.cfg, cfgsets.cgen)
#~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
def pollsuggestions():
sugg.asktrend_allparallel()
sugg.asktrend_saveondisk()
示例4: SuggestionResponses
# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import resource_path [as 别名]
cfgsets.cgen['large_server'] = LARGESERVER
sugg = SuggestionResponses(cfgsets.cfg, cfgsets.cgen)
ds = DeepsearchModule.DeepSearch(cfgsets.cfg_deep, cfgsets.cgen)
wrp = Warper (cfgsets.cgen, cfgsets.cfg, ds)
mega_parall = megasearch.DoParallelSearch(cfgsets.cfg, cfgsets.cgen, ds, wrp)
apiresp = ApiResponses(cfgsets.cfg, cfgsets.cgen, wrp, ds)
auth = miscdefs.Auth(cfgsets)
#~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
motd = '\n\n~*~ ~*~ NZBMegasearcH ~*~ ~*~'
print motd
DEBUGFLAG = False
LARGESERVER = False
logsdir = SearchModule.resource_path('logs/')
if(len(os.getenv('OPENSHIFT_DATA_DIR', ''))):
logsdir = os.environ.get('OPENSHIFT_DATA_DIR')
if(len(sys.argv) > 1):
for argv in sys.argv:
if(argv == 'help'):
print ''
print '`debug`: start in debug mode'
print '`large`: modality for GUNICORN + NGINX large server'
print '`daemon`: start in daemon mode, detached from terminal'
print ''
exit()
if(argv == 'debug'):
print '====== DEBUGMODE DEBUGMODE DEBUGMODE DEBUGMODE ======'
示例5: Flask
# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import resource_path [as 别名]
import SearchModule
from ApiModule import ApiResponses
from SuggestionModule import SuggestionResponses
import megasearch
import config_settings
import miscdefs
DEBUGFLAG = False
motd = '\n\n~*~ ~*~ NZBMegasearcH ~*~ ~*~'
print motd
#~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
#~ bootstrap datefmt='%Y-%m-%d %H:%M:%S'
cfg,cgen = config_settings.read_conf()
logsdir = SearchModule.resource_path('logs/')
logging.basicConfig(filename=logsdir+'nzbmegasearch.log',level=logging.INFO,format='%(asctime)s - %(name)s - %(levelname)s - %(message)s')
log = logging.getLogger(__name__)
handler = logging.handlers.RotatingFileHandler(logsdir+'nzbmegasearch.log', maxBytes=cgen['log_size'], backupCount=cgen['log_backupcount'])
log.addHandler(handler)
log.info(motd)
templatedir = SearchModule.resource_path('templates')
app = Flask(__name__, template_folder=templatedir)
cver = miscdefs.ChkVersion()
print '>> version: '+ str(cver.ver_notify['curver'])
SearchModule.loadSearchModules()
if(DEBUGFLAG):
cgen['general_trend'] = 0
print 'MEGA2: DEBUGFLAG MUST BE SET TO FALSE BEFORE DEPLOYMENT'
sugg = SuggestionResponses(cfg, cgen)
mega_parall = megasearch.DoParallelSearch(cfg)
示例6: str
# 需要导入模块: import SearchModule [as 别名]
# 或者: from SearchModule import resource_path [as 别名]
LARGESERVER = True
# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
cver = miscdefs.ChkVersion(DEBUGFLAG)
print ">> version: " + str(cver.ver_notify["curver"])
motd = motd + " v." + str(cver.ver_notify["curver"]) + "large_server: " + str(LARGESERVER) + " debug: " + str(DEBUGFLAG)
cfgsets = config_settings.CfgSettings()
first_time = 0
reload_all()
if cfgsets.cfg is None or cfgsets.cfg_deep is None:
first_time = 1
">> It will be configured"
logsdir = SearchModule.resource_path("logs/")
if len(os.getenv("OPENSHIFT_DATA_DIR", "")):
logsdir = os.environ.get("OPENSHIFT_DATA_DIR")
certdir = SearchModule.resource_path("certificates/")
log = logging.getLogger()
handler = logging.handlers.RotatingFileHandler(
logsdir + "nzbmegasearch.log", maxBytes=cfgsets.cgen["log_size"], backupCount=cfgsets.cgen["log_backupcount"]
)
log.setLevel(logging.INFO)
formatter = logging.Formatter("%(asctime)s - %(name)s - %(levelname)s - %(message)s")
handler.setFormatter(formatter)
log.addHandler(handler)
log.info(motd)
templatedir = SearchModule.resource_path("templates")
app = Flask(__name__, template_folder=templatedir)