Commit 27a36490 authored by echel0n's avatar echel0n

Added stricter checks for manual search handler

parent 07836086
......@@ -61,8 +61,8 @@ class SearchQueue(Queue):
def is_show_in_queue(self, show_id):
return any(isinstance(task, (ManualSearchTask, FailedSearchTask)) and task.show_id == show_id for task in self.tasks.copy().values())
def get_all_tasks_from_queue(self, show_id):
return [task for task in self.tasks.copy().values() if isinstance(task, (ManualSearchTask, FailedSearchTask)) and task.show_id == show_id]
def get_all_tasks_from_queue_by_show(self, show_id):
return [task for task in self.tasks.copy().values() if task.show_id == show_id]
def pause_daily_searcher(self):
sickrage.app.scheduler.pause_job(sickrage.app.daily_searcher.name)
......
......@@ -1509,17 +1509,21 @@ class GetManualSearchStatusHandler(BaseHandler, ABC):
def handle_get(self):
show = self.get_argument('show')
episodes = []
# Queued Manual Searches
episodes = self.get_episodes(int(show), sickrage.app.search_queue.get_all_tasks_from_queue(show), 'Queued')
for search_task in sickrage.app.search_queue.get_all_tasks_from_queue_by_show(show):
if isinstance(search_task, (ManualSearchTask, FailedSearchTask)):
episodes += self.get_episodes(int(show), [search_task], 'Queued')
# Running Manual Searches
if sickrage.app.search_queue.is_manual_search_in_progress():
for search_task in sickrage.app.search_queue.tasks.copy().values():
if not search_task.success:
if isinstance(search_task, (ManualSearchTask, FailedSearchTask)) and not search_task.success:
episodes += self.get_episodes(int(show), [search_task], 'Searching')
# Finished Manual Searches
for search_task in sickrage.app.search_queue.MANUAL_SEARCH_HISTORY:
for search_task in sickrage.app.search_queue.MANUAL_SEARCH_HISTORY.copy():
if show is not None:
if not str(search_task.show_id) == show:
continue
......
This diff was suppressed by a .gitattributes entry.
This diff was suppressed by a .gitattributes entry.
......@@ -661,21 +661,35 @@ $(document).ready(function ($) {
if (el) {
var rSearchTerm = '';
if (ep.searchstatus.toLowerCase() === 'searching') {
img.prop('title', gt('Searching'));
img.prop('class', loadingIcon);
img.prop('title', gt('Searching'));
img.prop('alt', gt('Searching'));
SICKRAGE.ajax_search.disableLink(el);
htmlContent = ep.searchstatus;
htmlContent = ep.searchstatus;
} else if (ep.searchstatus.toLowerCase() === 'queued') {
img.prop('title', gt('Queued'));
img.prop('class', queuedIcon);
img.prop('title', gt('Queued'));
img.prop('alt', gt('Queued'));
SICKRAGE.ajax_search.disableLink(el);
htmlContent = ep.searchstatus;
} else if (ep.searchstatus.toLowerCase() === 'finished') {
img.prop('title', gt('Searching'));
img.parent().prop('class', 'epRetry');
img.prop('class', searchIcon);
img.prop('title', gt('Search'));
img.prop('alt', gt('Search'));
if (ep.quality !== 'N/A') {
img.parent().prop('class', 'epRetry');
}
SICKRAGE.ajax_search.enableLink(el);
// Update Status and Quality
......@@ -683,6 +697,7 @@ $(document).ready(function ($) {
htmlContent = ep.status.replace(rSearchTerm, "$1" + ' <span class="badge text-white ' + ep.quality + '">' + "$2" + '</span>');
parent.closest('tr').prop("class", ep.overview + " season-" + ep.season + " seasonstyle font-weight-bold text-dark");
}
// update the status column if it exists
parent.siblings('.col-status').html(htmlContent);
......@@ -693,16 +708,16 @@ $(document).ready(function ($) {
if (elementCompleteEpisodes) {
if (ep.searchstatus.toLowerCase() === 'searching') {
imageCompleteEpisodes.prop('title', gt('Searching'));
imageCompleteEpisodes.prop('alt', 'searching');
imageCompleteEpisodes.prop('alt', gt('Searching'));
imageCompleteEpisodes.prop('class', loadingIcon);
SICKRAGE.ajax_search.disableLink(elementCompleteEpisodes);
} else if (ep.searchstatus.toLowerCase() === 'queued') {
imageCompleteEpisodes.prop('title', gt('Queued'));
imageCompleteEpisodes.prop('alt', 'queued');
imageCompleteEpisodes.prop('alt', gt('Queued'));
imageCompleteEpisodes.prop('class', queuedIcon);
} else if (ep.searchstatus.toLowerCase() === 'finished') {
imageCompleteEpisodes.prop('title', gt('Manual Search'));
imageCompleteEpisodes.prop('alt', '[search]');
imageCompleteEpisodes.prop('title', gt('Search'));
imageCompleteEpisodes.prop('alt', gt('Search'));
imageCompleteEpisodes.prop('class', searchIcon);
if (ep.overview.toLowerCase() === 'snatched') {
elementCompleteEpisodes.closest('tr').remove();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment