Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

trouble expanding ${HOME} in output file template, using youtube-dl.conf #1639

Closed
pdelong42 opened this issue Oct 22, 2013 · 2 comments
Closed

trouble expanding ${HOME} in output file template, using youtube-dl.conf #1639

pdelong42 opened this issue Oct 22, 2013 · 2 comments
Labels

Comments

@pdelong42
Copy link

@pdelong42 pdelong42 commented Oct 22, 2013

I'm having an issue expanding environment variables from within the argument to the -o command-line arg, while using it within the youtube-dl.conf file. Admittedly, I've only tried $HOME so-far, but I can't imagine it being specific to only that var. See the sample output below.

Escaping special characters doesn't seem to help. I also have the same problem with tilde expansion, and I can provide some sample output for that case too, if desired.

Naturally, I wouldn't classify this as a critical issue, but it would be nice to keep the same config file across all the hosts I use, without having to hard-code a different home-directory for each place it lives.

bash-3.2$ cat ~/.config/youtube-dl.conf 
-o ${HOME}'/%(extractor)s.com/%(uploader)s/%(title)s-%(id)s.%(ext)s' -v
bash-3.2$ pbpaste | xargs youtube-dl
[debug] System config: []
[debug] User config: ['-o', '${HOME}/%(extractor)s.com/%(uploader)s/%(title)s-%(id)s.%(ext)s', '-v']
[debug] Command-line args: ['http://www.youtube.com/watch?v=a1Y73sPHKxw']
[debug] youtube-dl version 2013.10.17
[debug] Python version 2.7.2 - Darwin-12.5.0-x86_64-i386-64bit
[debug] Proxy map: {}
[youtube] Setting language
[youtube] a1Y73sPHKxw: Downloading video webpage
[youtube] a1Y73sPHKxw: Downloading video info webpage
[youtube] a1Y73sPHKxw: Extracting video information
[download] Destination: ${HOME}/youtube.com/cregets/Dramatic Chipmunk-a1Y73sPHKxw.mp4
[download] 100% of 232.12KiB in 00:00
bash-3.2$ find $HOME -name \*a1Y73sPHKxw\* -print
/Users/pd72/${HOME}/youtube.com/cregets/Dramatic Chipmunk-a1Y73sPHKxw.mp4
bash-3.2$ 
@phihag phihag closed this in 586a91b Oct 22, 2013
@phihag
Copy link
Contributor

@phihag phihag commented Oct 22, 2013

youtube-dl is not a shell script, and therefore can't really expand variables or other shell constructs. Since version 2013.10.22 it can, however, expand user names. Simply set the configuration to

-o '~/%(extractor)s.com/%(uploader)s/%(title)s-%(id)s.%(ext)s' -v

Then, type

sudo youtube-dl -U

to update. As mentioned above, you need 2013.10.22 or newer. I'm releasing as we speak, but since I'm currently on an extremely slow network, it may take a couple of minutes until the new version is out. Thanks for the report!

@pdelong42
Copy link
Author

@pdelong42 pdelong42 commented Oct 23, 2013

Thanks, that works great! I prefer tilde-expansion anyway. :-) (Mucking about with $HOME was just an attempt at a workaround anyway, since I couldn't get tilde-expansion working earlier.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.