Hi,

attached is some workaround for controlling VLC, one using [tcpclient], and another one using dbus-send.

Both uses tcl for scripting with [hc/sys_gui]

patco

Le 06/05/2016 à 15:51, Jack a écrit :
Hello,

Now, with Pd 0.46.7 you have [netsend -b].
It allows you to send a string in 'binary' mode (you don't need anymore
to use the FUDI protocol used by netsend before).

Then, something like :

[list add file.mp4(
|
[l2s] <- from zexy library (there is vanilla solution for this)
|
[list fromsymbol]
|
[list append 10]
|
[list prepend send]
|
[list trim]
|
[netsend -b]

should work.
++

Jack



Le 06/05/2016 14:45, Mario Mey a écrit :
Hi, there. I'm trying to use PureData 0.46.7 to control VLC. Based on a
patch in https://github.com/mxa/AudioVideoPatches, that uses Python code
(pyext) to send TCP messages, I want to use [netsend] to send them,
without Python.

I start VLC with:

vlc -I rc --rc-host=localhost:1234

And, in Pd:

[connect localhost 1234(
|
|  [list add file.mp4(
|  [list prepend send]
|  [list trim]
| /
[netsend]

The connection is well done, but I discovered that the messages arrives
with a ";" at the end of the message. For example, when I click on [list
add file.mp4(, VLC says (sorry for the language):

[0x7f387c0044a8] filesystem access error: cannot open file
/home/mario/file.mp4; (No such file or directory)
[0x7f387c0044a8] main access error: Falló lectura de archivo
[0x7f387c0044a8] main access error: VLC no pudo abrir el archivo
«/home/mario/file.mp4;» (No such file or directory).
[0x7f3888005ac8] main input error: open of
`file:///home/mario/file.mp4%3B' failed
[0x7f3888005ac8] main input error: Su entrada no puede abrirse
[0x7f3888005ac8] main input error: VLC es incapaz de abrir el MRL
«file:///home/mario/file.mp4%3B». Vea el registro para más detalles.

Also, I use a simple Python script (Server code in
https://wiki.python.org/moin/TcpCommunication) to receive this messages
and, when it does, it prints:

received data: b'add file.mp4;\n'

Ssome guys from #dataflow told me that the best workaround is to make a
small program/app/script that strips semicolons. Yes, now I'm writing
it... but I would not need another program to do this.

I've never reported a Pd bug. I'm writing this mail to you to know about
this (maybe it is not necessary to report it)... and maybe someone knows
another workaround.

Thank you.

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management ->
https://lists.puredata.info/listinfo/pd-list

_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

#N canvas 767 95 972 377 10;
#X obj 20 267 sys_gui;
#X obj 20 288 print;
#X obj 20 246 r SYS_GUI;
#X obj 16 181 s SYS_GUI;
#X text 16 317 patko2015;
#X text 24 123 launch VLC with GUI;
#X obj 639 118 openpanel;
#X obj 639 101 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X text 11 228 tcl interpreter;
#X msg 639 139 add \$1;
#X obj 247 210 r vlc-server;
#X obj 227 277 t b a;
#X obj 260 299 s SYS_GUI;
#X msg 194 276 set;
#X obj 227 208 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#X msg 28 140 set pid [exec vlc -I rc &] \, pdsend [list vlc-server
$pid], f 31;
#X msg 279 278 puts 'test';
#X msg 723 141 play;
#X msg 756 162 pause;
#N canvas 198 119 565 442 tcpServer 0;
#X obj 48 174 tcpclient;
#X obj 88 200 tgl 15 0 empty empty connected 18 7 0 8 -24198 -13381
-1 1 1;
#X text 119 173 tcpclient opens a tcp socket to send and receive bytes
on;
#X floatatom 223 270 9 0 0 0 - - -, f 9;
#X floatatom 273 244 9 0 0 0 - - -, f 9;
#X text 342 243 Size of the send buffer;
#X obj 223 194 route sent buf blocked;
#X text 293 269 Number of bytes sent;
#X obj 323 220 print sender_blocked!;
#X obj 68 226 unpack 0 0 0 0;
#X floatatom 68 249 3 0 0 0 - - -, f 3;
#X floatatom 99 249 3 0 0 0 - - -, f 3;
#X floatatom 131 249 3 0 0 0 - - -, f 3;
#X floatatom 163 249 3 0 0 0 - - -, f 3;
#X text 28 248 from;
#X text 99 300 Received messages are output as a list of bytes;
#X text 174 329 Attempting to print long messages can hang Pd!;
#X obj 137 99 any2string 0 -1;
#X msg 155 55 disconnect;
#X obj 49 4 inlet;
#X obj 49 26 t a b;
#X obj 128 19 inlet;
#X obj 49 403 outlet;
#X obj 135 120 list append 13 10;
#X obj 49 331 bytes2any 128 32;
#X obj 139 388 spigot;
#X obj 137 411 print >>>;
#X obj 188 384 tgl 15 0 empty empty print 18 7 0 8 -24198 -13381 -1
1 1;
#X obj 131 353 bytes2any 128 0;
#X connect 0 0 24 0;
#X connect 0 0 28 0;
#X connect 0 1 9 0;
#X connect 0 2 1 0;
#X connect 0 3 6 0;
#X connect 6 0 3 0;
#X connect 6 1 4 0;
#X connect 6 2 8 0;
#X connect 9 0 10 0;
#X connect 9 1 11 0;
#X connect 9 2 12 0;
#X connect 9 3 13 0;
#X connect 17 0 23 0;
#X connect 18 0 0 0;
#X connect 19 0 20 0;
#X connect 20 0 17 0;
#X connect 21 0 0 0;
#X connect 23 0 0 0;
#X connect 24 0 22 0;
#X connect 25 0 26 0;
#X connect 27 0 25 1;
#X connect 28 0 25 0;
#X restore 482 213 pd tcpServer;
#X obj 20 37 cnv 15 20 20 empty empty 1 2 10 0 14 -233017 -66577 0
;
#X obj 564 12 cnv 15 20 20 empty empty 2 2 10 0 14 -233017 -66577 0
;
#X obj 665 71 cnv 15 20 20 empty empty 3 3 10 0 14 -233017 -66577 0
;
#X msg 758 141 stop;
#X msg 16 77 set pid [exec vlc -I rc --rc-host 127.0.0.1:5555 &] \,
pdsend [list vlc-server $pid], f 42;
#X msg 563 37 connect 127.0.0.1 5555;
#X msg 482 106 help;
#X msg 227 255 exec kill -9 6257;
#X msg 247 230 set exec kill -9 \$1;
#X msg 815 164 volume \$1;
#X text 379 87 prints vlc help to console;
#N canvas 31 58 642 321 get_time 0;
#X obj 144 11 inlet;
#X obj 142 36 t a a;
#X obj 175 142 spigot;
#X msg 142 114 1;
#X obj 175 164 t b a;
#X msg 228 157 0;
#X obj 142 55 list;
#X obj 441 51 spigot;
#X obj 441 73 t b a;
#X msg 494 66 0;
#X msg 479 28 1;
#X obj 142 95 sel pos: state:;
#X obj 437 109 sel 2 4;
#X msg 437 138 1;
#X msg 474 138 0;
#X obj 437 170 metro 2000;
#X obj 207 184 list split 1;
#X obj 72 75 route bang;
#X obj 126 249 outlet percent;
#X obj 237 249 outlet seconds;
#X msg 437 194 get_time;
#X obj 437 219 outlet retrig;
#X connect 0 0 1 0;
#X connect 1 0 6 0;
#X connect 1 1 2 0;
#X connect 1 1 7 0;
#X connect 2 0 4 0;
#X connect 3 0 2 1;
#X connect 4 0 5 0;
#X connect 4 1 16 0;
#X connect 5 0 2 1;
#X connect 6 0 17 0;
#X connect 7 0 8 0;
#X connect 8 0 9 0;
#X connect 8 1 12 0;
#X connect 9 0 7 1;
#X connect 10 0 7 1;
#X connect 11 0 3 0;
#X connect 11 1 10 0;
#X connect 12 0 13 0;
#X connect 12 1 14 0;
#X connect 13 0 15 0;
#X connect 14 0 15 0;
#X connect 15 0 20 0;
#X connect 16 0 18 0;
#X connect 16 1 19 0;
#X connect 17 1 11 0;
#X connect 20 0 21 0;
#X restore 483 286 pd get_time;
#X symbolatom 500 351 10 0 0 0 - - -, f 10;
#X floatatom 586 351 5 0 0 0 - - -, f 5;
#X text 666 101 add media file;
#X text 40 62 launch VLC without GUI;
#X obj 814 123 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144
-1 -1 5;
#X text 201 189 kill vlc;
#X text 17 -1 VLC tcp socket interfacing with hc/sys_gui moocow/bytes2any
and mrpeach/tcpclient (unix only);
#X obj 814 144 * 40;
#X obj 171 188 cnv 15 20 20 empty empty 4 3 10 0 14 -233017 -66577
0;
#X connect 0 0 1 0;
#X connect 2 0 0 0;
#X connect 6 0 9 0;
#X connect 7 0 6 0;
#X connect 9 0 19 0;
#X connect 10 0 28 0;
#X connect 11 0 13 0;
#X connect 11 1 12 0;
#X connect 13 0 27 0;
#X connect 14 0 27 0;
#X connect 15 0 3 0;
#X connect 16 0 12 0;
#X connect 17 0 19 0;
#X connect 18 0 19 0;
#X connect 19 0 31 0;
#X connect 23 0 19 0;
#X connect 24 0 3 0;
#X connect 25 0 19 1;
#X connect 26 0 19 0;
#X connect 27 0 11 0;
#X connect 28 0 27 0;
#X connect 29 0 19 0;
#X connect 31 0 32 0;
#X connect 31 1 33 0;
#X connect 31 2 19 0;
#X connect 36 0 39 0;
#X connect 39 0 29 0;
#N canvas 125 218 746 299 10;
#X obj 17 235 sys_gui;
#X obj 629 215 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1;
#N canvas 31 63 450 300 Setproperties 0;
#X obj 27 46 inlet;
#X msg 27 114 org.freedesktop.DBus.Properties.Set string:org.mpris.MediaPlayer2.Player
string:\$1 variant:double:\$2;
#X obj 27 168 s dbus-send;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X restore 589 111 pd Setproperties;
#X obj 589 47 hradio 15 1 0 8 empty empty empty 0 -8 0 10 -262144 -1
-1 6;
#X obj 17 214 r SYS_GUI;
#N canvas 31 141 441 220 dbus-send 0;
#X obj 19 144 list trim;
#X obj 19 52 r dbus-send;
#X obj 19 168 s SYS_GUI;
#X obj 19 94 list prepend exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.vlc
/org/mpris/MediaPlayer2;
#X connect 0 0 2 0;
#X connect 1 0 3 0;
#X connect 3 0 0 0;
#X restore 149 215 pd dbus-send;
#X obj 17 142 s SYS_GUI;
#X msg 29 117 exec vlc -I dummy --control dbus &;
#X obj 589 89 list prepend Volume;
#X msg 17 72 exec vlc --control dbus &;
#X text 15 16 patko2015;
#X text 16 53 launch VLC with GUI;
#X text 52 101 no GUI;
#N canvas 516 107 517 300 introspect 0;
#X obj 60 194 s SYS_GUI;
#X msg 60 129 exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.vlc
/org/mpris/MediaPlayer2 org.freedesktop.DBus.Introspectable.Introspect
> /dev/tty;
#X text 121 77 this outputs all parameters in tty console;
#X connect 1 0 0 0;
#X restore 140 271 pd introspect;
#X obj 357 63 openpanel;
#X obj 357 25 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1;
#X text 8 196 tcl interpreter;
#N canvas 29 51 507 300 trackList 0;
#X obj 46 36 openpanel;
#X obj 46 13 inlet;
#X obj 44 95 s dbus-send;
#X msg 45 61 org.mpris.MediaPlayer2.TrackList.AddTrack string:file://\$1
objpath:/org/mpris/MediaPlayer2/AddTrack boolean:true;
#X connect 0 0 3 0;
#X connect 1 0 0 0;
#X connect 3 0 2 0;
#X restore 629 241 pd trackList;
#X obj 589 67 / 7;
#X msg 383 127 Play;
#X msg 376 103 Pause;
#X text 129 195 dbus message prepend;
#X text 95 252 get interface methods and properties;
#X text 379 24 open media file;
#X text 586 28 set volume;
#N canvas 522 116 495 299 position 0;
#X obj 29 15 inlet;
#X obj 298 200 r vlc-pos;
#X obj 29 206 s SYS_GUI;
#X msg 29 114 set pos [exec dbus-send --print-reply --dest=org.mpris.MediaPlayer2.vlc
/org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:org.mpris.MediaPlayer2.Player
string:Position] \, pdsend [list vlc-pos [lindex $pos end]];
#X obj 29 53 metro 100;
#X obj 298 226 / 1e+06;
#X obj 298 262 outlet;
#X connect 0 0 4 0;
#X connect 1 0 5 0;
#X connect 3 0 2 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
#X restore 497 228 pd position;
#X text 12 -1 DBUS interfacing with hc/sys_gui tcl interpreter;
#X msg 371 249 Quit;
#X msg 361 225 Raise;
#N canvas 31 63 450 300 player.methods 0;
#X obj 85 46 inlet;
#X msg 172 128 org.mpris.MediaPlayer2.Player.\$1;
#X obj 103 193 s dbus-send;
#X obj 104 163 list append;
#X obj 85 100 list split 1;
#X connect 0 0 4 0;
#X connect 1 0 3 0;
#X connect 3 0 2 0;
#X connect 4 0 1 0;
#X connect 4 1 3 1;
#X restore 357 181 pd player.methods;
#N canvas 31 58 450 300 methods 0;
#X obj 85 46 inlet;
#X obj 103 193 s dbus-send;
#X obj 104 163 list append;
#X obj 85 100 list split 1;
#X msg 171 127 org.mpris.MediaPlayer2.\$1;
#X connect 0 0 3 0;
#X connect 2 0 1 0;
#X connect 3 0 4 0;
#X connect 3 1 2 1;
#X connect 4 0 2 0;
#X restore 361 273 pd methods;
#X text 241 270 or use d-feet;
#X floatatom 497 251 5 0 0 0 - - -, f 5;
#X obj 497 203 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1
1;
#X text 514 201 get position;
#X text 536 251 in seconds;
#X msg 431 160 Seek int64:\$1;
#X text 335 44 can not handle path with spaces;
#X obj 15 35 cnv 15 20 20 empty empty 1 2 10 0 14 -233017 -66577 0
;
#X obj 323 24 cnv 15 20 20 empty empty 2 2 10 0 14 -233017 -66577 0
;
#X msg 357 82 OpenUri string:file://[list \$1];
#X floatatom 432 143 5 0 0 0 - - -, f 5;
#X obj 85 278 print;
#X obj 16 256 route bang;
#X connect 0 0 43 0;
#X connect 1 0 17 0;
#X connect 3 0 18 0;
#X connect 4 0 0 0;
#X connect 8 0 2 0;
#X connect 9 0 6 0;
#X connect 14 0 40 0;
#X connect 15 0 14 0;
#X connect 18 0 8 0;
#X connect 19 0 29 0;
#X connect 20 0 29 0;
#X connect 25 0 32 0;
#X connect 27 0 30 0;
#X connect 28 0 30 0;
#X connect 33 0 25 0;
#X connect 36 0 29 0;
#X connect 40 0 29 0;
#X connect 41 0 36 0;
#X connect 43 1 42 0;
_______________________________________________
Pd-list@lists.iem.at mailing list
UNSUBSCRIBE and account-management -> 
https://lists.puredata.info/listinfo/pd-list

Reply via email to