Merge branch 'refs/heads/develop'

This commit is contained in:
Ruud
2014-06-02 10:40:07 +02:00
3 changed files with 7 additions and 29 deletions

View File

@@ -1,5 +1,3 @@
from functools import wraps
from threading import Thread
import json
import threading
import traceback
@@ -9,7 +7,6 @@ from couchpotato.core.helpers.request import getParams
from couchpotato.core.logger import CPLog
from tornado.gen import coroutine
from tornado.web import RequestHandler, asynchronous
import tornado
log = CPLog(__name__)
@@ -23,16 +20,6 @@ api_docs = {}
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
class NonBlockHandler(RequestHandler):
@@ -101,17 +88,12 @@ class ApiHandler(RequestHandler):
try: del kwargs['t']
except: pass
# Add async callback handler
@run_async
def run_handler(callback):
try:
res = api[route](**kwargs)
callback(res)
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)
# Fire api handler(s)
try:
result = api[route](**kwargs)
except:
log.error('Failed doing api request "%s": %s', (route, traceback.format_exc()))
result = {'success': False, 'error': 'Failed returning results'}
# Check JSONP callback
jsonp_callback = self.get_argument('callback_func', default = None)

View File

@@ -63,7 +63,6 @@ class Release(Plugin):
def cleanDone(self):
log.debug('Removing releases from dashboard')
time.sleep(3)
now = time.time()
week = 262080
@@ -88,9 +87,6 @@ class Release(Plugin):
del media_exist
# Reindex statuses
db.reindex_index('media_status')
# get movies last_edit more than a week ago
medias = fireEvent('media.with_status', 'done', single = True)

View File

@@ -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)
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)
# Delete non zip files