コード例 #1
0
ファイル: miscdefs.py プロジェクト: PeterBeard/usntssearch
	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
0
    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)
コード例 #3
0
    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
コード例 #4
0
	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
コード例 #5
0
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()
コード例 #6
0
ファイル: mega2.py プロジェクト: OldSchoolOnline/usntssearch
    mega_parall = megasearch.DoParallelSearch(cfgsets.cfg, cfgsets.cgen, ds,
                                              wrp)
    apiresp = ApiResponses(cfgsets.cfg, cfgsets.cgen, wrp, ds)
    getsmartinfo = nzbsanity.GetNZBInfo(cfgsets.cfg, cfgsets.cgen, ds, app)
    auth = miscdefs.Auth(cfgsets)
    testserver = miscdefs.ChkServer(cfgsets.cgen)


# ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~
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 ======'
コード例 #7
0
ファイル: mega2.py プロジェクト: crush89/usntssearch
	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 ======'
コード例 #8
0
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)
コード例 #9
0
ファイル: mega2.py プロジェクト: carterjl2/usntssearch
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)	
コード例 #10
0
    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)