JERisBRISK

Genki Shadowcast Launcher for MPV

May 10th, 2021 (edited)
671
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @setlocal enabledelayedexpansion
  2.  
  3. @REM Genki Shadowcast Launcher for MPV by JERisBRISK
  4.  
  5. @set _version=1.1
  6. @set _arg1=%~1
  7. @set _arg1Start=!_arg1:~1,1!
  8.  
  9. @if /i [!_arg1Start!]==[?] (
  10.   call :usage
  11.   goto :eof
  12. )
  13.  
  14. @if /i [!_arg1Start!]==[h] (
  15.   call :help
  16.   goto :eof
  17. )
  18.  
  19. @if /i [!_arg1Start!]==[f] (
  20.   goto :fullScreen
  21. )
  22.  
  23. @if /i [!_arg1Start!]==[w] (
  24.   goto :windowed
  25. )
  26.  
  27. @REM no switch passed, ask the user what they want
  28. @goto :userChoice
  29.  
  30. :title
  31. @echo -= Genki Shadowcast Launcher for MPV =-
  32. @echo      Version %_version% by JERisBRISK
  33. @goto :eof
  34.  
  35. :usage
  36. @echo Usage:
  37. @echo  %~nx0 [-f ^| -w ^| -?]
  38. @echo   f : fullscreen mode
  39. @echo   w : windowed mode
  40. @echo   ? : show usage
  41. @echo   h : show usage and dependencies
  42. @echo  Slashes may be used instead of dashes for all switches
  43. @goto :eof
  44.  
  45. :checkMpv
  46. @where /q mpv.exe
  47. @if ERRORLEVEL 1 (
  48.   echo - mpv is missing
  49.   echo   get it at https://mpv.io and add to your PATH or place %~nx0 next to it
  50.   exit /b 1
  51. ) else (
  52.   echo + mpv is present
  53.   exit /b 0
  54. )
  55. @goto :eof
  56.  
  57. :checkMono
  58. @where /q mono-to-stereo.exe
  59. @if ERRORLEVEL 1 (
  60.   echo - mono-to-stereo is missing
  61.   echo   get it at https://github.com/ToadKing/mono-to-stereo/releases and add to your PATH or place %~nx0 next to it
  62.   echo   things will sound funky until this is done
  63.   exit /b 1
  64. ) else (
  65.   echo + mono-to-stereo is present
  66.   exit /b 0
  67. )
  68. @goto :eof
  69.  
  70. :help
  71. @call :title
  72. @echo.
  73. @call :usage
  74. @echo.
  75. @echo Dependencies:
  76. @call :checkMpv
  77. @echo.
  78. @call :checkMono
  79. @goto :eof
  80.  
  81. :userChoice
  82. @choice /T 7 /D N /M "Run full-screen (default is No after 7 seconds)"
  83.  
  84. @if ERRORLEVEL 2 (
  85.   goto :windowed
  86. ) else (
  87.   goto :fullScreen
  88. )
  89. @goto :eof
  90.  
  91.  
  92. :fullScreen
  93. @call :checkMpv
  94. @if ERRORLEVEL 1 exit /b 1
  95. @echo   Starting MPV in full screen mode
  96. @call :run --fs
  97. @goto :eof
  98.  
  99.  
  100. :windowed
  101. @call :checkMpv
  102. @if ERRORLEVEL 1 exit /b 1
  103. @echo   Starting MPV in windowed mode
  104. @call :run
  105. @goto :eof
  106.  
  107.  
  108. :run %1
  109. @start /high mpv.exe av://dshow:video="ShadowCast" --profile=low-latency --untimed %1
  110. @call :checkMono
  111. @if ERRORLEVEL 1 exit /b 1
  112. @echo   Starting Mono to Stereo
  113. @start "Mono to Stereo" /normal /min mono-to-stereo.exe --in-device "Digital Audio Interface (2- ShadowCast)"
  114. @start "Mono to Stereo" /normal /min mono-to-stereo.exe --in-device "Digital Audio Interface (ShadowCast)"
  115. @goto :eof
  116.  
RAW Paste Data