server_status.mako 11 KB
Newer Older
1
<%inherit file="../layouts/main.mako"/>
2
<%!
3
    import datetime
4
    import sickrage
5
6
    from sickrage.core.queues import TaskStatus, TaskPriority
    from sickrage.core.queues.show import ShowTaskActions
7
    from sickrage.core.common import dateTimeFormat
echel0n's avatar
echel0n committed
8
    from sickrage.core.helpers import pretty_time_delta
9
10
%>
<%block name="content">
echel0n's avatar
echel0n committed
11
    <%
12
        schedulers = {
13
14
            _('Daily Search'): 'daily_searcher',
            _('Backlog'): 'backlog_searcher',
15
16
            _('Show Updater'): 'show_updater',
            _('RSS Cache Updater'): 'rsscache_updater',
17
18
19
20
21
22
23
        }

        if sickrage.app.config.version_notify:
            schedulers.update({_('Version Check'): 'version_updater'})
        if sickrage.app.config.download_propers:
            schedulers.update({_('Proper Finder'): 'proper_searcher'})
        if sickrage.app.config.process_automatically:
24
            schedulers.update({_('Post Processor'): 'auto_postprocessor'})
25
26
27
28
        if sickrage.app.config.use_subtitles:
            schedulers.update({_('Subtitles Finder'): 'subtitle_searcher'})
        if sickrage.app.config.use_trakt:
            schedulers.update({_('Trakt Checker'): 'trakt_searcher'})
echel0n's avatar
echel0n committed
29
    %>
echel0n's avatar
echel0n committed
30

echel0n's avatar
echel0n committed
31
    <div class="row">
32
        <div class="col-lg-10 mx-auto">
echel0n's avatar
echel0n committed
33
            <div class="card mb-3">
echel0n's avatar
echel0n committed
34
                <div class="card-header">
echel0n's avatar
echel0n committed
35
36
37
38
                    <h3>${_('Scheduler')}</h3>
                </div>
                <div class="card-body">
                    <div class="table-responsive">
echel0n's avatar
echel0n committed
39
                        <table id="schedulerStatusTable" class="table" width="100%">
40
                            <thead class="thead-dark">
echel0n's avatar
echel0n committed
41
42
43
44
45
46
                            <tr>
                                <th>${_('Scheduled Job')}</th>
                                <th>${_('Enabled')}</th>
                                <th>${_('Active')}</th>
                                <th>${_('Cycle Time')}</th>
                                <th>${_('Next Run')}</th>
47
                                <th>${_('Action')}</th>
echel0n's avatar
echel0n committed
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
                            </tr>
                            </thead>
                            <tbody>
                                % for schedulerName, scheduler in schedulers.items():
                                    <% service = getattr(sickrage.app, scheduler) %>
                                    <% job = sickrage.app.scheduler.get_job(service.name) %>
                                    <% enabled = bool(getattr(job, 'next_run_time', False)) %>
                                    <tr>
                                        <td>${schedulerName}</td>
                                        % if enabled:
                                            <td align="center" style="background-color:green">${_('YES')}</td>
                                        % else:
                                            <td align="center" style="background-color:red">${_('NO')}</td>
                                        % endif
                                        % if scheduler == 'BACKLOGSEARCHER':
                                            <% searchQueue = getattr(sickrage.app, 'search_queue') %>
                                            <% BLSinProgress = searchQueue.is_backlog_in_progress() %>
                                            <% del searchQueue %>
                                            % if BLSinProgress:
                                                <td align="center">${_('True')}</td>
                                            % else:
                                            % try:
70
                                                <td align="center">${service.running}</td>
echel0n's avatar
echel0n committed
71
72
73
74
75
76
                                            % except Exception:
                                                <td>N/A</td>
                                            % endtry
                                            % endif
                                        % else:
                                        % try:
77
                                            <td align="center">${service.running}</td>
echel0n's avatar
echel0n committed
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
                                        % except Exception:
                                            <td align="center">N/A</td>
                                        % endtry
                                        % endif
                                        % if job:
                                        <% cycleTime = (job.trigger.interval.microseconds + (job.trigger.interval.seconds + job.trigger.interval.days * 24 * 3600) * 10**6) / 10**6 %>
                                            <td align="right"
                                                data-seconds="${cycleTime}">${pretty_time_delta(cycleTime)}</td>
                                        % if job.next_run_time:
                                        <%
                                            x = job.next_run_time - datetime.datetime.now(job.next_run_time.tzinfo)
                                            timeLeft = (x.microseconds + (x.seconds + x.days * 24 * 3600) * 10**6) / 10**6
                                        %>
                                            <td align="right"
                                                data-seconds="${timeLeft}">${pretty_time_delta(timeLeft)}</td>
                                        % else:
                                            <td align="center"></td>
                                        % endif
                                        % endif
97
98
99
                                        <td align="center">
                                            <button class="btn forceSchedulerJob"
                                                    data-target="${srWebRoot}/forceSchedulerJob?name=${scheduler}">
100
                                                <i class="fa fa-exclamation-triangle"></i> ${_('Force Run')}
101
102
                                            </button>
                                        </td>
echel0n's avatar
echel0n committed
103
104
105
106
107
108
109
                                    </tr>
                                % endfor
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
echel0n's avatar
echel0n committed
110
111
        </div>
    </div>
