Open gh0stl4b opened 10 years ago
Would it be a good idea to use a Python script as the configuration file? For example:
# file ~/.config/youtube-dl/config.py
def YoutubeDLFlags(url, ie_key, other_flags):
flags = []
if ie_key == 'YouTube':
flags.extend(['-f', 'bestvideo[ext!=webm]+bestaudio[ext!=webm]'])
elif ie_key == 'Youku':
flags.extend(['--proxy', 'hostname:port'])
return flags
There are indeed lots of implementation issues, but I think it's a good start. A fixed set of flags is simply not flexible enough.
@yan12125 Could you explain why a simple config file with sections is not enough? For the example you posted all you would need is:
[YouTube]
format = bestvideo[ext!=webm]+bestaudio[ext!=webm]
[Youku]
proxy = hostname:port
(I like not using leading dashes, but it could be made optional to support the old format).
Sorry for a bad example. Python scripts could solve #6745 as well. In my case, I use a different set of flags when developing youtube-dl. For example:
import os.path
def YoutubeDLFlags(url, ie_key, other_flags):
if os.path.exists('./youtube_dl/__main__.py'):
return ['-v', '--write-pages']
flags = []
if ie_key == 'YouTube':
flags.extend(['-f', 'bestvideo[ext!=webm]+bestaudio[ext!=webm]'])
elif ie_key == 'Youku':
flags.extend(['--proxy', 'hostname:port'])
return flags
I think that adding a --include-config
to read an specific file would be enough. Even even if we added support for a python script, supporting the simple config would be easier to create for users.
Any news on whether this is actually gonna get made? Or should I start to learn python and make pull requests? :sweat_smile:
Any updates on this? The feature would come in handy, expecially when dealing with different services on a regular basis.
the --username and --password config flags are basically useless without this feature implemented
I love having the option to configure youtube-dl globaly, but it would be great to be able to specify options per service, so like one directory for YouTube, another for SoundCloud and another for Twitch.
I would presume it should look something like this:
I hope you get the basic gist.
Thank you :)