Merge branch 'refs/heads/develop'
This commit is contained in:
+6
-24
@@ -1,5 +1,3 @@
|
|||||||
from functools import wraps
|
|
||||||
from threading import Thread
|
|
||||||
import json
|
import json
|
||||||
import threading
|
import threading
|
||||||
import traceback
|
import traceback
|
||||||
@@ -9,7 +7,6 @@ from couchpotato.core.helpers.request import getParams
|
|||||||
from couchpotato.core.logger import CPLog
|
from couchpotato.core.logger import CPLog
|
||||||
from tornado.gen import coroutine
|
from tornado.gen import coroutine
|
||||||
from tornado.web import RequestHandler, asynchronous
|
from tornado.web import RequestHandler, asynchronous
|
||||||
import tornado
|
|
||||||
|
|
||||||
|
|
||||||
log = CPLog(__name__)
|
log = CPLog(__name__)
|
||||||
@@ -23,16 +20,6 @@ api_docs = {}
|
|||||||
api_docs_missing = []
|
api_docs_missing = []
|
||||||
|
|
||||||
|
|
||||||
def run_async(func):
|
|
||||||
@wraps(func)
|
|
||||||
def async_func(*args, **kwargs):
|
|
||||||
func_hl = Thread(target = func, args = args, kwargs = kwargs)
|
|
||||||
func_hl.start()
|
|
||||||
return func_hl
|
|
||||||
|
|
||||||
return async_func
|
|
||||||
|
|
||||||
|
|
||||||
# NonBlock API handler
|
# NonBlock API handler
|
||||||
class NonBlockHandler(RequestHandler):
|
class NonBlockHandler(RequestHandler):
|
||||||
|
|
||||||
@@ -101,17 +88,12 @@ class ApiHandler(RequestHandler):
|
|||||||
try: del kwargs['t']
|
try: del kwargs['t']
|
||||||
except: pass
|
except: pass
|
||||||
|
|
||||||
# Add async callback handler
|
# Fire api handler(s)
|
||||||
@run_async
|
try:
|
||||||
def run_handler(callback):
|
result = api[route](**kwargs)
|
||||||
try:
|
except:
|
||||||
res = api[route](**kwargs)
|
log.error('Failed doing api request "%s": %s', (route, traceback.format_exc()))
|
||||||
callback(res)
|
result = {'success': False, 'error': 'Failed returning results'}
|
||||||
except:
|
|
||||||
log.error('Failed doing api request "%s": %s', (route, traceback.format_exc()))
|
|
||||||
callback({'success': False, 'error': 'Failed returning results'})
|
|
||||||
|
|
||||||
result = yield tornado.gen.Task(run_handler)
|
|
||||||
|
|
||||||
# Check JSONP callback
|
# Check JSONP callback
|
||||||
jsonp_callback = self.get_argument('callback_func', default = None)
|
jsonp_callback = self.get_argument('callback_func', default = None)
|
||||||
|
|||||||
@@ -63,7 +63,6 @@ class Release(Plugin):
|
|||||||
|
|
||||||
def cleanDone(self):
|
def cleanDone(self):
|
||||||
log.debug('Removing releases from dashboard')
|
log.debug('Removing releases from dashboard')
|
||||||
time.sleep(3)
|
|
||||||
|
|
||||||
now = time.time()
|
now = time.time()
|
||||||
week = 262080
|
week = 262080
|
||||||
@@ -88,9 +87,6 @@ class Release(Plugin):
|
|||||||
|
|
||||||
del media_exist
|
del media_exist
|
||||||
|
|
||||||
# Reindex statuses
|
|
||||||
db.reindex_index('media_status')
|
|
||||||
|
|
||||||
# get movies last_edit more than a week ago
|
# get movies last_edit more than a week ago
|
||||||
medias = fireEvent('media.with_status', 'done', single = True)
|
medias = fireEvent('media.with_status', 'done', single = True)
|
||||||
|
|
||||||
|
|||||||
@@ -99,7 +99,7 @@ def runCouchPotato(options, base_path, args, data_dir = None, log_dir = None, En
|
|||||||
if not os.path.isdir(backup_path): os.makedirs(backup_path)
|
if not os.path.isdir(backup_path): os.makedirs(backup_path)
|
||||||
|
|
||||||
for root, dirs, files in os.walk(backup_path):
|
for root, dirs, files in os.walk(backup_path):
|
||||||
for backup_file in files:
|
for backup_file in sorted(files):
|
||||||
ints = re.findall('\d+', backup_file)
|
ints = re.findall('\d+', backup_file)
|
||||||
|
|
||||||
# Delete non zip files
|
# Delete non zip files
|
||||||
|
|||||||
Reference in New Issue
Block a user