[MPlayer-users] Playing an URL with special characters, charset problem

arthur at life.net.br arthur at life.net.br
Sun Sep 12 14:18:45 CEST 2010


On 09/12/2010 07:28 AM, Onur Küçük wrote:
>
> On Fri, 10 Sep 2010 23:56:53 -0300
> "arthur at life.net.br"<arthur at life.net.br>  wrote:
>
>> So I also tried on python:
>> address =
>> 'http://translate.google.com/translate_tts?tl='+TTS_language+'&q='+
>> quote_plus(text.encode('utf-8'))
>
>   Technically this is correct but it should not be needed
>
>> I'm using this line to run mplayer on python
>> subprocess.Popen(['mplayer', '-slave', address], stdin=PIPE,
>> stdout=PIPE, stderr=STDOUT)
>
>   You are doing
>
>   a = subprocess.Popen....
>
>   a.communicate()
>
>   right ? It will not work if you don't do this. Also instead of just
> running it,
>
>   print a.communicate()[0]
>
>   is your friend.
>

Thank you Onur,

so with that I get the output: (that is actually the same I get from 
running in the terminal)

==================================
MPlayer SVN-r32106-4.4.3 (C) 2000-2010 MPlayer Team

Playing 
http://translate.google.com/translate_tts?tl=fr&q="%C3%A2%2C%C3%AA%2C%C3%AE%2C%C3%B4%2C%C3%BB".
Resolving translate.google.com for AF_INET6...

Couldn't resolve name for AF_INET6: translate.google.com
Resolving translate.google.com for AF_INET...
Connecting to server translate.google.com[74.125.153.139]: 80...

Cache size set to 320 KBytes
Cache fill:  7.21% (23616 bytes)

Audio only file format detected.
==========================================================================
Opening audio decoder: [mp3lib] MPEG layer-2, layer-3
AUDIO: 16000 Hz, 2 ch, s16le, 32.0 kbit/6.25% (ratio: 4000->64000)
Selected audio codec: [mp3] afm: mp3lib (mp3lib MPEG layer-2, layer-3)
==========================================================================
AO: [oss] 16000Hz 2ch s16le (2 bytes per sample)
Video: no video
Starting playback...
A:   3.9 (03.9) of 5.0 (05.0)  0.1% 0%


Exiting... (End of file)
==================================

Mplayer is actually getting the right input, but it's still making the 
wrong request: (the whole package)
	0x0000:  00d0 cb79 5670 0023 5ab3 16de 0800 4500  ...yVp.#Z.....E.
	0x0010:  00de 0853 4000 4006 1ddb d3e1 5c02 4a7d  ...S at .@.....\.J}
	0x0020:  998b 891a 0050 52b1 0938 eaa1 b234 8018  .....PR..8...4..
	0x0030:  005c fc84 0000 0101 080a 000d 0190 8317  .\..............
	0x0040:  93f8 4745 5420 2f74 7261 6e73 6c61 7465  ..GET./translate
	0x0050:  5f74 7473 3f74 6c3d 6672 2671 3d25 3232  _tts?tl=fr&q=%22
	0x0060:  c3a2 2532 43c3 aa25 3243 c3ae 2532 43c3  ..%2C..%2C..%2C.
	0x0070:  b425 3243 c3bb 2532 3220 4854 5450 2f31  .%2C..%22.HTTP/1
	0x0080:  2e30 0d0a 486f 7374 3a20 7472 616e 736c  .0..Host:.transl
	0x0090:  6174 652e 676f 6f67 6c65 2e63 6f6d 0d0a  ate.google.com..
	0x00a0:  5573 6572 2d41 6765 6e74 3a20 4d50 6c61  User-Agent:.MPla
	0x00b0:  7965 7220 5356 4e2d 7233 3231 3036 2d34  yer.SVN-r32106-4
	0x00c0:  2e34 2e33 0d0a 4963 792d 4d65 7461 4461  .4.3..Icy-MetaDa
	0x00d0:  7461 3a20 310d 0a43 6f6e 6e65 6374 696f  ta:.1..Connectio
	0x00e0:  6e3a 2063 6c6f 7365 0d0a 0d0a            n:.close....

Is there something we can do about it?

Thank you

-- 
Arthur Helfstein Fragoso
arthur at life.net.br


More information about the MPlayer-users mailing list