Advertisement
DePhoegon

VLC IP CableCard TV Movie Recording, Windows (Streamlined)

Aug 21st, 2017
275
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 6.00 KB | None | 0 0
  1. @echo off
  2. :: Using VLC to Set Recording for Movies
  3. :: Simplified Restart
  4. :: Windows Version, Works with Default Script Settings [Restricted], Stores & Restores Short Date Format
  5. :: COMODO users, Set bat file as 'installer or Updater'
  6. :: Uses Internal PowerShell Scripts
  7. :: Uses Task Scheduler to launch VLC directly with correct augments
  8. goto Start
  9. :ARE
  10. echo Already Recorded
  11. :RE2
  12. echo Restart or exit?
  13. set /p T= "Restart (R)"
  14. if %T%==R (goto Top)
  15. if %T%==r (goto Top)
  16. :End
  17. exit
  18. :Start
  19. set VLC=C:\Program Files (x86)\VideoLAN\VLC\vlc.exe
  20. set FF=Z:\TVVideo\
  21. set FD=Z:\Videos\TVMovieswAds\
  22. set IP=http://192.168.51.249:5004/auto/v
  23. set F=.ts
  24. set M=.mp4
  25. set WV=Z:\TSAudio\WaitV\
  26. :top
  27. set T=0
  28. set MT=0
  29. set DT=0
  30. set YT=0
  31. set HR=00
  32. set HMR=00
  33. set /p CHN= "Enter Channel Number?: "
  34. set /p SW= "Which Movie? (No Spaces): "
  35. set /p SE= "Release Year: "
  36. set SP=-[%SE%]
  37. :: Looks for Movie scheduled & Recorded (and also Transcoded into another format. Variable %M% can be set to any extension you'd transcode them into.
  38. if Exist %FF%%SW%%SP%%F% (echo %FF%%SW%%SP%%F% & goto ARE)
  39. if Exist %FD%%SW%%SP%%F% (echo %FD%%SW%%SP%%F% & goto ARE)
  40. if Exist %WV%%SW%%SP%%F% (echo %WV%%SW%%SP%%F% & goto ARE)
  41. if Exist %FF%%SW%%SP%%M% (echo %FF%%SW%%SP%%M% & goto ARE)
  42. if Exist %FD%%SW%%SP%%M% (echo %FD%%SW%%SP%%M% & goto ARE)
  43. Schtasks /query /tn %SW%%SP% >NUL 2>&1
  44. if %errorlevel% EQU 0 (echo %SW%%SP% Schedule already created & goto RE2 )
  45. :MMM
  46. set YT=0
  47. set /p YT= "What Year? [ #### ] {No Entry=Current Year}: "
  48. if %YT% EQU 0 ( call :SDY ) else ( goto MMY )
  49. set YT=%TYV%
  50. goto YR
  51. :MMY
  52. set NT=0
  53. :: Check for Number input
  54. set /a NT=%NT%+%YT%
  55. if %NT% EQU 0 (echo Numbers Only & goto MMM)
  56. call :SDY
  57. if %YT% LSS %TYV% (echo Past Year & goto MMM)
  58. :: Sets A year limit
  59. set /a NT=%TYV%+2
  60. if %YT% GTR %NT% (echo More then 2 years out & Goto MMM)
  61. :YR
  62. set MT=0
  63. set /p MT= "Which Month? [ ## ] {No Entry=Current Month}: "
  64. set NT=0
  65. if %MT% EQU 0 ( call :SDM & set NT=1 )
  66. if %NT% EQU 1 ( set MT=%TMV%& goto MR )
  67. set /a NT=%MT%+%NT%
  68. if %NT% EQU 0 ( echo Numbers only & goto YR)
  69. if %MT% LSS 0 ( echo Invalid selection & goto YR)
  70. if %MT% GTR 12 ( echo Invalid selection & goto YR)
  71. :MR
  72. set DT=0
  73. set /p DT= "Which Day? [ ## ] {No Entry=Current Day}: "
  74. set NT=0
  75. if %DT% EQU 0 ( call :SDD & set NT=1)
  76. if %NT% EQU 1 ( set DT=%TDV%& goto DR)
  77. set /a NT=%DT%+%NT%
  78. if %NT% EQU 0 (echo Invalid Selection, Numbers only & goto MR)
  79. goto DC
  80. :DR
  81. goto DVC
  82. :DVP
  83. :: Corrects Single Digits, format issue
  84. if %DT% LSS 10 set DT=0%DT%
  85. if %MT% LSS 10 set MT=0%MT%
  86. set DAT=%MT%/%DT%/%YT%
  87. :TTH
  88. set HR=0
  89. set HMR=0
  90. set /p HR= "What Starting Hour? [ ##, No Leading Zero / Enter for 00]: "
  91. if %HR% LSS 0 (echo Wrong Hour & goto TTH)
  92. if %HR% GTR 23 (echo Wrong Hour & goto TTH)
  93. if %HR% LSS 10 set HR=0%HR%
  94. :TTM
  95. set /p HMR= "What Starting Minutes in Hour? [ ##, No Leading Zero / Enter for 00]: "
  96. if %HMR% LSS 0 (echo Wrong Minute & goto TTM)
  97. if %HMR% GTR 59 (echo Wrong Minute & goto TTM)
  98. if %HMR% LSS 10 set HMR=0%HMR%
  99. set TIME=%HR%:%HMR%
  100. set /p LONG= "How Long in Minutes?: "
  101. set /a L=(%LONG%*60)-5
  102. set AUG=:sout=#duplicate{dst=file{dst=%FD%%SW%%SP%%F%},dst=display} --run-time=%L%
  103. set PSN=TS
  104. call :PSFC
  105. schtasks /create /tn "%SW%%SP%" /tr "\"%VLC%\" %IP%%CHAN% %AUG% vlc://quit" /sc once /st %TIME% /sd %DAT%
  106. call :PSFCr
  107. goto RE2
  108. :DC
  109. :: Verifies Days Exist in calendar
  110. if %DT% LSS 0 goto DFC
  111. if %DT% LSS 1 (echo Program altered & pause & goto End)
  112. if %MT% LSS 1 (echo Program altered & pause & goto End)
  113. if %MT% GTR 12 (echo Program altered & pause & goto End)
  114. if %MT% EQU 1 goto D31
  115. if %MT% EQU 2 goto D28
  116. if %MT% EQU 3 goto D31
  117. if %MT% EQU 4 goto D30
  118. if %MT% EQU 5 goto D31
  119. if %MT% EQU 6 goto D30
  120. if %MT% EQU 7 goto D31
  121. if %MT% EQU 8 goto D31
  122. if %MT% EQU 9 goto D30
  123. if %MT% EQU 10 goto D31
  124. if %MT% EQU 11 goto D30
  125. if %MT% EQU 12 goto D31
  126. :D31
  127. if %DT% GTR 31 goto DFC
  128. Goto DR
  129. :D30
  130. if %DT% GTR 30 goto DFC
  131. goto DR
  132. :D28
  133. :: Leap Year, Verifying February Days & accounting for leap years w/o hard coding years
  134. set MDC=0
  135. set /a MDC=(%YT%/4)*4
  136. if %YT% EQU %MDC% ( set /a MDC=(%YT%/100)*100) else (goto LYF)
  137. if %YT% EQU %MDC% ( set MDC=0 & set /a MDC=(%YT%/400)*400 & if %YT% EQU %MDC% ( set MDC=0) else (goto LYF) )
  138. goto LYP
  139. :LYF
  140. if %DT% GTR 28 goto DFC
  141. goto DR
  142. :LYP
  143. if %DT% GTR 29 goto DFC
  144. goto DR
  145. :DFC
  146. echo Invalid Day & goto MR
  147. :DVC
  148. set DAC=0
  149. :: Verifies Selected Date is set in the current or future
  150. call :SD3
  151. if %YT% LEQ %TYV% set /a DAC=%DAC%+1
  152. if %MT%==08 set MT=8
  153. if %MT%==09 set MT=9
  154. if %MT% LEQ %TMV% set /a DAC=%DAC%+1
  155. if %DT% LSS %TDV% set /a DAC=%DAC%+1
  156. if %DAC% LSS 3 Goto DVP
  157. echo Invalid Date selection.  %MT%/%DT%/%YT% [Month/Day/Year] is in the past, or check your calander.
  158. goto MMM
  159. :SDD
  160. ::To avoid base 8 conflicts.
  161. :: PowerShell to adjust date format, allowing usage of this batch file despite the preferred or default date format
  162. set PSN=D
  163. call :PSFC
  164. set TDV=0
  165. if %date:~3,2% GEQ 10 ( set TDV=%date:~3,2%) else ( set TDV=%date:~4,1%)
  166. call :PSFCr
  167. exit /b
  168. :SDM
  169. ::To avoid base 8 conflicts.
  170. set PSN=M
  171. call :PSFC
  172. set TMV=0
  173. if %date:~0,2% GEQ 10 ( set TMV=%date:~0,2%) else ( set TMV=%date:~1,1%)
  174. call :PSFCr
  175. exit /b
  176. :SDY
  177. ::To avoid Conflicts
  178. set PSN=Y
  179. call :PSFC
  180. set TYV=%date:~6,4%
  181. call :PSFCr
  182. exit /b
  183. :SD3
  184. :: Used to get all 3, at once & generate a 5th file, incase system steps on itself with writing/deleting the same file.
  185. set PSN=3
  186. call :PSFC
  187. if %date:~3,2% GEQ 10 ( set TDV=%date:~3,2%) else ( set TDV=%date:~4,1%)
  188. if %date:~0,2% GEQ 10 ( set TMV=%date:~0,2%) else ( set TMV=%date:~1,1%)
  189. set TYV=%date:~6,4%
  190. call :PSFCr
  191. exit /b
  192. :PSFC
  193. ::Creates Powershell script to change short date format & calls the first one
  194. powershell -command "$cul = Get-Culture;$Store = $cul.datetimeformat.shortdatepattern;Write-output $Store > VLCDFS%PSN%.txt;$Cul.DateTimeFormat.ShortDatePattern = 'MM/dd/yyyy';Set-Culture $Cul"
  195. exit /b
  196. :PSFCr
  197. powershell -command "$DF = Get-Content VLCDFS%PSN%.txt;$cul = Get-Culture;$cul.datetimeformat.shortdatepattern = $DF;Set-Culture $cul;remove-item VLCDFS%PSN%.txt"
  198. exit /b
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement