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

If-satement in --exec #22397

Closed
hollysheep opened this issue Sep 14, 2019 · 1 comment
Closed

If-satement in --exec #22397

hollysheep opened this issue Sep 14, 2019 · 1 comment
Labels

Comments

@hollysheep
Copy link

@hollysheep hollysheep commented Sep 14, 2019

  • I'm asking a question
  • I've looked through the README and FAQ for similar questions
  • I've searched the bugtracker for similar questions including closed ones

I have youtube-dl running on my raspberry pi and it checks every 10min if there is a new video in my youtube playlist. i add them when i'm not at home and the videos are downloaded then. i want to run some commands if the file title contains a specific uploader_id because i have to re-encode the videos with ffmpeg. when i try something like this

youtube-dl --merge-output-format mkv -f 'worstvideo[ext!=webm]+worstaudio[ext!=webm]/best[ext!=webm]' -o '%(timestamp)s-%(release_date)s-%(upload_date)s-%(uploader_id)s'.mkv URL --exec 'if [[ {} =~ <uloader_id> ]]; then touch /home/user/file; fi'

This test should create an empty file when the file title contains the uploader_id. Running this results in this error:

/bin/sh: 1: [[: not found

When i run the command with single brackets i have this error:

/bin/sh: 1: [: NA-NA-20190913-uploader_id.mkv: unexpected operator

@hollysheep hollysheep added the question label Sep 14, 2019
@dstftw
Copy link
Collaborator

@dstftw dstftw commented Sep 18, 2019

Move code to sh script and run it in --exec.

@dstftw dstftw closed this Sep 18, 2019
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.