import React, {useState} from "react"; import {fetchVideoDownloaderConfig, getDownloaders, postDownload, putDownload} from "../api"; import { APIButton, DirectorySearch, InfoHeader, InfoPopup, mergeDeep, RequiredAsterisk, useLocalStorage } from "./Common"; import Icon from "semantic-ui-react/dist/commonjs/elements/Icon"; import Message from "semantic-ui-react/dist/commonjs/collections/Message"; import {Button, Form, FormInput, Header} from "./Theme"; import {Form as SForm, FormDropdown} from "semantic-ui-react"; import {Link} from "react-router"; import {TagsSelector} from "../Tags"; import Grid from "semantic-ui-react/dist/commonjs/collections/Grid"; import { commaSeparatedValidator, InputForm, NumberInputForm, ToggleForm, UrlInput, UrlsTextarea, useForm } from "../hooks/useForm"; import { channelFrequencyOptions, days30Option, defaultVideoFormatOption, defaultVideoResolutionOptions, Downloaders, downloadFormatOptions, downloadOrderOptions, downloadResolutionOptions, extendedFrequencyOptions, frequencyOptions, weeklyOption } from "./Vars"; export function DepthInputForm({form, required, name = 'depth', path = 'settings.depth'}) { return } export function MaximumPagesInputForm({form, required, name = 'max_pages', path = 'settings.max_pages'}) { return } export function DestinationForm({ form, infoContent, label = 'Destination', name = 'destination', path = 'destination', required = false, }) { const [inputProps, inputAttrs] = form.getCustomProps({name, path, required}); const {disabled, value, onChange} = inputProps; const infoPopup = infoContent ? : null; return } export function DownloadTagsSelector({form, limit, path = 'tag_names', name = 'tag_names'}) { const [inputProps, inputAttrs] = form.getCustomProps({name, path}); const {value, onChange} = inputProps; return ; } export function DownloadFrequencySelector({ form, freqOptions = frequencyOptions, name = 'frequency', path = 'frequency', }) { const [inputProps, inputAttrs] = form.getSelectionProps({name: 'frequency', path}); return } export function DownloaderSelector({form, name = 'sub_downloader', path = 'sub_downloader'}) { const [downloaders, setDownloaders] = React.useState([]); const [inputProps, inputAttrs] = form.getSelectionProps({name, path, required: true}); const fetchDownloaders = async () => { let {downloaders: downloaders_} = await getDownloaders(); downloaders_ = downloaders_.map((i) => { return {key: i.name, text: i.pretty_name || i.name, value: i.name} }) setDownloaders(downloaders_); } React.useEffect(() => { fetchDownloaders(); }, []); return } export function ExcludedUrls({form, name = 'excluded_urls', path = 'settings.excluded_urls'}) { return } export function TitleInclusionInput({form, path = 'settings.title_include'}) { const [inputProps, inputAttrs] = form.getInputProps({ name: 'title_include', path, validator: commaSeparatedValidator, }); return <> } export function TitleExclusionInput({form, path = 'settings.title_exclude'}) { const [inputProps, inputAttrs] = form.getInputProps({ name: 'title_exclude', path, validator: commaSeparatedValidator, }); return <> } export function DownloadFormButtons({onCancel, form}) { return