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

(Windows) Batch script discrepancy #9048

Closed
YuyQuan opened this issue Apr 1, 2016 · 3 comments
Closed

(Windows) Batch script discrepancy #9048

YuyQuan opened this issue Apr 1, 2016 · 3 comments

Comments

@YuyQuan
Copy link

@YuyQuan YuyQuan commented Apr 1, 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.04.01. If it's not read this FAQ entry and update. Issues with outdated version will be rejected.

  • [x ] I've verified and I assure that I'm running youtube-dl 2016.04.01

Before submitting an issue make sure you have:

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

What is the purpose of your issue?

  • [ x] 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.04.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.

(Windows) Batch script integration with variables and output filenames.

My script:

@echo on
set /p id="Enter ID: "
CALL "youtube-dl.exe" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail -o "Q:\_Editing\Audio Source Folder\%(title)s.%(ext)" %id%
PAUSE

Outputs:

Q:\_Editing\yt-downloader>set /p id="Enter ID: "
Enter ID: https://www.youtube.com/watch?v=BaW_jenozKc

Q:\_Editing\yt-downloader>CALL "youtube-dl.exe" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail -o "Q:\_Editing\Audio Source Folder\(ext)" https://www.youtube.com/watch?v=BaW_jenozKc
Usage: youtube-dl.exe [OPTIONS] URL [URL...]

youtube-dl.exe: error: Cannot download a video and extract audio into the same file! Use "Q:\_Editing\Audio Source Folder\(ext).%(ext)s" instead of "Q:\_Editing\Audio Source Folder\(ext)" as the output template

Q:\_Editing\yt-downloader>PAUSE
Press any key to continue . . .

However, this script will work:

@echo on
set /p id="Enter ID: "
CALL "youtube-dl.exe" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail -o "Q:\_Editing\Audio Source Folder\temp.mp3" %id%
PAUSE

Output:

Q:\_Editing\yt-downloader>set /p id="Enter ID: "
Enter ID: https://www.youtube.com/watch?v=BaW_jenozKc

Q:\_Editing\yt-downloader>CALL "youtube-dl.exe" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail -o "Q:\_Editing\Audio Source Folder\temp.mp3" https://www.youtube.com/watch?v=BaW_jenozKc
[youtube] BaW_jenozKc: Downloading webpage
[youtube] BaW_jenozKc: Downloading video info webpage
[youtube] BaW_jenozKc: Extracting video information
[youtube] BaW_jenozKc: Downloading MPD manifest
[youtube] BaW_jenozKc: Downloading thumbnail ...
[youtube] BaW_jenozKc: Writing thumbnail to: Q:\_Editing\Audio Source Folder\temp.jpg
[download] Destination: Q:\_Editing\Audio Source Folder\temp.mp3
[download] 100% of 308.59KiB in 00:00
[ffmpeg] Correcting container in "Q:\_Editing\Audio Source Folder\temp.mp3"
[ffmpeg] Post-process file Q:\_Editing\Audio Source Folder\temp.mp3 exists, skipping
ERROR: AtomicParsley was not found. Please install.

Q:\_Editing\yt-downloader>PAUSE
Press any key to continue . . .

*note mp3 works, just the jpg thumbnail is a work in progress on my part. Ignore the AtomicParsley ERROR

I've concluded that the way batch uses variables (using percent symbols) conflicts with how the filename output system works in yt-downloader.

@jaimeMF
Copy link
Collaborator

@jaimeMF jaimeMF commented Apr 1, 2016

You have to escape them, see #7950 (comment).

@jaimeMF jaimeMF closed this Apr 1, 2016
@YuyQuan
Copy link
Author

@YuyQuan YuyQuan commented Apr 1, 2016

Thanks that did it!

One last note I wanted to add to anyone doing something similar:

I had to remove CALL from my script and just added the full directory to the application. For whatever reason, when adding the proper file output operations, the script would still give me errors.
So this was the updated script:

@echo on
set /p id="Enter ID: "
CALL "youtube-dl.exe" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail -o "Q:\_Editing\Audio Source Folder\%%(title)s.%%(ext)s" %id%
PAUSE

produced

Q:\_Editing\yt-downloader>set /p id="Enter ID: "
Enter ID: https://www.youtube.com/watch?v=BaW_jenozKc

Q:\_Editing\yt-downloader>CALL "youtube-dl.exe" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail -o "Q:\_Editing\Audio Source Folder\%(title)s.%(ext)s" https://www.youtube.com/watch?v=BaW_jenozKc
Usage: youtube-dl.exe [OPTIONS] URL [URL...]

youtube-dl.exe: error: Cannot download a video and extract audio into the same file! Use "Q:\_Editing\Audio Source Folder\(ext)s.%(ext)s" instead of "Q:\_Editing\Audio Source Folder\(ext)s" as the output template

Q:\_Editing\yt-downloader>PAUSE
Press any key to continue . . .

As you can see, it clearly recognizes the "Q:_Editing\Audio Source Folder%(title)s.%(ext)s"
Pointing right to yt-download and removing CALL works:

@echo on
set /p id="Enter ID: "
"Q:\_Editing\yt-downloader\youtube-dl.exe" -x --audio-format mp3 --audio-quality 0 --embed-thumbnail -o "Q:\_Editing\Audio Source Folder\%%(title)s.%%(ext)s" %id%
PAUSE

obviously toggle echo

@Reino17
Copy link

@Reino17 Reino17 commented Apr 2, 2016

That's because CALL is only used for other batch-files and subroutines.

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.