Playlist fixes

pull/90/head
aandrew-me 3 years ago
parent 13680166c6
commit f4bdec346a

@ -17,6 +17,8 @@ if (os.platform() === "win32") {
} }
let foldernameFormat = "%(playlist_title)s"; let foldernameFormat = "%(playlist_title)s";
let filenameFormat = "%(playlist_index)s.%(title)s.%(ext)s"; let filenameFormat = "%(playlist_index)s.%(title)s.%(ext)s";
let playlistIndex = 1;
let playlistEnd = "";
function getId(id) { function getId(id) {
return document.getElementById(id); return document.getElementById(id);
@ -54,16 +56,7 @@ function download(type) {
nameFormatting(); nameFormatting();
// Playlist download range // Playlist download range
let playlistIndex = 1; managePlaylistRange()
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}`);
// Whether to use browser cookies or not // Whether to use browser cookies or not
if (localStorage.getItem("browser")) { if (localStorage.getItem("browser")) {
@ -192,6 +185,16 @@ function download(type) {
}); });
} }
function managePlaylistRange(){
if (getId("playlistIndex").value) {
playlistIndex = Number(getId("playlistIndex").value);
}
if (getId("playlistEnd").value) {
playlistEnd = Number(getId("playlistEnd").value);
}
console.log(`Range: ${playlistIndex}:${playlistEnd}`);
}
function afterClose(count) { function afterClose(count) {
getId(`p${count}`).textContent = i18n.__("File saved."); getId(`p${count}`).textContent = i18n.__("File saved.");
getId("pasteLink").style.display = "inline-block"; getId("pasteLink").style.display = "inline-block";
@ -241,6 +244,7 @@ function downloadThumbnails() {
let count = 0; let count = 0;
hideOptions(); hideOptions();
nameFormatting(); nameFormatting();
managePlaylistRange()
const downloadProcess = ytdlp.exec( const downloadProcess = ytdlp.exec(
[ [
"--yes-playlist", "--yes-playlist",
@ -252,6 +256,8 @@ function downloadThumbnails() {
"--write-thumbnail", "--write-thumbnail",
"--convert-thumbnails png", "--convert-thumbnails png",
"--skip-download", "--skip-download",
"-I",
`"${playlistIndex}:${playlistEnd}"`,
`"${url}"`, `"${url}"`,
], ],
{ shell: true, detached: false } { shell: true, detached: false }
@ -302,6 +308,7 @@ function saveLinks() {
let count = 0; let count = 0;
hideOptions(); hideOptions();
nameFormatting(); nameFormatting();
managePlaylistRange()
const downloadProcess = ytdlp.exec( const downloadProcess = ytdlp.exec(
[ [
"--yes-playlist", "--yes-playlist",
@ -313,6 +320,8 @@ function saveLinks() {
"webpage_url", "webpage_url",
`"${path.join(downloadDir, foldernameFormat, "links.txt")}"`, `"${path.join(downloadDir, foldernameFormat, "links.txt")}"`,
"--skip-download", "--skip-download",
"-I",
`"${playlistIndex}:${playlistEnd}"`,
`"${url}"`, `"${url}"`,
], ],
{ shell: true, detached: false } { shell: true, detached: false }

Loading…
Cancel
Save