Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @ECHO off
- ::Set your group name below:
- SET group=YourGroup
- ::Known bug - if the season is double digits, the season & episode number in the filename will be wrong. Will fix soon.
- ECHO.
- ECHO Making sure there are no leftover temp files...
- ECHO.
- DEL output.vtt
- DEL output.srt
- DEL output.ts
- ECHO.
- ECHO If this is your first time using this script, please make sure streamlink is installed,
- ECHO and wget.exe, mkvmerge.exe and subtitleedit.exe are in the same directory as this batch file.
- ECHO.
- :START
- SET /p m3u8=Playlist (m3u8) url:
- SET "shortm3u8=%m3u8:*/hd=hd%"
- ECHO shortm3u8: %shortm3u8%
- for /f "tokens=1,2 delims=/" %%a in ("%shortm3u8%") do set "tv1=%%a" &set "tv2=%%b"
- ECHO.
- ECHO temp variable 1: %tv1%
- ECHO.
- ECHO temp variable 2: %tv2%
- IF "%tv1%"=="%m3u8:1080p=%" (
- SET res=720
- ) ELSE (
- SET res=1080
- )
- SET oldm3u8=%m3u8%
- SET "m3u8=%m3u8:16x9-720p.m3u8=16x9-1080p.m3u8%"
- SET "m3u8=%m3u8:m1080-16x9-hls-400-2500k.m3u8=m1080-16x9-hls-6500k.m3u8%"
- SET "m3u8=%m3u8:m1080-16x9-hls-1200k.m3u8=m1080-16x9-hls-6500k.m3u8%"
- SET "m3u8=%m3u8:m1080-16x9-hls-2500k.m3u8=m1080-16x9-hls-6500k.m3u8%"
- SET "m3u8=%m3u8:720p-720p-3000k.m3u8=1080p.m3u8%"
- SET "m3u8=%m3u8:720p-540p-2000k.m3u8=1080p.m3u8%"
- ECHO.
- ECHO old m3u8: %oldm3u8%
- ECHO.
- ECHO new m3u8: %m3u8%
- IF "%tv1%"=="%tv1:16x9=%" (
- SET aspect=4x3
- ) ELSE (
- SET aspect=16x9
- )
- IF "%aspect%"=="16x9" (
- for /f "tokens=2 delims=_-" %%a in ("%tv2%") do set "tv3=%%a"
- ) ELSE (
- for /f "tokens=1 delims=_-" %%a in ("%tv2%") do set "tv3=%%a"
- )
- SET season=%tv3:~4,1%
- SET season=0%season%
- SET "season=%season:~-2%"
- SET epnum=%tv3:~5,2%
- SET epnum=0%epnum%
- SET "epnum=%epnum:~-2%"
- SET ident=%tv3%
- IF "%ident:~0,4%"=="arur" (SET series=Arthur)
- IF "%ident:~0,4%"=="bobl" (SET series=Bob.the.Builder)
- IF "%ident:~0,4%"=="caiu" (SET series=Caillu)
- IF "%ident:~0,4%"=="cith" (SET series=The.Cat.in.the.Hat.Knows.a.Lot.About.That)
- IF "%ident:~0,4%"=="cuge" (SET series=Curious.George)
- IF "%ident:~0,4%"=="cybr" (SET series=Cyberchase)
- IF "%ident:~0,4%"=="dins" (SET series=Dinosaur.Train)
- IF "%ident:~0,4%"=="dsna" (SET series=Design.Squad)
- IF "%ident:~0,4%"=="dtig" (SET series=Daniel.Tigers.Neighborhood)
- IF "%ident:~0,4%"=="elco" (SET series=The.Electric.Company)
- IF "%ident:~0,4%"=="mspe" (SET series=Martha.Speaks)
- IF "%ident:~0,4%"=="mstr" (SET series=Mister.Rogers)
- IF "%ident:~0,4%"=="ncat" (SET series=Nature.Cat)
- IF "%ident:~0,4%"=="odds" (SET series=Odd.Squad)
- IF "%ident:~0,4%"=="pcat" (SET series=Peg.plus.Cat)
- IF "%ident:~0,4%"=="pipe" (SET series=Pinkalicious.and.Peterrific)
- IF "%ident:~0,4%"=="rjgo" (SET series=Ready.Jet.Go)
- IF "%ident:~0,4%"=="sbub" (SET series=Splash.and.Bubbles)
- IF "%ident:~0,4%"=="sesa" (SET series=Sesame.Street)
- IF "%ident:~0,4%"=="sgir" (SET series=SciGirls)
- IF "%ident:~0,4%"=="sisk" (SET series=Sid.the.Science.Kid)
- IF "%ident:~0,4%"=="swhy" (SET series=Super.Why)
- IF "%ident:~0,4%"=="worg" (SET series=WordGirl)
- IF "%ident:~0,4%"=="wowo" (SET series=WordWorld)
- ECHO.
- ECHO Series Name: %series%
- ECHO.
- ECHO Season Number: %season%
- ECHO.
- ECHO Episode Number: %epnum%
- ECHO.
- ECHO ident: %ident%
- ECHO.
- ECHO Max Resolution: %res%p
- ECHO.
- ECHO Aspect Ratio: %aspect%
- ECHO.
- SET /p eptitle=Episode title:
- SET "eptitle=%eptitle: =.%"
- SET /p subs=Subtitles (vtt) url (enter 0 for none):
- ECHO.
- IF %subs%==0 (
- GOTO :skipsubs
- ) ELSE (
- ECHO Subtitles detected . . .
- )
- ECHO.
- ECHO Removing https from vtt url . . .
- ECHO.
- SET "subs=%subs:https=http%"
- ECHO Subtitles (vtt) url: %subs%
- ECHO.
- ECHO Downloading subtitles . . .
- ECHO.
- WGET "%subs%" -O output.vtt
- ECHO.
- ECHO Converting subtitles . . .
- ECHO.
- SUBTITLEEDIT /convert output.vtt srt
- :SKIPSUBS
- ECHO.
- ECHO.
- ECHO Downloading video and audio . . .
- ECHO.
- STREAMLINK %m3u8% best -o output.ts
- ECHO.
- IF %subs%==0 (
- GOTO :MERGENOSUBS
- ) ELSE (
- ECHO Merging files . . .
- )
- ECHO.
- MKVMERGE -o output.mkv --language 1:eng output.ts --default-track 0:0 --language 0:eng output.srt
- :FINISH
- IF "%m3u8%"=="%m3u8:1080p=%" (
- SET res=720
- ) ELSE (
- SET res=1080
- )
- REN output.mkv %series%.S%season%E%epnum%.%eptitle%.%res%p.PBSK.WEB-DL.AAC2.0.H.264-%group%.mkv
- ECHO.
- ECHO Continuing will delete temp files . . .
- ECHO.
- PAUSE
- DEL output.vtt
- DEL output.srt
- DEL output.ts
- EXIT /B
- :MERGENOSUBS
- ECHO.
- ECHO Merging files . . .
- ECHO.
- MKVMERGE -o output.mkv --language 1:eng output.ts
- GOTO :FINISH
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement