-
Notifications
You must be signed in to change notification settings - Fork 275
/
Copy pathsearches.py
73 lines (55 loc) · 2.81 KB
/
searches.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# coding=utf-8
from __future__ import unicode_literals
from medusa import app, logger, ui
from medusa.server.web.core import PageTemplate
from medusa.server.web.manage.handler import Manage
from tornroutes import route
@route('/manage/manageSearches(/?.*)')
class ManageSearches(Manage):
def __init__(self, *args, **kwargs):
super(ManageSearches, self).__init__(*args, **kwargs)
def index(self):
t = PageTemplate(rh=self, filename='manage_manageSearches.mako')
# t.backlogPI = api.backlog_search_scheduler.action.get_progress_indicator()
return t.render(backlogPaused=app.search_queue_scheduler.action.is_backlog_paused(),
backlogRunning=app.search_queue_scheduler.action.is_backlog_in_progress(),
dailySearchStatus=app.daily_search_scheduler.action.amActive,
findPropersStatus=app.proper_finder_scheduler.action.amActive,
searchQueueLength=app.search_queue_scheduler.action.queue_length(),
forcedSearchQueueLength=app.forced_search_queue_scheduler.action.queue_length(),
subtitlesFinderStatus=app.subtitles_finder_scheduler.action.amActive,
controller='manage', action='manageSearches')
def forceBacklog(self):
# force it to run the next time it looks
result = app.backlog_search_scheduler.forceRun()
if result:
logger.log('Backlog search forced')
ui.notifications.message('Backlog search started')
return self.redirect('/manage/manageSearches/')
def forceSearch(self):
# force it to run the next time it looks
result = app.daily_search_scheduler.forceRun()
if result:
logger.log('Daily search forced')
ui.notifications.message('Daily search started')
return self.redirect('/manage/manageSearches/')
def forceFindPropers(self):
# force it to run the next time it looks
result = app.proper_finder_scheduler.forceRun()
if result:
logger.log('Find propers search forced')
ui.notifications.message('Find propers search started')
return self.redirect('/manage/manageSearches/')
def forceSubtitlesFinder(self):
# force it to run the next time it looks
result = app.subtitles_finder_scheduler.forceRun()
if result:
logger.log('Subtitle search forced')
ui.notifications.message('Subtitle search started')
return self.redirect('/manage/manageSearches/')
def pauseBacklog(self, paused=None):
if paused == '1':
app.search_queue_scheduler.action.pause_backlog()
else:
app.search_queue_scheduler.action.unpause_backlog()
return self.redirect('/manage/manageSearches/')