aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Ankarström <john@ankarstrom.se>2020-10-24 19:56:51 +0200
committerJohn Ankarström <john@ankarstrom.se>2020-10-24 19:56:51 +0200
commite44efcad2daf39f6b9908dd0ac46c9d1309eabcb (patch)
treef9ba5be4eb72b37fbab8dc35e42ac2f7e70256a0
downloadwatch-e44efcad2daf39f6b9908dd0ac46c9d1309eabcb.tar.gz
release 1.0
-rw-r--r--watch.cmd18
1 files changed, 18 insertions, 0 deletions
diff --git a/watch.cmd b/watch.cmd
new file mode 100644
index 0000000..1c7ea1b
--- /dev/null
+++ b/watch.cmd
@@ -0,0 +1,18 @@
+@echo off
+set url=%*
+set url=%url:watch:=%
+
+youtube-dl -j %url% > %TEMP%\youtubejson
+
+type %TEMP%\youtubejson ^
+ | jq ".formats[] | select(.ext == """mp4""") | {width, url}"^
+ | jq -sr "sort_by(.width) | .[-1].url"^
+ > %TEMP%\youtubevideo
+
+type %TEMP%\youtubejson^
+ | jq ".formats[] | select(.ext == """m4a""") | {url}" | jq -sr ".[-1].url"^
+ > %TEMP%\youtubeaudio
+
+for /f %%v in (%TEMP%\youtubevideo) ^
+do for /f %%a in (%TEMP%\youtubeaudio) ^
+do start "" "%ProgramFiles%\MPC-HC\mpc-hc" "%%v" /dub "%%a" \ No newline at end of file