Support for playlist range

pull/84/head
aandrew-me 3 years ago
parent 97681adda5
commit d082110a20

@ -259,6 +259,11 @@ input[type="checkbox"]{
top:4px;
}
input[type=number]::-webkit-inner-spin-button,
input[type=number]::-webkit-outer-spin-button {
appearance: none;
}
.submitBtn {
padding: 15px;
border-radius: 10px;
@ -295,7 +300,7 @@ input[type="checkbox"]{
width: 100px;
}
.time {
.time, .input {
padding: 8px;
border: none;
outline: none;

@ -29,6 +29,9 @@
#audioBox{
display:none;
}
#advancedMenu{
display:none;
}
</style>
</head>
@ -93,6 +96,15 @@
</div>
<button id="advancedToggle" class="advancedToggle">More options</button>
<!-- Hidden -->
<div id="advancedMenu">
<span>Playlist range</span>
<input type="number" id="playlistIndex" class="input" placeholder="Start">:
<input type="number" id="playlistEnd" class="input" placeholder="End">
</div>
<p id="incorrectMsg"></p>
</div>

@ -58,6 +58,18 @@ function download(type) {
filenameFormat = localStorage.getItem("filenameFormat");
}
// Playlist download range
let playlistIndex = 1;
let playlistEnd = "";
if (getId("playlistIndex").value) {
playlistIndex = Number(getId("playlistIndex").value);
}
if (getId("playlistEnd").value) {
playlistEnd = Number(getId("playlistEnd").value);
}
console.log(`Range: ${playlistIndex}:${playlistEnd}`);
getId("list").innerHTML = "";
getId("playlistName").textContent = "";
@ -100,6 +112,8 @@ function download(type) {
"--yes-playlist",
"-o",
`"${path.join(downloadDir, foldernameFormat, filenameFormat)}"`,
"-I",
`"${playlistIndex}:${playlistEnd}"`,
"--ffmpeg-location",
ffmpeg,
cookieArg,
@ -119,6 +133,8 @@ function download(type) {
format,
"-o",
`"${path.join(downloadDir, foldernameFormat, filenameFormat)}"`,
"-I",
`"${playlistIndex}:${playlistEnd}"`,
"--ffmpeg-location",
ffmpeg,
cookieArg,
@ -262,6 +278,20 @@ audioToggle.addEventListener("click", (event) => {
getId("audioBox").style.display = "block";
});
// More options
let moreOptions = true;
getId("advancedToggle").addEventListener("click", () => {
if (moreOptions) {
getId("advancedMenu").style.display = "block";
moreOptions = false;
} else {
getId("advancedMenu").style.display = "none";
moreOptions = true;
}
});
// Menu
getId("openDownloads").addEventListener("click", () => {
openFolder(downloadDir);
});

@ -77,5 +77,6 @@
"Use configuration file":"Use configuration file",
"Filename format for playlists":"Filename format for playlists",
"Folder name format for playlists":"Folder name format for playlists",
"Reset to default":"Reset to default"
"Reset to default":"Reset to default",
"Playlist range":"Playlist range"
}

Loading…
Cancel
Save