aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Pipfile.lock36
-rw-r--r--app/dl_formats.py9
-rw-r--r--app/ytdl.py5
-rw-r--r--ui/src/app/app.component.html2
-rw-r--r--ui/src/app/formats.ts7
5 files changed, 36 insertions, 23 deletions
diff --git a/Pipfile.lock b/Pipfile.lock
index 04474cc..c8295d6 100644
--- a/Pipfile.lock
+++ b/Pipfile.lock
@@ -204,11 +204,11 @@
},
"charset-normalizer": {
"hashes": [
- "sha256:5189b6f22b01957427f35b6a08d9a0bc45b46d3788ef5a92e978433c7a35f8a5",
- "sha256:575e708016ff3a5e3681541cb9d79312c416835686d054a23accb873b254f413"
+ "sha256:5a3d016c7c547f69d6f81fb0db9449ce888b418b5b9952cc5e6e66843e9dd845",
+ "sha256:83e9a75d1911279afd89352c68b45348559d1fc0506b054b346651b5e7fee29f"
],
"markers": "python_version >= '3.6'",
- "version": "==2.1.0"
+ "version": "==2.1.1"
},
"frozenlist": {
"hashes": [
@@ -529,21 +529,21 @@
},
"yt-dlp": {
"hashes": [
- "sha256:a01d3c7187683ec17db33ecd3b506436c7e94c5693002f059f76d32fb437083e",
- "sha256:cc290ac8a1fec626841765fed12f7a1ebdfe01791ae5c5f3794edfce35d81843"
+ "sha256:af3721ecb286a95272008add3b9bebde4f370fb3bdd1bb6402727af9e2e3aa2b",
+ "sha256:bc74ee255790043e458197aaf25c6c104fefc9fcda4458f652619447ab4ae0d7"
],
"index": "pypi",
- "version": "==2022.8.19"
+ "version": "==2022.9.1"
}
},
"develop": {
"astroid": {
"hashes": [
- "sha256:86b0a340a512c65abf4368b80252754cda17c02cdbbd3f587dddf98112233e7b",
- "sha256:bb24615c77f4837c707669d16907331374ae8a964650a66999da3f5ca68dc946"
+ "sha256:396c88d0a58d7f8daadf730b2ce90838bf338c6752558db719ec6f99c18ec20e",
+ "sha256:d612609242996c4365aeb0345e61edba34363eaaba55f1c0addf6a98f073bef6"
],
- "markers": "python_full_version >= '3.6.2'",
- "version": "==2.11.7"
+ "markers": "python_full_version >= '3.7.2'",
+ "version": "==2.12.5"
},
"dill": {
"hashes": [
@@ -622,19 +622,11 @@
},
"pylint": {
"hashes": [
- "sha256:487ce2192eee48211269a0e976421f334cf94de1806ca9d0a99449adcdf0285e",
- "sha256:fabe30000de7d07636d2e82c9a518ad5ad7908590fe135ace169b44839c15f90"
+ "sha256:4b124affc198b7f7c9b5f9ab690d85db48282a025ef9333f51d2d7281b92a6c3",
+ "sha256:4f3f7e869646b0bd63b3dfb79f3c0f28fc3d2d923ea220d52620fd625aed92b0"
],
"index": "pypi",
- "version": "==2.14.5"
- },
- "setuptools": {
- "hashes": [
- "sha256:10602cd0a6f5feab6656e9587f9075292ab777c5200f3bf00293ecd23d9f2788",
- "sha256:d2e010624c781b26ad6629a8de9832327cf853dea93894487979e55f9ad06857"
- ],
- "markers": "python_version >= '3.7'",
- "version": "==65.1.0"
+ "version": "==2.15.0"
},
"tomli": {
"hashes": [
@@ -727,7 +719,7 @@
"sha256:ee6acae74a2b91865910eef5e7de37dc6895ad96fa23603d1d27ea69df545015",
"sha256:ef3f72c9666bba2bab70d2a8b79f2c6d2c1a42a7f7e2b0ec83bb2f9e383950af"
],
- "markers": "python_version >= '2.7' and python_version not in '3.0, 3.1, 3.2, 3.3, 3.4'",
+ "markers": "python_version < '3.11'",
"version": "==1.14.1"
}
}
diff --git a/app/dl_formats.py b/app/dl_formats.py
index c06b93b..316d5df 100644
--- a/app/dl_formats.py
+++ b/app/dl_formats.py
@@ -19,6 +19,10 @@ def get_format(format: str, quality: str) -> str:
if format.startswith("custom:"):
return format[7:]
+ if format == "thumbnail":
+ # Quality is irrelevant in this case since we skip the download
+ return "bestaudio/best"
+
if format == "mp3":
# Audio quality needs to be set post-download, set in opts
return "bestaudio/best"
@@ -66,4 +70,9 @@ def get_opts(format: str, quality: str, ytdl_opts: dict) -> dict:
opts["postprocessors"].append({"key": "FFmpegMetadata"})
opts["postprocessors"].append({"key": "EmbedThumbnail"})
+ if format == "thumbnail":
+ opts["skip_download"] = True
+ opts["writethumbnail"] = True
+ opts["postprocessors"].append({"key": "FFmpegThumbnailsConvertor", "format": "jpg", "when": "before_dl"})
+
return opts
diff --git a/app/ytdl.py b/app/ytdl.py
index 97fa0a8..0bafc91 100644
--- a/app/ytdl.py
+++ b/app/ytdl.py
@@ -6,6 +6,7 @@ import time
import asyncio
import multiprocessing
import logging
+import re
from dl_formats import get_format, get_opts
log = logging.getLogger('ytdl')
@@ -127,6 +128,10 @@ class Download:
self.tmpfilename = status.get('tmpfilename')
if 'filename' in status:
self.info.filename = os.path.relpath(status.get('filename'), self.download_dir)
+
+ # Set correct file extension for thumbnails
+ if(self.info.format == 'thumbnail'):
+ self.info.filename = re.sub(r'\.webm$', '.jpg', self.info.filename)
self.info.status = status['status']
self.info.msg = status.get('msg')
if 'downloaded_bytes' in status:
diff --git a/ui/src/app/app.component.html b/ui/src/app/app.component.html
index 1f53798..6d59fd4 100644
--- a/ui/src/app/app.component.html
+++ b/ui/src/app/app.component.html
@@ -26,7 +26,7 @@
<div class="container add-url-box">
<div class="row">
<div class="col add-url-component input-group">
- <input type="text" class="form-control" placeholder="Video or playlist URL" name="addUrl" [(ngModel)]="addUrl" [disabled]="addInProgress || downloads.loading">
+ <input type="text" autocomplete="off" spellcheck="false" class="form-control" placeholder="Video or playlist URL" name="addUrl" [(ngModel)]="addUrl" [disabled]="addInProgress || downloads.loading">
</div>
</div>
<div class="row">
diff --git a/ui/src/app/formats.ts b/ui/src/app/formats.ts
index 15be903..a3bf3e8 100644
--- a/ui/src/app/formats.ts
+++ b/ui/src/app/formats.ts
@@ -43,4 +43,11 @@ export const Formats: Format[] = [
{ id: '128', text: '128 kbps' },
],
},
+ {
+ id: 'thumbnail',
+ text: 'Thumbnail',
+ qualities: [
+ { id: 'best', text: 'Best' }
+ ],
+ },
];
bgstack15