From a3920dcaa09a14482f9ba0610c4478e0c97b7568 Mon Sep 17 00:00:00 2001 From: MrS0m30n3 Date: Sun, 14 Jan 2018 17:08:09 +0200 Subject: [PATCH] Check if youtube-dl exists during startup Show an error message if updates are disabled and we could not locate youtube-dl on the system. --- youtube_dl_gui/__init__.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/youtube_dl_gui/__init__.py b/youtube_dl_gui/__init__.py index ac27d10..d8c0fe2 100644 --- a/youtube_dl_gui/__init__.py +++ b/youtube_dl_gui/__init__.py @@ -18,6 +18,7 @@ from __future__ import unicode_literals import sys import gettext +import os.path try: import wx @@ -48,7 +49,9 @@ from .optionsmanager import OptionsManager from .utils import ( get_config_path, - get_locale_file + get_locale_file, + os_path_exists, + YOUTUBEDL_BIN ) @@ -78,7 +81,14 @@ from .mainframe import MainFrame def main(): """The real main. Creates and calls the main app windows. """ + youtubedl_path = os.path.join(opt_manager.options["youtubedl_path"], YOUTUBEDL_BIN) + app = wx.App() frame = MainFrame(opt_manager, log_manager) frame.Show() + + if opt_manager.options["disable_update"] and not os_path_exists(youtubedl_path): + wx.MessageBox(_("Failed to locate youtube-dl and updates are disabled"), _("Error"), wx.OK | wx.ICON_ERROR) + frame.close() + app.MainLoop()