112

echel0n's avatar
echel0n committed
113
    <div class="row">
114
        <div class="col-lg-10 mx-auto">
echel0n's avatar
echel0n committed
115
            <div class="card mb-3">
echel0n's avatar
echel0n committed
116
                <div class="card-header">
echel0n's avatar
echel0n committed
117
                    <h3>${_('Show Task Queue')}</h3>
echel0n's avatar
echel0n committed
118
119
                </div>
                <div class="card-body">
echel0n's avatar
echel0n committed
120
                    <table id="queueStatusTable" class="table" width="100%">
121
                        <thead class="thead-dark">
echel0n's avatar
echel0n committed
122
123
124
                        <tr>
                            <th>${_('Show ID')}</th>
                            <th>${_('Show Name')}</th>
echel0n's avatar
echel0n committed
125
126
127
128
                            <th>${_('Task Status')}</th>
                            <th>${_('Task Priority')}</th>
                            <th>${_('Task Added')}</th>
                            <th>${_('Task Queue Type')}</th>
echel0n's avatar
echel0n committed
129
130
131
                        </tr>
                        </thead>
                        <tbody>
132
                            % for task in sickrage.app.show_queue.tasks.copy().values():
133
134
135
136
137
138
139
140
141
142
143
                                <tr>
                                % try:
                                    <% showindexer_id = task.indexer_id %>
                                    <td>${showindexer_id}</td>
                                % except Exception:
                                    <td></td>
                                % endtry
                                % try:
                                    <% showname = task.show_name %>
                                    <td>${showname}</td>
                                % except Exception:
144
                                    % if task.action == ShowTaskActions.ADD:
145
146
                                        <td>${task.showDir}</td>
                                    % else:
echel0n's avatar
echel0n committed
147
                                        <td></td>
148
149
                                    % endif
                                % endtry
150
                                    <td>${TaskStatus(task.status).value.capitalize()}</td>
151
152
153
154
155
156
157
158
159
160
161
162
                                    % if task.priority == TaskPriority.EXTREME:
                                        <td>${_('EXTREME')}</td>
                                    % elif task.priority == TaskPriority.HIGH:
                                        <td>${_('HIGH')}</td>
                                    % elif task.priority == TaskPriority.NORMAL:
                                        <td>${_('NORMAL')}</td>
                                    % elif task.priority == TaskPriority.LOW:
                                        <td>${_('LOW')}</td>
                                    % else:
                                        <td>${task.priority}</td>
                                    % endif
                                    <td>${task.added.strftime(dateTimeFormat)}</td>
163
                                    <td>${ShowTaskActions(task.action).value}</td>
164
                                </tr>
echel0n's avatar
echel0n committed
165
166
167
168
                            % endfor
                        </tbody>
                    </table>
                </div>
echel0n's avatar
echel0n committed
169
170
171
            </div>
        </div>
    </div>
172

echel0n's avatar
echel0n committed
173
    <div class="row">
174
        <div class="col-lg-10 mx-auto">
echel0n's avatar
echel0n committed
175
            <div class="card mb-3">
echel0n's avatar
echel0n committed
176
                <div class="card-header">
echel0n's avatar
echel0n committed
177
178
179
                    <h3>${_('Disk Space')}</h3>
                </div>
                <div class="card-body">
echel0n's avatar
echel0n committed
180
                    <table id="DFStatusTable" class="table" width="100%">
echel0n's avatar
echel0n committed
181
                        <thead>
echel0n's avatar
echel0n committed
182
                        <tr>
echel0n's avatar
echel0n committed
183
184
185
                            <th>${_('Type')}</th>
                            <th>${_('Location')}</th>
                            <th>${_('Free space')}</th>
echel0n's avatar
echel0n committed
186
                        </tr>
echel0n's avatar
echel0n committed
187
188
189
190
191
192
193
194
195
196
197
198
                        </thead>
                        <tbody>
                            % if sickrage.app.config.tv_download_dir:
                                <tr>
                                    <td>${_('TV Download Directory')}</td>
                                    <td>${sickrage.app.config.tv_download_dir}</td>
                                    % if tvdirFree is not False:
                                        <td align="middle">${tvdirFree}</td>
                                    % else:
                                        <td align="middle"><i>${_('Missing')}</i></td>
                                    % endif
                                </tr>
echel0n's avatar
echel0n committed
199
200
                            % endif
                        <tr>
echel0n's avatar
echel0n committed
201
202
203
204
205
                            <td rowspan=${len(rootDir)}>${_('Media Root Directories')}</td>
                            % for cur_dir in rootDir:
                                <td>${cur_dir}</td>
                            % if rootDir[cur_dir] is not False:
                                <td align="middle">${rootDir[cur_dir]}</td>
echel0n's avatar
echel0n committed
206
                            % else:
echel0n's avatar
echel0n committed
207
                                <td align="middle"><i>${_('Missing')}</i></td>
echel0n's avatar
echel0n committed
208
                            % endif
echel0n's avatar
echel0n committed
209
210
211
212
213
214
                            </tr>
                            % endfor
                        </tbody>
                    </table>
                </div>
            </div>
echel0n's avatar
echel0n committed
215
216
        </div>
    </div>
217
</%block>