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

Automatically close Terminal window upon successful download? #10220

Closed
kwolk opened this issue Aug 4, 2016 · 11 comments
Closed

Automatically close Terminal window upon successful download? #10220

kwolk opened this issue Aug 4, 2016 · 11 comments

Comments

@kwolk
Copy link

@kwolk kwolk commented Aug 4, 2016

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

Make sure you are using the latest version: run youtube-dl --version and ensure your version is 2016.08.01. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • I've verified and I assure that I'm running youtube-dl 2016.08.01

Before submitting an issue make sure you have:

  • At least skimmed through README and most notably FAQ and BUGS sections
  • Searched the bugtracker for similar issues including closed ones

What is the purpose of your issue?

  • Bug report (encountered problems with youtube-dl)
  • Site support request (request for adding support for a new site)
  • Feature request (request for a new functionality)
  • Question
  • Other

The following sections concretize particular purposed issues, you can erase any section (the contents between triple ---) not applicable to your issue


If the purpose of this issue is a bug report, site support request or you are not completely sure provide the full verbose output as follows:

Add -v flag to your command line you run youtube-dl with, copy the whole output and insert it here. It should look similar to one below (replace it with your log inserted between triple ```):

$ youtube-dl -v <your command line>
[debug] System config: []
[debug] User config: []
[debug] Command-line args: [u'-v', u'http://www.youtube.com/watch?v=BaW_jenozKcj']
[debug] Encodings: locale cp1251, fs mbcs, out cp866, pref cp1251
[debug] youtube-dl version 2016.08.01
[debug] Python version 2.7.11 - Windows-2003Server-5.2.3790-SP2
[debug] exe versions: ffmpeg N-75573-g1d0487f, ffprobe N-75573-g1d0487f, rtmpdump 2.4
[debug] Proxy map: {}
...
<end of log>

If the purpose of this issue is a site support request please provide all kinds of example URLs support for which should be included (replace following example URLs by yours):


Description of your issue, suggested solution and other information

Explanation of your issue in arbitrary form goes here. Please make sure the description is worded well enough to be understood. Provide as much context and examples as possible.
If work on your issue required an account credentials please provide them or explain how one can obtain them.

I would like to know if it it possible to have Terminal automatically close the Window in use after it has successfully downloaded a batch file please?

@siddht4
Copy link

@siddht4 siddht4 commented Aug 4, 2016

do this as follows
create a batch file with the name test.bat
in the test.batch file add this commands
@echo off
youtube-dl [video-link]
exit

done

@siddht4
Copy link

@siddht4 siddht4 commented Aug 4, 2016

for your example it would be

rename the test.txt to test.bat
test.txt

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 4, 2016

Thanks @siddht1 AFAIK it's impossible to close the terminal inside application. A shell script is the right way.

@yan12125 yan12125 closed this Aug 4, 2016
@kwolk
Copy link
Author

@kwolk kwolk commented Aug 5, 2016

Many thanks for the example, but I couldn't get your provided example file to work, I use the command:

youtube-dl --batch-file test.bat
AND
youtube-dl -a test.bat

I received the following error:

ERROR: u'@echo off' is not a valid URL. Set --default-search "ytsearch" (or run youtube-dl "ytsearch:@echo off" ) to search YouTube

I tried of course without echo off but it wouldn't work either.

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 5, 2016

Forgot to ask, are you using Windows? If so, just double click on test.bat.

@kwolk
Copy link
Author

@kwolk kwolk commented Aug 5, 2016

No, OS X, I skimmed past that in the documentation.

(Terminal is OS X, it's Command in Windows as I recall)

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 5, 2016

This should work:

youtube-dl "<the video URL>" && exit
@kwolk
Copy link
Author

@kwolk kwolk commented Aug 6, 2016

That it does. Many thanks.

For clarification:

this is for OS X

  1. Create a text file in TextEdit (e.g. "zzz.txt") and save it to the Desktop.
  2. Enter all of the URLs of the YouTube videos you want to download inside zzz.txt one after the other on separate lines.
  3. Rename zzz.txt to zzz.bat --this is a batch file now.
  4. Open a Terminal window and type: youtube-dl -a ~/Desktop/zzz.bat && exit

Now all the videos in the text (batch) file will download and the Terminal window will close.

note: for the Terminal window to actually close you will need to follow this site's advice: http://superuser.com/questions/160473/avoiding-process-completed-prompt-after-terminal-script-ends-on-mac-os-x

@yan12125
Copy link
Collaborator

@yan12125 yan12125 commented Aug 6, 2016

I guess you mean youtube-dl -a ~/Desktop/zzz.bat instead of youtube-dl ~/Desktop/zzz.bat in step 4?

@kwolk
Copy link
Author

@kwolk kwolk commented Aug 12, 2016

Updated!

@siddht4
Copy link

@siddht4 siddht4 commented Sep 2, 2016

ok i thought you asked for windows as the title was "Automatically close Terminal window upon successful download?", i have the bash script for linux its similar as @yan12125 example

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