diff --git a/app/src/components/Common.js b/app/src/components/Common.js index d7e64d25..1f49c52b 100644 --- a/app/src/components/Common.js +++ b/app/src/components/Common.js @@ -752,12 +752,12 @@ export function mimetypeColor(mimetype) { return 'pink' } else if (mimetype.startsWith('text/html')) { return 'green' - } else if (mimetype.startsWith('application/zip') || mimetype.startsWith('application/zlib') || mimetype.startsWith('application/x-7z-compressed') || mimetype.startsWith('application/x-bzip2') || mimetype.startsWith('application/x-xz')) { - return 'purple' - } else if (mimetype.startsWith('application/epub') || mimetype.startsWith('application/x-mobipocket-ebook')) { + } else if (mimetype.startsWith('application/epub')) { return 'yellow' } else if (mimetype.startsWith('audio/')) { return 'violet' + } else if (isZipMimetype(mimetype)) { + return 'purple' } } catch (e) { console.error(e); diff --git a/app/src/components/Download.js b/app/src/components/Download.js index 64ff6283..d0284442 100644 --- a/app/src/components/Download.js +++ b/app/src/components/Download.js @@ -161,7 +161,15 @@ class ChannelDownload extends React.Component { constructor(props) { super(props); this.state = { - url: '', frequency: 604800, pending: false, disabled: false, ready: false, error: null, success: null, + advancedOpen: false, + destination: null, + disabled: false, + error: null, + frequency: 604800, + pending: false, + ready: false, + success: null, + url: '', }; this.freqOptions = [{key: 'once', text: 'Once', value: 0}, ...frequencyOptions.slice(1),]; this.handleUrlChange = this.handleUrlChange.bind(this); @@ -181,12 +189,13 @@ class ChannelDownload extends React.Component { handleSubmit = async () => { this.setState({disabled: true, pending: true, success: null, error: null}); - const {url, frequency} = this.state; + const {url, frequency, destination} = this.state; if (!url) { this.setState({error: 'URL is required'}); return; } - let response = await postDownload(url, 'video_channel', frequency); + let response = await postDownload(url, 'video_channel', frequency, + null, null, destination); if (response.status === 204) { this.setState({pending: false, disabled: false, success: true, url: '', ready: false}); } else { @@ -196,8 +205,15 @@ class ChannelDownload extends React.Component { } } + toggleAdvancedAccordion = (e) => { + if (e) { + e.preventDefault(); + } + this.setState({advancedOpen: !this.state.advancedOpen}); + } + render() { - const {ready, disabled, url, error, frequency, pending, success} = this.state; + const {advancedOpen, ready, disabled, url, error, frequency, pending, success} = this.state; const buttonDisabled = !ready || disabled; const onceMessage = ( @@ -207,6 +223,17 @@ class ChannelDownload extends React.Component { in the future. ); + const directorySearch =
+ + + this.setState({destination: i})}/> + +
; + return
Channel / Playlist
@@ -232,6 +259,18 @@ class ChannelDownload extends React.Component { {frequency === 0 && onceMessage} + + + + Advanced + + + {directorySearch} + + + +
+