Skip to content

Commit

Permalink
Enhancements
Browse files Browse the repository at this point in the history
  • Loading branch information
Andrew committed Jan 27, 2024
1 parent 672bd5c commit 0b51534
Show file tree
Hide file tree
Showing 8 changed files with 23 additions and 42 deletions.
3 changes: 2 additions & 1 deletion assets/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ body {
left: 0;
right: 0;
margin: auto;
top: 16%;
top: 20%;
background-color: var(--box-main);
border-radius: 10px;
width: 80%;
Expand Down Expand Up @@ -582,6 +582,7 @@ button {

h2{
margin: 12px;
font-size: 24px;
}

/* Scrollbar */
Expand Down
2 changes: 1 addition & 1 deletion flatpak/io.github.aandrew_me.ytdn.metainfo.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@
<p>ytDownloader lets you download videos and audios of different qualities from hundreds of
sites including the popular ones but not limited to Youtube, Facebook, Instagram, Tiktok,
Twitter, Twitch and so on.</p>
<p>✔️ Supports Light/Dark/Transparent mode</p>
<p>✔️ Supports high quality video resolutions</p>
<p>✔️ Supports audio extraction in multiple formats</p>
<p>✔️ Supports playlist downloads</p>
<p>✔️ Supports downloading particular ranges</p>
<p>✔️ Supports downloading subtitles</p>
<p>✔️ Supports multiple themes</p>
<p>✔️ Completely free and open source</p>
<p>✔️ Fast download speeds</p>
</description>
Expand Down
4 changes: 2 additions & 2 deletions html/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
<!-- Video tab -->
<div id="videoList">
<div class="separationBox">
<h2>Video</h2>
<h2 id="videoHeader">Video</h2>
<label class="formatSelect">Select Format </label>
<select id="videoFormatSelect" class="select">
</select>
Expand All @@ -104,7 +104,7 @@ <h2>Video</h2>

<!-- Audio options for video -->
<div id="audioForVideo">
<h2>Audio</h2>
<h2 id="audioHeader">Audio</h2>
<label class="formatSelect">Select Audio Format </label>
<select id="audioForVideoFormatSelect" class="select">
</select>
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"yt-dlp-wrap-plus": "^2.3.18"
},
"name": "ytdownloader",
"version": "3.16.2",
"version": "3.17.0",
"main": "main.js",
"scripts": {
"start": "electron .",
Expand Down Expand Up @@ -88,7 +88,6 @@
"snap",
"rpm",
"zip",
"pacman",
"deb"
],
"category": "Utility",
Expand Down
44 changes: 11 additions & 33 deletions src/renderer.js
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ async function getInfo(url) {
// Cleaning text
getId("videoFormatSelect").innerHTML = "";
getId("audioFormatSelect").innerHTML = "";
getId("audioForVideoFormatSelect").innerHTML = "";
getId("audioForVideoFormatSelect").innerHTML = `<option value="none|none">No Audio</option>`;

const startTime = getId("startTime");
startTime.value = "";
Expand Down Expand Up @@ -488,7 +488,7 @@ async function getInfo(url) {

if (
(format.video_ext !== "none" &&
format.audio_ext === "none" &&
format.acodec === "none" &&
!(
format.video_ext === "mp4" &&
format.vcodec &&
Expand Down Expand Up @@ -626,30 +626,7 @@ async function getInfo(url) {
format.audio_ext !== "none" ||
(format.acodec !== "none" && format.video_ext !== "none")
) {
let size;
if (format.filesize || format.filesize_approx) {
size = (
Number(format.filesize || format.filesize_approx) /
1000000
).toFixed(2);
} else {
size = i18n.__("Unknown size");
}
const element =
"<option value='" +
(format.format_id + "|" + format.ext) +
"'>" +
(i18n.__(format.format_note) ||
format.resolution ||
i18n.__("Unknown quality")) +
" | " +
format.ext +
" | " +
size +
" " +
i18n.__("MB") +
"</option>";
getId("videoFormatSelect").innerHTML += element;
// Skip them
}

// When there is no audio
Expand Down Expand Up @@ -940,7 +917,7 @@ function download(
audioForVideoExt = audioForVideoValue.split("|")[1];
}

if ((videoExt === "mp4" && audioForVideoExt === "opus") || (videoExt === "webm" && audioForVideoExt === "m4a")) {
if ((videoExt === "mp4" && audioForVideoExt === "opus") || (videoExt === "webm" && (audioForVideoExt === "m4a" || audioForVideoExt === "mp4"))) {
ext = "mkv"
} else {
ext = videoExt;
Expand Down Expand Up @@ -1031,24 +1008,23 @@ function download(
console.log("Filename:", filename);

/**@type {string} */
let audioFormat;
let audioFormat = "+ba";

if (audioForVideoFormat_id === "auto") {
if (ext === "mp4") {
if (!(audioExtensionList.length == 0)) {
if (audioExtensionList.includes("m4a")) {
audioFormat = "+m4a";
} else {
audioFormat = "+ba";
}
} else {
audioFormat = "";
}
} else {
audioFormat = "+ba";
}

} else {
} else if (audioForVideoFormat_id === "none") {
audioFormat = ""
}
else {
audioFormat = `+${audioForVideoFormat_id}`;
}

Expand Down Expand Up @@ -1159,6 +1135,8 @@ function download(
);
}

console.log("Spawn args:" + downloadProcess.ytDlpProcess.spawnargs[downloadProcess.ytDlpProcess.spawnargs.length - 1])

getId(randomId + ".close").addEventListener("click", () => {
controller.abort()
try {
Expand Down
2 changes: 2 additions & 0 deletions src/translate_index.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ document.querySelectorAll(".formatSelect").forEach((element) => {
getId("videoDownload").textContent = i18n.__("Download");
getId("audioDownload").textContent = i18n.__("Download");
getId("videoToggle").textContent = i18n.__("Video");
getId("videoHeader").textContent = i18n.__("Video");
getId("audioToggle").textContent = i18n.__("Audio");
getId("audioHeader").textContent = i18n.__("Audio");
getId("advancedVideoToggle").textContent = i18n.__("More options");
getId("advancedAudioToggle").textContent = i18n.__("More options");
getId("rangeText").textContent = i18n.__("Download particular time-range");
Expand Down
3 changes: 2 additions & 1 deletion translations/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,6 @@
"Solarized Dark": "Solarized Dark",
"Preferred video codec": "Preferred video codec",
"Show more format options": "Show more format options",
"You need to give the app permission to access home directory to use this. You can do it with Flatseal by enabling the permission with text 'filesystem=home'": "You need to give the app permission to access home directory to use this. You can do it with Flatseal by enabling the permission with text 'filesystem=home'"
"You need to give the app permission to access home directory to use this. You can do it with Flatseal by enabling the permission with text 'filesystem=home'": "You need to give the app permission to access home directory to use this. You can do it with Flatseal by enabling the permission with text 'filesystem=home'",
"No Audio":"No Audio"
}

0 comments on commit 0b51534

Please sign in to comment.