adding an -o & an "%(title)s - %(id)s.%(ext)s" argument failes #14

Closed
opened 2022-04-05 23:02:50 +09:30 by soulmaestro · 4 comments
soulmaestro commented 2022-04-05 23:02:50 +09:30 (Migrated from github.com)

if i add extra arguments to name the outputfile as i like it to become, somehow the naming argument get f*d over:

i tried adding the following commands through the config.htm-screen and directly in the config.yml file
- -o
- "%(title)s - %(id)s.%(ext)s"

this has to be capsulated in double quotes as i'm on Windows (and i'm sure Linux will go broke on it as well) as else the space behind %(title)s will cause '-' to be seen as a next commandline option which will make the full youtube-dl.exe ... command faulty

however "%(title)s - %(id)s.%(ext)s" becomes "\"%(title)s - %(id)s.%(ext)s\"" if i go through the config-screen
and for the next downloads with that profile the file(s) get a starting and trailing # around it.
imho that somehow comes from the \ being added.

if i save it directly into the config.yml as such the double quotes get stripped on reading the file in config.go and that makes the full commandline fail for the 1st stated reason (no double quotes = spaces cause the '-' to be seen as next commandline option).

if i try to use single quotes around it making it: '"%(title)s - %(id)s.%(ext)s"' (singlequote, double quote ... double, single) it again excapes the double quotes on reading the configfile, resulting again in the added #'s at the start and finish of the full filename(s) e.g.: #name - id.mp4#

if i try the other way around: "'%(title)s - %(id)s.%(ext)s'" (double quotes on the outside, single qoutes on the inside), it keeps the single quotes and strips the qouble quotes, but the resulting filename also has those single quotes at start and finish
e.g.: 'name - id.mp4'

The command i hope to get (with the default and other args) is
youtube-dl.exe -o "%(title)s - %(id)s.%(ext)s" <url>
which is according to the youtube-dl readme a correct optionline
with a resulting filename: name - id.mp4 without any # or ' around that.

anyone having an idea how to tackle this?

if i add extra arguments to name the outputfile as i like it to become, somehow the naming argument get f*d over: i tried adding the following commands through the config.htm-screen and directly in the config.yml file `- -o` `- "%(title)s - %(id)s.%(ext)s" ` this has to be capsulated in double quotes as i'm on Windows (and i'm sure Linux will go broke on it as well) as else the space behind %(title)s will cause '-' to be seen as a next commandline option which will make the full youtube-dl.exe ... command faulty however `"%(title)s - %(id)s.%(ext)s"` becomes `"\"%(title)s - %(id)s.%(ext)s\""` if i go through the config-screen and for the next downloads with that profile the file(s) get a starting and trailing # around it. imho that somehow comes from the \ being added. if i save it directly into the config.yml as such the double quotes get stripped on reading the file in config.go and that makes the full commandline fail for the 1st stated reason (no double quotes = spaces cause the '-' to be seen as next commandline option). if i try to use single quotes around it making it: ` '"%(title)s - %(id)s.%(ext)s"' ` (singlequote, double quote ... double, single) it again excapes the double quotes on reading the configfile, resulting again in the added #'s at the start and finish of the full filename(s) e.g.: #name - id.mp4# if i try the other way around: ` "'%(title)s - %(id)s.%(ext)s'" ` (double quotes on the outside, single qoutes on the inside), it keeps the single quotes and strips the qouble quotes, but the resulting filename also has those single quotes at start and finish e.g.: 'name - id.mp4' The command i hope to get (with the default and other args) is `youtube-dl.exe -o "%(title)s - %(id)s.%(ext)s" <url>` which is according to the youtube-dl readme a correct optionline with a resulting filename: `name - id.mp4` without any # or ' around that. anyone having an idea how to tackle this?
soulmaestro commented 2022-04-05 23:17:31 +09:30 (Migrated from github.com)

To give you a better idea of what the correct, single quoted and escaped double quoted version result in i copy-pasted all 3 and the first 7-ish resulting outputlines in the following pastebin:
https://pastebin.com/pdjttyMv
and this is my config.html for that profile:
https://imgur.com/a/dn8nOK8

To give you a better idea of what the correct, single quoted and escaped double quoted version result in i copy-pasted all 3 and the first 7-ish resulting outputlines in the following pastebin: [https://pastebin.com/pdjttyMv](https://pastebin.com/pdjttyMv) and this is my config.html for that profile: [https://imgur.com/a/dn8nOK8](https://imgur.com/a/dn8nOK8)
tardisx commented 2022-04-06 07:57:10 +09:30 (Migrated from github.com)

Hi @soulmaestro, gropple does not invoke the shell, so shell style escaping / quoting is unnecessary. Spaces inside arguments should be ok and the double quotes should be unnecessary. Give that a try and let me know if it works.

Hi @soulmaestro, gropple does not invoke the shell, so shell style escaping / quoting is unnecessary. Spaces inside arguments should be ok and the double quotes should be unnecessary. Give that a try and let me know if it works.
soulmaestro commented 2022-04-06 08:36:49 +09:30 (Migrated from github.com)

well damned :o
The one option that i never tried - no shell style escaping/quoting - is working 👍

the cmd.Start() - and especially the 'cmd'-part - made me think escaping/quoting was necessary.
(windows cmd vs Golang cmd variable name. )

tyvm for the quick response and preventing some of my hair to turn grey combating this what looks like a non-excisting problem/issue :)

well damned :o The one option that i never tried - no shell style escaping/quoting - is working 👍 the cmd.Start() - and especially the 'cmd'-part - made me think escaping/quoting was necessary. (windows cmd vs Golang cmd variable name. ) tyvm for the quick response and preventing some of my hair to turn grey combating this what looks like a non-excisting problem/issue :)
tardisx commented 2022-04-06 08:45:08 +09:30 (Migrated from github.com)

No problem :-) I will open a separate issue to improve the documentation, because I think this is probably surprising behaviour for many people.

No problem :-) I will open a separate issue to improve the documentation, because I think this is probably surprising behaviour for many people.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: justin/gropple#14
No description provided.