diff -Nru youtube-dlg-0.4-4/debian/build-ppa.sh youtube-dlg-0.4-5/debian/build-ppa.sh --- youtube-dlg-0.4-4/debian/build-ppa.sh 2019-01-17 21:22:00.000000000 +0000 +++ youtube-dlg-0.4-5/debian/build-ppa.sh 2019-07-12 12:04:49.000000000 +0000 @@ -14,7 +14,7 @@ old_format_source=$(cat ./debian/source/format) tmp_suffix="buildPPA_$(date +%s)_tmp" -for i in xenial bionic cosmic disco +for i in xenial bionic cosmic disco eoan do old_version="$(cat ./debian/changelog | head -n 1 | awk -F "(" '{print $2}' | awk -F ")" '{print $1}')" new_version="${old_version}~${i}1" diff -Nru youtube-dlg-0.4-4/debian/changelog youtube-dlg-0.4-5/debian/changelog --- youtube-dlg-0.4-4/debian/changelog 2019-01-17 21:22:00.000000000 +0000 +++ youtube-dlg-0.4-5/debian/changelog 2019-07-12 12:04:49.000000000 +0000 @@ -1,4 +1,11 @@ -youtube-dlg (0.4-4-git20190118~disco1) disco; urgency=medium +youtube-dlg (0.4-5-git20190712~disco1) disco; urgency=medium + + * Find and use system youtube-dl binary + Fallback to downloading it from the internet if a system one is not available + + -- Mikhail Novosyolov Fri, 12 Jul 2019 15:04:49 +0300 + +youtube-dlg (0.4-4-git20190118) unstable; urgency=medium * git from 2019-01-18 commit c5c18e5 * depend from youtube-dl diff -Nru youtube-dlg-0.4-4/youtube_dl_gui/downloaders.py youtube-dlg-0.4-5/youtube_dl_gui/downloaders.py --- youtube-dlg-0.4-4/youtube_dl_gui/downloaders.py 2019-01-17 21:11:44.000000000 +0000 +++ youtube-dlg-0.4-5/youtube_dl_gui/downloaders.py 2019-07-12 12:03:22.000000000 +0000 @@ -21,7 +21,10 @@ from Queue import Queue from threading import Thread -from .utils import convert_item +from .utils import ( + convert_item, + system_youtube_dl, +) class PipeReader(Thread): @@ -314,7 +317,11 @@ if os.name == 'nt': cmd = [self.youtubedl_path] + options + [url] else: - cmd = ['python', self.youtubedl_path] + options + [url] + if (system_youtube_dl is None): + cmd = ['python', self.youtubedl_path] + options + [url] + else: + cmd = [system_youtube_dl] + options + [url] + #print("Executing cmd: ", cmd) return cmd diff -Nru youtube-dlg-0.4-4/youtube_dl_gui/downloadmanager.py youtube-dlg-0.4-5/youtube_dl_gui/downloadmanager.py --- youtube-dlg-0.4-4/youtube_dl_gui/downloadmanager.py 2019-01-17 21:11:44.000000000 +0000 +++ youtube-dlg-0.4-5/youtube_dl_gui/downloadmanager.py 2019-07-12 12:03:22.000000000 +0000 @@ -40,6 +40,7 @@ from .utils import ( YOUTUBEDL_BIN, + system_youtube_dl, os_path_exists, format_bytes, to_string, @@ -506,7 +507,7 @@ def _check_youtubedl(self): """Check if youtube-dl binary exists. If not try to download it. """ - if not os_path_exists(self._youtubedl_path()) and self.parent.update_thread is None: + if (system_youtube_dl is None) and not os_path_exists(self._youtubedl_path()) and self.parent.update_thread is None: self.parent.update_thread = UpdateThread(self.opt_manager.options['youtubedl_path'], True) self.parent.update_thread.join() self.parent.update_thread = None @@ -529,7 +530,10 @@ def _youtubedl_path(self): """Returns the path to youtube-dl binary. """ path = self.opt_manager.options['youtubedl_path'] - path = os.path.join(path, YOUTUBEDL_BIN) + if system_youtube_dl is not None: + path = system_youtube_dl + else: + path = os.path.join(self.opt_manager.options["youtubedl_path"], YOUTUBEDL_BIN) return path diff -Nru youtube-dlg-0.4-4/youtube_dl_gui/__init__.py youtube-dlg-0.4-5/youtube_dl_gui/__init__.py --- youtube-dlg-0.4-4/youtube_dl_gui/__init__.py 2019-01-17 21:11:44.000000000 +0000 +++ youtube-dlg-0.4-5/youtube_dl_gui/__init__.py 2019-07-12 12:03:22.000000000 +0000 @@ -51,7 +51,8 @@ get_config_path, get_locale_file, os_path_exists, - YOUTUBEDL_BIN + YOUTUBEDL_BIN, + system_youtube_dl, ) @@ -81,7 +82,12 @@ def main(): """The real main. Creates and calls the main app windows. """ - youtubedl_path = os.path.join(opt_manager.options["youtubedl_path"], YOUTUBEDL_BIN) + + if system_youtube_dl is not None: + youtubedl_path = system_youtube_dl + print("Found and using system youtube-dl") + else: + youtubedl_path = os.path.join(opt_manager.options["youtubedl_path"], YOUTUBEDL_BIN) app = wx.App() frame = MainFrame(opt_manager, log_manager) diff -Nru youtube-dlg-0.4-4/youtube_dl_gui/utils.py youtube-dlg-0.4-5/youtube_dl_gui/utils.py --- youtube-dlg-0.4-4/youtube_dl_gui/utils.py 2019-01-17 21:11:44.000000000 +0000 +++ youtube-dlg-0.4-5/youtube_dl_gui/utils.py 2019-07-12 12:03:22.000000000 +0000 @@ -19,6 +19,9 @@ import locale import subprocess +import distutils +from distutils.spawn import find_executable + try: from twodict import TwoWayOrderedDict except ImportError as error: @@ -36,6 +39,9 @@ if os.name == 'nt': YOUTUBEDL_BIN += '.exe' +# Prefer system youtube-dl; if it does not exist, fallback to downloading +# it in downloadmanager.py/_check_youtubedl +system_youtube_dl = find_executable(YOUTUBEDL_BIN) FILESIZE_METRICS = ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]