Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.
Sign upGitHub is where the world builds software
Millions of developers and companies build, ship, and maintain their software on GitHub — the largest and most advanced development platform in the world.
Expansion of ~ in -o #1040
Expansion of ~ in -o #1040
Comments
|
It should be escaped in the template, not in the final filename, don't?. Depending on the video and the template, the filename could start with a |
|
Interesting. Expanding ~ is convenient when writing scripts to share with other people. For example, in the video downloader alfred workflow (which is a group of scripts around youtube-dl), several lines of python code are dedicated just to grabbing the current user home directory. Not a huge deal, but definitely a gotcha that I tripped over a few times. If there's a clean way to add it and not run into problems with video/usernames with ~, I think it would be helpful. |
|
Actually it would need to add just one line of code (it's a function in the standard library), but I don't know if it should be resolved in the ouptut template or in the final filename, I personally think it should be replaced in the template. |
|
Not sure what platform you are using, but on *nix, ~ expansion should be done by the shell. Do you not just need to avoid quoting it?
Providing duplicate ~ expansion in the application would make it impossible to create files starting with literal '~'. |
|
@jojopi Thanks for the hint, you can force creating files with starting '~' if you use a relative path: |
|
My little experience and strong bias lead me to argue that a more difficult ~ literal is better than a less intuitive expansion… but maybe that's just my lack of unix skills. The ~/Downloads/'template' thing works great and I have no further objections. |
|
I know this issue is closed, but I feel there are certain aspects which are still not addressed. I've had this same problem, but while using -o in my youtube-dl.conf file, and no amount of escaping seems to work (instead of expanding tilde, I get a directory which is literally the tilde character, and it's a pain to remove). Other possible workarounds I've tried, which also don't work, involve trying to use ${HOME} in the filename template. But it fails to expand - it gets treated literally by youtube-dl - and no amount of escaping helps. Should I open a new issue for this latter variation of the problem? |
|
@pdelong42 Expansion works fine for me. Please open a new issue and include the complete output of youtube-dl when called with the |
I may be doing something wrong, but ~ isn't properly expanded to your home folder when used in a template. It instead creates a folder with the name ~.