<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; BAT/CMD/JS: VLC Scheduler - VLC планировщик]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=11487&amp;type=atom" />
	<updated>2016-04-10T04:00:36Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=11487</id>
		<entry>
			<title type="html"><![CDATA[BAT/CMD/JS: VLC Scheduler - VLC планировщик]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=102472#p102472" />
			<content type="html"><![CDATA[<p>Написал на досуге около года тому назад, чтобы не вскакивать по воскресным утрам для записи передач &quot;Чудо Техники&quot;. Сам устанавливает подключение к интернету, если оборвалось, складывая фрагменты в один m3u.<br />Хоть скрипт и примитивный, глюки имеются. Но, теперь сплю спокойно и сколько хочу <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" /><br /></p><div class="codebox"><pre><code>@if (@a==@b) @end /*
@echo off
mode con lines=12 cols=40
setlocal EnableDelayedExpansion
Set dates=%date:~6,4%%date:~3,2%%date:~0,2%
set     ini=%~dpn0.ini
set doc=TEST
set m3u=%~dp0%dates%.m3u
echo #Session of %dates%#&gt;&gt;%m3u%
set Minimum=-1
:Begin
cls &amp; set i=0
for /f &quot;eol= tokens=* delims= usebackq&quot; %%s in (%ini%) do (
        for /f &quot;tokens=1,2&quot; %%a in (&quot;%%s&quot;) do (
                if &quot;%%b&quot;==&quot;&quot; (
                        echo %%a
                        set %%a
                        echo %%a.
                ) else (
                        if &quot;%%a&quot;==&quot;Record&quot; (
                                for /f &quot;tokens=1,2,3 delims=:-&quot; %%c in (&quot;%%b&quot;) do (
                                        set Channel=%%c
                                        set Dating=%%d
                                        set Ending=%%e
                                        set Link=!Channel%%c!
                                        set/P Setup=Channel#%%c !Dating:~0,2!:!Dating:~2,2!-!Ending:~0,2!:!Ending:~2,2! to &quot;!doc!.avi&quot;:
                                        set /a Digits=!Setup!
                                        if !Digits! == 0 (
                                                if not &quot;!Setup!&quot;==&quot;&quot; (
                                                        set doc=!Setup!
                                                        goto Begin
                                                )
                                        )
                                        if !Digits! == !Setup! (
                                                set /a Channel=!Digits!
                                        )
                                )
                        ) else (
                                set /a i=i+1
                                set Channel!i!=%%b
                                set Title!i!=%%a
                                if !i! lss 10 (echo 0!i!:%%a) else (echo !i!:%%a)
                        )
                )
        )
)
for /f &quot;tokens=1,2 delims=:-&quot; %%a in (&quot;!Setup!&quot;) do (
        if &quot;%%b&quot;==&quot;&quot; (
                if not &quot;%%a&quot;==&quot;&quot; (
                        set Channel=%%a
                )
        ) else (
                set Dating=%%a
                set Ending=%%b
        )
)
if not &quot;!Setup!&quot;==&quot;&quot; (
        set Setup=
        del %ini%&gt;nul
        for /l %%j in (1,1,%i%) do echo !Title%%j!      !Channel%%j!&gt;&gt;%ini%
        echo Record     !Channel!:!Dating!-!Ending!&gt;&gt;%ini%
        goto Begin
)
mode con lines=1 cols=40
:Waiting
Set Times=%time:~0,2%%time:~3,2%
Set Times=!Times: =0!
Set /a Current=(!Times:~0,1!*600)+(!Times:~1,1!*60)+(!Times:~2,1!*10)+(!Times:~3,1!)
Set /a Expect=(!Dating:~0,1!*600)+(!Dating:~1,1!*60)+(!Dating:~2,1!*10)+(!Dating:~3,1!)
Set /a Remains=!Expect!-!Current!
Set /a Hours=!Remains!/60
Set /a Minutes=!Remains!-(!Hours!*60)
if !Hours! leq 9 set Hours=0%Hours%
if !Minutes! leq 9 set Minutes=0%Minutes%
cls &amp; &lt;nul set/P z=%time:~0,8%[!Dating:~0,2!:!Dating:~2,2!..!Ending:~0,2!:!Ending:~2,2!] - !Hours!:!Minutes!
if !Remains! gtr 0 (ping -n 2 127.0.0.1 &gt;nul &amp; goto Waiting)
C:
cd &quot;%ProgramFiles(x86)%\VideoLAN\VLC&quot;
mode con lines=1 cols=8
:Recording
Set Times=%time:~0,2%%time:~3,2%
Set Times=!Times: =0!
Set /a Current=(!Times:~0,1!*600)+(!Times:~1,1!*60)+(!Times:~2,1!*10)+(!Times:~3,1!)
Set /a Expect=(!Ending:~0,1!*600)+(!Ending:~1,1!*60)+(!Ending:~2,1!*10)+(!Ending:~3,1!)
Set /a Remains=!Expect!-!Current!
Set /a Hours=!Remains!/60
Set /a Minutes=!Remains!-(!Hours!*60)
if !Hours! leq 9 set Hours=0%Hours%
if !Minutes! leq 9 set Minutes=0%Minutes%
&lt;nul set/P z=%time:~0,8%[!Dating:~0,2!:!Dating:~2,2!..!Ending:~0,2!:!Ending:~2,2!] - !Hours!:!Minutes!
if !Remains! lss !Minimum! goto Playing
set Minimum=5
rasdial &lt;provider&gt; &lt;login&gt; &lt;password&gt;
if %ErrorLevel% NEQ 0 (cls &amp; echo  &amp; ping -n 2 127.0.0.1 &gt;nul &amp; echo  &amp; goto Recording)
for /f &quot;delims=&quot; %%I in (&#039;cscript /nologo /e:jscript &quot;%~f0&quot; &quot;%Link%&quot;&#039;) do (
        set url=%%I
        &lt;nul set/P z=:
        goto Record
)
goto Recording
:Playing
cls &amp; echo COMPLETE %Files%
echo vlc://quit&gt;&gt;%m3u%
start &quot;Video Session&quot; /MIN vlc --no-autoscale --zoom=0.4 --video-x=-640 --video-y=300 --no-video-deco --no-embedded-video --scale=50 --directx-volume=0.5 --qt-opacity=0.5 %m3u% --play-and-exit
goto :EOF
:Record
Set dates=%date:~6,4%%date:~3,2%%date:~0,2%
Set File=%~dp0%dates%.%doc%.%Times%.mp4
Set /a Limit=!Remains!*60
echo %File%&gt;&gt; %m3u%
start &quot;Video Session&quot; /MIN vlc --no-autoscale --zoom=0.4 --video-x=-640 --video-y=300 --no-video-deco --no-embedded-video --scale=50 --directx-volume=0.5 --qt-opacity=0.5 %file% --play-and-exit
vlc -vvv --qt-minimal-view --qt-opacity=0.5 --run-time %limit% %url% :sout=#duplicate{dst=std{access=file,mux=ts,dst=&quot;%File%&quot;}} vlc://quit --play-and-exit %full%
goto Recording
JScript */var x=new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
x.open(&quot;GET&quot;,WSH.Arguments(0),true);
x.setRequestHeader(&quot;User-Agent&quot;,&quot;XMLHTTP/1.0&quot;);
x.send(&quot;&quot;);
while (x.readyState!=4) {WSH.Sleep(50)};
var s=x.responseText;
WSH.Echo(s.match(/var showFile = &#039;([^&#039;]+)&#039;/)[1]);</code></pre></div><p>Пример ini-файла:</p><div class="codebox"><pre><code>Первый  http://your_site/index.php?identificator#1
Россия  http://your_site/index.php?identificator#2
ТВ3     http://your_site/index.php?identificator#3
НТВ     http://your_site/index.php?identificator#4
Record  2:2320-2351</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Alikberov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=29916</uri>
			</author>
			<updated>2016-04-10T04:00:36Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=102472#p102472</id>
		</entry>
</feed>
