-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathscripts.html
More file actions
1456 lines (1404 loc) · 68 KB
/
scripts.html
File metadata and controls
1456 lines (1404 loc) · 68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html>
<head>
<title>Jumpy - Scripts</title>
<style type="text/css">
.black {
color: black;
}
.orange {
color: #ff6600;
}
.comment, .comment a {
color: dimgrey;
}
ul {
list-style-type: disc;
}
.comment a:link a:visited a:hover a:active {
text-decoration:none;
}
.icon{
padding:8;
}
.icon:hover{
background:#808080;
}
pre, code {
-moz-tab-size: 4;
-o-tab-size: 4;
tab-size: 4;
/*color:darkblue;*/
color:#0000BB;
text-decoration: none;
/*font-weight: bold;*/
}
code {
white-space: pre;
}
kbd {
/*color:darkblue;*/
color:#0000BB;
text-decoration: none;
font-weight: bold;
}
body {
font-family: sans-serif;
padding-left: 2em;
width: 50em;
}
table {
border-collapse:collapse;
}
td {
vertical-align:top;
padding-right: 1em;
}
div.contents {
position: fixed;
height: auto;
width: 12em;
top: 2em;
left: 2em;
right: 5px;
/* text-align: right;*/
font-size: small;
}
div.main {
width: 45em;
margin-left: 15em;
}
.thumb {
cursor:pointer;
}
</style>
<script type="text/javascript">
function preview(img, bg) {
var style=document.getElementById("preview").style;
style.background="url("+img.getAttribute('src')+")";
var cap=document.getElementById("caption");
cap.innerHTML='';
cap.appendChild(document.createTextNode(img.getAttribute('title')));
}
</script>
</head>
<body>
<div class="contents">
<ul style="list-style-type:none;padding:0px;margin:10px;white-space:nowrap;">
<center><a href="readme.html">BASICS</a></center><br/>
<li><a href="readme.html#QUICKSETUP">Quick Setup</a></li>
<li><a href="readme.html#REQUIREMENTS">Requirements</a></li>
<li><a href="readme.html#XBMC">Kodi Installation</a></li>
<li><a href="readme.html#PHANTOMJS">PhantomJS Installation</a></li>
<li><a href="readme.html#INSTALLATION">Plugin Installation</a></li>
<li><a href="readme.html#SHORTPATHS">Windows Short Paths</a></li>
<li><a href="readme.html#BOOKMARKS">Bookmarks</a></li>
<li><a href="readme.html#LOGCONF">Log and Conf</a></li>
<li><a href="readme.html#BUGS">Bugs</a></li>
<li><a href="readme.html#SCRIPTSINI">jumpy-scripts.ini</a></li>
<li><a href="readme.html#WEBREADER">Webreader</a></li>
<li><a href="readme.html#FEEDREADER">Feedreader</a></li>
<li><a href="readme.html#RESOLVER">Resolver</a></li>
<li><a href="readme.html#EARMARKER">Earmarker</a></li>
<li><a href="readme.html#CAPTURE">Capture</a></li>
<br/>
<center><a href="#SCRIPTS">SCRIPTS</a></center><br/>
<li><a href="#QUICKSTART">Quick Start</a></li>
<li><a href="#QUICKSTARTPLAYER">Quick Start - Players</a></li>
<li><table><tr><td><a href="#API">API</a><td>
<select style="display:block;border:none;color:#0000BB;background-color:#FFFFFF;font-family:monospace" onchange="document.location.href='#'+this.options[this.selectedIndex].innerHTML">
<option>addAction</option>
<option>addAudio</option>
<option>addAudiofeed</option>
<option>addBookmark</option>
<option>addCmd</option>
<option>addConsoleCmd</option>
<option>addFolder</option>
<option>addImage</option>
<option>addImagefeed</option>
<option>addISO</option>
<option>addItem</option>
<option>addMedia</option>
<option>addPath</option>
<option>addPlayer</option>
<option>addPlaylist</option>
<option>addUnresolved</option>
<option>addVideo</option>
<option>addVideofeed</option>
<option>err</option>
<option>esc</option>
<option>getFolderName</option>
<option>getHome</option>
<option>getHostIP</option>
<option>getLogDir</option>
<option>getPluginJar</option>
<option>getProfileDir</option>
<option>getProperty</option>
<option>getResource</option>
<option>getVar</option>
<option>getXmbPath</option>
<option>imgfx</option>
<option>info</option>
<option>log</option>
<option>mkDirs</option>
<option>ok</option>
<option>popVar</option>
<option>readConf</option>
<option>reboot</option>
<option>refresh</option>
<option>register</option>
<option>restart</option>
<option>run</option>
<option>setEnv</option>
<option>setIcon</option>
<option>setInfo</option>
<option>setPath</option>
<option>setProperty</option>
<option>setSubtitles</option>
<option>setVar</option>
<option>version</option>
<option>vmsg</option>
<option>warn</option>
</select></td></tr></table>
</li>
<li><a href="#OTHERSCRIPTS">Other Languages</a></li>
<!--<li><a href="#ARRAY">Array Notation</a></li>-->
<li><a href="#PLAYERS">Players</a></li>
<li><a href="#INTERPRETERS">Interpreters</a></li>
<li><a href="#ICONS">Icons</a></li>
<li><a href="#JUMPSTART">Jumpstarting Scripts</a></li>
<li><a href="#EXAMPLES">Examples</a></li>
<!--<ul>-->
<!--<a href="#HELLOPY">py</a></li> <a href="#HELLOSH">sh</a>-->
<!--<a href="#HELLOPL">pl</a> <a href="#HELLOBAT">bat</a</li>-->
<!--</ul>-->
<!--<center>LINKS</center><br/>-->
<br/>
<li><a href="http://sourceforge.net/projects/jumpy-plugin/files/">Download</a></li>
<li><a href="http://www.universalmediaserver.com/forum/viewtopic.php?f=6&t=288">Forum</a></li>
<li><a href="https://github.com/skeptical/jumpy">Code</a></li>
</ul>
</div>
<div class="main">
<a name="SCRIPTS"><H3 style="color:darkblue"><center><span class="orange">SCRIPTS</span></center></H3></a>
Any arbitrary system command qualifies as a 'script' which jumpy will execute and listen for
<a href="#API">API</a> calls while it's running. Generally your script does its thing, maybe adds
some items to the xmb and exits. If your needs are simple and/or you prefer reading code, skip to <a href="#QUICKSTART">Quick Start</a> or
<a href="#EXAMPLES">Examples</a>, otherwise here are a few basics:
<br/><br/>
<ul>
<li>A script is always run in its own directory.
</li>
<li>A script doesn't necessarily need to interact with the API.
</li>
<li>Python scripts found inside '<i>plugins/jumpy</i>' are called automatically at startup
with no arguments. You can only add folders during this first call.
</li>
<li>Other scripts can be located anywhere, and are registered with Jumpy by means of <a href="readme.html#SCRIPTSINI">jumpy-scripts.ini</a>.
They can be called at startup, shutdown, or placed on the xmb for future use.
</li>
<li>Any folder item added with <a href="#addItem"><kbd>addItem</kbd></a> will execute whatever command
you've specified in the <code>cmd</code> parameter when the user clicks on it in the future. Usually you will want
your future command to call the same script but with different arguments.
</li>
<li>Commands with '<code>&</code>' as the last argument will be launched asynchronously.</li>
<li>Any media item you add will be passed along to PMS for normal processing.
</li>
<li>Python scripts communicate with Jumpy via internal <a href="#API">API</a> calls to the jumpy python module.
</li>
<li>Other scripts communicate with Jumpy by using an equivalent <i><a href="#OTHERSCRIPTS">command-line syntax</a></i>
to make API calls on the system.
</li>
<li>The script's runtime environment is set such that PMS' standard binary tools
<ul><code><i>ffmpeg mplayer vlc mencoder tsmuxer flac<br/>eac3to dcraw and convert (imagemagick)</i></code></ul>
if present are in the system PATH and can be launched just by name.</li>
</ul>
<br/>
<b><a name="QUICKSTART">Quick Start</a></b>
<ul>If all you need is to run some arbitrary command, create a section in <i><a href="readme.html#SCRIPTSINI">jumpy-scripts.ini</a></i>
(located wherever <i>PMS.conf</i> is) modeled on these:
<ul>
<pre>
<i class="comment">; Create the folder "Jumpy > my scripts > testing > hello" on the xmb</i>
<i class="comment">; containing an action labeled 'click me' which will run the command</i>
<i class="comment">; 'echo hello' when the user clicks on it.</i>
[my scripts/testing/hello]
cmd = pms addCmd "click me" "echo hello"
<i class="comment">; Run the command 'echo "foo"' at startup</i>
<i class="comment">; (note the '+' which means 'execute at startup').</i>
[+foo]
cmd = echo "foo"
<i class="comment">; Run the command 'echo "bar"' at shutdown</i>
<i class="comment">; (note the '-' which means 'execute at shutdown').</i>
[-bar]
cmd = echo "bar"</pre>
</ul>
and restart PMS. Any output from your command will appear in <i><a href="#LOGCONF">jumpy.log</a></i>.
</ul>
<br/>
<b><a name="QUICKSTARTPLAYER">Quick Start - Players</a></b>
<ul>A player can be as simple as a single command. Here's one to
play your <i>mpegs</i> and <i>vobs</i> upside-down, defined as a one-liner in <i><a href="readme.html#SCRIPTSINI">jumpy-scripts.ini</a></i>:
<ul><pre style="overflow:auto">
[+flipflop]
cmd = pms addPlayer flipflop <i><span class="orange">"ffmpeg -y -i '${filename}' -vf 'vflip,hflip' -target ntsc-dvd ${outfile}"</i></span> "f:mpg|vob m:video/mpeg"
</pre>
</ul>
If you want to try it out add it to <i>jumpy-scripts.ini</i>, restart and look for <i>flipflop</i> items in
the <i>#--TRANSCODE--#</i> folder, since mpegs are likely streamed as-is by default.
<br/><br/>
For details see <a href="#addPlayer"><code>pms.addPlayer</code></a>, and
<a href="#PLAYERS">Players</a>.
</ul>
<br/>
<b><a name="API">API</a></b>
<ul>
The python API is initialized on import
<pre>import jumpy</pre>
defining a global object <kbd>pms</kbd> (i.e. the current xmb folder) with the following methods:
<br/><br/>
<li><a name="addFolder"></a><kbd>pms.addFolder</kbd><code>(name, cmd, thumb<i>=None</i>)</code><br/>
<a name="addBookmark"></a><kbd>pms.addBookmark</kbd><code>(name, cmd, thumb<i>=None</i>)</code><br/>
<a name="addAudio"></a><kbd>pms.addAudio</kbd><code>(name, cmd, thumb<i>=None</i>, details<i>=None</i>)</code><br/>
<a name="addImage"></a><kbd>pms.addImage</kbd><code>(name, cmd, thumb<i>=None</i>, details<i>=None</i>)</code><br/>
<a name="addVideo"></a><kbd>pms.addVideo</kbd><code>(name, cmd, thumb<i>=None</i>, details<i>=None</i>)</code><br/>
<a name="addPlaylist"></a><kbd>pms.addPlaylist</kbd><code>(name, cmd, thumb<i>=None</i>)</code><br/>
<a name="addISO"></a><kbd>pms.addISO</kbd><code>(name, cmd, thumb<i>=None</i>)</code><br/>
<a name="addAudiofeed"></a><kbd>pms.addAudiofeed</kbd><code>(name, cmd, thumb<i>=None</i>)</code><br/>
<a name="addImagefeed"></a><kbd>pms.addImagefeed</kbd><code>(name, cmd, thumb<i>=None</i>)</code><br/>
<a name="addVideofeed"></a><kbd>pms.addVideofeed</kbd><code>(name, cmd, thumb<i>=None</i>)</code><br/>
<ul> Convenience functions for <code>pms.addItem</code> with the appropriate
<code>type</code> built-in.</ul>
</li>
<br/>
<li><a name="addItem"><kbd>pms.addItem</kbd><code>(type, name, cmd, thumb<i>=None</i>, details<i>=None</i>)</code></a>
<br/>or<br/>
<kbd>pms.addItem</kbd><code>(type, name, [cmd, argv1, argv2, ...], thumb<i>=None</i>, details<i>=None</i>)</code><br/><br/>
where
<ul>
<li><code>type</code> is one of these constants:
<pre>
<i class="comment"># media items # dynamic items</i>
PMS_AUDIO PMS_FOLDER
PMS_IMAGE PMS_BOOKMARK
PMS_VIDEO PMS_ACTION
PMS_UNKNOWN
PMS_PLAYLIST <i class="comment"># hybrid items</i>
PMS_ISO PMS_MEDIA
PMS_AUDIOFEED PMS_UNRESOLVED
PMS_IMAGEFEED
PMS_VIDEOFEED
</pre>
</li>
<li><a name="esc"></a><code>name</code> is the item's label.
<ul><li><a name="UNIXPATH"/>Using a unix-style path as the label (e.g. '<code>myscripts/perl/foo</code>')
will create the specified path on the xmb, branching from the current folder if relative or the xmb
root if absolute. Also:
<ul>
<li>'<code>~</code>' is the <i>Jumpy</i> folder.</li>
<li>If there's any chance your label may contain a literal '<code><span class="orange">/</span></code>'
use <i><b>pms.esc</b></i> to escape it:
<ul><code>pms.addVideo(pms.esc('<i>Part 1<span class="orange">/</span>2</i>'), '<i>part1.mpg</i>')</code></ul></li>
</ul>
</li>
</ul>
</li>
<br/>
<li><code>cmd</code> is either a command or a uri depending on the given <code>type</code>:
<ul>
<br/>
<li>For <b>dynamic items</b> <code>cmd</code> is the command
to be executed in the future when the user opens the folder on the xmb. It can be either:
<ol type=A>
<li>a typical command string to be parsed according to the usual system rules.
</li>
<li>a python list of strings, i.e. a command array.
</li>
<li><a name="ARRAY"/>a special delimited string
describing a flattened command array using the following <b><i>array notation syntax</i></b>:
<ul>
<code>"<span class="orange">[</span>command<span class="orange"> , </span>arg1<span class="orange"> , </span>arg2<span class="orange"> , </span>arg3<span class="orange"> , </span>arg4 ... <span class="orange">]</span>"</code>
</ul>
where the rules are:
<ol>
<li>enclose your array in square <code><span class="orange">[]</span></code> brackets.
</li>
<li>delimit your args using a comma with a space on both sides, i.e. '<code><span class="orange"> , </span></code>'.
</li>
</ol>
for example <code>"<span class="orange">[</span>echo<span class="orange"> , </span>hello world<span class="orange">]</span>"</code>.
This form avoids embedded quotes when your args contain spaces, and is useful for other languages making
system calls to the API.
</ol>
</li>
</li>
<br/>
<li>For <b>media items</b> <code>cmd</code> is a single resolved media path/url to be passed along to PMS for normal
processing.
</li>
<br/>
<li>For <b>hybrid items</b> <code>cmd</code> can be either a path/url or a command, depending on how you use it.
</li>
<br/>
<li>as a command it can include the runtime variable <code>${home}</code> which expands to the jumpy home folder.</ul>
</li>
</li>
<br/>
<li><a name="thumb"></a><code>thumb</code> is the item's thumbnail image, and can be either
<ul>
<li>a path or url to to an image file.</li>
<li>or the name of a pre-defined <a href="#ICONS">icon</a>.</li>
</ul>
To control color, shading and other effects an optional <a href="#FX"><i>+fx string</i></a> can be
appended here (see <a href="#ICONS">icons</a> for syntax examples).
</li>
<br/>
<li><a name="details"></a><code>details</code> is a python dict describing the item's detailed properties
with any of the following keys:
<ul>
<li><a name="media"></a><code>media</code>: a dict of media properties with any of these keys:
<ul>
<li><code>duration</code>: a time string in <i>seconds</i> or <i>hh:mm:ss</i> format.</li>
<li><code>size</code>: the total number of bytes.</li>
<li><code>streams</code>: a list of dicts each describing one stream and containing the
mandatory key <code>type</code> which determines what other keys are valid (all values are strings).
<code>type</code> can be:
<ul>
<li><code>video</code>, where associated keys are <code>codec</code>, <code>aspect</code>, <code>width</code>, <code>height</code>, <code>duration</code>.
Only one video stream is allowed.
</li>
<li><code>audio</code>, where associated keys are <code>codec</code>, <code>language</code>, <code>channels</code>.
</li>
<li><code>subtitle</code>, where the associated key is <code>language</code>.
</li>
</ul>
</li>
</ul>
</li>
<li><code>headers</code>: a dict of http headers to be set when <code>cmd</code> is a url.</li>
</ul>
</li>
for example
<ul>
<code>{
'media': {
'duration': <i class="comment">'12:34'</i>,
'size': <i class="comment">'7654321'</i>,
'streams': [
{'type': <i class="comment">'video'</i>, 'width': <i class="comment">'720'</i>, 'height': <i class="comment">'480'</i>},
{'type': <i class="comment">'audio'</i>, 'channels': <i class="comment">'2'</i>},
{'type': <i class="comment">'subtitle'</i>, 'language': <i class="comment">'eng'</i>},
{'type': <i class="comment">'subtitle'</i>, 'language': <i class="comment">'jpn'</i>}
]
},
'headers': { 'User-Agent': <i class="comment">'my ua'</i>, 'Cookie': <i class="comment">'foo=x; bar=y;'</i>}
}</code>
</ul>
</ul>
</li>
<br/>
<li><a name="addUnresolved"><kbd>pms.addUnresolved</kbd><code>(name, cmd, thumb<i>=None</i>, type<i>=PMS_VIDEO</i>, details<i>=None</i>)</code></a>
<ul>
Add an incomplete media item whose final uri/url will be resolved at playback, where
<ul>
<li><code>cmd</code> is either:
<ul>
<li>a command array (a python list, or a string in <a href="#ARRAY">array notation syntax</a>) that when executed will deliver the final url either via
the API (<code>addVideo</code>, <code>addAudio</code> etc)
or by printing it to stdout.
</li>
<li>a url resolvable by the built-in resolver support (e.g. via <i>kodi</i> or <i>youtube-dl</i> if installed).
</li>
</ul>
</li>
<li><code>type</code> is the item's expected media type - see <a href="#addItem"><code>addItem</code></a>.
</li>
<li><code>name</code>, <code>thumb</code>, <code>mediainfo</code> - see <a href="#addItem"><code>addItem</code></a>.
</li>
</ul>
</ul>
</li>
<br/>
<li><a name="addAction"><kbd>pms.addAction</kbd><code>(name, cmd, thumb<i>=None</i>, playback<i>=None</i>)</code></a>
<ul>
Add an mpeg video item to launch a command that ultimately produces video, where
<ul>
<li><code>name</code> is the item's label (or unix-style path), see <a href="#addItem"><code>addItem</code></a>.
</li>
<li><code>cmd</code> is the command to be executed when the user clicks the item,
and can include the <code>${filename}</code>, <code>${outfile}</code>, and <code>${home}</code>
runtime variables.
see <code>cmd</code> under <a href="#addPlayer"><code>addPlayer</code></a>.
</li>
<li><code>thumb</code> is the item's thumbnail image, see <a href="#thumb"><code>thumb</code></a> under <code>addItem</code>..
</li>
<li><code>playback</code> is a string to control delay and buffering, see <a href="#PLAYBACK">addPlayer</a>.
</li>
</ul>
the video could be generated using <a href="#vmsg"><code>pms.ok()</code></a>, <code>pms.info()</code> and so on in your script.
</ul>
</li>
<br/>
<li><a name="addCmd"><kbd>pms.addCmd</kbd><code>(name, cmd, ok<i>='Success'</i>, fail<i>='Failed'</i>, thumb<i>=None</i>)</code></a>
<ul>
Add an mpeg video item to run a command and automatically show a video message based on the
outcome, where
<ul>
<li><code>ok</code> is the message to display if its exit code is 0.</li>
<li><code>fail</code> is the message to display if its exit code is non-zero.</li>
<li><code>name</code>, <code>cmd</code>, <code>thumb</code> - see <a href="#addAction"><code>addAction</code></a>.
</li>
</ul>
</ul>
</li>
<br/>
<li><a name="addConsoleCmd"><kbd>pms.addConsoleCmd</kbd><code>(name, cmd, thumb<i>=None</i>)</code></a>
<ul>
Add an mpeg video item to run a command and automatically show its console output as a
video, where
<ul>
<li><code>name</code>, <code>cmd</code>, <code>thumb</code> - see <a href="#addAction"><code>addAction</code></a>.
</li>
</ul>
</ul>
</li>
<br/>
<li><a name="addMedia"><kbd>pms.addMedia</kbd><code>(name, format, cmd, thumb<i>=None</i>)</code></a>
<ul>
Add a generic media item containing properties set by the user which will presumably
be handled by a corresponding user-defined player, where
<ul>
<li><code>name</code> is the item's label (or unix-style path), see <a href="#addItem"><code>addItem</code></a>.
</li>
<li><code>format</code> is a string specifying the item's media format, followed by optional
user-defined properties in the form:
<ul><code>media_format<span class="orange">:</span>delay_seconds<span class="orange">:</span>buffer_mb<span class="orange">+</span>userdata</code></ul>
where
<ul>
<li><code>delay_seconds<span class="orange">:</span>buffer_mb</code> uses the syntax of
<code>playback</code> in <a href="#PLAYBACK"><code>addplayer</code></a>.</li>
<li><code>userdata</code> is any string defined by you.</li>
</ul>
e.g.
<ul><code>foo
foo<span class="orange">+</span>myFooData
foo<span class="orange">:</span>10<span class="orange">+</span>myFooData
foo<span class="orange">:</span>-1<span class="orange">:</span>20<span class="orange">+</span>myFooData
</code></ul>
</li>
<li><code>cmd</code> is the command to be executed when the user clicks the item,
and can include the <code>${filename}</code>, <code>${outfile}</code>, <code>${format}</code>, <code>${userdata}</code>, and <code>${home}</code>
runtime variables.
see <code>cmd</code> under <a href="#addPlayer"><code>addPlayer</code></a>.
</li>
<li><code>thumb</code> is the item's thumbnail image, see <a href="#thumb"><code>thumb</code></a> under <code>addItem</code>..
</li>
</ul>
</ul>
</li>
<br/>
<li><a name="addPath"><kbd>pms.addPath</kbd><code>(path<i>=None</i>)</code></a>
<ul>
<li><code>path</code> is a path segment to be prefixed to the system PATH when the item is executed in the future.
</li>
<li>You typically set this once at the beginning, after which any descendants will inherit it. Its value builds incrementally, and
can be cleared to its initial value for the current folder using <code>pms.addPath()</code> with path omitted.
</li>
<li>For python scripts <code>path</code> will also be appended to <a href="http://docs.python.org/using/cmdline.html#environment-variables"><code>PYTHONPATH</code></a>.
<code>PYTHONPATH</code> tells python where to import any uninstalled modules you may be using.
</li>
</ul>
</li>
<br/>
<li><a name="setEnv"><kbd>pms.setEnv</kbd><code>(name<i>=None</i>, val<i>=None</i>)</code></a>
<ul>
Define an environment variable to be set when the current folder or its descendants are executed in the future. Also
<ul>
<li><code>pms.setEnv('<i>foo</i>')</code> with no <code>val</code> will remove the variable '<i>foo</i>'.
</li>
<li><code>pms.setEnv()</code> without args will clear the current user-defined variables.
</li>
</ul>
</ul>
</li>
<br/>
<li><a name="version"><kbd>pms.version</kbd><code>()</code></a>
<ul>Get jumpy's version.
</ul>
</li>
<br/>
<li><a name="getHome"><kbd>pms.getHome</kbd><code>()</code></a>
<ul>Get jumpy's home path.
</ul>
</li>
<br/>
<li><a name="getHostIP"><kbd>pms.HostIP</kbd><code>()</code></a>
<ul>Get the local IP of PMS/UMS.
</ul>
</li>
<br/>
<li><a name="getFolderName"><kbd>pms.getFolderName</kbd><code>()</code></a>
<ul>Get the name of the current xmb folder.
</ul>
</li>
<br/>
<li><a name="getXmbPath"><kbd>pms.getXmbPath</kbd><code>()</code></a>
<ul>Get the full path of the current xmb folder.
</ul>
</li>
<br/>
<li><a name="mkDirs"><kbd>pms.mkDirs</kbd><code>(path, thumb<i>=None</i>)</code></a>
<ul>Create the given (unix-style) <code>path</code> on the xmb and set
<code>thumb</code> as the end folder's thumbnail.
</ul>
</li>
<br/>
<li><a name="getProfileDir"><kbd>pms.getProfileDir</kbd><code>()</code></a>
<ul>Get the path to the PMS profile directory's 'jumpy' subfolder (where confs can be read/written).
</ul>
</li>
<br/>
<li><a name="getLogDir"><kbd>pms.getLogDir</kbd><code>()</code></a>
<ul>Get the PMS log path (where logs can be written).
</ul>
</li>
<br/>
<li><a name="getPluginJar"><kbd>pms.getPluginJar</kbd><code>()</code></a>
<ul>Get the path to the running <i>jumpy.jar</i>.
</ul>
</li>
<br/>
<li><a name="register"><kbd>pms.register</kbd><code>(obj)</code></a>
<ul>Register a python object with the java side. This is currently for
asynchronous commands (i.e. with '<code>&</code>' as the last argument)
to signal "ready" <i><u>if</u></i> they have first
requested a temporary suspension of execution in java by setting
<code>pms_await</code> prior to importing jumpy. For example:<pre>
pms_await = True <i class="comment"># request java execution to halt</i>
import jumpy
<i class="comment"># ... # init</i>
pms.register(True) <i class="comment"># signal java execution to proceed</i>
<i class="comment"># ... # asynchronous activity</i>
<pre>
</ul>
</li>
<!--<br/>-->
<li><a name="refresh"><kbd>pms.refresh</kbd><code>(up<i>=0</i>)</code></a>
<ul>Mark the current folder and its ancestors <i>n</i> levels <code>up</code> for refresh. Note that how
and when the refresh actually takes effect is renderer-dependent, usually requiring re-entry into
the folder on the xmb.
</ul>
</li>
<br/>
<li><a name="restart"><kbd>pms.restart</kbd><code>()</code></a>
<ul>Restart PMS' http server.
</ul>
</li>
<br/>
<li><a name="reboot"><kbd>pms.reboot</kbd><code>()</code></a>
<ul>Restart PMS itself.
</ul>
</li>
<br/>
<li><a name="run"><kbd>pms.run</kbd><code>(cmd, name<i>=None</i>)</code></a>
<ul>Run the given command and return its exit code as a string.
<ul>
<li>Commands with '<code>&</code>' as the last argument
(whether in Windows or unix) are launched
asynchronously and automatically killed if still alive at program shutdown.
</li>
<li>If given, <code>name</code> is used to identify the process in the log. Otherwise
name is taken from the calling object or executable.
</li>
</ul>
</ul>
</li>
<br/>
<li><a name="getVar"><kbd>pms.getVar</kbd><code>(key)</code></a>
<ul>Get a previously set session variable from <i>jumpy</i> (or <code>''</code> if not found), including the predefined ones below:
<br/>
<ul>
<table>
<tr><td><code>librtmp</code></td><td>:</td><td><code>'true'</code> if ffmpeg is compiled with <i class=comment>--enable-librtmp</i>.</td></tr>
<tr><td><code>using_librtmp</code></td><td>:</td><td><code>'true'</code> if <code>librtmp</code> is <code>'true'</code> and the <i>PMS.conf</i> setting <code>rtmpdump.force</code> is not <code>'true'</code>.</td></tr>
<tr><td><code>libass</code></td><td>:</td><td><code>'true'</code> if ffmpeg is compiled with <i class=comment>--enable-libass</i>.</td></tr>
</table>
</ul>
</ul>
</li>
<br/>
<li><a name="popVar"><kbd>pms.popVar</kbd><code>(key)</code></a>
<ul>Remove and return a previously set session variable (or <code>''</code> if not found).
</ul>
</li>
<br/>
<li><a name="setVar"><kbd>pms.setVar</kbd><code>(key, val)</code></a>
<ul>Set a session variable (for later retrieval via <code>getVar</code> or <code>popVar</code>)</i>.
</ul>
</li>
<br/>
<li><a name="getProperty"><kbd>pms.getProperty</kbd><code>(key, fallback<i>=''</i>)</code></a>
<ul>Get a property from <i>PMS.conf</i>, or <code>fallback</code> if the property isn't set.
</ul>
</li>
<br/>
<li><a name="setProperty"><kbd>pms.setProperty</kbd><code>(key, val)</code></a>
<ul>Set a property in <i>PMS.conf</i>.
</ul>
</li>
<br/>
<li><a name="getResource"><kbd>pms.getResource</kbd><code>(src)</code></a>
<ul>Get the path to an existing local or cached resource, where <code>src</code> is either
<ul>
<li>an existing file
</li>
<li>an icon or image with an <i><a href="#FX">+fx string</a></i> added, in
which case it will be generated and cached if it doesn't already exist.
</li>
</ul>
</ul>
</li>
<br/>
<li><a name="setSubtitles"><kbd>pms.setSubtitles</kbd><code>(path)</code></a>
<ul>Set an external subtitles file for the last item added. This function must be called
before adding any other items (<i>requires UMS > <i class=comment>2.3.0</i> and ffmpeg compiled with <i class=comment>--enable-libass</i></i>).
</ul>
</li>
<br/>
<li><a name="setInfo"><kbd>pms.setInfo</kbd><code>(settings, section<i>=None</i>)</code></a>
<ul>Set script metadata and options, where
<ul>
<li><code>settings</code> is a python dict containing any of the following reserved
keywords for creating the script's gui panel:
<ul>
<li><code>_title</code>: a display name.</li>
<li><code>_desc</code>: a description.</li>
<li><code>_icon</code>: a path to an image file.</li>
<li><code>_link</code>: link(s) in <a href="http://daringfireball.net/projects/markdown/syntax#link">markdown <i>inline</i></a>
format, i.e. <code><b>[</b><i class='comment'>link text</i><b>](</b><i class='comment'>url</i><b>)</b></code>, separated
by newline characters if more than one.
</li>
<li><code>_version</code>: its version.</li>
<li><code>_conf</code>: a path to a conf or properties file containing script-specific settings.
Jumpy will read the file and include its items in the script's gui panel as follows:
<ul>
<li>any comments will become tooltips.</li>
<li>values will be placed in text boxes by default.</li>
<li>if a setting's comment contains the exact text '<i class='comment'>(true|false)</i>' its value will be
rendered as a checkbox instead.</li>
</ul>
Note that jumpy will store any edits or changes to a user copy of this file in the profile folder and
leave the original "master" copy unchanged. Use <a href="#readConf"><code>readConf</code></a> to read user-edited settings correctly.
</li>
</ul>
Also please note:
<ul>
<li>any other keys found in the dict will be displayed as regular script settings.</li>
<li>any setting name beginning with '<code>$</code>' will be considered "global" and saved to
<i>PMS.conf</i> instead.</li>
</ul>
</li>
<li><code>section</code>, if given, designates a configuration section to be internally maintained
by jumpy, meant mostly for its own built-in components (e.g. <i>Resolver</i>) and would not typically
be set by an external user script.
</li>
</ul>
</li>
</li>
</ul>
<br/>
<li><a name="readConf"><kbd>pms.readConf</kbd><code>(filename)</code></a>
<ul>Read the conf file <code>filename</code> as well as its user copy, if any, in the profile section
and return the current settings as a python dict.
</ul>
</li>
<br/>
<li><a name="addPlayer"><kbd>pms.addPlayer</kbd><code>(name, cmd, supported, type=<i>PMS_VIDEO</i>, purpose=<i>PMS_MISC_PLAYER</i>, desc<i>=None</i>, icon<i>=None</i>, playback<i>=None</i>, priority<i>=0</i>)</code></a>
<br/><br/>
where
<ul>
<li><code>name</code> is the player's name.
</li>
<br/>
<li><code>cmd</code> is the command PMS will invoke to play matching media with your
player, and can include these runtime variables:
<ul><li><code>${filename}</code> which expands to the media item's full path.
</li>
<li><code>${outfile}</code> which expands to the output file where your player's data stream should be written.
</li>
<li><code>${format}</code> which expands to the media item's format name.
</li>
<li><code>${userdata}</code> which expands to any userdata attached if the item was created
using <a href="#addMedia"><code>pms.addMedia()</code></a>.
</li>
<li><code>${home}</code> which expands to the jumpy home folder.
</li>
</ul>
for example:
<ul><code>"c:\myplayer.bat ${filename} ${outfile}"</code></ul>
</li>
<br/>
<li><code>supported</code> is a string specifying supported media in the same syntax used for configuring renderers
(see <a href="https://github.com/ps3mediaserver/ps3mediaserver/blob/master/src/main/external-resources/renderers/PS3.conf#L362"><i>PMS.conf</i></a>).
For instance an "audio as video" player might use:
<ul><code>"f:flac|wav m:video/mpeg"</code></ul>
which means 'accept any <i>flac</i> or <i>wav</i> file and broadcast a <i>video/mpeg</i>
mimetype for it'. Some things to keep in mind:
<ul><li><code>f:</code> (format) is the only required parameter in the <code>supported</code> string.
</li>
<li> if omitted, <code>m:</code> (mimetype) will default to PMS' default mimetype for the primary format given by <code>f:</code>.
</li>
<li>If <code>f:</code> specifies known formats, your player will override PMS' default
player for those formats. In this case, since the media is known and can be parsed, you can
further narrow <code>supported</code> using the other valid parameters (<code>v: a: n:</code> <a href="https://github.com/ps3mediaserver/ps3mediaserver/blob/master/src/main/external-resources/renderers/PS3.conf#L427">etc</a>).
<li>If <code>f:</code> specifies unrecognised formats (real such as <code>f:txt</code> or
imaginary such as <code>f:foo</code>), then only <code>m:</code> will be valid,
since PMS obviously can't parse the media and presumably your player knows what to do
anyway.
</li>
<li>If you need to specify several different <code>supported</code> lines separate them with commas
in your string (this feature is as yet untested).
</li>
</li>
</ul>
</li>
<br/>
<li><code>type</code> is the general media type(s) handled by the player, given by these constants
(which can be combined by bitwise OR):
<pre>
PMS_AUDIO
PMS_IMAGE
PMS_VIDEO
PMS_UNKNOWN
</pre>
</li>
<li><code>purpose</code> determines the player's category in the PMS transcode tab,
and is one of these constants:
<pre>
PMS_VIDEO_SIMPLEFILE_PLAYER
PMS_AUDIO_SIMPLEFILE_PLAYER
PMS_VIDEO_WEBSTREAM_PLAYER
PMS_AUDIO_WEBSTREAM_PLAYER
PMS_MISC_PLAYER
</pre>
</li>
<li><code>desc</code> is a description of the player to be included in the PMS transcode tab.
<br/><br/>
</li>
<li><code>icon</code> is the default icon to use for the player's supported formats, usage is
identical to <a href="#img"><code>img</code></a> in <code>pms.setIcon()</code>.
<br/><br/>
</li>
<li><a name="PLAYBACK"></a><code>playback</code> is a string to modify the player's default playback behavior where
<ul>
<li>the format is <code>delay_seconds:buffer_mb</code>, e.g. <code>15:20</code> for a 15 second delay and 20mb buffer.</li>
<li>you can omit buffer, e.g. just <code>15</code> for a 15 second delay</li>
<li><code>-1</code> means 'default' for either variable, e.g. <code>-1:20</code> for default delay and 20mb buffer.</li>
</ul>
<br/>
<li><code>priority</code> is the player's relative position in the PMS engine list, where
<ul>
<li><code>0</code> sets it as the default player for its supported formats , i.e. at the front of the list.</li>
<li><code>-1</code> means it's a secondary player (i.e. included in the <i>#--TRANSCODE--#</i> folder).</li>
</ul>
</li>
</ul>
</li>
<br/>
<li><a name="setIcon"></a><kbd>pms.setIcon</kbd><code>(fmt, img)</code><br/>
<ul>
Set the default xmb icon for the given format(s), where
<ul>
<li><code>fmt</code> is one or more formats separated by '<code>|</code>', e.g. '<code>foo|bar</code>'</li>
<li><a name="img"></a><code>img</code> is either a filename or <a href="#ICONS">named icon</a>
and can be appended with an optional <i><a href="#FX">+fx string</a></i>.</li>
</ul>
</ul>
</li>
<br/>
<li><a name="info"></a><kbd>pms.info</kbd><code>(msg, seconds<i>=7</i>)</code><br/>
<a name="ok"></a><kbd>pms.ok</kbd><code>(msg, seconds<i>=7</i>)</code><br/>
<a name="warn"></a><kbd>pms.warn</kbd><code>(msg, seconds<i>=7</i>)</code><br/>
<a name="err"></a><kbd>pms.err</kbd><code>(msg, seconds<i>=7</i>)</code><br/>
<ul>Output a dvd-ntsc video showing <code>msg</code> printed under the relevant icon for
the specified number of <code>seconds</code>.
These are convenience functions for <code>pms.vmsg()</code> and will automatically output
to the current <code>${outfile}</code>.
</ul>
</li>
<br/>
<li><a name="log"></a><kbd>pms.log</kbd><code>(msg)</code><br/>
<ul>Write <code>msg</code> to <i>jumpy.log</i>, <i>debug.log</i> and the gui log tab.
</ul>
</li>
<br/>
<li><a name="vmsg"></a><kbd>pms.vmsg</kbd><code>(
seconds <i>= 10</i>, <i class="comment"># duration</i>
msg <i>= ""</i>, <i class="comment"># message string</i>
file <i>= None</i>, <i class="comment"># (or) text file</i>
out <i>= </i><i class="comment">(automatic)</i>, <i class="comment"># output file</i>
countdown <i>= False</i>, <i class="comment"># whether to show a mm:ss countdown</i>
<i class="comment"> # ** see <a href="http://www.imagemagick.org/Usage/text/">imagemagick text docs</a></i>
fill <i>= 'white'</i>, <i class="comment"># ** i.e. <a href="http://www.imagemagick.org/Usage/option_link.cgi?fill">-fill</a></i>
background <i>= 'black'</i>, <i class="comment"># ** i.e. <a href="http://www.imagemagick.org/Usage/option_link.cgi?background">-background</a></i>
pointsize <i>= 20</i>, <i class="comment"># ** i.e. <a href="http://www.imagemagick.org/Usage/option_link.cgi?pointsize">-pointsize</a></i>
font <i>= "DejaVu-Sans-Mono-Book"</i>, <i class="comment"># ** i.e. <a href="http://www.imagemagick.org/Usage/option_link.cgi?font">-font</a></i>
density <i>= 75</i>, <i class="comment"># ** i.e. <a href="http://www.imagemagick.org/Usage/option_link.cgi?density">-density</a></i>
gravity <i>= None</i>, <i class="comment"># ** i.e. <a href="http://www.imagemagick.org/Usage/option_link.cgi?gravity">-gravity</a></i>
rate <i>= '1'</i>, <i class="comment"># input rate (images/sec)</i>
img <i>= None</i>, <i class="comment"># background image (file or <a href="#ICONS">named icon</a>)</i>
imggrav <i>= 'center'</i>, <i class="comment"># ** i.e. <a href="http://www.imagemagick.org/Usage/option_link.cgi?gravity">-gravity</a> for img</i>
resize <i>= False</i>, <i class="comment"># whether to 'best fit' img</i>
native <i>= False</i>, <i class="comment"># whether to generate output at native (real time) frame rate</i>
silence <i>= False</i> <i class="comment"># whether to generate a silent audio track</i>
)</code>
<br/>
<ul>Output a custom dvd-ntsc video showing <code>msg</code> with an optional countdown and
background image. This is a <i>variadic named argument</i> function which means the
parameters are all optional and need to be specified by name, e.g.
<ul><code>pms.vmsg(seconds=12, msg='hello ', countdown=True)</code></ul>
or from the unix shell, for instance
<ul><code>$pms vmsg seconds=12 msg='hello ' countdown=True</code></ul>
Note that <code>out</code> doesn't actually need to be specified, it will be automatically
resolved to the current <code>${outfile}</code>.
For details please see the script <i>jumpy/lib/vmsg.py</i>, basically a front-end
for <a href="http://www.imagemagick.org/script/command-line-options.php?">imagemagick convert</a>.
</ul>
</li>
<!--</ul>-->
<br/>
<li><a name="imgfx"></a><kbd>pms.imgfx</kbd><code>(imgfile, fx, dir<i>=None</i>)</code><br/>
<ul>Apply the specified effects to the given image and save it for later use as a thumbnail or icon,
where
<ul>
<li>
<code>imgfile</code> is the input image file.
</li>
<li>
<a name="FX"></a><code>fx</code> is a semicolon-separated list of any of these operations:
<ul>
<li><code>f=<i class="comment">color</i></code> - use this <a href="http://www.imagemagick.org/Usage/option_link.cgi?fill">fill</a>, where <i class="comment">color</i>
is an imagemagick <a href="http://www.imagemagick.org/script/color.php#color_names">named color</a>, <code>#rrggbb</code> hex color or other supported <a href="http://www.imagemagick.org/script/color.php">color code</a>.
</li>
<li><code>r=<i class="comment">wxh</i></code> - resize to this width x height in pixels.</li>
<li><code>t=<i class="comment">SRT</i></code> - apply these imagemagick <a href="http://www.imagemagick.org/Usage/distorts/#srt"><i class="comment">SRT</i></a> (scale-rotate-transform)
operations (with underscores substituted for spaces). </li>
<li><code>c=<i class="comment">crop</i></code> - crop to this imagemagick <a href="http://www.imagemagick.org/Usage/option_link.cgi?crop"><i class="comment">crop</i></a>
<a href="http://www.imagemagick.org/script/command-line-processing.php#geometry">geometry</a>. </li>
<li><code>h</code> - flip horizontal, i.e. <a href="http://www.imagemagick.org/script/command-line-options.php#flop">flop</a>.</li>
<li><code>v</code> - flip vertical, i.e. <a href="http://www.imagemagick.org/script/command-line-options.php#flip">flip</a>.</li>
<li><code>3</code> - apply a 3D effect.</li>
<li><code>s</code> - apply a shadow effect.</li>
<li><code>g</code> - apply a gel effect.</li>
</ul>
See <a href="#ICONS">icons</a> for examples of <i>fx string</i> syntax.
</li>
<li>
<code>dir</code> is the directory to save the rendered image in, and defaults to the current directory
if omitted.
</li>
</ul>
<br/>
This function doesn't normally need to be called directly and is invoked in the background whenever
any <code>thumb</code>, <code>img</code>, or <code>icon</code> argument to the other api functions is appended with a
<i>+fx string</i>.
For details please see the script <i>jumpy/lib/imgfx.py</i>, another front-end
to <a href="http://www.imagemagick.org/script/command-line-options.php?">imagemagick convert</a>.</ul>
</ul>
</li>
<br/>
<b><a name="OTHERSCRIPTS">Scripts In Other Languages</a></b>
<ul>
Jumpy defines a <code><span class="orange">pms</span></code> environment variable which scripts in any
language can use to make API calls via the system. Any <a href="#API">API</a> call, for instance
<br/>
<ul>
<code>pms.addFolder("Hello", "echo hello")</code>
</ul>
can be made using an equivalent <b><i>command-line syntax</i></b>:
<br/><br/>
<ul><li>unix shell:</li>
<code><span class="orange">$pms</span> addFolder Hello "echo hello"</code>
</ul><br/>
<ul><li>Windows batch file:</li>
<code><span class="orange">%pms%</span> addFolder Hello "echo hello"</code>
</ul><br/>
<ul><li>perl:</li>
<code>`<span class="orange">$ENV{'pms'}</span> addFolder Hello "echo hello"`</code>
</ul><br/>
For API functions that return a string, such as <code>pms.getProperty("ffmpeg.path")</code>:
<br/><br/>
<ul><li>unix shell:</li>
<code>ffmpeg=$(<span class="orange">$pms</span> getProperty ffmpeg.path)
</code>
</ul><br/>
<ul><li>Windows batch file:</li>
<code>for /f "delims=" %%i in ('<span class="orange">%pms%</span> getProperty ffmpeg.path') do set ffmpeg=%%i
</code>
</ul><br/>
<ul><li>perl:</li>
<code>my $ffmpeg = `<span class="orange">$ENV{'pms'}</span> getProperty ffmpeg.path`
</code>
</ul><br/>
Keep in mind that these are system calls and you need to quote/escape your strings as appropriate.
To avoid embedded quotes <a href="#addItem"><kbd>addItem</kbd></a> also supports a special
<i><a href="#ARRAY">array notation syntax</a></i> to describe
your command array as a single string when your args contain spaces, for example:
<br/><br/>
<ul><li>Windows batch file:</li>
<code><span class="orange">%pms%</span> addFolder Hello "<span class="orange">[</span>echo<span class="orange"> , </span>hello world<span class="orange">]</span>"</code>
</ul><br/>
Array notation syntax is useful when scripts are using some flavor of <code>$0</code>
to call themselves back in the future. In general we don't automatically know whether <code>$0</code>
contains spaces or not, and without array notation syntax would need to embed it in quotes to guard against
spaces when making system calls to the API, e.g. <code>\"$0\"</code> or <code>""%~0""</code> and so on
(see <a href="#EXAMPLES">Examples</a>).
</ul>
<br/>
<b><a name="PLAYERS">Players</a></b>
<ul>
Players are scripts that define a set of supported media formats and output a media
stream to the destination file designated by PMS when items matching these formats are
sent to them. This process, which we'll illustrate using the
<a href="readme.html#WEBREADER">webreader</a> player (see <i>jumpy/webreader/webreader.py</i>)
as an example, involves two phases:
<br/><br/>
<b>Setup</b>
<br/><br/>
<ul>
The script is identified as a startup <code>[<span class="orange">+</span>]</code> item in
<i><a href="readme.html#SCRIPTSINI">jumpy-scripts.ini</a></i> with a startup command defined by you