feat(download-client): add support for Porla (#553)

* Add support for the 'Test' button to work

* Make Porla show up in filter actions select

* Add an empty Porla action

* Make Porla action find download client

* Make implementation actually add torrent to Porla

* Fix qBittorrent import

* Finish up Porla action

* Check length on commitish before slicing

* Move Porla to the other DL clients

* Add Porla to type name map

* Move Porla to beneath the other download clients
This commit is contained in:
Viktor Elofsson 2023-01-29 18:17:01 +01:00 committed by GitHub
parent b95c1e6913
commit 870e109f6c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 271 additions and 2 deletions

View file

@ -241,6 +241,11 @@ export const DownloadClientTypeOptions: RadioFieldsetOption[] = [
description: "Add torrents directly to Transmission",
value: "TRANSMISSION"
},
{
label: "Porla",
description: "Add torrents directly to Porla",
value: "PORLA"
},
{
label: "Radarr",
description: "Send to Radarr and let it decide",
@ -274,6 +279,7 @@ export const DownloadClientTypeNameMap: Record<DownloadClientType | string, stri
"QBITTORRENT": "qBittorrent",
"RTORRENT": "rTorrent",
"TRANSMISSION": "Transmission",
"PORLA": "Porla",
"RADARR": "Radarr",
"SONARR": "Sonarr",
"LIDARR": "Lidarr",
@ -291,6 +297,7 @@ export const ActionTypeOptions: RadioFieldsetOption[] = [
{ label: "Deluge v2", description: "Add torrents directly to Deluge 2", value: "DELUGE_V2" },
{ label: "rTorrent", description: "Add torrents directly to rTorrent", value: "RTORRENT" },
{ label: "Transmission", description: "Add torrents directly to Transmission", value: "TRANSMISSION" },
{ label: "Porla", description: "Add torrents directly to Porla", value: "PORLA" },
{ label: "Radarr", description: "Send to Radarr and let it decide", value: "RADARR" },
{ label: "Sonarr", description: "Send to Sonarr and let it decide", value: "SONARR" },
{ label: "Lidarr", description: "Send to Lidarr and let it decide", value: "LIDARR" },
@ -308,11 +315,12 @@ export const ActionTypeNameMap = {
"QBITTORRENT": "qBittorrent",
"RTORRENT": "rTorrent",
"TRANSMISSION": "Transmission",
"PORLA": "Porla",
"RADARR": "Radarr",
"SONARR": "Sonarr",
"LIDARR": "Lidarr",
"WHISPARR": "Whisparr",
"READARR": "Readarr"
"READARR": "Readarr"
};
export const ActionContentLayoutOptions: SelectGenericOption<ActionContentLayout>[] = [

View file

@ -157,6 +157,24 @@ function FormFieldsQbit() {
);
}
function FormFieldsPorla() {
const {
values: {}
} = useFormikContext<InitialValues>();
return (
<div className="flex flex-col space-y-4 px-1 py-6 sm:py-0 sm:space-y-0">
<TextFieldWide
name="host"
label="Host"
help="Eg. http(s)://client.domain.ltd, http(s)://domain.ltd/porla, http://domain.ltd:port"
/>
<PasswordFieldWide name="settings.apikey" label="Auth token" />
</div>
)
}
function FormFieldsRTorrent() {
return (
<div className="flex flex-col space-y-4 px-1 py-6 sm:py-0 sm:space-y-0">
@ -209,11 +227,12 @@ export const componentMap: componentMapType = {
QBITTORRENT: <FormFieldsQbit/>,
RTORRENT: <FormFieldsRTorrent />,
TRANSMISSION: <FormFieldsTransmission/>,
PORLA: <FormFieldsPorla />,
RADARR: <FormFieldsArr/>,
SONARR: <FormFieldsArr/>,
LIDARR: <FormFieldsArr/>,
WHISPARR: <FormFieldsArr/>,
READARR: <FormFieldsArr/>
READARR: <FormFieldsArr/>
};
function FormFieldsRulesBasic() {

View file

@ -411,6 +411,42 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => {
/>
</div>
);
case "PORLA":
return (
<div className="w-full">
<div className="mt-6 grid grid-cols-12 gap-6">
<DownloadClientSelect
name={`actions.${idx}.client_id`}
action={action}
clients={clients}
/>
<div className="col-span-6 sm:col-span-6">
<TextField
name={`actions.${idx}.save_path`}
label="Save path"
columns={6}
placeholder="eg. /full/path/to/torrent/data"
/>
</div>
</div>
<CollapsableSection title="Rules" subtitle="client options">
<div className="col-span-12">
<div className="mt-6 grid grid-cols-12 gap-6">
<NumberField
name={`actions.${idx}.limit_download_speed`}
label="Limit download speed (KiB/s)"
/>
<NumberField
name={`actions.${idx}.limit_upload_speed`}
label="Limit upload speed (KiB/s)"
/>
</div>
</div>
</CollapsableSection>
</div>
);
default:
return null;

View file

@ -4,6 +4,7 @@ type DownloadClientType =
"DELUGE_V2" |
"RTORRENT" |
"TRANSMISSION" |
"PORLA" |
"RADARR" |
"SONARR" |
"LIDARR" |