Commit 770cddb5 authored by echel0n's avatar echel0n
Browse files

Fixed issue with quicksearch and episodes

Added post processing API v2 handler
parent 7a1493df
......@@ -37,7 +37,7 @@ from sickrage.core.helpers import create_https_certificates
from sickrage.core.webserver.handlers.account import AccountLinkHandler, AccountUnlinkHandler, AccountIsLinkedHandler
from sickrage.core.webserver.handlers.announcements import AnnouncementsHandler, MarkAnnouncementSeenHandler, AnnouncementCountHandler
from sickrage.core.webserver.handlers.api.v1 import ApiHandler
from sickrage.core.webserver.handlers.api.v2 import PingHandler, RetrieveSeriesMetadataHandler
from sickrage.core.webserver.handlers.api.v2 import PingHandler, RetrieveSeriesMetadataHandler, PostProcessHandler
from sickrage.core.webserver.handlers.api.v2.config import ConfigHandler
from sickrage.core.webserver.handlers.api.v2.episode import EpisodesRenameHandler, EpisodesManualSearchHandler
from sickrage.core.webserver.handlers.api.v2.file_browser import FileBrowserHandler
......@@ -232,6 +232,7 @@ class WebServer(threading.Thread):
(r'%s/api/config' % sickrage.app.config.general.web_root, ConfigHandler),
(r'%s/api/ping' % sickrage.app.config.general.web_root, PingHandler),
(r'%s/api/file-browser' % sickrage.app.config.general.web_root, FileBrowserHandler),
(r'%s/api/postprocess' % sickrage.app.config.general.web_root, PostProcessHandler),
(r'%s/api/retrieve-series-metadata' % sickrage.app.config.general.web_root, RetrieveSeriesMetadataHandler),
(r'%s/api/series-providers' % sickrage.app.config.general.web_root, SeriesProvidersHandler),
(r'%s/api/series-providers/([a-z]+)/search' % sickrage.app.config.general.web_root, SeriesProvidersSearchHandler),
......
......@@ -20,11 +20,11 @@
# ##############################################################################
import json
import os
import re
import traceback
from abc import ABC
import sickrage
from sickrage.core.enums import ProcessMethod
from sickrage.core.helpers import get_internal_ip, get_external_ip
from sickrage.core.webserver.handlers.base import BaseHandler
......@@ -151,3 +151,24 @@ class RetrieveSeriesMetadataHandler(APIv2BaseHandler, ABC):
json_data['seriesSlug'] = f'{series_id}-{series_provider_id.slug}'
self.write_json(json_data)
class PostProcessHandler(APIv2BaseHandler, ABC):
def get(self):
path = self.get_argument("path", sickrage.app.config.general.tv_download_dir)
force_replace = self.get_argument("force_replace", None) or False
return_data = self.get_argument("return_data", None) or False
process_method = self.get_argument("process_method", ProcessMethod.COPY.name)
is_priority = self.get_argument("is_priority", None) or False
delete = self.get_argument("delete", None) or False
failed = self.get_argument("failed", None) or False
proc_type = self.get_argument("type", 'manual')
force_next = self.get_argument("force_next", None) or False
if not path and not sickrage.app.config.general.tv_download_dir:
return self.send_error(400, error="You need to provide a path or set TV Download Dir")
json_data = sickrage.app.postprocessor_queue.put(path, process_method=ProcessMethod[process_method.upper()], force=force_replace,
is_priority=is_priority, delete_on=delete, failed=failed, proc_type=proc_type, force_next=force_next)
self.write_json({'data': json_data if return_data else '', 'msg': f'Started postprocess for {path}'})
......@@ -250,7 +250,7 @@ class QuicksearchDotJsonHandler(BaseHandler, ABC):
'category': 'episodes',
'series_id': result.series_id,
'series_provider_id': result.series_provider_id,
'episode__id': result.episode__id,
'episode_id': result.episode_id,
'season': result.season,
'episode': result.episode,
'name': result.name,
......
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