Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
SiCKRAGE
sickrage
Commits
c51340c6
Commit
c51340c6
authored
Nov 15, 2020
by
echel0n
Browse files
Refactored task action_id property to action
Added is_loading and is_removing properties to TV show object
parent
011d469d
Changes
8
Hide whitespace changes
Inline
Side-by-side
sickrage/core/queues/__init__.py
View file @
c51340c6
...
...
@@ -355,11 +355,11 @@ class WorkerThread(threading.Thread):
class
Task
(
object
):
def
__init__
(
self
,
name
,
action
_id
=
0
,
depend
=
None
):
def
__init__
(
self
,
name
,
action
=
0
,
depend
=
None
):
super
(
Task
,
self
).
__init__
()
self
.
name
=
name
.
replace
(
" "
,
"-"
).
upper
()
self
.
id
=
None
self
.
action
_id
=
action
_id
self
.
action
=
action
self
.
priority
=
TaskPriority
.
NORMAL
self
.
status
=
TaskStatus
.
QUEUED
self
.
added
=
None
...
...
sickrage/core/queues/postprocessor.py
View file @
c51340c6
...
...
@@ -126,8 +126,8 @@ class PostProcessorQueue(Queue):
class
PostProcessorTask
(
Task
):
def
__init__
(
self
,
dirName
,
nzbName
=
None
,
process_method
=
None
,
force
=
False
,
is_priority
=
None
,
delete_on
=
False
,
failed
=
False
,
proc_type
=
"auto"
):
action
_id
=
(
PostProcessorTaskActions
.
MANUAL
,
PostProcessorTaskActions
.
AUTO
)[
proc_type
==
"auto"
]
super
(
PostProcessorTask
,
self
).
__init__
(
action
_id
.
value
,
action
_id
)
action
=
(
PostProcessorTaskActions
.
MANUAL
,
PostProcessorTaskActions
.
AUTO
)[
proc_type
==
"auto"
]
super
(
PostProcessorTask
,
self
).
__init__
(
action
.
value
,
action
)
self
.
dirName
=
dirName
self
.
nzbName
=
nzbName
...
...
sickrage/core/queues/show.py
View file @
c51340c6
...
...
@@ -50,14 +50,14 @@ class ShowQueue(Queue):
def
_is_in_queue
(
self
,
indexer_id
,
actions
):
for
task
in
self
.
tasks
.
copy
().
values
():
if
task
.
is_queued
()
and
task
.
indexer_id
==
indexer_id
and
task
.
action
_id
in
actions
:
if
task
.
is_queued
()
and
task
.
indexer_id
==
indexer_id
and
task
.
action
in
actions
:
return
True
return
False
def
_is_being
(
self
,
indexer_id
,
actions
):
for
task
in
self
.
tasks
.
copy
().
values
():
if
task
.
is_started
()
and
task
.
indexer_id
==
indexer_id
and
task
.
action
_id
in
actions
:
if
task
.
is_started
()
and
task
.
indexer_id
==
indexer_id
and
task
.
action
in
actions
:
return
True
return
False
...
...
@@ -196,8 +196,8 @@ class ShowTask(Task):
- show being subtitled
"""
def
__init__
(
self
,
indexer_id
,
action
_id
):
super
(
ShowTask
,
self
).
__init__
(
action
_id
.
value
,
action
_id
)
def
__init__
(
self
,
indexer_id
,
action
):
super
(
ShowTask
,
self
).
__init__
(
action
.
value
,
action
)
self
.
indexer_id
=
indexer_id
def
is_in_queue
(
self
):
...
...
@@ -216,11 +216,15 @@ class ShowTask(Task):
show_obj
=
find_show
(
self
.
indexer_id
)
if
show_obj
:
WebSocketMessage
(
'SHOW_QUEUE_STATUS_UPDATED'
,
{
'series_id'
:
show_obj
.
indexer_id
,
'show_queue_status'
:
show_obj
.
show_queue_status
}).
push
()
else
:
WebSocketMessage
(
'SHOW_QUEUE_STATUS_UPDATED'
,
{
'series_id'
:
self
.
indexer_id
,
'action'
:
self
.
action
.
name
}).
push
()
def
finish
(
self
):
show_obj
=
find_show
(
self
.
indexer_id
)
if
show_obj
:
WebSocketMessage
(
'SHOW_QUEUE_STATUS_UPDATED'
,
{
'series_id'
:
show_obj
.
indexer_id
,
'show_queue_status'
:
show_obj
.
show_queue_status
}).
push
()
else
:
WebSocketMessage
(
'SHOW_QUEUE_STATUS_UPDATED'
,
{
'series_id'
:
self
.
indexer_id
,
'action'
:
self
.
action
.
name
}).
push
()
class
ShowTaskAdd
(
ShowTask
):
...
...
@@ -535,8 +539,8 @@ class ShowTaskSubtitle(ShowTask):
class
ShowTaskUpdate
(
ShowTask
):
def
__init__
(
self
,
indexer_id
=
None
,
indexer_update_only
=
False
,
force
=
False
,
action
_id
=
ShowTaskActions
.
UPDATE
):
super
(
ShowTaskUpdate
,
self
).
__init__
(
indexer_id
,
action
_id
if
not
force
else
ShowTaskActions
.
FORCEUPDATE
)
def
__init__
(
self
,
indexer_id
=
None
,
indexer_update_only
=
False
,
force
=
False
,
action
=
ShowTaskActions
.
UPDATE
):
super
(
ShowTaskUpdate
,
self
).
__init__
(
indexer_id
,
action
if
not
force
else
ShowTaskActions
.
FORCEUPDATE
)
self
.
indexer_update_only
=
indexer_update_only
self
.
force
=
force
...
...
sickrage/core/tv/episode/__init__.py
View file @
c51340c6
...
...
@@ -306,11 +306,11 @@ class TVEpisode(object):
for
search_task
in
sickrage
.
app
.
search_queue
.
get_all_tasks_from_queue_by_show
(
self
.
showid
):
if
search_task
.
season
==
self
.
season
and
search_task
.
episode
==
self
.
episode
:
if
search_task
.
action
_id
in
[
SearchTaskActions
.
MANUAL_SEARCH
,
SearchTaskActions
.
FAILED_SEARCH
]:
if
search_task
.
action
in
[
SearchTaskActions
.
MANUAL_SEARCH
,
SearchTaskActions
.
FAILED_SEARCH
]:
search_queue_status
[
'manual'
]
=
search_task
.
status
.
name
elif
search_task
.
action
_id
==
SearchTaskActions
.
DAILY_SEARCH
:
elif
search_task
.
action
==
SearchTaskActions
.
DAILY_SEARCH
:
search_queue_status
[
'daily'
]
=
search_task
.
status
.
name
elif
search_task
.
action
_id
==
SearchTaskActions
.
BACKLOG_SEARCH
:
elif
search_task
.
action
==
SearchTaskActions
.
BACKLOG_SEARCH
:
search_queue_status
[
'backlog'
]
=
search_task
.
status
.
name
return
search_queue_status
...
...
sickrage/core/tv/show/__init__.py
View file @
c51340c6
...
...
@@ -575,6 +575,11 @@ class TVShow(object):
'action'
:
'ADD'
,
'message'
:
_
(
'This show is in the process of being downloaded - the info below is incomplete.'
)
}
elif
sickrage
.
app
.
show_queue
.
is_being_removed
(
self
.
indexer_id
):
return
{
'action'
:
'REMOVE'
,
'message'
:
_
(
'This show is in the process of being removed.'
)
}
elif
sickrage
.
app
.
show_queue
.
is_being_updated
(
self
.
indexer_id
):
return
{
'action'
:
'UPDATE'
,
...
...
@@ -606,6 +611,16 @@ class TVShow(object):
'message'
:
_
(
'This show is queued and awaiting subtitles download.'
)
}
return
{}
@
property
def
is_loading
(
self
):
return
self
.
show_queue_status
.
get
(
'action'
)
==
'ADD'
@
property
def
is_removing
(
self
):
return
self
.
show_queue_status
.
get
(
'action'
)
==
'REMOVE'
def
save
(
self
):
with
self
.
lock
,
sickrage
.
app
.
main_db
.
session
()
as
session
:
sickrage
.
app
.
log
.
debug
(
"{0:d}: Saving to database: {1}"
.
format
(
self
.
indexer_id
,
self
.
name
))
...
...
@@ -1393,6 +1408,9 @@ class TVShow(object):
series
=
session
.
query
(
MainDB
.
TVShow
).
filter_by
(
indexer_id
=
self
.
indexer_id
).
one_or_none
()
json_data
=
TVShowSchema
().
dump
(
series
)
json_data
[
'is_loading'
]
=
self
.
is_loading
json_data
[
'is_removing'
]
=
self
.
is_removing
# images section
json_data
[
'images'
]
=
{
'poster'
:
self
.
poster
,
...
...
sickrage/core/webserver/static/images/poster.png
deleted
100644 → 0
View file @
011d469d
389 KB
sickrage/core/webserver/views/home/server_status.mako
View file @
c51340c6
...
...
@@ -141,7 +141,7 @@
<% showname = task.show_name %>
<td>${showname}</td>
% except Exception:
% if task.action
_id
== ShowTaskActions.ADD:
% if task.action == ShowTaskActions.ADD:
<td>${task.showDir}</td>
% else:
<td></td>
...
...
@@ -160,7 +160,7 @@
<td>${task.priority}</td>
% endif
<td>${task.added.strftime(dateTimeFormat)}</td>
<td>${ShowTaskActions(task.action
_id
).value}</td>
<td>${ShowTaskActions(task.action).value}</td>
</tr>
% endfor
</tbody>
...
...
sickrage/core/websocket/__init__.py
View file @
c51340c6
...
...
@@ -68,6 +68,7 @@ class WebSocketMessage(object):
# message_queue.put(self.json())
for
client
in
clients
.
copy
():
try
:
client
.
write_message
(
self
.
json
())
message
=
self
.
json
()
sickrage
.
app
.
wserver
.
io_loop
.
add_callback
(
client
.
write_message
,
message
)
except
AssertionError
:
continue
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment