From c19c82e28a93f1ec0c571e3d0d75be9db1270abe Mon Sep 17 00:00:00 2001 From: Michael Bleuez Date: Fri, 15 Jan 2021 12:18:26 +0100 Subject: [PATCH] default youtube-dl exec is now configurable --- README.md | 4 ++++ autoytdl/AYTDL.py | 7 ++++++- autoytdl/config.py | 4 ++++ autoytdl/version.py | 2 +- 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 1f29943..2cc3e0d 100644 --- a/README.md +++ b/README.md @@ -122,6 +122,10 @@ pip install --user . pip uninstall auto-ytdl ``` +If you don't wish to install, you can directly run: +```python aytdl.py``` +instead of ```aytdl``` + # Usage Once installed you can run diff --git a/autoytdl/AYTDL.py b/autoytdl/AYTDL.py index 2c2b9da..c0aa2c7 100755 --- a/autoytdl/AYTDL.py +++ b/autoytdl/AYTDL.py @@ -72,7 +72,12 @@ def prepare_ytdl_commmand_line(dateafter): url = "\""+url+"\"" # here we run youtube-dl - exit_code = os.system("youtube-dlc " + + ytdl_exe = None + if hasattr(self.config, 'youtube_dl_executable'): + ytdl_exe = self.config.youtube_dl_executable + if ytdl_exe is None or ytdl_exe == "": + ytdl_exe = "youtube-dlc" + exit_code = os.system(ytdl_exe + " " + prepare_ytdl_commmand_line(dateafter) + " " + url) if exit_code != 0: # may be a youtube-dl error taht is recoverable ask = "Y" diff --git a/autoytdl/config.py b/autoytdl/config.py index 9c56bc3..7e48bdc 100644 --- a/autoytdl/config.py +++ b/autoytdl/config.py @@ -86,6 +86,10 @@ def __init__(self): self.embed_thumbnail = True # youtube-dl args section + + self.comments += ["youtube-dl executable, path or command"] + self.youtube_dl_executable = "youtube-dlc" + self.comments += [""] # padding self.comments += [ "youtube-dl arguments: double-dash \"--\" arguments may be appended at the END of the config file:\n#write: \"option name without --\" = true/false/value\n#-> true to activate a flag\n#-> false to make it not appear in the command\n#-> value (or \"value\" for string values) to set the option argument"] diff --git a/autoytdl/version.py b/autoytdl/version.py index c05aad2..1fbba95 100644 --- a/autoytdl/version.py +++ b/autoytdl/version.py @@ -1,2 +1,2 @@ # follows semantic versionning -__version__ = "1.2.5" +__version__ = "1.3.0"