Move yt_dlp import inside method in VideoInfoMixin
The import of yt_dlp is now performed locally within the method to prevent import errors when yt-dlp is not installed. This change improves robustness for environments where yt-dlp may be missing.
This commit is contained in:
@@ -8,7 +8,6 @@ from PIL import Image
|
|||||||
from PySide6.QtCore import Qt
|
from PySide6.QtCore import Qt
|
||||||
from PySide6.QtGui import QPixmap
|
from PySide6.QtGui import QPixmap
|
||||||
from PySide6.QtWidgets import QHBoxLayout, QLabel, QMainWindow, QPushButton, QVBoxLayout, QWidget
|
from PySide6.QtWidgets import QHBoxLayout, QLabel, QMainWindow, QPushButton, QVBoxLayout, QWidget
|
||||||
from yt_dlp import YoutubeDL
|
|
||||||
|
|
||||||
from src.core.ytsage_logging import logger
|
from src.core.ytsage_logging import logger
|
||||||
from src.gui.ytsage_gui_dialogs import ( # use of src\gui\ytsage_gui_dialogs\__init__.py
|
from src.gui.ytsage_gui_dialogs import ( # use of src\gui\ytsage_gui_dialogs\__init__.py
|
||||||
@@ -372,6 +371,9 @@ class VideoInfoMixin:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
|
# Import yt_dlp locally to avoid import errors when yt-dlp is not installed
|
||||||
|
from yt_dlp import YoutubeDL
|
||||||
|
|
||||||
logger.debug(f"Attempting to save thumbnail for URL: {video_url}")
|
logger.debug(f"Attempting to save thumbnail for URL: {video_url}")
|
||||||
|
|
||||||
ydl_opts = {
|
ydl_opts = {
|
||||||
|
|||||||
Reference in New Issue
Block a user