@echo off cd /d "%~dp0" echo ========================================================== echo Version 1.6a echo 05/02/24 echo ========================================================== REM MPV builds RSS. set "MPVRSSFeedURL=https://sourceforge.net/p/mpv-player-windows/activity/feed" REM Parse MPV RSS feed to get latest V3 and non-V3 MPV build links. echo Parsing MPV RSS feed for download links. echo ========================================================== powershell -Command "$rss_data = Invoke-RestMethod -Uri '%MPVRSSFeedURL%'; $latestV3Build = $rss_data | Where-Object { $_.link -like '*64bit-v3*mpv-x86_64-v3*-git-*.7z/download' } | Select-Object -First 1; $latestNonV3Build = $rss_data | Where-Object { $_.link -like '*64bit*mpv-x86_64*-git-*.7z/download' -and $_.link -notlike '*-v3-*' } | Select-Object -First 1; [System.IO.File]::WriteAllText('%CD%\mpv_temp_v3.txt', $latestV3Build.link); [System.IO.File]::WriteAllText('%CD%\mpv_temp.txt', $latestNonV3Build.link);" set /p LatestV3BuildLink=<"%CD%\mpv_temp_v3.txt" set /p LatestNonV3BuildLink=<"%CD%\mpv_temp.txt" REM echo Latest V3 Build Link: %LatestV3BuildLink% REM echo Latest Non-V3 Build Link: %LatestNonV3BuildLink% REM Download 7zr.exe & 7za (extras). echo Downloading 7zr and 7za. echo ========================================================== curl -s "https://www.7-zip.org/a/7zr.exe" -o "%CD%\7zr.exe" >nul curl -s "https://www.7-zip.org/a/7z2301-extra.7z" -o "%CD%\7z2301-extra.7z" >nul "%CD%\7zr.exe" x "7z2301-extra.7z" -o"%CD%\7za" >nul move "%CD%\7za\7za.exe" "%CD%" >nul echo Downloading Coreinfo. echo ========================================================== REM Download Coreinfo. curl -s https://download.sysinternals.com/files/Coreinfo.zip -o "%CD%\Coreinfo.zip" REM Unzip Coreinfo. "%CD%\7za.exe" x "%CD%\Coreinfo.zip" -o"%CD%\Coreinfo" >nul echo Parsing CPU instructions with Coreinfo. echo ========================================================== REM Check for AVX2 support using Coreinfo. set "AVX2Support=false" for /f "tokens=2*" %%a in ('"".\Coreinfo\Coreinfo.exe" /accepteula | findstr /C:"AVX2""') do ( if "%%a"=="*" ( set "AVX2Support=true" ) else if "%%a"=="-" ( set "AVX2Support=false" ) ) REM AVX2 support ? if "%AVX2Support%"=="true" ( echo CPU is x86_64-v3 or newer. echo ========================================================== echo Downloading latest x86_64-v3 MPV build... echo ========================================================== curl -s -L "%LatestV3BuildLink%" -o "%CD%\mpv_v3.7z" echo Latest x86_64-v3 MPV build Download Complete. echo ========================================================== REM Create folder for MPV and extract files using 7zr.exe. mkdir "%CD%\MPV" "%CD%\7zr.exe" x "mpv_v3.7z" -o"%CD%\MPV" >nul echo MPV_x86_64-v3 extracted to \MPV\. echo ========================================================== REM Create additional script folders. mkdir "%CD%\MPV\scripts" mkdir "%CD%\MPV\script-opts" ) else ( echo CPU is x86_64-v2 or older. echo ========================================================== echo Downloading latest non-v3 MPV build... echo ========================================================== curl -s -L "%LatestNonV3BuildLink%" -o "%CD%\mpv_non_v3.7z" echo Latest non-v3 MPV build Download Complete. echo ========================================================== REM Create folder for MPV and extract files using 7zr.exe. mkdir "%CD%\MPV" "%CD%\7zr.exe" x "mpv_non_v3.7z" -o"%CD%\MPV" >nul echo MPV_x86_64 extracted to \MPV\. echo ========================================================== REM Create additional script folders. mkdir "%CD%\MPV\scripts" mkdir "%CD%\MPV\script-opts" ) REM Conf files, updater and lua scripts. echo Downloading mpv.conf and input.conf to \MPV\mpv\. echo ========================================================== curl -s "https://gist.githubusercontent.com/JySzE/db4149cad726b3b6955dca8d47a19721/raw" -o "%CD%\MPV\mpv\mpv.conf" curl -s "https://gist.githubusercontent.com/JySzE/ced7f506629c32f44adf4fe43a341189/raw" -o "%CD%\MPV\mpv\input.conf" echo Downloading mpv_conf_updater.bat to \MPV\. echo ========================================================== curl -s "https://gist.githubusercontent.com/JySzE/94686099207e3d260d17a6c02ed0623a/raw" -o "%CD%\MPV\mpv_conf_updater.bat" echo Downloading mpv-menu-plugin by tsl0922 to \MPV\scripts\. echo ========================================================== curl -s -L "https://github.com/tsl0922/mpv-menu-plugin/releases/download/2.4.1/menu.zip" -o "%CD%\menu.zip" "%CD%\7za.exe" x "%CD%\menu.zip" -o"%CD%" >nul move "%CD%\menu\*.*" "%CD%\MPV\scripts" >nul echo Downloading autoload by MPV to \MPV\scripts\. echo ========================================================== curl -s "https://raw.githubusercontent.com/mpv-player/mpv/master/TOOLS/lua/autoload.lua" -o "%CD%\MPV\scripts\autoload.lua" echo Downloading thumbfast by po5 to \MPV\scripts\. echo ========================================================== curl -s "https://raw.githubusercontent.com/po5/thumbfast/master/thumbfast.lua" -o "%CD%\MPV\scripts\thumbfast.lua" echo Downloading osc.lua for thumbfast to \MPV\scripts\. echo ========================================================== curl -s "https://raw.githubusercontent.com/po5/thumbfast/vanilla-osc/player/lua/osc.lua" -o "%CD%\MPV\scripts\osc.lua" echo Downloading thumbfast.conf to \MPV\script-opts\. echo ========================================================== curl -s "https://raw.githubusercontent.com/po5/thumbfast/master/thumbfast.conf" -o "%CD%\MPV\script-opts\thumbfast.conf" echo Editing thumbfast.conf "tone_mapping=no, direct_io=yes". echo ========================================================== curl -s -L "https://phoenixnap.dl.sourceforge.net/project/gnuwin32/sed/4.2.1/sed-4.2.1-bin.zip" -o "%CD%\sed-4.2.1-bin.zip" "%CD%\7za.exe" x "%CD%\sed-4.2.1-bin.zip" -o"%CD%\sed" >nul curl -s -L "https://versaweb.dl.sourceforge.net/project/gnuwin32/sed/4.2.1/sed-4.2.1-dep.zip" -o "%CD%\sed-4.2.1-dep.zip" "%CD%\7za.exe" x "%CD%\sed-4.2.1-dep.zip" -o"%CD%\sed_dep" >nul move "%CD%\sed_dep\bin\*.*" "%CD%\sed\bin\" >nul set "file=%CD%\MPV\script-opts\thumbfast.conf" set "tempfile=%CD%\MPV\script-opts\thumbfast.tmp" REM Perform the replacements using sed. "%CD%\sed\bin\sed.exe" "s/tone_mapping=auto/tone_mapping=no/g; s/direct_io=no/direct_io=yes/g" "%file%" > "%tempfile%" REM Replace the original file with the modified one. move /Y "%tempfile%" "%file%" >nul echo Downloading persist-properties.lua to \MPV\scripts\. echo ========================================================== curl -s "https://gist.githubusercontent.com/JySzE/90a3f57ce05e3abeadf07af6fa1f680e/raw" -o "%CD%\MPV\scripts\persist-properties.lua" echo Downloading Gandhi Sans Font to \MPV\fonts\. echo ========================================================== mkdir "%CD%\MPV\fonts" curl -sk "https://www.tipografiagandhi.com/common/zip/gandhi_sans_and_serif.zip" -o "%CD%\gandhi_sans_and_serif.zip" "%CD%\7za.exe" x "%CD%\gandhi_sans_and_serif.zip" -o"%CD%\" >nul move "%CD%\TipografiaGandhi\GandhiSans-*.*" "%CD%\MPV\fonts\" >nul REM Clean up temporary files. echo Deleting temp files. echo ========================================================== del "%CD%\mpv_temp*.txt" /F /Q del "%CD%\Coreinfo.zip" /F /Q rd /s /q "%CD%\Coreinfo" del "%CD%\mpv_*.7z" /F /Q rd /s /q "%CD%\MPV\doc" del "%CD%\menu.zip" /F /Q rd /s /q "%CD%\menu" del "%CD%\sed-4.2.1-*.zip" /F /Q rd /s /q "%CD%\sed" rd /s /q "%CD%\sed_dep" rd /s /q "%CD%\7za" rd /s /q "%CD%\TipografiaGandhi" del "%CD%\gandhi_sans_and_serif.zip" /F /Q del "%CD%\7z2301-extra.7z" /F /Q del "%CD%\7z*.exe" /F /Q REM Checking for APPDATA MPV folder because it reads conf files from here first. echo Checking for APPDATA MPV folder... set "folder=%APPDATA%/mpv" set "backup_folder=mpv_bak" set "backup_suffix=1" IF EXIST "%folder%" ( echo ========================================================== echo The APPDATA MPV folder exists. echo ========================================================== echo Renaming APPDATA "mpv" folder to "mpv_bak" rem Increment the backup_suffix if mpv_bak folder already exists :check_backup_folder if exist "%APPDATA%\%backup_folder%_%backup_suffix%" ( set /a "backup_suffix+=1" goto :check_backup_folder ) move "%APPDATA%\mpv" "%APPDATA%\%backup_folder%_%backup_suffix%" >nul ) ELSE ( echo ========================================================== echo The APPDATA MPV folder does not exist. This is good. ) echo ========================================================== echo All done enjoy! echo ========================================================== pause (goto) 2>nul & del "%~dp0\SoM_MPV_Builder.bat"