I am trying to create a batch file for Blu-ray Disc playback on XBMC 11/12 that launches MPC-HC (with LAV Filters) reads the 'Disc.inf' and gets the correct playlist file without any use selection/input.
Here's what I have so far (Note I have no experience with this just been searching around)
This batch file seems to work great, but one problem is it will only work if the correct playlist listed is 3 characters eg 789
If the playlist is say 30 MPC will try and open 0030.mpls instead of 00030.mpls
I can't figure how to get the batch file to check the length of the variable and if its less than 3 characters then add a 0 to the beginning of a variable.
Just thought I'd post here to see if anyone might know how I could get this to work, or if there a better way of doing it completely
Here's what I have so far (Note I have no experience with this just been searching around)
Code:
findstr /m "playlists=" D:\disc.inf
IF ERRORLEVEL 1 GOTO playlistnotfound
IF ERRORLEVEL 0 GOTO playlistfound
:playlistfound
for /f "tokens=2 delims==," %%i in ('findstr playlists D:\disc.inf') do set playlist=%%i
"C:\Program Files (x86)\MPC-HC\mpc-hc.exe" "D:\BDMV\PLAYLIST\00%playlist%.mpls"
GOTO End
:playlistnotfound
"C:\Program Files (x86)\MPC-HC\mpc-hc.exe" "D:\BDMV\index.bdmv"
GOTO End
:end
This batch file seems to work great, but one problem is it will only work if the correct playlist listed is 3 characters eg 789
If the playlist is say 30 MPC will try and open 0030.mpls instead of 00030.mpls
I can't figure how to get the batch file to check the length of the variable and if its less than 3 characters then add a 0 to the beginning of a variable.
Just thought I'd post here to see if anyone might know how I could get this to work, or if there a better way of doing it completely