Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- :: Windows Version, PowerShell Commands (Internal Scripts, Works with Default Script settings in windows [Restricted]), Task Scheduler, Date Format
- :: Uses PowerShell to adjust Short Date Format, for Date verification & easy entering of Current day, Saves Current Date Format & Replaces it. It should happen 6 Times when entering the date, and 3 When Restarting using the same date.
- :: COMODO Users, Set bat file as 'Updater or Installer', will allow Scripts to be ran w/o stopping them. Check code, it's safe but always look, Set bat file as READ ONLY when not adding/deleting shows.
- :: Verifies Entered Date & uses one date format, modifies & restores system date format [Stores in txt file, restores & deletes txt file] Makes compatible with any date time format w/o to much headache
- :: Improved schtasks usage, & launching VLC directly with the correct augments & no Command line windows [Very Huge benefit], & hidden VLC window
- goto Start
- :ARE
- echo Already Recorded
- :RE2
- set AREP=0
- if %YT% EQU 0 set AREP=1
- set SDC=0
- set RSC=0
- set RSS=0
- set S=0
- echo Restart Options
- echo 1. Blank Restart
- echo 2. Same Channel
- echo 3. Same Show
- echo 4. Same Channel and show
- if %AREP% EQU 1 ( echo Selected Channel- %CHAN% // Selected Show- %SW% & goto RE3 )
- :: Skips echos for Options that'd give errors, & Echos Other data
- echo 5. Same Day
- echo 6. Same Day and Show
- echo 7. Same Day and Channel
- echo 8. Same Day, Show, and Channel
- echo Selected Channel- %CHAN% // Selected Show- %SW% // Selected Date- %DAT%
- :RE3
- set /p RSS= "Enter to quit: "
- if %RSS% EQU 0 goto End
- if %RSS% EQU 1 goto Top
- if %RSS% EQU 2 goto SH0
- if %RSS% EQU 3 ( set SDC=1& goto RTOP )
- if %RSS% EQU 4 ( set SDC=1& goto RES )
- if %AREP% EQU 1 goto End
- :: Prevents the Selection of Options that'd generate Errors, and Exits instead
- if %RSS% EQU 5 ( set RSC=1& goto RTOP )
- if %RSS% EQU 6 (
- set RSC=1
- set SDC=1
- goto RTOP
- )
- if %RSS% EQU 7 ( set RSC=1& goto SH0 )
- if %RSS% EQU 8 (
- set RSC=1
- set SDC=1
- goto RES
- )
- :End
- exit
- :Start
- :: Program & Folder variables, Changeable as needed.
- set VLC=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
- set FF=Z:\TVVideo\
- set TF=Z:\Videos\TVSHOW\
- set WT=Z:\TSAudio\WaitT\
- set TSTV=Z:\Videos\TVShowwAdsTS\
- set IP=http://192.168.51.249:5004/auto/v
- set F=.ts
- set M=.mp4
- :Top
- set S=0
- set RSC=0
- set YT=0
- set SDC=0
- set SMC=0
- :RTOP
- set CHAN=0
- set /p CHAN= "Enter Channel Number?: "
- set NT=0
- set /a NT=%NT%+%CHAN%
- if %NT% EQU 0 ( echo Input Channel Number& goto RTOP )
- :RES
- if %SDC% EQU 1 ( call :SD3 ) else ( goto SH0 )
- set /a SDC=%TYV%*%TDV%*%TMV%
- set RSS=%SDC%
- set /p SDC= "Special Episdoe? [No input=No, any input= Yes]"
- if %SDC% EQU %RSS% ( goto RSH )
- set RSS=0
- set SDC=0
- goto SPC
- :SH0
- if %S% EQU 2 goto SH1
- echo Select Show.
- echo 0. Special Episode. [To Use, Select First]
- :SH1
- if %S% EQU 0 goto SH2
- echo Special Episode - Select Show
- :SH2
- :: Lists Shows, Alter List as want
- echo 1. Attack on Titan
- echo 2. Doctor Who
- echo 3. Dragon Ball Super
- echo 4. Dragon Ball Z Kai: The Final Chapters
- echo 5. M*A*S*H*
- echo 6. Mike Tyson Mysteries
- echo 7. Mighty MagiSwords
- echo 8. Rick and Morty
- echo 9. Samurai Jack
- echo 10. Star Trek: The Next Generation
- echo 11. Star Trek: Voyager
- echo 12. Your Pretty Face is Going to Hell
- ::Setup to check for input on Show Name prompt
- if %S% EQU 2 goto SHS
- call :SD3
- :: Overcomplicated way to detect no input & avoid accidental matching
- set /a SW=(%TDV%*%TMV%)+(%TMV%*(%TDV%+%TDV%))+%TYV%
- set NT=no%SW%show
- set SW=%NT%
- set /p SW= "[If other type out] {No Spaces}: "
- if %SW%==%NT% ( echo No Default selection, Input Required. & goto SH0 )
- :: Cycle for selection of Show, with special episode
- if %SW% EQU 0 (
- echo Choose show or Enter name.
- set S=2
- goto SH0
- ) else ( goto SH3 )
- :SHS
- set /a SW=(%TDV%*%TMV%)+(%TMV%*(%TDV%+%TDV%))+%TYV%
- set NT=no%SW%show
- set SW=%NT%
- set /p SW= "[If other type out] {No Spaces}: "
- if %SW%==%NT% ( echo No Default selection, Input Required. & goto SH0 )
- :SH3
- if %SW% EQU 1 Set SW=Attack-on-Titan
- if %SW% EQU 2 set SW=Doctor-Who
- if %SW% EQU 3 set SW=Dragon-Ball-Super
- if %SW% EQU 4 set SW=Dragon-Ball-Z-Kai-The-Final-Chapters
- if %SW% EQU 5 set SW=MASH
- if %SW% EQU 6 set SW=Mike-Tyson-Mysteries
- if %SW% EQU 7 set SW=Mighty-MagiSwords
- if %SW% EQU 8 set SW=Rick-and-Morty
- if %SW% EQU 9 set SW=Samurai-Jack
- if %SW% EQU 10 set SW=Star-Trek-The-Next-Generation
- if %SW% EQU 11 set SW=Star-Trek-Voyager
- if %SW% EQU 12 set SW=Your-Pretty-Face-is-going-to-Hell
- if %S% EQU 2 goto SPC
- :RSH
- set RSS=0
- set SDC=0
- set /p S= "Which Season? [ # ]: "
- set /p E= "Which Episode? [ # ]: "
- set SE=-S%S%E%E%
- goto TST
- :SPC
- set /p S= "Season# and Special Episode. [ S#-Name-of-Episode ] {No Spaces}: "
- set SE=-%S%
- :TST
- ::Check for Existing Recording or Scheduled in task scheduler
- if EXIST %TF%%SW%%SE%%F% (echo %TF%%SW%%SE%%F% & goto ARE)
- if EXIST %TSTV%%SW%%SE%%F% (echo %TSTV%%SW%%SE%%F% & goto ARE)
- if EXIST %TSTV%%SW%%SE%%M% (echo %TSTV%%SW%%SE%%M% & goto ARE)
- if EXIST %TF%%SW%%SE%%M% (echo %TF%%SW%%SE%%M% & goto ARE)
- if EXIST %WT%%SW%%SE%%F% (echo %WT%%SW%%SE%%F% & goto ARE)
- if EXIST %FF%%SW%%SE%%F% (echo %FF%%SW%%SE%%F% & goto ARE)
- if EXIST %FF%%SW%%SE%%M% (echo %FF%%SW%%SE%%M% & goto ARE)
- Schtasks /query /tn %SW%%SE% >NUL 2>&1
- if %errorlevel% EQU 0 (echo %SW%%SE% Schedule already created & goto RE2 )
- :MMM
- :: Check for entered Date from Restart, & auto enters current date for Year, Month, Day
- if %RSC% EQU 1 goto DVC
- set YT=0
- set /p YT= "What Year? [ #### ] {No Entry=Current Year}: "
- if %YT% EQU 0 ( call :SDY ) else ( goto MMY )
- set YT=%TYV%
- goto YR
- :MMY
- set NT=0
- :: Check for Number input
- set /a NT=%NT%+%YT%
- if %NT% EQU 0 (echo Numbers Only & goto MMM)
- call :SDY
- if %YT% LSS %TYV% (echo Past Year & goto MMM)
- :: Sets A year limit
- set /a NT=%TYV%+2
- if %YT% GTR %NT% (echo More then 2 years out & Goto MMM)
- :YR
- set MT=0
- set /p MT= "Which Month? [ ## ] {No Entry=Current Month}: "
- set NT=0
- if %MT% EQU 0 ( call :SDM & set NT=1 )
- if %NT% EQU 1 ( set MT=%TMV%& goto MR )
- set /a NT=%MT%+%NT%
- if %NT% EQU 0 ( echo Numbers only & goto YR)
- if %MT% LSS 0 ( echo Invalid selection & goto YR)
- if %MT% GTR 12 ( echo Invalid selection & goto YR)
- :MR
- set DT=0
- set /p DT= "Which Day? [ ## ] {No Entry=Current Day}: "
- set NT=0
- if %DT% EQU 0 ( call :SDD & set NT=1)
- if %NT% EQU 1 ( set DT=%TDV%& goto DR)
- set /a NT=%DT%+%NT%
- if %NT% EQU 0 (echo Invalid Selection, Numbers only & goto MR)
- goto DC
- :DR
- goto DVC
- :DVP
- :: Corrects Single Digits, format issue
- if %DT% LSS 10 set DT=0%DT%
- if %MT% LSS 10 set MT=0%MT%
- set DAT=%MT%/%DT%/%YT%
- :TTH
- set HR=0
- set HMR=0
- set /p HR= "What Starting Hour? [ ##, No Leading Zero / Enter for 00]: "
- if %HR% LSS 0 (echo Wrong Hour & goto TTH)
- if %HR% GTR 23 (echo Wrong Hour & goto TTH)
- if %HR% LSS 10 set HR=0%HR%
- :TTM
- set /p HMR= "What Starting Minutes in Hour? [ ##, No Leading Zero / Enter for 00]: "
- if %HMR% LSS 0 (echo Wrong Minute & goto TTM)
- if %HMR% GTR 59 (echo Wrong Minute & goto TTM)
- if %HMR% LSS 10 set HMR=0%HMR%
- set TIME=%HR%:%HMR%
- set /p LONG= "How Long in Minutes?: "
- set /a L=(%LONG%*60)-5
- set AUG=:sout=#duplicate{dst=file{dst=%TSTV%%SW%%SE%%F%}} --qt-start-minimized --run-time=%L%
- :: Avoids Date format errors, Sets short date format, then restores the one in use by the system.
- set PSN=TS
- call :PSFC
- schtasks /create /tn "%SW%%SE%" /tr "\"%VLC%\" %IP%%CHAN% %AUG% vlc://quit" /sc once /st %TIME% /sd %DAT%
- call :PSFCr
- goto RE2
- :DC
- :: Verifies Days Exist in calendar
- if %DT% LSS 0 goto DFC
- if %DT% LSS 1 (echo Program altered & pause & goto End)
- if %MT% LSS 1 (echo Program altered & pause & goto End)
- if %MT% GTR 12 (echo Program altered & pause & goto End)
- if %MT% EQU 1 goto D31
- if %MT% EQU 2 goto D28
- if %MT% EQU 3 goto D31
- if %MT% EQU 4 goto D30
- if %MT% EQU 5 goto D31
- if %MT% EQU 6 goto D30
- if %MT% EQU 7 goto D31
- if %MT% EQU 8 goto D31
- if %MT% EQU 9 goto D30
- if %MT% EQU 10 goto D31
- if %MT% EQU 11 goto D30
- if %MT% EQU 12 goto D31
- :D31
- if %DT% GTR 31 goto DFC
- Goto DR
- :D30
- if %DT% GTR 30 goto DFC
- goto DR
- :D28
- :: Leap Year, Verifying February Days & accounting for leap years w/o hard coding years
- set MDC=0
- set /a MDC=(%YT%/4)*4
- if %YT% EQU %MDC% ( set /a MDC=(%YT%/100)*100) else (goto LYF)
- if %YT% EQU %MDC% ( set MDC=0 & set /a MDC=(%YT%/400)*400 & if %YT% EQU %MDC% ( set MDC=0) else (goto LYF) )
- goto LYP
- :LYF
- if %DT% GTR 28 goto DFC
- goto DR
- :LYP
- if %DT% GTR 29 goto DFC
- goto DR
- :DFC
- echo Invalid Day & goto MR
- :DVC
- set DAC=0
- if %RSC% EQU 1 (
- if %MT% GEQ 10 ( set MT=%MT%) else ( set MT=%MT:~1%)
- if %DT% GEQ 10 ( set DT=%DT%) else ( set DT=%DT:~1%)
- )
- :: Verifies Selected Date is set in the current or future
- call :SD3
- if %YT% LEQ %TYV% set /a DAC=%DAC%+1
- if %MT% LEQ %TMV% set /a DAC=%DAC%+1
- if %DT% LSS %TDV% set /a DAC=%DAC%+1
- if %DAC% LSS 3 Goto DVP
- echo Invalid Date selection. %MT%/%DT%/%YT% [Month/Day/Year] is in the past, or check your calander.
- goto MMM
- :SDD
- ::To avoid base 8 conflicts.
- :: PowerShell to adjust date format, allowing usage of this batch file despite the preferred or default date format
- set PSN=D
- call :PSFC
- set TDV=0
- if %date:~3,2% GEQ 10 ( set TDV=%date:~3,2%) else ( set TDV=%date:~4,1%)
- call :PSFCr
- exit /b
- :SDM
- ::To avoid base 8 conflicts.
- set PSN=M
- call :PSFC
- set TMV=0
- if %date:~0,2% GEQ 10 ( set TMV=%date:~0,2%) else ( set TMV=%date:~1,1%)
- call :PSFCr
- exit /b
- :SDY
- ::To avoid Conflicts
- set PSN=Y
- call :PSFC
- set TYV=%date:~6,4%
- call :PSFCr
- exit /b
- :SD3
- :: Used to get all 3, at once & generate a 5th file, incase system steps on itself with writing/deleting the same file.
- set PSN=3
- call :PSFC
- if %date:~3,2% GEQ 10 ( set TDV=%date:~3,2%) else ( set TDV=%date:~4,1%)
- if %date:~0,2% GEQ 10 ( set TMV=%date:~0,2%) else ( set TMV=%date:~1,1%)
- set TYV=%date:~6,4%
- call :PSFCr
- exit /b
- :PSFC
- ::Creates Powershell script to change short date format & calls the first one
- powershell -command "$cul = Get-Culture;$Store = $cul.datetimeformat.shortdatepattern;Write-output $Store > VLCDFS%PSN%.txt;$Cul.DateTimeFormat.ShortDatePattern = 'MM/dd/yyyy';Set-Culture $Cul"
- exit /b
- :PSFCr
- powershell -command "$DF = Get-Content VLCDFS%PSN%.txt;$cul = Get-Culture;$cul.datetimeformat.shortdatepattern = $DF;Set-Culture $cul;remove-item VLCDFS%PSN%.txt"
- exit /b
Add Comment
Please, Sign In to add comment