summaryrefslogtreecommitdiff
path: root/projects
diff options
context:
space:
mode:
Diffstat (limited to 'projects')
-rw-r--r--projects/gerbolyze/index.html70
-rw-r--r--projects/gerbonara/index.html24
-rw-r--r--projects/lolcat-c/index.html56
-rw-r--r--projects/python-mpv/index.html438
-rw-r--r--projects/wsdiff/index.html62
5 files changed, 325 insertions, 325 deletions
diff --git a/projects/gerbolyze/index.html b/projects/gerbolyze/index.html
index 461c199..d17382c 100644
--- a/projects/gerbolyze/index.html
+++ b/projects/gerbolyze/index.html
@@ -118,8 +118,8 @@ anime silkscreen.</p>
<ol class="arabic">
<li><p class="first">Generate a scale-accurate template of the finished PCB from your CAD tool's gerber output:</p>
<pre class="code literal-block">
-$ gerbolyze template --top template_top.svg [--bottom template_bottom.svg] my_gerber_dir
-</pre>
+<span class="lineno"></span><span class="line">$ gerbolyze template --top template_top.svg [--bottom template_bottom.svg] my_gerber_dir
+</span></pre>
</li>
<li><p class="first">Load the resulting template image <a class="reference external" href="https://inkscape.org/">Inkscape</a> or another SVG editing program. Put your artwork on the appropriate SVG
layer. Dark colors become filled gerber primitives, bright colors become unfilled primitives. You can directly put
@@ -128,24 +128,24 @@ images, too. Masks are not supported.</p>
</li>
<li><p class="first">Vectorize the edited SVG template image drectly into the PCB's gerber files:</p>
<pre class="code literal-block">
-$ gerbolyze paste --top template_top_edited.svg [--bottom ...] my_gerber_dir output_gerber_dir
-</pre>
+<span class="lineno"></span><span class="line">$ gerbolyze paste --top template_top_edited.svg [--bottom ...] my_gerber_dir output_gerber_dir
+</span></pre>
</li>
</ol>
</div>
<div class="section" id="quick-start-installation-any-platform">
<h2><a class="toc-backref" href="#toc-entry-2">Quick Start Installation (Any Platform)</a></h2>
<pre class="code shell literal-block">
-python<span class="whitespace"> </span>-m<span class="whitespace"> </span>pip<span class="whitespace"> </span>install<span class="whitespace"> </span>--user<span class="whitespace"> </span>gerbolyze
-</pre>
+<span class="lineno"></span><span class="line">python<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>gerbolyze
+</span></pre>
<p>To uninstall, run</p>
<pre class="code shell literal-block">
-python<span class="whitespace"> </span>-m<span class="whitespace"> </span>pip<span class="whitespace"> </span>uninstall<span class="whitespace"> </span>gerbolyze<span class="whitespace"> </span>gerbonara<span class="whitespace"> </span>resvg-wasi<span class="whitespace"> </span>svg-flatten-wasi
-</pre>
+<span class="lineno"></span><span class="line">python<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>uninstall<span class="w"> </span>gerbolyze<span class="w"> </span>gerbonara<span class="w"> </span>resvg-wasi<span class="w"> </span>svg-flatten-wasi
+</span></pre>
<p>To update, run</p>
<pre class="code shell literal-block">
-python<span class="whitespace"> </span>-m<span class="whitespace"> </span>pip<span class="whitespace"> </span>install<span class="whitespace"> </span>--user<span class="whitespace"> </span>--upgrade<span class="whitespace"> </span>--upgrade-strategy<span class="whitespace"> </span>eager<span class="whitespace"> </span>gerbolyze
-</pre>
+<span class="lineno"></span><span class="line">python<span class="w"> </span>-m<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>--upgrade<span class="w"> </span>--upgrade-strategy<span class="w"> </span>eager<span class="w"> </span>gerbolyze
+</span></pre>
</div>
<div class="section" id="speeding-up-gerbolyze-using-natively-built-binaries">
<h2><a class="toc-backref" href="#toc-entry-3">Speeding up gerbolyze using natively-built binaries</a></h2>
@@ -167,14 +167,14 @@ binary that gerbolyze uses by giving it the absoulute path to a binary in the <t
environment variables.</p>
<div class="section" id="build-from-source-any-distro">
<h3><a class="toc-backref" href="#toc-entry-4">Build from source (any distro)</a></h3>
-<pre class="code shell literal-block">
-git<span class="whitespace"> </span>clone<span class="whitespace"> </span>--recurse-submodules<span class="whitespace"> </span>https://git.jaseg.de/gerbolyze.git<span class="whitespace">
-</span><span class="name builtin">cd</span><span class="whitespace"> </span>gerbolyze<span class="whitespace">
-
-</span>python3<span class="whitespace"> </span>-m<span class="whitespace"> </span>venv<span class="whitespace">
-</span><span class="name builtin">source</span><span class="whitespace"> </span>venv/bin/activate<span class="whitespace">
-</span>python3<span class="whitespace"> </span>setup.py<span class="whitespace"> </span>install
-</pre>
+<pre class="code sh literal-block">
+<span class="lineno"></span><span class="line">git<span class="w"> </span>clone<span class="w"> </span>--recurse-submodules<span class="w"> </span>https://git.jaseg.de/gerbolyze.git<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="nb">cd</span><span class="w"> </span>gerbolyze<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>python3<span class="w"> </span>-m<span class="w"> </span>venv<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="nb">source</span><span class="w"> </span>venv/bin/activate<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>python3<span class="w"> </span>setup.py<span class="w"> </span>install
+</span></pre>
</div>
</div>
<div class="section" id="features">
@@ -258,20 +258,20 @@ modified template and let gerbolyze process your design.</p>
<h2><a class="toc-backref" href="#toc-entry-8">Command-line usage</a></h2>
<p id="command-line-usage-1">Generate SVG template from Gerber files:</p>
<pre class="code shell literal-block">
-gerbolyze<span class="whitespace"> </span>template<span class="whitespace"> </span><span class="operator">[</span>options<span class="operator">]</span><span class="whitespace"> </span><span class="operator">[</span>--top<span class="punctuation">|</span>--bottom<span class="operator">]</span><span class="whitespace"> </span>input_dir_or.zip<span class="whitespace"> </span>output.svg
-</pre>
+<span class="lineno"></span><span class="line">gerbolyze<span class="w"> </span>template<span class="w"> </span><span class="o">[</span>options<span class="o">]</span><span class="w"> </span><span class="o">[</span>--top<span class="p">|</span>--bottom<span class="o">]</span><span class="w"> </span>input_dir_or.zip<span class="w"> </span>output.svg
+</span></pre>
<p>Render design from an SVG made with the template above into a set of gerber files:</p>
<pre class="code shell literal-block">
-gerbolyze<span class="whitespace"> </span>paste<span class="whitespace"> </span><span class="operator">[</span>options<span class="operator">]</span><span class="whitespace"> </span>artwork.svg<span class="whitespace"> </span>input_dir_or.zip<span class="whitespace"> </span>output_dir_or.zip
-</pre>
+<span class="lineno"></span><span class="line">gerbolyze<span class="w"> </span>paste<span class="w"> </span><span class="o">[</span>options<span class="o">]</span><span class="w"> </span>artwork.svg<span class="w"> </span>input_dir_or.zip<span class="w"> </span>output_dir_or.zip
+</span></pre>
<p>Use svg-flatten to convert an SVG file into Gerber or flattened SVG:</p>
<pre class="code shell literal-block">
-svg-flatten<span class="whitespace"> </span><span class="operator">[</span>options<span class="operator">]</span><span class="whitespace"> </span>--format<span class="whitespace"> </span><span class="operator">[</span>gerber<span class="punctuation">|</span>svg<span class="operator">]</span><span class="whitespace"> </span><span class="operator">[</span>input_file.svg<span class="operator">]</span><span class="whitespace"> </span><span class="operator">[</span>output_file<span class="operator">]</span>
-</pre>
+<span class="lineno"></span><span class="line">svg-flatten<span class="w"> </span><span class="o">[</span>options<span class="o">]</span><span class="w"> </span>--format<span class="w"> </span><span class="o">[</span>gerber<span class="p">|</span>svg<span class="o">]</span><span class="w"> </span><span class="o">[</span>input_file.svg<span class="o">]</span><span class="w"> </span><span class="o">[</span>output_file<span class="o">]</span>
+</span></pre>
<p>Use svg-flatten to convert an SVG file into the given layer of a KiCAD S-Expression (<tt class="docutils literal">.kicad_mod</tt>) file:</p>
<pre class="code shell literal-block">
-svg-flatten<span class="whitespace"> </span><span class="operator">[</span>options<span class="operator">]</span><span class="whitespace"> </span>--format<span class="whitespace"> </span>kicad<span class="whitespace"> </span>--sexp-layer<span class="whitespace"> </span>F.SilkS<span class="whitespace"> </span>--sexp-mod-name<span class="whitespace"> </span>My_Module<span class="whitespace"> </span><span class="operator">[</span>input_file.svg<span class="operator">]</span><span class="whitespace"> </span><span class="operator">[</span>output_file<span class="operator">]</span>
-</pre>
+<span class="lineno"></span><span class="line">svg-flatten<span class="w"> </span><span class="o">[</span>options<span class="o">]</span><span class="w"> </span>--format<span class="w"> </span>kicad<span class="w"> </span>--sexp-layer<span class="w"> </span>F.SilkS<span class="w"> </span>--sexp-mod-name<span class="w"> </span>My_Module<span class="w"> </span><span class="o">[</span>input_file.svg<span class="o">]</span><span class="w"> </span><span class="o">[</span>output_file<span class="o">]</span>
+</span></pre>
<p>Use svg-flatten to convert an SVG file into a <tt class="docutils literal">.kicad_mod</tt> with SVG layers fed into separate KiCAD layers based on
their IDs like the popular <tt class="docutils literal">svg2mod</tt> is doing:</p>
<dl class="docutils">
@@ -285,8 +285,8 @@ the layer names KiCAD exposes in the UI (even though most of them match up!).</p
</dd>
</dl>
<pre class="code shell literal-block">
-svg-flatten<span class="whitespace"> </span><span class="operator">[</span>options<span class="operator">]</span><span class="whitespace"> </span>--format<span class="whitespace"> </span>kicad<span class="whitespace"> </span>--sexp-mod-name<span class="whitespace"> </span>My_Module<span class="whitespace"> </span><span class="operator">[</span>input_file.svg<span class="operator">]</span><span class="whitespace"> </span><span class="operator">[</span>output_file<span class="operator">]</span>
-</pre>
+<span class="lineno"></span><span class="line">svg-flatten<span class="w"> </span><span class="o">[</span>options<span class="o">]</span><span class="w"> </span>--format<span class="w"> </span>kicad<span class="w"> </span>--sexp-mod-name<span class="w"> </span>My_Module<span class="w"> </span><span class="o">[</span>input_file.svg<span class="o">]</span><span class="w"> </span><span class="o">[</span>output_file<span class="o">]</span>
+</span></pre>
<div class="section" id="gerbolyze-template">
<h3><a class="toc-backref" href="#toc-entry-9"><tt class="docutils literal">gerbolyze template</tt></a></h3>
<p>Usage: <tt class="docutils literal">gerbolyze template [OPTIONS] INPUT</tt></p>
@@ -364,8 +364,8 @@ halftone primitives all over the place. The subtraction script has cut out an ar
existing silkscreen. You can turn off this behavior by passing <tt class="docutils literal"><span class="pre">--no-subtract</span></tt> or pass your own &quot;script&quot;.</p>
<p>The syntax of these scripts is:</p>
<pre class="code literal-block">
-{target layer} -= {source layer} {dilation} [; ...]
-</pre>
+<span class="lineno"></span><span class="line">{target layer} -= {source layer} {dilation} [; ...]
+</span></pre>
<p>The target layer must be <tt class="docutils literal"><span class="pre">out.{layer</span> name}</tt> and the source layer <tt class="docutils literal"><span class="pre">in.{layer</span> name}</tt>. The layer names are gerbolyze's
internal layer names, i.e.: <tt class="docutils literal">paste, silk, mask, copper, outline, drill</tt></p>
<p>The dilation value is optional, but can be a float with a leading <tt class="docutils literal">+</tt> or <tt class="docutils literal">-</tt>. If given, before subtraction the
@@ -374,11 +374,11 @@ source layer's features will be extended by that many mm. If not given, the dila
<p>Multiple commands can be separated by semicolons <tt class="docutils literal">;</tt> or line breaks.</p>
<p>The default subtraction script is:</p>
<pre class="code literal-block">
-out.silk -= in.mask
-out.silk -= in.silk+0.5
-out.mask -= in.mask+0.5
-out.copper -= in.copper+0.5
-</pre>
+<span class="lineno"></span><span class="line">out.silk -= in.mask</span>
+<span class="lineno"></span><span class="line">out.silk -= in.silk+0.5</span>
+<span class="lineno"></span><span class="line">out.mask -= in.mask+0.5</span>
+<span class="lineno"></span><span class="line">out.copper -= in.copper+0.5
+</span></pre>
</div>
</div>
<div class="section" id="svg-flatten-1">
diff --git a/projects/gerbonara/index.html b/projects/gerbonara/index.html
index 7da7f3e..65ec965 100644
--- a/projects/gerbonara/index.html
+++ b/projects/gerbonara/index.html
@@ -77,16 +77,16 @@ existing Gerber files exported from a normal PCB tool for artistic purposes.</p>
<h2>Quick Start</h2>
<p>First, install gerbonara from PyPI using pip:</p>
<pre class="code shell literal-block">
-pip<span class="whitespace"> </span>install<span class="whitespace"> </span>--user<span class="whitespace"> </span>gerbonara
-</pre>
+<span class="lineno"></span><span class="line">pip<span class="w"> </span>install<span class="w"> </span>--user<span class="w"> </span>gerbonara
+</span></pre>
<p>Then, you are ready to read and write gerber files:</p>
<pre class="code python literal-block">
-<span class="keyword namespace">from</span> <span class="name namespace">gerbonara</span> <span class="keyword namespace">import</span> <span class="name">LayerStack</span><span class="whitespace">
-
-</span><span class="name">stack</span> <span class="operator">=</span> <span class="name">LayerStack</span><span class="operator">.</span><span class="name">from_directory</span><span class="punctuation">(</span><span class="literal string single">'output/gerber'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">w</span><span class="punctuation">,</span> <span class="name">h</span> <span class="operator">=</span> <span class="name">stack</span><span class="operator">.</span><span class="name">outline</span><span class="operator">.</span><span class="name">size</span><span class="punctuation">(</span><span class="literal string single">'mm'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name builtin">print</span><span class="punctuation">(</span><span class="literal string affix">f</span><span class="literal string single">'Board size is </span><span class="literal string interpol">{</span><span class="name">w</span><span class="literal string interpol">:</span><span class="literal string single">.1f</span><span class="literal string interpol">}</span><span class="literal string single"> mm x </span><span class="literal string interpol">{</span><span class="name">h</span><span class="literal string interpol">:</span><span class="literal string single">.1f</span><span class="literal string interpol">}</span><span class="literal string single"> mm'</span><span class="punctuation">)</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="kn">from</span> <span class="nn">gerbonara</span> <span class="kn">import</span> <span class="n">LayerStack</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">stack</span> <span class="o">=</span> <span class="n">LayerStack</span><span class="o">.</span><span class="n">from_directory</span><span class="p">(</span><span class="s1">'output/gerber'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">w</span><span class="p">,</span> <span class="n">h</span> <span class="o">=</span> <span class="n">stack</span><span class="o">.</span><span class="n">outline</span><span class="o">.</span><span class="n">size</span><span class="p">(</span><span class="s1">'mm'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="nb">print</span><span class="p">(</span><span class="sa">f</span><span class="s1">'Board size is </span><span class="si">{</span><span class="n">w</span><span class="si">:</span><span class="s1">.1f</span><span class="si">}</span><span class="s1"> mm x </span><span class="si">{</span><span class="n">h</span><span class="si">:</span><span class="s1">.1f</span><span class="si">}</span><span class="s1"> mm'</span><span class="p">)</span>
+</span></pre>
</div>
<div class="section" id="command-line-interface">
<h2>Command-Line Interface</h2>
@@ -94,10 +94,10 @@ pip<span class="whitespace"> </span>install<span class="whitespace"> </span>--us
modifying, and merging Gerber files. To access it, use either the <tt class="docutils literal">gerbonara</tt> command that is part of the python
package, or run <tt class="docutils literal">python <span class="pre">-m</span> gerbonara</tt> For a list of functions or help on their usage, you can use:</p>
<pre class="code console literal-block">
-<span class="generic prompt">$ </span>python<span class="whitespace"> </span>-m<span class="whitespace"> </span>gerbonara<span class="whitespace"> </span>--help<span class="whitespace">
-</span><span class="generic output">[...]
-</span><span class="generic prompt">$ </span>python<span class="whitespace"> </span>-m<span class="whitespace"> </span>gerbonara<span class="whitespace"> </span>render<span class="whitespace"> </span>--help
-</pre>
+<span class="lineno"></span><span class="line"><span class="gp">$ </span>python<span class="w"> </span>-m<span class="w"> </span>gerbonara<span class="w"> </span>--help<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="go">[...]</span></span>
+<span class="lineno"></span><span class="line"><span class="go"></span><span class="gp">$ </span>python<span class="w"> </span>-m<span class="w"> </span>gerbonara<span class="w"> </span>render<span class="w"> </span>--help
+</span></pre>
</div>
<div class="section" id="development">
<h2>Development</h2>
diff --git a/projects/lolcat-c/index.html b/projects/lolcat-c/index.html
index b5ffa4a..161580f 100644
--- a/projects/lolcat-c/index.html
+++ b/projects/lolcat-c/index.html
@@ -48,37 +48,37 @@
<h3>Archlinux</h3>
<p>There's an <a class="reference external" href="https://aur.archlinux.org/packages/c-lolcat">AUR package</a>:</p>
<pre class="code sh literal-block">
-$<span class="whitespace"> </span>git<span class="whitespace"> </span>clone<span class="whitespace"> </span>https://aur.archlinux.org/packages/c-lolcat<span class="whitespace">
-</span>$<span class="whitespace"> </span><span class="name builtin">cd</span><span class="whitespace"> </span>c-lolcat<span class="whitespace">
-</span>$<span class="whitespace"> </span>makepkg<span class="whitespace"> </span>-csi
-</pre>
+<span class="lineno"></span><span class="line">$<span class="w"> </span>git<span class="w"> </span>clone<span class="w"> </span>https://aur.archlinux.org/packages/c-lolcat<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>$<span class="w"> </span><span class="nb">cd</span><span class="w"> </span>c-lolcat<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>$<span class="w"> </span>makepkg<span class="w"> </span>-csi
+</span></pre>
</div>
<div class="section" id="fedora">
<h3>Fedora</h3>
<pre class="code sh literal-block">
-$<span class="whitespace"> </span>dnf<span class="whitespace"> </span>install<span class="whitespace"> </span>lolcat
-</pre>
+<span class="lineno"></span><span class="line">$<span class="w"> </span>dnf<span class="w"> </span>install<span class="w"> </span>lolcat
+</span></pre>
</div>
<div class="section" id="ubuntu-snap">
<h3>Ubuntu (Snap)</h3>
<p>See <a class="reference external" href="https://blog.simos.info/how-to-make-a-snap-package-for-lolcat-with-snapcraft-on-ubuntu/">this awesome blog post by a kind person from the internet</a>:</p>
<pre class="code sh literal-block">
-$<span class="whitespace"> </span>snap<span class="whitespace"> </span>install<span class="whitespace"> </span>lolcat-c
-</pre>
+<span class="lineno"></span><span class="line">$<span class="w"> </span>snap<span class="w"> </span>install<span class="w"> </span>lolcat-c
+</span></pre>
</div>
<div class="section" id="mac">
<h3>Mac</h3>
<p>Build loclcat with:</p>
<pre class="code sh literal-block">
-$<span class="whitespace"> </span>make<span class="whitespace"> </span>lolcat
-</pre>
+<span class="lineno"></span><span class="line">$<span class="w"> </span>make<span class="w"> </span>lolcat
+</span></pre>
<p>...and put the resulting binary at a place of your choice.</p>
</div>
<div class="section" id="others">
<h3>Others</h3>
<pre class="code sh literal-block">
-$<span class="whitespace"> </span>make<span class="whitespace"> </span><span class="operator">&amp;&amp;</span><span class="whitespace"> </span>sudo<span class="whitespace"> </span>make<span class="whitespace"> </span>install
-</pre>
+<span class="lineno"></span><span class="line">$<span class="w"> </span>make<span class="w"> </span><span class="o">&amp;&amp;</span><span class="w"> </span>sudo<span class="w"> </span>make<span class="w"> </span>install
+</span></pre>
</div>
</div>
<div class="section" id="why">
@@ -86,24 +86,24 @@ $<span class="whitespace"> </span>make<span class="whitespace"> </span><span cla
<p>This <cite>lolcat</cite> clone is an attempt to reduce the world's carbon dioxide emissions by optimizing inefficient code. It's
&gt;10x as fast and &lt;0.1% as large as the original one.</p>
<pre class="code sh literal-block">
-newton~/d/lolcat<span class="whitespace"> </span>&lt;<span class="literal number">3</span><span class="whitespace"> </span>dmesg&gt;foo<span class="whitespace">
-</span>newton~/d/lolcat<span class="whitespace"> </span>&lt;<span class="literal number">3</span><span class="whitespace"> </span><span class="name builtin">time</span><span class="whitespace"> </span>upstream/bin/lolcat<span class="whitespace"> </span>foo<span class="whitespace">
-</span><span class="literal number">13</span>.51user<span class="whitespace"> </span><span class="literal number">1</span>.34system<span class="whitespace"> </span><span class="literal number">0</span>:15.99elapsed<span class="whitespace"> </span><span class="literal number">92</span>%CPU<span class="whitespace"> </span><span class="operator">(</span>0avgtext+0avgdata<span class="whitespace"> </span>10864maxresident<span class="operator">)</span>k<span class="whitespace">
-</span>0inputs+0outputs<span class="whitespace"> </span><span class="operator">(</span>0major+1716minor<span class="operator">)</span>pagefaults<span class="whitespace"> </span>0swaps<span class="whitespace">
-</span>newton~/d/lolcat<span class="whitespace"> </span>&lt;<span class="literal number">3</span><span class="whitespace"> </span><span class="name builtin">time</span><span class="whitespace"> </span>./lolcat<span class="whitespace"> </span>foo<span class="whitespace">
-</span><span class="literal number">0</span>.02user<span class="whitespace"> </span><span class="literal number">0</span>.00system<span class="whitespace"> </span><span class="literal number">0</span>:00.09elapsed<span class="whitespace"> </span><span class="literal number">34</span>%CPU<span class="whitespace"> </span><span class="operator">(</span>0avgtext+0avgdata<span class="whitespace"> </span>1936maxresident<span class="operator">)</span>k<span class="whitespace">
-</span>0inputs+0outputs<span class="whitespace"> </span><span class="operator">(</span>0major+117minor<span class="operator">)</span>pagefaults<span class="whitespace"> </span>0swaps
-</pre>
+<span class="lineno"></span><span class="line">newton~/d/lolcat<span class="w"> </span>&lt;<span class="m">3</span><span class="w"> </span>dmesg&gt;foo<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>newton~/d/lolcat<span class="w"> </span>&lt;<span class="m">3</span><span class="w"> </span><span class="nb">time</span><span class="w"> </span>upstream/bin/lolcat<span class="w"> </span>foo<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="m">13</span>.51user<span class="w"> </span><span class="m">1</span>.34system<span class="w"> </span><span class="m">0</span>:15.99elapsed<span class="w"> </span><span class="m">92</span>%CPU<span class="w"> </span><span class="o">(</span>0avgtext+0avgdata<span class="w"> </span>10864maxresident<span class="o">)</span>k<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>0inputs+0outputs<span class="w"> </span><span class="o">(</span>0major+1716minor<span class="o">)</span>pagefaults<span class="w"> </span>0swaps<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>newton~/d/lolcat<span class="w"> </span>&lt;<span class="m">3</span><span class="w"> </span><span class="nb">time</span><span class="w"> </span>./lolcat<span class="w"> </span>foo<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="m">0</span>.02user<span class="w"> </span><span class="m">0</span>.00system<span class="w"> </span><span class="m">0</span>:00.09elapsed<span class="w"> </span><span class="m">34</span>%CPU<span class="w"> </span><span class="o">(</span>0avgtext+0avgdata<span class="w"> </span>1936maxresident<span class="o">)</span>k<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>0inputs+0outputs<span class="w"> </span><span class="o">(</span>0major+117minor<span class="o">)</span>pagefaults<span class="w"> </span>0swaps
+</span></pre>
<p>Bonus comparison with <a class="reference external" href="https://github.com/tehmaze/lolcat/">python-lolcat</a>:</p>
<pre class="code sh literal-block">
-newton~/d/lolcat<span class="whitespace"> </span>&lt;<span class="literal number">3</span><span class="whitespace"> </span>dmesg&gt;foo<span class="whitespace">
-</span>$<span class="whitespace"> </span><span class="name builtin">time</span><span class="whitespace"> </span>python-lolcat<span class="whitespace"> </span>foo<span class="whitespace">
-</span><span class="literal number">12</span>.27user<span class="whitespace"> </span><span class="literal number">0</span>.00system<span class="whitespace"> </span><span class="literal number">0</span>:12.29elapsed<span class="whitespace"> </span><span class="literal number">99</span>%CPU<span class="whitespace"> </span><span class="operator">(</span>0avgtext+0avgdata<span class="whitespace"> </span>11484maxresident<span class="operator">)</span>k<span class="whitespace">
-</span>0inputs+0outputs<span class="whitespace"> </span><span class="operator">(</span>0major+1627minor<span class="operator">)</span>pagefaults<span class="whitespace"> </span>0swaps<span class="whitespace">
-</span>$<span class="whitespace"> </span><span class="name builtin">time</span><span class="whitespace"> </span>c-lolcat<span class="whitespace"> </span>foo<span class="whitespace">
-</span><span class="literal number">0</span>.29user<span class="whitespace"> </span><span class="literal number">0</span>.00system<span class="whitespace"> </span><span class="literal number">0</span>:00.30elapsed<span class="whitespace"> </span><span class="literal number">98</span>%CPU<span class="whitespace"> </span><span class="operator">(</span>0avgtext+0avgdata<span class="whitespace"> </span>468maxresident<span class="operator">)</span>k<span class="whitespace">
-</span>0inputs+0outputs<span class="whitespace"> </span><span class="operator">(</span>0major+21minor<span class="operator">)</span>pagefaults<span class="whitespace"> </span>0swaps
-</pre>
+<span class="lineno"></span><span class="line">newton~/d/lolcat<span class="w"> </span>&lt;<span class="m">3</span><span class="w"> </span>dmesg&gt;foo<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>$<span class="w"> </span><span class="nb">time</span><span class="w"> </span>python-lolcat<span class="w"> </span>foo<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="m">12</span>.27user<span class="w"> </span><span class="m">0</span>.00system<span class="w"> </span><span class="m">0</span>:12.29elapsed<span class="w"> </span><span class="m">99</span>%CPU<span class="w"> </span><span class="o">(</span>0avgtext+0avgdata<span class="w"> </span>11484maxresident<span class="o">)</span>k<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>0inputs+0outputs<span class="w"> </span><span class="o">(</span>0major+1627minor<span class="o">)</span>pagefaults<span class="w"> </span>0swaps<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>$<span class="w"> </span><span class="nb">time</span><span class="w"> </span>c-lolcat<span class="w"> </span>foo<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="m">0</span>.29user<span class="w"> </span><span class="m">0</span>.00system<span class="w"> </span><span class="m">0</span>:00.30elapsed<span class="w"> </span><span class="m">98</span>%CPU<span class="w"> </span><span class="o">(</span>0avgtext+0avgdata<span class="w"> </span>468maxresident<span class="o">)</span>k<span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span>0inputs+0outputs<span class="w"> </span><span class="o">(</span>0major+21minor<span class="o">)</span>pagefaults<span class="w"> </span>0swaps
+</span></pre>
<p>(Read: <cite>c-lolcat &lt;&lt; python-lolcat &lt;&lt; ruby-lolcat</cite>)</p>
</div>
</div>
diff --git a/projects/python-mpv/index.html b/projects/python-mpv/index.html
index e789ace..46dbb4b 100644
--- a/projects/python-mpv/index.html
+++ b/projects/python-mpv/index.html
@@ -39,8 +39,8 @@ features of the player, just as the lua interface does.</p>
<div class="section" id="installation">
<h2>Installation</h2>
<pre class="code bash literal-block">
-pip<span class="whitespace"> </span>install<span class="whitespace"> </span>mpv
-</pre>
+<span class="lineno"></span><span class="line">pip<span class="w"> </span>install<span class="w"> </span>mpv
+</span></pre>
<p>...though you can also realistically just copy <a class="reference external" href="https://raw.githubusercontent.com/jaseg/python-mpv/main/mpv.py">mpv.py</a> into your project as it's all nicely contained in one file.</p>
<div class="section" id="requirements">
<h3>Requirements</h3>
@@ -73,11 +73,11 @@ since right now there is not many OSX users.</p>
<div class="section" id="usage">
<h2>Usage</h2>
<pre class="code python literal-block">
-<span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">(</span><span class="name">ytdl</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="literal string single">'https://youtu.be/DOmdB7D-pUU'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">wait_for_playback</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">(</span><span class="n">ytdl</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="s1">'https://youtu.be/DOmdB7D-pUU'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">wait_for_playback</span><span class="p">()</span>
+</span></pre>
<p>python-mpv mostly exposes mpv's built-in API to python, adding only some porcelain on top. Most &quot;<a class="reference external" href="https://mpv.io/manual/master/#list-of-input-commands">input commands</a>&quot; are mapped to methods of the MPV class. Check out these methods and their docstrings in <a class="reference external" href="https://github.com/jaseg/python-mpv/blob/main/mpv.py">the source</a> for things you can do. Additional controls and status information are exposed through <a class="reference external" href="https://mpv.io/manual/master/#properties">MPV properties</a>. These can be accessed like <tt class="docutils literal">player.metadata</tt>, <tt class="docutils literal">player.fullscreen</tt> and <tt class="docutils literal">player.loop_playlist</tt>.</p>
<div class="section" id="threading">
<h3>Threading</h3>
@@ -95,168 +95,168 @@ that can be passed to an event loop to tell it to wake up the python-mpv event h
<div class="section" id="logging-properties-python-key-bindings-screenshots-and-youtube-dl">
<h4>Logging, Properties, Python Key Bindings, Screenshots and youtube-dl</h4>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="keyword">def</span> <span class="name function">my_log</span><span class="punctuation">(</span><span class="name">loglevel</span><span class="punctuation">,</span> <span class="name">component</span><span class="punctuation">,</span> <span class="name">message</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="name builtin">print</span><span class="punctuation">(</span><span class="literal string single">'[</span><span class="literal string interpol">{}</span><span class="literal string single">] </span><span class="literal string interpol">{}</span><span class="literal string single">: </span><span class="literal string interpol">{}</span><span class="literal string single">'</span><span class="operator">.</span><span class="name">format</span><span class="punctuation">(</span><span class="name">loglevel</span><span class="punctuation">,</span> <span class="name">component</span><span class="punctuation">,</span> <span class="name">message</span><span class="punctuation">))</span><span class="whitespace">
-
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">(</span><span class="name">log_handler</span><span class="operator">=</span><span class="name">my_log</span><span class="punctuation">,</span> <span class="name">ytdl</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span> <span class="name">input_default_bindings</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span> <span class="name">input_vo_keyboard</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="comment single"># Property access, these can be changed at runtime</span><span class="whitespace">
-</span><span class="name decorator">&#64;player</span><span class="operator">.</span><span class="name">property_observer</span><span class="punctuation">(</span><span class="literal string single">'time-pos'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="keyword">def</span> <span class="name function">time_observer</span><span class="punctuation">(</span><span class="name">_name</span><span class="punctuation">,</span> <span class="name">value</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="comment single"># Here, _value is either None if nothing is playing or a float containing</span><span class="whitespace">
-</span> <span class="comment single"># fractional seconds since the beginning of the file.</span><span class="whitespace">
-</span> <span class="name builtin">print</span><span class="punctuation">(</span><span class="literal string single">'Now playing at </span><span class="literal string interpol">{:.2f}</span><span class="literal string single">s'</span><span class="operator">.</span><span class="name">format</span><span class="punctuation">(</span><span class="name">value</span><span class="punctuation">))</span><span class="whitespace">
-
-</span><span class="name">player</span><span class="operator">.</span><span class="name">fullscreen</span> <span class="operator">=</span> <span class="keyword constant">True</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">loop_playlist</span> <span class="operator">=</span> <span class="literal string single">'inf'</span><span class="whitespace">
-</span><span class="comment single"># Option access, in general these require the core to reinitialize</span><span class="whitespace">
-</span><span class="name">player</span><span class="punctuation">[</span><span class="literal string single">'vo'</span><span class="punctuation">]</span> <span class="operator">=</span> <span class="literal string single">'gpu'</span><span class="whitespace">
-
-</span><span class="name decorator">&#64;player</span><span class="operator">.</span><span class="name">on_key_press</span><span class="punctuation">(</span><span class="literal string single">'q'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="keyword">def</span> <span class="name function">my_q_binding</span><span class="punctuation">():</span><span class="whitespace">
-</span> <span class="name builtin">print</span><span class="punctuation">(</span><span class="literal string single">'THERE IS NO ESCAPE'</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="name decorator">&#64;player</span><span class="operator">.</span><span class="name">on_key_press</span><span class="punctuation">(</span><span class="literal string single">'s'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="keyword">def</span> <span class="name function">my_s_binding</span><span class="punctuation">():</span><span class="whitespace">
-</span> <span class="name">pillow_img</span> <span class="operator">=</span> <span class="name">player</span><span class="operator">.</span><span class="name">screenshot_raw</span><span class="punctuation">()</span><span class="whitespace">
-</span> <span class="name">pillow_img</span><span class="operator">.</span><span class="name">save</span><span class="punctuation">(</span><span class="literal string single">'screenshot.png'</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="name">player</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="literal string single">'https://youtu.be/DLzxrzFCyOs'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">wait_for_playback</span><span class="punctuation">()</span><span class="whitespace">
-
-</span><span class="keyword">del</span> <span class="name">player</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">def</span> <span class="nf">my_log</span><span class="p">(</span><span class="n">loglevel</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">message</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="nb">print</span><span class="p">(</span><span class="s1">'[</span><span class="si">{}</span><span class="s1">] </span><span class="si">{}</span><span class="s1">: </span><span class="si">{}</span><span class="s1">'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">loglevel</span><span class="p">,</span> <span class="n">component</span><span class="p">,</span> <span class="n">message</span><span class="p">))</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">(</span><span class="n">log_handler</span><span class="o">=</span><span class="n">my_log</span><span class="p">,</span> <span class="n">ytdl</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">input_default_bindings</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">input_vo_keyboard</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="c1"># Property access, these can be changed at runtime</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="nd">&#64;player</span><span class="o">.</span><span class="n">property_observer</span><span class="p">(</span><span class="s1">'time-pos'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">def</span> <span class="nf">time_observer</span><span class="p">(</span><span class="n">_name</span><span class="p">,</span> <span class="n">value</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="c1"># Here, _value is either None if nothing is playing or a float containing</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="c1"># fractional seconds since the beginning of the file.</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="nb">print</span><span class="p">(</span><span class="s1">'Now playing at </span><span class="si">{:.2f}</span><span class="s1">s'</span><span class="o">.</span><span class="n">format</span><span class="p">(</span><span class="n">value</span><span class="p">))</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">fullscreen</span> <span class="o">=</span> <span class="kc">True</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">loop_playlist</span> <span class="o">=</span> <span class="s1">'inf'</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="c1"># Option access, in general these require the core to reinitialize</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="p">[</span><span class="s1">'vo'</span><span class="p">]</span> <span class="o">=</span> <span class="s1">'gpu'</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="nd">&#64;player</span><span class="o">.</span><span class="n">on_key_press</span><span class="p">(</span><span class="s1">'q'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">def</span> <span class="nf">my_q_binding</span><span class="p">():</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="nb">print</span><span class="p">(</span><span class="s1">'THERE IS NO ESCAPE'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="nd">&#64;player</span><span class="o">.</span><span class="n">on_key_press</span><span class="p">(</span><span class="s1">'s'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">def</span> <span class="nf">my_s_binding</span><span class="p">():</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">pillow_img</span> <span class="o">=</span> <span class="n">player</span><span class="o">.</span><span class="n">screenshot_raw</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">pillow_img</span><span class="o">.</span><span class="n">save</span><span class="p">(</span><span class="s1">'screenshot.png'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="s1">'https://youtu.be/DLzxrzFCyOs'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">wait_for_playback</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">del</span> <span class="n">player</span>
+</span></pre>
</div>
<div class="section" id="skipping-silence-using-libav-filters">
<h4>Skipping silence using libav filters</h4>
<p>The following code uses the libav silencedetect filter to skip silence at the beginning of a file. It works by loading
the filter, then parsing its output from mpv's log. Thanks to Sean DeNigris on github (#202) for the original code!</p>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">sys</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="name">p</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name">p</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="name">sys</span><span class="operator">.</span><span class="name">argv</span><span class="punctuation">[</span><span class="literal number integer">1</span><span class="punctuation">])</span><span class="whitespace">
-
-</span><span class="keyword">def</span> <span class="name function">skip_silence</span><span class="punctuation">():</span><span class="whitespace">
-</span> <span class="name">p</span><span class="operator">.</span><span class="name">set_loglevel</span><span class="punctuation">(</span><span class="literal string single">'debug'</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name">p</span><span class="operator">.</span><span class="name">af</span> <span class="operator">=</span> <span class="literal string single">'lavfi=[silencedetect=n=-20dB:d=1]'</span><span class="whitespace">
-</span> <span class="name">p</span><span class="operator">.</span><span class="name">speed</span> <span class="operator">=</span> <span class="literal number integer">100</span><span class="whitespace">
-</span> <span class="keyword">def</span> <span class="name function">check</span><span class="punctuation">(</span><span class="name">evt</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="name">toks</span> <span class="operator">=</span> <span class="name">evt</span><span class="punctuation">[</span><span class="literal string single">'event'</span><span class="punctuation">][</span><span class="literal string single">'text'</span><span class="punctuation">]</span><span class="operator">.</span><span class="name">split</span><span class="punctuation">()</span><span class="whitespace">
-</span> <span class="keyword">if</span> <span class="literal string single">'silence_end:'</span> <span class="operator word">in</span> <span class="name">toks</span><span class="punctuation">:</span><span class="whitespace">
-</span> <span class="keyword">return</span> <span class="name builtin">float</span><span class="punctuation">(</span><span class="name">toks</span><span class="punctuation">[</span><span class="literal number integer">2</span><span class="punctuation">])</span><span class="whitespace">
-</span> <span class="name">p</span><span class="operator">.</span><span class="name">time_pos</span> <span class="operator">=</span> <span class="name">p</span><span class="operator">.</span><span class="name">wait_for_event</span><span class="punctuation">(</span><span class="literal string single">'log_message'</span><span class="punctuation">,</span> <span class="name">cond</span><span class="operator">=</span><span class="name">check</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name">p</span><span class="operator">.</span><span class="name">speed</span> <span class="operator">=</span> <span class="literal number integer">1</span><span class="whitespace">
-</span> <span class="name">p</span><span class="operator">.</span><span class="name">af</span> <span class="operator">=</span> <span class="literal string single">''</span><span class="whitespace">
-
-</span><span class="name">skip_silence</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name">p</span><span class="operator">.</span><span class="name">wait_for_playback</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">sys</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">p</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">p</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">[</span><span class="mi">1</span><span class="p">])</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">def</span> <span class="nf">skip_silence</span><span class="p">():</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">p</span><span class="o">.</span><span class="n">set_loglevel</span><span class="p">(</span><span class="s1">'debug'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">p</span><span class="o">.</span><span class="n">af</span> <span class="o">=</span> <span class="s1">'lavfi=[silencedetect=n=-20dB:d=1]'</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">p</span><span class="o">.</span><span class="n">speed</span> <span class="o">=</span> <span class="mi">100</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">def</span> <span class="nf">check</span><span class="p">(</span><span class="n">evt</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">toks</span> <span class="o">=</span> <span class="n">evt</span><span class="p">[</span><span class="s1">'event'</span><span class="p">][</span><span class="s1">'text'</span><span class="p">]</span><span class="o">.</span><span class="n">split</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">if</span> <span class="s1">'silence_end:'</span> <span class="ow">in</span> <span class="n">toks</span><span class="p">:</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">return</span> <span class="nb">float</span><span class="p">(</span><span class="n">toks</span><span class="p">[</span><span class="mi">2</span><span class="p">])</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">p</span><span class="o">.</span><span class="n">time_pos</span> <span class="o">=</span> <span class="n">p</span><span class="o">.</span><span class="n">wait_for_event</span><span class="p">(</span><span class="s1">'log_message'</span><span class="p">,</span> <span class="n">cond</span><span class="o">=</span><span class="n">check</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">p</span><span class="o">.</span><span class="n">speed</span> <span class="o">=</span> <span class="mi">1</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">p</span><span class="o">.</span><span class="n">af</span> <span class="o">=</span> <span class="s1">''</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">skip_silence</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">p</span><span class="o">.</span><span class="n">wait_for_playback</span><span class="p">()</span>
+</span></pre>
</div>
<div class="section" id="video-overlays">
<h4>Video overlays</h4>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">time</span><span class="whitespace">
-</span><span class="keyword namespace">from</span> <span class="name namespace">PIL</span> <span class="keyword namespace">import</span> <span class="name">Image</span><span class="punctuation">,</span> <span class="name">ImageDraw</span><span class="punctuation">,</span> <span class="name">ImageFont</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">()</span><span class="whitespace">
-
-</span><span class="name">player</span><span class="operator">.</span><span class="name">loop</span> <span class="operator">=</span> <span class="keyword constant">True</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="literal string single">'test.webm'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">wait_until_playing</span><span class="punctuation">()</span><span class="whitespace">
-
-</span><span class="name">font</span> <span class="operator">=</span> <span class="name">ImageFont</span><span class="operator">.</span><span class="name">truetype</span><span class="punctuation">(</span><span class="literal string single">'DejaVuSans.ttf'</span><span class="punctuation">,</span> <span class="literal number integer">40</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="keyword">while</span> <span class="operator word">not</span> <span class="name">player</span><span class="operator">.</span><span class="name">core_idle</span><span class="punctuation">:</span><span class="whitespace">
-
-</span> <span class="name">time</span><span class="operator">.</span><span class="name">sleep</span><span class="punctuation">(</span><span class="literal number float">0.5</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name">overlay</span> <span class="operator">=</span> <span class="name">player</span><span class="operator">.</span><span class="name">create_image_overlay</span><span class="punctuation">()</span><span class="whitespace">
-
-</span> <span class="keyword">for</span> <span class="name">pos</span> <span class="operator word">in</span> <span class="name builtin">range</span><span class="punctuation">(</span><span class="literal number integer">0</span><span class="punctuation">,</span> <span class="literal number integer">500</span><span class="punctuation">,</span> <span class="literal number integer">5</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="name">ts</span> <span class="operator">=</span> <span class="name">player</span><span class="operator">.</span><span class="name">time_pos</span><span class="whitespace">
-</span> <span class="keyword">if</span> <span class="name">ts</span> <span class="operator word">is</span> <span class="keyword constant">None</span><span class="punctuation">:</span><span class="whitespace">
-</span> <span class="keyword">break</span><span class="whitespace">
-
-</span> <span class="name">img</span> <span class="operator">=</span> <span class="name">Image</span><span class="operator">.</span><span class="name">new</span><span class="punctuation">(</span><span class="literal string single">'RGBA'</span><span class="punctuation">,</span> <span class="punctuation">(</span><span class="literal number integer">400</span><span class="punctuation">,</span> <span class="literal number integer">150</span><span class="punctuation">),</span> <span class="punctuation">(</span><span class="literal number integer">255</span><span class="punctuation">,</span> <span class="literal number integer">255</span><span class="punctuation">,</span> <span class="literal number integer">255</span><span class="punctuation">,</span> <span class="literal number integer">0</span><span class="punctuation">))</span><span class="whitespace">
-</span> <span class="name">d</span> <span class="operator">=</span> <span class="name">ImageDraw</span><span class="operator">.</span><span class="name">Draw</span><span class="punctuation">(</span><span class="name">img</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name">d</span><span class="operator">.</span><span class="name">text</span><span class="punctuation">((</span><span class="literal number integer">10</span><span class="punctuation">,</span> <span class="literal number integer">10</span><span class="punctuation">),</span> <span class="literal string single">'Hello World'</span><span class="punctuation">,</span> <span class="name">font</span><span class="operator">=</span><span class="name">font</span><span class="punctuation">,</span> <span class="name">fill</span><span class="operator">=</span><span class="punctuation">(</span><span class="literal number integer">0</span><span class="punctuation">,</span> <span class="literal number integer">255</span><span class="punctuation">,</span> <span class="literal number integer">255</span><span class="punctuation">,</span> <span class="literal number integer">128</span><span class="punctuation">))</span><span class="whitespace">
-</span> <span class="name">d</span><span class="operator">.</span><span class="name">text</span><span class="punctuation">((</span><span class="literal number integer">10</span><span class="punctuation">,</span> <span class="literal number integer">60</span><span class="punctuation">),</span> <span class="literal string affix">f</span><span class="literal string single">'t=</span><span class="literal string interpol">{</span><span class="name">ts</span><span class="literal string interpol">:</span><span class="literal string single">.3f</span><span class="literal string interpol">}</span><span class="literal string single">'</span><span class="punctuation">,</span> <span class="name">font</span><span class="operator">=</span><span class="name">font</span><span class="punctuation">,</span> <span class="name">fill</span><span class="operator">=</span><span class="punctuation">(</span><span class="literal number integer">255</span><span class="punctuation">,</span> <span class="literal number integer">0</span><span class="punctuation">,</span> <span class="literal number integer">255</span><span class="punctuation">,</span> <span class="literal number integer">255</span><span class="punctuation">))</span><span class="whitespace">
-
-</span> <span class="name">overlay</span><span class="operator">.</span><span class="name">update</span><span class="punctuation">(</span><span class="name">img</span><span class="punctuation">,</span> <span class="name">pos</span><span class="operator">=</span><span class="punctuation">(</span><span class="literal number integer">2</span><span class="operator">*</span><span class="name">pos</span><span class="punctuation">,</span> <span class="name">pos</span><span class="punctuation">))</span><span class="whitespace">
-</span> <span class="name">time</span><span class="operator">.</span><span class="name">sleep</span><span class="punctuation">(</span><span class="literal number float">0.05</span><span class="punctuation">)</span><span class="whitespace">
-
-</span> <span class="name">overlay</span><span class="operator">.</span><span class="name">remove</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">time</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">from</span> <span class="nn">PIL</span> <span class="kn">import</span> <span class="n">Image</span><span class="p">,</span> <span class="n">ImageDraw</span><span class="p">,</span> <span class="n">ImageFont</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">loop</span> <span class="o">=</span> <span class="kc">True</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="s1">'test.webm'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">wait_until_playing</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">font</span> <span class="o">=</span> <span class="n">ImageFont</span><span class="o">.</span><span class="n">truetype</span><span class="p">(</span><span class="s1">'DejaVuSans.ttf'</span><span class="p">,</span> <span class="mi">40</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">while</span> <span class="ow">not</span> <span class="n">player</span><span class="o">.</span><span class="n">core_idle</span><span class="p">:</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.5</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">overlay</span> <span class="o">=</span> <span class="n">player</span><span class="o">.</span><span class="n">create_image_overlay</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">for</span> <span class="n">pos</span> <span class="ow">in</span> <span class="nb">range</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">500</span><span class="p">,</span> <span class="mi">5</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">ts</span> <span class="o">=</span> <span class="n">player</span><span class="o">.</span><span class="n">time_pos</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">if</span> <span class="n">ts</span> <span class="ow">is</span> <span class="kc">None</span><span class="p">:</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">break</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">img</span> <span class="o">=</span> <span class="n">Image</span><span class="o">.</span><span class="n">new</span><span class="p">(</span><span class="s1">'RGBA'</span><span class="p">,</span> <span class="p">(</span><span class="mi">400</span><span class="p">,</span> <span class="mi">150</span><span class="p">),</span> <span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">))</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">d</span> <span class="o">=</span> <span class="n">ImageDraw</span><span class="o">.</span><span class="n">Draw</span><span class="p">(</span><span class="n">img</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">d</span><span class="o">.</span><span class="n">text</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">10</span><span class="p">),</span> <span class="s1">'Hello World'</span><span class="p">,</span> <span class="n">font</span><span class="o">=</span><span class="n">font</span><span class="p">,</span> <span class="n">fill</span><span class="o">=</span><span class="p">(</span><span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">128</span><span class="p">))</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">d</span><span class="o">.</span><span class="n">text</span><span class="p">((</span><span class="mi">10</span><span class="p">,</span> <span class="mi">60</span><span class="p">),</span> <span class="sa">f</span><span class="s1">'t=</span><span class="si">{</span><span class="n">ts</span><span class="si">:</span><span class="s1">.3f</span><span class="si">}</span><span class="s1">'</span><span class="p">,</span> <span class="n">font</span><span class="o">=</span><span class="n">font</span><span class="p">,</span> <span class="n">fill</span><span class="o">=</span><span class="p">(</span><span class="mi">255</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">255</span><span class="p">,</span> <span class="mi">255</span><span class="p">))</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">overlay</span><span class="o">.</span><span class="n">update</span><span class="p">(</span><span class="n">img</span><span class="p">,</span> <span class="n">pos</span><span class="o">=</span><span class="p">(</span><span class="mi">2</span><span class="o">*</span><span class="n">pos</span><span class="p">,</span> <span class="n">pos</span><span class="p">))</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">time</span><span class="o">.</span><span class="n">sleep</span><span class="p">(</span><span class="mf">0.05</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">overlay</span><span class="o">.</span><span class="n">remove</span><span class="p">()</span>
+</span></pre>
</div>
<div class="section" id="playlist-handling">
<h4>Playlist handling</h4>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">(</span><span class="name">ytdl</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span> <span class="name">input_default_bindings</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span> <span class="name">input_vo_keyboard</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="name">player</span><span class="operator">.</span><span class="name">playlist_append</span><span class="punctuation">(</span><span class="literal string single">'https://youtu.be/PHIGke6Yzh8'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">playlist_append</span><span class="punctuation">(</span><span class="literal string single">'https://youtu.be/Ji9qSuQapFY'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">playlist_append</span><span class="punctuation">(</span><span class="literal string single">'https://youtu.be/6f78_Tf4Tdk'</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="name">player</span><span class="operator">.</span><span class="name">playlist_pos</span> <span class="operator">=</span> <span class="literal number integer">0</span><span class="whitespace">
-
-</span><span class="keyword">while</span> <span class="keyword constant">True</span><span class="punctuation">:</span><span class="whitespace">
-</span> <span class="comment single"># To modify the playlist, use player.playlist_{append,clear,move,remove}. player.playlist is read-only</span><span class="whitespace">
-</span> <span class="name builtin">print</span><span class="punctuation">(</span><span class="name">player</span><span class="operator">.</span><span class="name">playlist</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name">player</span><span class="operator">.</span><span class="name">wait_for_playback</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">(</span><span class="n">ytdl</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">input_default_bindings</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">input_vo_keyboard</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">playlist_append</span><span class="p">(</span><span class="s1">'https://youtu.be/PHIGke6Yzh8'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">playlist_append</span><span class="p">(</span><span class="s1">'https://youtu.be/Ji9qSuQapFY'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">playlist_append</span><span class="p">(</span><span class="s1">'https://youtu.be/6f78_Tf4Tdk'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">playlist_pos</span> <span class="o">=</span> <span class="mi">0</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">while</span> <span class="kc">True</span><span class="p">:</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="c1"># To modify the playlist, use player.playlist_{append,clear,move,remove}. player.playlist is read-only</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="nb">print</span><span class="p">(</span><span class="n">player</span><span class="o">.</span><span class="n">playlist</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">player</span><span class="o">.</span><span class="n">wait_for_playback</span><span class="p">()</span>
+</span></pre>
</div>
<div class="section" id="directly-feeding-mpv-data-from-python">
<h4>Directly feeding mpv data from python</h4>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name decorator">&#64;player</span><span class="operator">.</span><span class="name">python_stream</span><span class="punctuation">(</span><span class="literal string single">'foo'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="keyword">def</span> <span class="name function">reader</span><span class="punctuation">():</span><span class="whitespace">
-</span> <span class="keyword">with</span> <span class="name builtin">open</span><span class="punctuation">(</span><span class="literal string single">'test.webm'</span><span class="punctuation">,</span> <span class="literal string single">'rb'</span><span class="punctuation">)</span> <span class="keyword">as</span> <span class="name">f</span><span class="punctuation">:</span><span class="whitespace">
-</span> <span class="keyword">while</span> <span class="keyword constant">True</span><span class="punctuation">:</span><span class="whitespace">
-</span> <span class="keyword">yield</span> <span class="name">f</span><span class="operator">.</span><span class="name">read</span><span class="punctuation">(</span><span class="literal number integer">1024</span><span class="operator">*</span><span class="literal number integer">1024</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="name">player</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="literal string single">'python://foo'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">wait_for_playback</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="nd">&#64;player</span><span class="o">.</span><span class="n">python_stream</span><span class="p">(</span><span class="s1">'foo'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">def</span> <span class="nf">reader</span><span class="p">():</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">with</span> <span class="nb">open</span><span class="p">(</span><span class="s1">'test.webm'</span><span class="p">,</span> <span class="s1">'rb'</span><span class="p">)</span> <span class="k">as</span> <span class="n">f</span><span class="p">:</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">while</span> <span class="kc">True</span><span class="p">:</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">yield</span> <span class="n">f</span><span class="o">.</span><span class="n">read</span><span class="p">(</span><span class="mi">1024</span><span class="o">*</span><span class="mi">1024</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="s1">'python://foo'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">wait_for_playback</span><span class="p">()</span>
+</span></pre>
</div>
<div class="section" id="using-external-subtitles">
<h4>Using external subtitles</h4>
<p>The easiest way to load custom subtitles from a file is to pass the <tt class="docutils literal"><span class="pre">--sub-file</span></tt> option to the <tt class="docutils literal">loadfile</tt> call:</p>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">loadfile</span><span class="punctuation">(</span><span class="literal string single">'test.webm'</span><span class="punctuation">,</span> <span class="name">sub_file</span><span class="operator">=</span><span class="literal string single">'test.srt'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">wait_for_playback</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">loadfile</span><span class="p">(</span><span class="s1">'test.webm'</span><span class="p">,</span> <span class="n">sub_file</span><span class="o">=</span><span class="s1">'test.srt'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">wait_for_playback</span><span class="p">()</span>
+</span></pre>
<p>Note that you can also pass many other options to <tt class="docutils literal">loadfile</tt>. See the mpv docs for details.</p>
<p>If you want to add subtitle files or streams at runtime, you can use the <tt class="docutils literal"><span class="pre">sub-add</span></tt> command. <tt class="docutils literal"><span class="pre">sub-add</span></tt> can only be
called once the player is done loading the file and starts playing. An easy way to wait for this is to wait for the
<tt class="docutils literal"><span class="pre">core-idle</span></tt> property.</p>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="literal string single">'test.webm'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">wait_until_playing</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">sub_add</span><span class="punctuation">(</span><span class="literal string single">'test.srt'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">player</span><span class="operator">.</span><span class="name">wait_for_playback</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="s1">'test.webm'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">wait_until_playing</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">sub_add</span><span class="p">(</span><span class="s1">'test.srt'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span><span class="o">.</span><span class="n">wait_for_playback</span><span class="p">()</span>
+</span></pre>
</div>
<div class="section" id="using-mpv-s-built-in-gui">
<h4>Using MPV's built-in GUI</h4>
@@ -264,92 +264,92 @@ called once the player is done loading the file and starts playing. An easy way
GUI features such as the OSD or keyboard input. To enable the built-in GUI, use the following options when initializing
the MPV instance. See <a class="reference external" href="https://github.com/jaseg/python-mpv/issues/61">Issue 102</a> for more details</p>
<pre class="code python literal-block">
-<span class="comment single"># Enable the on-screen controller and keyboard shortcuts</span><span class="whitespace">
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">(</span><span class="name">input_default_bindings</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span> <span class="name">input_vo_keyboard</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span> <span class="name">osc</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="comment single"># Alternative version using the old &quot;floating box&quot; style on-screen controller</span><span class="whitespace">
-</span><span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">(</span><span class="name">player_operation_mode</span><span class="operator">=</span><span class="literal string single">'pseudo-gui'</span><span class="punctuation">,</span><span class="whitespace">
-</span> <span class="name">script_opts</span><span class="operator">=</span><span class="literal string single">'osc-layout=box,osc-seekbarstyle=bar,osc-deadzonesize=0,osc-minmousemove=3'</span><span class="punctuation">,</span><span class="whitespace">
-</span> <span class="name">input_default_bindings</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span><span class="whitespace">
-</span> <span class="name">input_vo_keyboard</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">,</span><span class="whitespace">
-</span> <span class="name">osc</span><span class="operator">=</span><span class="keyword constant">True</span><span class="punctuation">)</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="c1"># Enable the on-screen controller and keyboard shortcuts</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">(</span><span class="n">input_default_bindings</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">input_vo_keyboard</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span> <span class="n">osc</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="c1"># Alternative version using the old &quot;floating box&quot; style on-screen controller</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">(</span><span class="n">player_operation_mode</span><span class="o">=</span><span class="s1">'pseudo-gui'</span><span class="p">,</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">script_opts</span><span class="o">=</span><span class="s1">'osc-layout=box,osc-seekbarstyle=bar,osc-deadzonesize=0,osc-minmousemove=3'</span><span class="p">,</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">input_default_bindings</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">input_vo_keyboard</span><span class="o">=</span><span class="kc">True</span><span class="p">,</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">osc</span><span class="o">=</span><span class="kc">True</span><span class="p">)</span>
+</span></pre>
</div>
<div class="section" id="pyqt-embedding">
<h4>PyQT embedding</h4>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">sys</span><span class="whitespace">
-
-</span><span class="keyword namespace">from</span> <span class="name namespace">PyQt5.QtWidgets</span> <span class="keyword namespace">import</span> <span class="operator">*</span><span class="whitespace">
-</span><span class="keyword namespace">from</span> <span class="name namespace">PyQt5.QtCore</span> <span class="keyword namespace">import</span> <span class="operator">*</span><span class="whitespace">
-
-</span><span class="keyword">class</span> <span class="name class">Test</span><span class="punctuation">(</span><span class="name">QMainWindow</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="keyword">def</span> <span class="name function magic">__init__</span><span class="punctuation">(</span><span class="name builtin pseudo">self</span><span class="punctuation">,</span> <span class="name">parent</span><span class="operator">=</span><span class="keyword constant">None</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="name builtin">super</span><span class="punctuation">()</span><span class="operator">.</span><span class="name function magic">__init__</span><span class="punctuation">(</span><span class="name">parent</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">container</span> <span class="operator">=</span> <span class="name">QWidget</span><span class="punctuation">(</span><span class="name builtin pseudo">self</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">setCentralWidget</span><span class="punctuation">(</span><span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">container</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">container</span><span class="operator">.</span><span class="name">setAttribute</span><span class="punctuation">(</span><span class="name">Qt</span><span class="operator">.</span><span class="name">WA_DontCreateNativeAncestors</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">container</span><span class="operator">.</span><span class="name">setAttribute</span><span class="punctuation">(</span><span class="name">Qt</span><span class="operator">.</span><span class="name">WA_NativeWindow</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name">player</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">(</span><span class="name">wid</span><span class="operator">=</span><span class="name builtin">str</span><span class="punctuation">(</span><span class="name builtin">int</span><span class="punctuation">(</span><span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">container</span><span class="operator">.</span><span class="name">winId</span><span class="punctuation">())),</span><span class="whitespace">
-</span> <span class="name">vo</span><span class="operator">=</span><span class="literal string single">'x11'</span><span class="punctuation">,</span> <span class="comment single"># You may not need this</span><span class="whitespace">
-</span> <span class="name">log_handler</span><span class="operator">=</span><span class="name builtin">print</span><span class="punctuation">,</span><span class="whitespace">
-</span> <span class="name">loglevel</span><span class="operator">=</span><span class="literal string single">'debug'</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name">player</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="literal string single">'test.webm'</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="name">app</span> <span class="operator">=</span> <span class="name">QApplication</span><span class="punctuation">(</span><span class="name">sys</span><span class="operator">.</span><span class="name">argv</span><span class="punctuation">)</span><span class="whitespace">
-
-</span><span class="comment single"># This is necessary since PyQT stomps over the locale settings needed by libmpv.</span><span class="whitespace">
-</span><span class="comment single"># This needs to happen after importing PyQT before creating the first mpv.MPV instance.</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">locale</span><span class="whitespace">
-</span><span class="name">locale</span><span class="operator">.</span><span class="name">setlocale</span><span class="punctuation">(</span><span class="name">locale</span><span class="operator">.</span><span class="name">LC_NUMERIC</span><span class="punctuation">,</span> <span class="literal string single">'C'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="name">win</span> <span class="operator">=</span> <span class="name">Test</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name">win</span><span class="operator">.</span><span class="name">show</span><span class="punctuation">()</span><span class="whitespace">
-</span><span class="name">sys</span><span class="operator">.</span><span class="name">exit</span><span class="punctuation">(</span><span class="name">app</span><span class="operator">.</span><span class="name">exec_</span><span class="punctuation">())</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">sys</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">from</span> <span class="nn">PyQt5.QtWidgets</span> <span class="kn">import</span> <span class="o">*</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">from</span> <span class="nn">PyQt5.QtCore</span> <span class="kn">import</span> <span class="o">*</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">class</span> <span class="nc">Test</span><span class="p">(</span><span class="n">QMainWindow</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">parent</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="nb">super</span><span class="p">()</span><span class="o">.</span><span class="fm">__init__</span><span class="p">(</span><span class="n">parent</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">container</span> <span class="o">=</span> <span class="n">QWidget</span><span class="p">(</span><span class="bp">self</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">setCentralWidget</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">container</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">container</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="n">Qt</span><span class="o">.</span><span class="n">WA_DontCreateNativeAncestors</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">container</span><span class="o">.</span><span class="n">setAttribute</span><span class="p">(</span><span class="n">Qt</span><span class="o">.</span><span class="n">WA_NativeWindow</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">player</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">(</span><span class="n">wid</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="nb">int</span><span class="p">(</span><span class="bp">self</span><span class="o">.</span><span class="n">container</span><span class="o">.</span><span class="n">winId</span><span class="p">())),</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">vo</span><span class="o">=</span><span class="s1">'x11'</span><span class="p">,</span> <span class="c1"># You may not need this</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">log_handler</span><span class="o">=</span><span class="nb">print</span><span class="p">,</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">loglevel</span><span class="o">=</span><span class="s1">'debug'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">player</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="s1">'test.webm'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">app</span> <span class="o">=</span> <span class="n">QApplication</span><span class="p">(</span><span class="n">sys</span><span class="o">.</span><span class="n">argv</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="c1"># This is necessary since PyQT stomps over the locale settings needed by libmpv.</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="c1"># This needs to happen after importing PyQT before creating the first mpv.MPV instance.</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">locale</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_NUMERIC</span><span class="p">,</span> <span class="s1">'C'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">win</span> <span class="o">=</span> <span class="n">Test</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">win</span><span class="o">.</span><span class="n">show</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">sys</span><span class="o">.</span><span class="n">exit</span><span class="p">(</span><span class="n">app</span><span class="o">.</span><span class="n">exec_</span><span class="p">())</span>
+</span></pre>
</div>
<div class="section" id="pygobject-embedding">
<h4>PyGObject embedding</h4>
<pre class="code python literal-block">
-<span class="comment hashbang">#!/usr/bin/env python3</span><span class="whitespace">
-</span><span class="keyword namespace">import</span> <span class="name namespace">gi</span><span class="whitespace">
-
-</span><span class="keyword namespace">import</span> <span class="name namespace">mpv</span><span class="whitespace">
-
-</span><span class="name">gi</span><span class="operator">.</span><span class="name">require_version</span><span class="punctuation">(</span><span class="literal string single">'Gtk'</span><span class="punctuation">,</span> <span class="literal string single">'3.0'</span><span class="punctuation">)</span><span class="whitespace">
-</span><span class="keyword namespace">from</span> <span class="name namespace">gi.repository</span> <span class="keyword namespace">import</span> <span class="name">Gtk</span><span class="whitespace">
-
-
-</span><span class="keyword">class</span> <span class="name class">MainClass</span><span class="punctuation">(</span><span class="name">Gtk</span><span class="operator">.</span><span class="name">Window</span><span class="punctuation">):</span><span class="whitespace">
-
-</span> <span class="keyword">def</span> <span class="name function magic">__init__</span><span class="punctuation">(</span><span class="name builtin pseudo">self</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="name builtin">super</span><span class="punctuation">(</span><span class="name">MainClass</span><span class="punctuation">,</span> <span class="name builtin pseudo">self</span><span class="punctuation">)</span><span class="operator">.</span><span class="name function magic">__init__</span><span class="punctuation">()</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">set_default_size</span><span class="punctuation">(</span><span class="literal number integer">600</span><span class="punctuation">,</span> <span class="literal number integer">400</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">connect</span><span class="punctuation">(</span><span class="literal string double">&quot;destroy&quot;</span><span class="punctuation">,</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">on_destroy</span><span class="punctuation">)</span><span class="whitespace">
-
-</span> <span class="name">widget</span> <span class="operator">=</span> <span class="name">Gtk</span><span class="operator">.</span><span class="name">Frame</span><span class="punctuation">()</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">add</span><span class="punctuation">(</span><span class="name">widget</span><span class="punctuation">)</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">show_all</span><span class="punctuation">()</span><span class="whitespace">
-
-</span> <span class="comment single"># Must be created &gt;after&lt; the widget is shown, else property 'window' will be None</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">mpv</span> <span class="operator">=</span> <span class="name">mpv</span><span class="operator">.</span><span class="name">MPV</span><span class="punctuation">(</span><span class="name">wid</span><span class="operator">=</span><span class="name builtin">str</span><span class="punctuation">(</span><span class="name">widget</span><span class="operator">.</span><span class="name">get_property</span><span class="punctuation">(</span><span class="literal string double">&quot;window&quot;</span><span class="punctuation">)</span><span class="operator">.</span><span class="name">get_xid</span><span class="punctuation">()))</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">mpv</span><span class="operator">.</span><span class="name">play</span><span class="punctuation">(</span><span class="literal string double">&quot;test.webm&quot;</span><span class="punctuation">)</span><span class="whitespace">
-
-</span> <span class="keyword">def</span> <span class="name function">on_destroy</span><span class="punctuation">(</span><span class="name builtin pseudo">self</span><span class="punctuation">,</span> <span class="name">widget</span><span class="punctuation">,</span> <span class="name">data</span><span class="operator">=</span><span class="keyword constant">None</span><span class="punctuation">):</span><span class="whitespace">
-</span> <span class="name builtin pseudo">self</span><span class="operator">.</span><span class="name">mpv</span><span class="operator">.</span><span class="name">terminate</span><span class="punctuation">()</span><span class="whitespace">
-</span> <span class="name">Gtk</span><span class="operator">.</span><span class="name">main_quit</span><span class="punctuation">()</span><span class="whitespace">
-
-
-</span><span class="keyword">if</span> <span class="name variable magic">__name__</span> <span class="operator">==</span> <span class="literal string single">'__main__'</span><span class="punctuation">:</span><span class="whitespace">
-</span> <span class="comment single"># This is necessary since like Qt, Gtk stomps over the locale settings needed by libmpv.</span><span class="whitespace">
-</span> <span class="comment single"># Like with Qt, this needs to happen after importing Gtk but before creating the first mpv.MPV instance.</span><span class="whitespace">
-</span> <span class="keyword namespace">import</span> <span class="name namespace">locale</span><span class="whitespace">
-</span> <span class="name">locale</span><span class="operator">.</span><span class="name">setlocale</span><span class="punctuation">(</span><span class="name">locale</span><span class="operator">.</span><span class="name">LC_NUMERIC</span><span class="punctuation">,</span> <span class="literal string single">'C'</span><span class="punctuation">)</span><span class="whitespace">
-
-</span> <span class="name">application</span> <span class="operator">=</span> <span class="name">MainClass</span><span class="punctuation">()</span><span class="whitespace">
-</span> <span class="name">Gtk</span><span class="operator">.</span><span class="name">main</span><span class="punctuation">()</span>
-</pre>
+<span class="lineno"></span><span class="line"><span class="ch">#!/usr/bin/env python3</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">gi</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">import</span> <span class="nn">mpv</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="n">gi</span><span class="o">.</span><span class="n">require_version</span><span class="p">(</span><span class="s1">'Gtk'</span><span class="p">,</span> <span class="s1">'3.0'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="kn">from</span> <span class="nn">gi.repository</span> <span class="kn">import</span> <span class="n">Gtk</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">class</span> <span class="nc">MainClass</span><span class="p">(</span><span class="n">Gtk</span><span class="o">.</span><span class="n">Window</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">def</span> <span class="fm">__init__</span><span class="p">(</span><span class="bp">self</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="nb">super</span><span class="p">(</span><span class="n">MainClass</span><span class="p">,</span> <span class="bp">self</span><span class="p">)</span><span class="o">.</span><span class="fm">__init__</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">set_default_size</span><span class="p">(</span><span class="mi">600</span><span class="p">,</span> <span class="mi">400</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">connect</span><span class="p">(</span><span class="s2">&quot;destroy&quot;</span><span class="p">,</span> <span class="bp">self</span><span class="o">.</span><span class="n">on_destroy</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">widget</span> <span class="o">=</span> <span class="n">Gtk</span><span class="o">.</span><span class="n">Frame</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">add</span><span class="p">(</span><span class="n">widget</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">show_all</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="c1"># Must be created &gt;after&lt; the widget is shown, else property 'window' will be None</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">mpv</span> <span class="o">=</span> <span class="n">mpv</span><span class="o">.</span><span class="n">MPV</span><span class="p">(</span><span class="n">wid</span><span class="o">=</span><span class="nb">str</span><span class="p">(</span><span class="n">widget</span><span class="o">.</span><span class="n">get_property</span><span class="p">(</span><span class="s2">&quot;window&quot;</span><span class="p">)</span><span class="o">.</span><span class="n">get_xid</span><span class="p">()))</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">mpv</span><span class="o">.</span><span class="n">play</span><span class="p">(</span><span class="s2">&quot;test.webm&quot;</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="k">def</span> <span class="nf">on_destroy</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span> <span class="n">widget</span><span class="p">,</span> <span class="n">data</span><span class="o">=</span><span class="kc">None</span><span class="p">):</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="bp">self</span><span class="o">.</span><span class="n">mpv</span><span class="o">.</span><span class="n">terminate</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">Gtk</span><span class="o">.</span><span class="n">main_quit</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span><span class="k">if</span> <span class="vm">__name__</span> <span class="o">==</span> <span class="s1">'__main__'</span><span class="p">:</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="c1"># This is necessary since like Qt, Gtk stomps over the locale settings needed by libmpv.</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="c1"># Like with Qt, this needs to happen after importing Gtk but before creating the first mpv.MPV instance.</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="kn">import</span> <span class="nn">locale</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">locale</span><span class="o">.</span><span class="n">setlocale</span><span class="p">(</span><span class="n">locale</span><span class="o">.</span><span class="n">LC_NUMERIC</span><span class="p">,</span> <span class="s1">'C'</span><span class="p">)</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">application</span> <span class="o">=</span> <span class="n">MainClass</span><span class="p">()</span><span class="w"></span></span>
+<span class="lineno"></span><span class="line"><span class="w"></span> <span class="n">Gtk</span><span class="o">.</span><span class="n">main</span><span class="p">()</span>
+</span></pre>
</div>
<div class="section" id="using-opengl-from-pygobject">
<h4>Using OpenGL from PyGObject</h4>
diff --git a/projects/wsdiff/index.html b/projects/wsdiff/index.html
index 493fae5..e7deab5 100644
--- a/projects/wsdiff/index.html
+++ b/projects/wsdiff/index.html
@@ -39,41 +39,41 @@ on available screen space.</p>
<div class="section" id="installation">
<h2>Installation</h2>
<pre class="code sh literal-block">
-$<span class="whitespace"> </span>pip<span class="whitespace"> </span>install<span class="whitespace"> </span>wsdiff
-</pre>
+<span class="lineno"></span><span class="line">$<span class="w"> </span>pip<span class="w"> </span>install<span class="w"> </span>wsdiff
+</span></pre>
</div>
<div class="section" id="usage">
<h2>Usage</h2>
<pre class="literal-block">
-usage: wsdiff [-h] [-b] [-s SYNTAX_CSS] [-l LEXER] [-L] [-t PAGETITLE]
- [-o OUTPUT] [--header] [--content]
- [old] [new]
-
-Given two source files or directories this application creates an html page
-that highlights the differences between the two.
-
-positional arguments:
- old source file or directory to compare (&quot;before&quot; file)
- new source file or directory to compare (&quot;after&quot; file)
-
-options:
- -h, --help show this help message and exit
- -b, --open Open output file in a browser
- -s SYNTAX_CSS, --syntax-css SYNTAX_CSS
- Path to custom Pygments CSS file for code syntax
- highlighting
- -l LEXER, --lexer LEXER
- Manually select pygments lexer (default: guess from
- filename, use -L to list available lexers.)
- -L, --list-lexers List available lexers for -l/--lexer
- -t PAGETITLE, --pagetitle PAGETITLE
- Override page title of output HTML file
- -o OUTPUT, --output OUTPUT
- Name of output file (default: stdout)
- --header Only output HTML header with stylesheets and stuff,
- and no diff
- --content Only output HTML content, without header
-</pre>
+<span class="lineno"></span><span class="line">usage: wsdiff [-h] [-b] [-s SYNTAX_CSS] [-l LEXER] [-L] [-t PAGETITLE]</span>
+<span class="lineno"></span><span class="line"> [-o OUTPUT] [--header] [--content]</span>
+<span class="lineno"></span><span class="line"> [old] [new]</span>
+<span class="lineno"></span><span class="line"></span>
+<span class="lineno"></span><span class="line">Given two source files or directories this application creates an html page</span>
+<span class="lineno"></span><span class="line">that highlights the differences between the two.</span>
+<span class="lineno"></span><span class="line"></span>
+<span class="lineno"></span><span class="line">positional arguments:</span>
+<span class="lineno"></span><span class="line"> old source file or directory to compare (&quot;before&quot; file)</span>
+<span class="lineno"></span><span class="line"> new source file or directory to compare (&quot;after&quot; file)</span>
+<span class="lineno"></span><span class="line"></span>
+<span class="lineno"></span><span class="line">options:</span>
+<span class="lineno"></span><span class="line"> -h, --help show this help message and exit</span>
+<span class="lineno"></span><span class="line"> -b, --open Open output file in a browser</span>
+<span class="lineno"></span><span class="line"> -s SYNTAX_CSS, --syntax-css SYNTAX_CSS</span>
+<span class="lineno"></span><span class="line"> Path to custom Pygments CSS file for code syntax</span>
+<span class="lineno"></span><span class="line"> highlighting</span>
+<span class="lineno"></span><span class="line"> -l LEXER, --lexer LEXER</span>
+<span class="lineno"></span><span class="line"> Manually select pygments lexer (default: guess from</span>
+<span class="lineno"></span><span class="line"> filename, use -L to list available lexers.)</span>
+<span class="lineno"></span><span class="line"> -L, --list-lexers List available lexers for -l/--lexer</span>
+<span class="lineno"></span><span class="line"> -t PAGETITLE, --pagetitle PAGETITLE</span>
+<span class="lineno"></span><span class="line"> Override page title of output HTML file</span>
+<span class="lineno"></span><span class="line"> -o OUTPUT, --output OUTPUT</span>
+<span class="lineno"></span><span class="line"> Name of output file (default: stdout)</span>
+<span class="lineno"></span><span class="line"> --header Only output HTML header with stylesheets and stuff,</span>
+<span class="lineno"></span><span class="line"> and no diff</span>
+<span class="lineno"></span><span class="line"> --content Only output HTML content, without header
+</span></pre>
</div>
<div class="section" id="example-output">
<h2>Example Output</h2>