「YouTube (Music)のプレイリストのギャップレス再生」の版間の差分

Notion-MW
Notion-MW
103行目: 103行目:
<li><p>ytp&#45;invisible.vbs(bashを非表示で起動するためのvbs)</p>
<li><p>ytp&#45;invisible.vbs(bashを非表示で起動するためのvbs)</p>
<syntaxhighlight lang="</syntaxhighlight></li></ul>">
<syntaxhighlight lang="</syntaxhighlight></li></ul>">
visual basic Dim oWshShell Set oWshShell = CreateObject(&quot;WScript.Shell&quot;) Dim mpv_args For cnt = 2 To WScript.Arguments.Count - 1 mpv_args = mpv_args &amp; &quot; &quot; &amp; WScript.Arguments(cnt) Next oWshShell.Run &quot;&quot;&quot;C:\Program Files\Git\bin\bash.exe&quot;&quot; -c 'ytpx.sh &quot;&quot;&quot; &amp; Wscript.Arguments(0) &amp; &quot;&quot;&quot; &quot; &amp; Wscript.Arguments(1) &amp; mpv_args &amp; &quot;'&quot;, 0, False ```
vb.net Dim oWshShell Set oWshShell = CreateObject(&quot;WScript.Shell&quot;) Dim mpv_args For cnt = 2 To WScript.Arguments.Count - 1 mpv_args = mpv_args &amp; &quot; &quot; &amp; WScript.Arguments(cnt) Next oWshShell.Run &quot;&quot;&quot;C:\Program Files\Git\bin\bash.exe&quot;&quot; -c 'ytpx.sh &quot;&quot;&quot; &amp; Wscript.Arguments(0) &amp; &quot;&quot;&quot; &quot; &amp; Wscript.Arguments(1) &amp; mpv_args &amp; &quot;'&quot;, 0, False ```


<pre>2つ目以降の引数をつなげて渡している。Runのオプションで0(非表示)、False(終了を待たない)を指定している。デバッグ時は0を1に変えておくとウィンドウが表示される。</pre>
<pre>2つ目以降の引数をつなげて渡している。Runのオプションで0(非表示)、False(終了を待たない)を指定している。デバッグ時は0を1に変えておくとウィンドウが表示される。</pre>
134行目: 134行目:
上記の実装では引用符の入力など多少の回りくどいキーボード操作が必要である。URLはクリップボードに入っているので、ショートカットキーから起動することももちろん可能である。ただし再生曲数を入力するためのダイアログは必要である。以下のAutoHotkeyのスクリプトの例では、Ctrl+Alt+Shift+Lを押すと入力ダイアログを表示して再生曲数を取得し、ytp.batを起動する。
上記の実装では引用符の入力など多少の回りくどいキーボード操作が必要である。URLはクリップボードに入っているので、ショートカットキーから起動することももちろん可能である。ただし再生曲数を入力するためのダイアログは必要である。以下のAutoHotkeyのスクリプトの例では、Ctrl+Alt+Shift+Lを押すと入力ダイアログを表示して再生曲数を取得し、ytp.batを起動する。


<syntaxhighlight lang="visual basic">^!+l::
<syntaxhighlight lang="vb.net">^!+l::
InputBox, play_numbers, Gapless Play YouTube, Enter the number of tracks to play ("" or "0" will play to the end)
InputBox, play_numbers, Gapless Play YouTube, Enter the number of tracks to play ("" or "0" will play to the end)
Run ytp.bat "%clipboard%" %play_numbers%</syntaxhighlight>
Run ytp.bat "%clipboard%" %play_numbers%</syntaxhighlight>