10 playlist download (#71)

* leveraging message queue for playlist entries DL

* playlist support implemented

It's a little bit slow but solid enough :D
This commit is contained in:
Marco
2023-07-28 11:44:38 +02:00
committed by GitHub
parent d4f656fd87
commit 68c829c40e
15 changed files with 257 additions and 58 deletions

View File

@@ -32,6 +32,7 @@ languages:
splashText: No active downloads
archiveTitle: Archive
clipboardAction: Copied URL to clipboard
playlistCheckbox: Download playlist (it will take time, after submitting you may close this window)
italian:
urlInput: URL di YouTube o di qualsiasi altro servizio supportato
statusTitle: Stato
@@ -63,6 +64,7 @@ languages:
splashText: Nessun download attivo
archiveTitle: Archivio
clipboardAction: URL copiato negli appunti
playlistCheckbox: Download playlist (richiederà tempo, puoi chiudere la finestra dopo l'inoltro)
chinese:
urlInput: YouTube 或其他受支持服务的视频网址
statusTitle: 状态
@@ -95,6 +97,7 @@ languages:
splashText: 没有正在进行的下载
archiveTitle: 归档
clipboardAction: 复制 URL 到剪贴板
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)
spanish:
urlInput: URL de YouTube u otro servicio compatible
statusTitle: Estado
@@ -126,6 +129,7 @@ languages:
splashText: No active downloads
archiveTitle: Archive
clipboardAction: Copied URL to clipboard
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)
russian:
urlInput: URL-адрес YouTube или любого другого поддерживаемого сервиса
statusTitle: Статус
@@ -157,6 +161,7 @@ languages:
splashText: Нет активных загрузок
archiveTitle: Архив
clipboardAction: URL скопирован в буфер обмена
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)
korean:
urlInput: YouTube나 다른 지원되는 사이트의 URL
statusTitle: 상태
@@ -188,6 +193,7 @@ languages:
splashText: No active downloads
archiveTitle: Archive
clipboardAction: Copied URL to clipboard
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)
japanese:
urlInput: YouTubeまたはサポート済み動画のURL
statusTitle: 状態
@@ -220,6 +226,7 @@ languages:
splashText: No active downloads
archiveTitle: Archive
clipboardAction: Copied URL to clipboard
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)
catalan:
urlInput: URL de YouTube o d'un altre servei compatible
statusTitle: Estat
@@ -251,6 +258,7 @@ languages:
splashText: No active downloads
archiveTitle: Archive
clipboardAction: Copied URL to clipboard
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)
ukrainian:
urlInput: URL-адреса YouTube або будь-якого іншого підтримуваного сервісу
statusTitle: Статус
@@ -282,6 +290,7 @@ languages:
splashText: Немає активних завантажень
archiveTitle: Архів
clipboardAction: URL скопійовано в буфер обміну
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)
polish:
urlInput: Adres URL YouTube lub innej obsługiwanej usługi
statusTitle: Status
@@ -313,3 +322,4 @@ languages:
splashText: Brak aktywnych pobrań
archiveTitle: Archiwum
clipboardAction: Adres URL zostanie skopiowany do schowka
playlistCheckbox: Download playlist (it will take time, after submitting you may even close this window)

View File

@@ -3,8 +3,10 @@ import CloseIcon from '@mui/icons-material/Close'
import {
Backdrop,
Button,
Checkbox,
Container,
FormControl,
FormControlLabel,
Grid,
IconButton,
InputAdornment,
@@ -12,15 +14,15 @@ import {
MenuItem,
Paper,
Select,
styled,
TextField
TextField,
styled
} from '@mui/material'
import AppBar from '@mui/material/AppBar'
import Dialog from '@mui/material/Dialog'
import Slide from '@mui/material/Slide'
import Toolbar from '@mui/material/Toolbar'
import { TransitionProps } from '@mui/material/transitions'
import Typography from '@mui/material/Typography'
import { TransitionProps } from '@mui/material/transitions'
import { Buffer } from 'buffer'
import {
forwardRef,
@@ -79,6 +81,8 @@ export default function DownloadDialog({
const [url, setUrl] = useState('')
const [workingUrl, setWorkingUrl] = useState('')
const [isPlaylist, setIsPlaylist] = useState(false)
// memos
const cliArgs = useMemo(() =>
new CliArguments().fromString(settings.cliArgs), [settings.cliArgs])
@@ -120,7 +124,8 @@ export default function DownloadDialog({
immediate || url || workingUrl,
`${cliArgs.toString()} ${toFormatArgs(codes)} ${customArgs}`,
availableDownloadPaths[downloadPath] ?? '',
fileNameOverride
fileNameOverride,
isPlaylist,
)
setUrl('')
@@ -323,7 +328,7 @@ export default function DownloadDialog({
</Grid>
}
</Grid>
<Grid container spacing={1} pt={2}>
<Grid container spacing={1} pt={2} justifyContent="space-between">
<Grid item>
<Button
variant="contained"
@@ -336,6 +341,13 @@ export default function DownloadDialog({
{settings.formatSelection ? i18n.t('selectFormatButton') : i18n.t('startButton')}
</Button>
</Grid>
<Grid item>
<FormControlLabel
control={<Checkbox onChange={() => setIsPlaylist(state => !state)} />}
checked={isPlaylist}
label={i18n.t('playlistCheckbox')}
/>
</Grid>
</Grid>
</Paper>
</Grid>

View File

@@ -36,18 +36,35 @@ export class RPCClient {
return data
}
public download(url: string, args: string, pathOverride = '', renameTo = '') {
if (url) {
this.send({
method: 'Service.Exec',
public download(
url: string,
args: string,
pathOverride = '',
renameTo = '',
playlist?: boolean
) {
if (!url) {
return
}
if (playlist) {
return this.send({
method: 'Service.ExecPlaylist',
params: [{
URL: url.split("?list").at(0)!,
URL: url,
Params: args.split(" ").map(a => a.trim()),
Path: pathOverride,
Rename: renameTo,
}]
})
}
this.send({
method: 'Service.Exec',
params: [{
URL: url.split("?list").at(0)!,
Params: args.split(" ").map(a => a.trim()),
Path: pathOverride,
Rename: renameTo,
}]
})
}
public formats(url: string) {

View File

@@ -6,6 +6,7 @@ export type RPCMethods =
| "Service.KillAll"
| "Service.FreeSpace"
| "Service.Formats"
| "Service.ExecPlaylist"
| "Service.DirectoryTree"
| "Service.UpdateExecutable"

View File

@@ -76,7 +76,13 @@ export default function Home() {
}, [status.connected])
useEffect(() => {
client.freeSpace().then(bytes => dispatch(setFreeSpace(bytes.result)))
client
.freeSpace()
.then(bytes => dispatch(setFreeSpace(bytes.result)))
.catch(() => {
setSocketHasError(true)
setShowBackdrop(false)
})
}, [])
useEffect(() => {