1

HI, I am using GoogleCL version 0.9.11 to upload videos to Youtube. My OS is CentOS 5.5 and Python 2.5.

One of the string parameters contain new line "\n", and it cant display properly.

google youtube post ~/videos/cat-falls-down-stairs.avi Comedy --tags "currency of the internet" --summary "Poor whiskers takes a tumble.\nShe's fine, though, don't worry."

The summary page display as:

Poor whiskers takes a tumble.\nShe's fine, though, don't worry.

But I want:

Poor whiskers takes a tumble.
She's fine, though, don't worry.

The "\n" wont work. Who has a solution?

Thanks a lot!

Senthil Kumaran
  • 54,681
  • 14
  • 94
  • 131
DocWiki
  • 3,488
  • 10
  • 39
  • 49

3 Answers3

9

You can use Bash's $'' construct to expand escape sequences before they are passed to googlecl.

google youtube post ~/videos/cat-falls-down-stairs.avi Comedy \
    --tags 'currency of the internet' \
    --summary $'Poor whiskers takes a tumble.\nShe'\''s fine, though, don'\''t worry.'
ephemient
  • 198,619
  • 38
  • 280
  • 391
  • Can you take a look at this question: http://stackoverflow.com/questions/8084389/bash-variable-in-single-quote – DocWiki Nov 10 '11 at 18:26
1

Just put an acutal newline in side the string. Bash knows how to handle multi-line strings if you just press enter in the middle of them.

google youtube post ~/videos/cat-falls-down-stairs.avi Comedy --tags "currency of the internet" --summary "Poor whiskers takes a tumble.
She's fine, though, don't worry."
Ken Bloom
  • 57,498
  • 14
  • 111
  • 168
  • I'd love to format this better to avoid the horizontal scrolling, but I think it will detract from the main point of the answer. – Ken Bloom Feb 07 '11 at 04:41
  • "Just put an acutal newline in side the string."??? How? When I key down the "Enter" key, the command runs and issues an error. Cant key down the "Enter" key when you type a command. I am afraid. – DocWiki Feb 07 '11 at 05:46
  • @DocWiki: is it possible that you pasted the command into the command line, then moved to the middle of the string and hit enter? Bash will execute the command automatically if you do that. (Even if you paste everything except for the last quotation mark, then move to the appropriate place in the line and hit enter, you still won't get a newline where you want.) – Ken Bloom Feb 07 '11 at 19:26
  • @DocWiki: However, if you paste only the stuff that belongs before the newline (making sure to leave mismatched quotation marks), then hit enter, then type/paste the rest of the command, in that case, you'll get a newline in the middle of the string. – Ken Bloom Feb 07 '11 at 19:27
0

googlecl is a python application. Escape the \n with a \ and have your string as "Poor whiskers takes a tumble.\\nShe's fine..." . This should perhaps help.

Senthil Kumaran
  • 54,681
  • 14
  • 94
  • 131