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

Wait for user input after downloading #6522

Closed
Krzysiu opened this issue Aug 10, 2015 · 13 comments
Closed

Wait for user input after downloading #6522

Krzysiu opened this issue Aug 10, 2015 · 13 comments

Comments

@Krzysiu
Copy link

@Krzysiu Krzysiu commented Aug 10, 2015

THE CASE. Hello! There's no way in Windows to log all console output or keep command line window opened after executing an application. The workaround - creating batch file with "youtube-dl.exe %*{EOL}pause" - could give different results than direct execute (it's my case*).

THE REQUEST. So my request is the new command line option in "Verbosity / Simulation Options" section to make youtube-dl wait for user input after doing its job, so user could read debug messages. Of course it's not needed when user uses cmd.exe, but when running it externally, it would help a lot.

SIMILAR OPTIONS IN OTHER APPS. I've seen some apps having such switch. The example is TrID. It's there as "-w Wait for a key before exiting".

PROPOSED BEHAVIOR. In youtube-dl there could be like switch like --wait or --user-input or --pause (I think that 1st is the best) with description "wait for user input after completing job" and youtube-dl would show "Press any key to continue..." in a new line after completing all jobs. I thought about description "...after download", but it wouldn't be clear for case when user is downloading whole playlist or other job with more than one download.

Greetings and thanks for your work :)

* youtube-dl gives me an error when I run it from Firefox, but command line window closes and I don't see how it's named. When I'm creating batch file with pause on the end, it works fine, so I can't reproduce it :)

@ad-m
Copy link

@ad-m ad-m commented Aug 10, 2015

👍

PS. Use Linux, please.

@dstftw
Copy link
Collaborator

@dstftw dstftw commented Aug 11, 2015

Just run youtube-dl in opened cmd.exe.

@dstftw dstftw closed this Aug 11, 2015
@Krzysiu
Copy link
Author

@Krzysiu Krzysiu commented Aug 13, 2015

@dstftw you didn't read my request, did you? Your "solution" won't help in my case.

As you can see - http://superuser.com/questions/306167/how-to-prevent-the-command-prompt-from-closing-after-execution - it's rather a popular problem, but here every other solution than built-in could change the result. It doesn't matter if it's cmd.exe, start.exe or batch file. It's just different, produces different result, runs application in slightly different env.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 13, 2015

The workaround - creating batch file with "youtube-dl.exe %{EOL}pause" - could give different results than direct execute (it's my case).

What's the difference? The results should be the same.

@midas02
Copy link
Contributor

@midas02 midas02 commented Mar 30, 2017

@phihag Can this be reopened please? This suggestion was never even discussed properly.

I would be really keen on such a feature as well, as it makes it much easier to call youtube-dl from within shell environments. Using batch files is not always desirable, and sometimes even impossible (e.g. they're impossible to use with accented characters).

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 31, 2017

On Windows this command should make the same effect like --wait:

youtube-dl https://youtube.com/xxx --exec "pause"
@midas02
Copy link
Contributor

@midas02 midas02 commented Mar 31, 2017

Thanks @yan12125, hadn't thought of that. Still, it would make it easier to have such an option available. Is there any reason for not implementing it? I can't imagine it would take a long time to implement.

[edit] ... having done some testing, it doesn't always seem to fit the purpose as well. --exec is only executed when a file is actually being downloaded, so '--exec pause' doesn't have any effect when running 'youtube-dl http://abc -F --exec pause'. In this example, no file is being downloaded, so the pause instruction will be ignored. One could work around that, again, by trying some piping ('youtube-dl http://abc -F && pause'), but still, that's a work-around, again. It would by far be easier not having to second-guess the programme's behaviour.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 31, 2017

You're right --exec is not the best solution.

Using batch files is not always desirable, and sometimes even impossible (e.g. they're impossible to use with accented characters)

Anything wrong with accented characters?

@midas02
Copy link
Contributor

@midas02 midas02 commented Mar 31, 2017

Yes. Try using a word like Löwe in a batch file. The umlauted o will come out in all kinds of shapes and sizes, depending on the character set the user's computer is using.
Another issue is when a string contains a percent sign. Batch files interpret these as variables, so you have to double them before writing that string to a batch file.
So the above are just two examples of why it's complicated to work with batch files, and you sometimes have to re-engineer your strings before writing them to batch files just because you know they will be mishandled. It's much easier if it could be avoided altogether.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Mar 31, 2017

I see. It's a pity that Windows has awful Unicode support. I guess the reason that this function is not implemented in youtube-dl is that it's totally unrelated to video downloading. Instead, it's more related to process handling of the operating system. To get things like "Wait for a key before exiting" correctly implemented in Python is absolutely difficult, so it's better to leave things handled by the underlying operating system. (for example the "pause" command on Windows)

it makes it much easier to call youtube-dl from within shell environments

Could you describe more? Although I have no plan to reopen this, it's always harmless with some brainstorming :)

@midas02
Copy link
Contributor

@midas02 midas02 commented Mar 31, 2017

it makes it much easier to call youtube-dl from within shell environments

Could you describe more? Although I have no plan to reopen this, it's always harmless with some brainstorming :)

Nothing special. Imagine pieces of code where a programmer wants to invoke youtube-dl, for instance with functions like ShellExecute and the likes. Then you may want to need a way to freeze the output of youtube-dl before the execution window disappears, like when you're using the -F parameter. So again, there are ways of engineering around that, but it's easier if you could leave that task up to youtube-dl.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Apr 1, 2017

Hmm, I heard that Powershell supports UTF-8 better. How about giving it a try?

@midas02
Copy link
Contributor

@midas02 midas02 commented Apr 1, 2017

Ah don't worry, I was only interested in the --wait option. For the time being, I'll just work around it by adding ' && pause ' to my youtube-dl strings.

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
5 participants
You can’t perform that action at this time.