Code: Select all
;- FILE : watch videos from internet ( not youtube )
;- needs vlc.exe / windows-10
;
;- from ahk-user SKAN function extract text :
;- xStr for general text extraction and parsing XML HTML
;- https://www.autohotkey.com/boards/viewtopic.php?f=6&t=74050
;- MODIFIED = 20200410
;- CREATED = 20200401
#warn
#NoEnv
SendMode,Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
wa:=A_screenwidth
ha:=A_screenHeight
if (wa=3840)
fontsize1=14
else
fontsize1=11
Gui,2:default
Gui,2: +HwndAId +0x2000000 ; +WS_CLIPCHILDREN Fixes drawing problems with child.
Gui,2: -DPIScale
SS_REALSIZECONTROL := 0x40
Gui,2:Color,Black,Black
Gui,2:Font,s%fontsize1% cGray,Lucida Console
xx:=101
;--------------------------------------------------
filename1=Nieuws NL_NOS / Extra_3-TV / ZAPP-TV
vlc1 =%a_programfiles%\videolan\vlc\vlc.exe ;- works with vlc.exe ( check path )
fx:=""
;------- download here : -------
folderx2=C:\users\%a_username%\downloads ;- check if this is your default DOWNLOAD-folder
;folderx2=D:\M_Downloads
;ifnotexist,%folderx2%
; filecreatedir,%folderx2%
folderx=%a_scriptdir%
stringmid,datex,a_now,1,10
HK1=Esc
Hotkey,%hk1%,pause1,ON
;-----------------------------------------------
Menu,S1 ,add,NOS-live ,NOS_Live
Menu,S1a,add,NOS-gisteren ,NOS_gisteren
Menu,S2 ,add,Podcast-de ,Podcast-de
Menu,S2 ,add,Podcast-NDR ,EXTRA3_Podcast
Menu,S3 ,add,Logfile ,Logfilex
menu,myMenuBar,Add,NOS ,:S1
menu,myMenuBar,Add,NOS_Yesterday ,:S1a
menu,myMenuBar,Add,EXTRA-3 ,:S2
menu,myMenuBar,Add,Logfile ,:S3
gui,2:menu,MyMenuBar
;-----------------------------------------------
whr := ComObjCreate("WinHttp.WinHttpRequest.5.1")
ComObjError(false)
whr.Silent := True ;- script failure = off
whr.SetTimeouts(500,500,500,500)
;xxa=Shell.Explorer ;- IExplorer
xxa=Mozilla.Browser ;- Mozilla Firefox
x:=(wa*7)/xx ,y:=(ha*.1)/xx,w:=(wa*88)/xx,h:=(ha*80)/xx
ifexist,%vlc1%
Gui,2:Add,ActiveX, x%x% y%y% w%w% h%h% vVlcx, VideoLAN.VLCPlugin.2
else
{
Gui,2:Add,ActiveX, x%x% y%y% w%w% h%h% vWB1 ,%xxa%
WB1.Silent := True
ComObjError(false)
}
/*
SM4=8 ; set volume level
soundset,0,WAVE,mute ; WAVE ON
SoundSet,%SM4%,WAVE ; WAVE
Gui,2:Add, Slider , x1490 y100 w40 h190 altsubmit vVOL11a gVOL11 Range0-100 Vertical invert thick25 cGray left line10,%sm4%
*/
/*
SM5=100 ; set volume level
soundset,0,master,mute ; master ON
SoundSet,%SM5%,master ; master
x:=(wa*97)/xx ,y:=(ha*20)/xx,w:=(wa*2)/xx,h:=(ha*30)/xx
Gui,2:Add, Slider , x%x% y%y% w%w% h%h% altsubmit vVOL12a gVOL12 Range0-100 Vertical invert thick25 cGray left line10,%sm5%
*/
;--- down ---
x:=(wa*8)/xx ,y:=(ha*85)/xx,w:=(wa*80)/xx,h:=(ha*2)/xx
Gui,2:Add, Progress, x%x% y%y% w%w% h%h% vPRBAR backgroundGray range0-100 Disabled
Gui,2:Add, Text, x%x% y%y% w%w% h%h% gPrBar1 ,
x:=(wa*.2)/xx ,y:=(ha*85)/xx,w:=(wa*2)/xx,
Gui,2:Add,Text, x%x% y%y% w%w% vT1 cYellow ;- procent
x:=(wa*3)/xx ,y:=(ha*85)/xx,w:=(wa*4.2)/xx,
Gui,2:Add,Text, x%x% y%y% w%w% vT2 cYellow ;- played time actual
x:=(wa*88.5)/xx ,y:=(ha*85)/xx,w:=(wa*4.2)/xx,
Gui,2:Add,Text, x%x% y%y% w%w% vT3 cYellow ;- total lenght from video
x:=(wa*93)/xx ,y:=(ha*85)/xx,w:=(wa*6)/xx,
Gui,2:Add,Text, x%x% y%y% w%w% vT5 cYellow ;- vlc state
;------------
;--- buttons left ----
x:=(wa*.1)/xx ,y:=(ha*.5)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
Gui,2:add, Button , x%x% y%y% w%w% h%h% gNOS_TV ,NOS-TV
y:=(ha*3.5)/xx
Gui,2:add, Button , x%x% y%y% w%w% h%h% gExtra_3,Extra-3
y:=(ha*6.5)/xx
Gui,2:add, Button , x%x% y%y% w%w% h%h% gZAPP ,ZAPP
;y:=(ha*9.5)/xx
;Gui,2:add, Button , x%x% y%y% w%w% h%h% gPLAY2 ,TEST
;--------------------------
;-------- down ------------
y:=(ha*88)/xx
ifexist,%vlc1%
{
x:=(ha*1)/xx
Gui,2:add, Button , x%x% y%y% w%w% h%h% gSnapshot vSnapshot1, SNAPSHOT
}
x:=(wa*19)/xx
Gui,2:add,Button , x%x% y%y% w%w% h%h% vDownload1 gDownload, DOWNLOAD
x:=(wa*25)/xx
Gui,2:add,Button , x%x% y%y% w%w% h%h% gFolder,Folder
x:=(wa*31)/xx,w:=(wa*7.5)/xx
Gui,2:add, Button , x%x% y%y% w%w% h%h% g2nd_GUI ,TEST 2nd_GUI
a5xx=00:00:10 ;- Jump Back
a6xx=00:00:20 ;- Jump Forward
a7xx=00:02:25 ;- GoTo Seek
Gui,2:Font, S14 cGray ,Lucida Console
x:=(wa*40)/xx,y:=(ha*88)/xx,w:=(wa*5)/xx,h:=(ha*2.3)/xx
Gui,2:Add,Edit,cGray right x%x% y%y% w%w% h%h% vJumpB,%a5xx% ;-- Jump backward
y:=(ha*91)/xx
Gui,2:Add,Button, x%x% y%y% w%w% h%h% gGoto1B vGoto1B2 ,<SKIP
x:=(wa*46)/xx,y:=(ha*88)/xx
Gui,2:Add,Edit,cGray right x%x% y%y% w%w% h%h% vJumpF,%a6xx% ;-- Jump forward
y:=(ha*91)/xx
Gui,2:Add,Button, x%x% y%y% w%w% h%h% gGoto1F vGoto1F2 ,SKIP>
x:=(wa*52)/xx,y:=(ha*88)/xx
Gui,2:Add,Edit,cGray right x%x% y%y% w%w% h%h% vGotox,%a7xx% ;-- GotoX
y:=(ha*91)/xx
Gui,2:Add,Button, x%x% y%y% w%w% h%h% gGoto1X vGoto1X2 ,GotoX
x:=(wa*58)/xx,y:=(ha*88)/xx,w:=(wa*17)/xx
Gui,2:Add,Text , x%x% y%y% w%w% vMemoryX cYellow ;- Memory_used
y:=(ha*91)/xx,w:=(wa*40)/xx
Gui,2:Add,Text , x%x% y%y% w%w% vDownloadx cRed ;- show when Download
Gui,2:Font, S11 cGray ,Lucida Console
x:=(wa*.1)/xx,y:=(ha*91)/xx,w:=(wa*39)/xx
Gui,2:add, Edit , x%x% y%y% w%w% cGray vTxt1 ;- show URL
w:=(wa*99.9)/xx,h:=(ha*94)/xx
Gui,2: Show,x0 y0 w%w% h%h%,%filename1%
ifexist,%vlc1%
{
settimer,aas1,1000
settimer,aas1,off
}
settimer,memorycheck,1000
GuiControl,2:Disable,download1
return
;-------------------------
2Guiclose:
exitapp
;--------------------------
;--------------------- 2-nd GUI example ------------
2nd_GUI: ;- example
wa:=A_screenwidth
ha:=A_screenHeight
xx:=101
filename2=TEST 2nd-GUI
Gui,3: -DPIScale
Gui,3: +HwndBId -Caption -Border
Gui,3:Color,Black,Gray
Gui,3:Font,s13 cGray,Lucida Console
Gui,3:default
vlcx.playlist.stop()
vlcx.playlist.items.clear()
sleep,500
gosub,clearall
GuiControl,2:Disable,download1
x:=(wa*90)/xx,y:=(ha*92)/xx,w:=(wa*5)/xx,h:=(ha*2.5)/xx
Gui,3: add,button, x%x% y%y% w%w% h%h% gChildDestroyall ,Close
w:=(wa*99.9)/xx,h:=(ha*97)/xx
Gui,3:Show,x0 y0 w%w% h%h%,%filename2%
return
;----------------
;------------------------------------------------------
childdestroyall:
Gui,3:destroy
return
;---------------------------
;==================== END 2nd-GUI example =========
;-------------------------
Prbar1:
gui,2:submit,nohide
vlcx.playlist.items.clear()
gosub,checkx
if (acc=0 or bcx=0)
return
MouseGetPos,xpos
;---
;GuiControlGet,prbar, Pos
;msgbox, 262208, ,X-Mouse=%xpos%`nX=%prbarX%`nY=%prbarY%`nHeight=%prbarH%`nWidth=%prbarW%,9
;return
;x000:=(wa*15)/xx
x100:=(wa*80)/xx
procent :=round((100*xpos)/x100)-10.5
calctime :=((bc*procent)/100)
;msgbox,CALC=%calctime%`nLenght=%bcx%`nNow=%acc%
vlcx.input.time :=(calctime)
return
;---------------------------------
podcast-de:
run,https://www.podcast.de/podcast/615938/
return
EXTRA3_Podcast:
run,http://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html
return
nos_live:
run,https://nos.nl/livestream/npo-nieuws.html
return
nos_gisteren:
run,https://www.npostart.nl/nos-journaal/NOSJournaal/episode
return
folder:
run,%folderx2%
return
logfilex:
run,%fx%
return
Goto1B:
vlcx.playlist.items.clear() ;--(?)
acx:=vlcx.input.time
guicontrolget,jumpb
varxx=%jumpb%
gosub,gosubtimecalc
vlcx.input.time :=(-total+acx)
return
Goto1F:
vlcx.playlist.items.clear() ;--(?)
acx:=vlcx.input.time
guicontrolget,jumpf
varxx=%jumpf%
gosub,gosubtimecalc
endtotal:=(total+acx)
if (endtotal>=bc)
endtotal:=(bc-10000) ;- goto endtotal minus 10 sec
vlcx.input.time :=(endtotal)
return
Goto1X:
gui,2:submit,nohide
vlcx.playlist.items.clear() ;--(?)
gosub,checkx
if (acc=0 or bcx=0)
return
guicontrolget,gotoX
varxx=%gotox%
total:=0
gosub,gosubtimecalc
endtotal:=(total)
if (endtotal>bc)
endtotal:=(bc-10000) ;- goto endtotal minus 10 sec
vlcx.input.time :=(endtotal)
return
;========== VLC functions ============================
;-------- pause / PLAY --------------
pause1:
gui,2:submit,nohide
vlcx.playlist.items.clear() ;--(?)
vlcx.playlist.togglePause()
return
;------- check ----------
checkx:
bc:=vlcx.input.length
ac:=vlcx.input.time
acc:=(ac//1000)
bcx:=(bc//1000)
return
SNAPSHOT:
;- rename saved picture bmp to png
ifexist,%vlc1%
vlcx.video.takeSnapshot()
return
;---------------------------------------------
;------------------------ Television last nieuws nederland ---------
NOS_TV:
gosub,clearall
GuiControl,2:Disable,download1
fx =%folderx%\NL_NOS_TV_Logfile.txt
url:="https://nos.nl/uitzending/nos-journaal.html"
whr.Open("GET",URL, true)
whr.Send() ; Using 'true' above and the call below allows the script to remain responsive.
whr.WaitForResponse()
H := whr.ResponseText ; haystack
;------------------------
B="720","url":{"mp4":"
E="}}
x720:=xStr(H,,B,E) ;- NOS URL
;-------------------------
Guicontrol,2:,txt1,%x720%
gosub,continue1
return
;---------------------------------------------------------------------
;------------------------------- EXTRA-3 german satire ----------------------------------------
Extra_3:
gosub,clearall
GuiControl,2:Disable,download1
fx =%folderx%\DE_NDR_TV_Logfile.txt
url :="https://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html"
whr.Open("GET",URL, true)
whr.Send() ; Using 'true' above and the call below allows the script to remain responsive.
whr.WaitForResponse()
H := whr.ResponseText ; haystack
;------------------------
;<span itemprop="contentUrl" content="https://mediandr-a.akamaihd.net/progressive/2020/0408/TV-20200408-2307-4900.hq.mp4" />
B=<span itemprop="contentUrl" content="
E=" />
x720:=xStr(H,,B,E)
Guicontrol,2:,txt1,%x720%
gosub,continue1
return
;------------------------------- ZAPP german MedienInfo -------------------------------------
ZAPP:
gosub,clearall
GuiControl,2:Disable,download1
/*
ZAPP NDR
1.=
https://www.ndr.de/fernsehen/sendungen/zapp/index.html
<div class="teaserpadding">
<h2>
<a href="/fernsehen/sendungen/zapp/ZAPP-spezial,sendung1030192.html" title="Zum Artikel: ZAPP" >
2.=
https://www.ndr.de/fernsehen/sendungen/zapp/ZAPP-spezial,sendung1030192.html :
<span itemprop="contentUrl" content="https://mediandr-a.akamaihd.net/progressive/2020/0401/TV-20200401-2147-2800.hq.mp4" />
*/
;----------
url1:="https://www.ndr.de/fernsehen/sendungen/zapp/index.html"
whr.Open("GET",URL1,true) ; Using 'true' above and the call below allows the script to remain responsive.
whr.Send()
whr.WaitForResponse()
;--------------------
H:= whr.ResponseText ; haystack
B=
(
<h2>
<a href="
)
E= " title="Zum Artikel: ZAPP"
res1:=xStr(H,,B,E)
tot1=https://www.ndr.de%res1%
url2:=tot1
whr.Open("GET",URL2,true) ; Using 'true' above and the call below allows the script to remain responsive.
whr.Send()
whr.WaitForResponse()
H:= whr.ResponseText ; haystack
;--------------------
B= <span itemprop="contentUrl" content="
E= " />
x720:=xStr(H,,B,E)
Guicontrol,2:,txt1,%x720%
gosub,continue1
return
;-------------------------------------------------------------------------------
;--------------
continue1:
if x720<>
{
fileappend,%x720%`r`n,%fx%
gosub,play
}
else
msgbox, 262208, ,Error read URL
return
;------------------------------------
Play:
Gui,2:submit,nohide
stringmid,datex,a_now,1,10
if x720 contains mp4
{
GuiControl,2:Enable,download1
ifexist,%vlc1%
{
vlcx.playlist.stop()
vlcx.playlist.items.clear()
sleep,1000
vlcx.playlist.add(x720,"","""""")
vlcx.playlist.next()
settimer,aas1,on
}
else
WB1.Navigate(x720)
}
return
/*
Play2:
Gui,2:submit,nohide
GuiControl,2:Disable,download1
c1=NEE4Ls8SMSs
;F1=https://www.youtube.com/watch?v=%c1%
;F1=https://www.youtube.com/embed/%c1%
;F1=https://www.youtube.com/watch?feature=youtu.be&v=%c1%
F1=https://www.youtube.com/embed/%c1%?autoplay=1
;F1=https://youtu.be/%c1%
vlcx.playlist.stop()
vlcx.playlist.items.clear()
sleep,1000
vlcx.playlist.add(F1,"","""""")
vlcx.playlist.next()
;Guicontrol,2:,txt1,%c2%
return
*/
;-------------------------------------------------------------------
;-------------- DOWNLOAD -----------------------
download:
Gui,2:submit,nohide
GuiControl,2:Disable,download1
stringmid,datex,a_now,1,10
SplitPath,x720, name, dir, ext, name_no_ext, drive
stringreplace,name,name,`%20,%A_space%,all ;replace `%20 with space
new=%folderx2%\%datex%_%name%
GuiControl,2:Text,downloadx,Download...%x720%
;runwait,%comspec% /c wget %x720% -nc -O "%new%",,hide,PID3
urldownloadtofile,%x720%,%new%
GuiControl,2:Text,downloadx,
ifexist,%new%
run,%new%
return
;----------------------------------------------
;----- volumex -------------------------------
VOL11:
GuiControlGet, VOL11a
SoundSet,%vol11a%,WAVE
return
;----- volumex ----------
VOL12:
GuiControlGet, VOL12a
;Guicontrol,2:,T1,%VOL12a%
SoundSet,%vol12a%,master
return
;------------------------
;=========== settimer progressbar ==================
aas1:
gui,2:submit,nohide
bc:=vlcx.input.length
ac:=vlcx.input.time
acc:=(ac//1000)
bcx:=(bc//1000)
if (acc=0 or bcx=0)
return
;msgbox, 262208, ,acc=%acc%`nbcx=%bcx% , 1
SetFormat, float, 02
hours1 := (acc//3600)
minutes1 := (acc - hours1 * 3600)// 60
seconds1 := (acc - hours1 * 3600 - minutes1 * 60)
hours1 +=0.00
minutes1+=0.00
seconds1+=0.00
acc=%hours1%:%minutes1%:%seconds1%
;------- played-time ---------------
hours := (bcx//3600)
minutes := (bcx - hours * 3600)// 60
seconds := (bcx - hours * 3600 - minutes * 60)
hours +=0.00
minutes+=0.00
seconds+=0.00
bcx=%hours%:%minutes%:%seconds%
;----- total-time ----------------
ay:=vlcx.input.state
if (ay=0)
cy=Idle
if (ay=1)
cy=Opening
if (ay=2)
cy=Buffering
if (ay=3)
cy=Playing
if (ay=4)
cy=Paused
if (ay=5)
cy=Stopped
if (ay=7)
cy=Error
if (ay=6)
{
cy=Ended
GuiControl,2:Text,T5,%cy%
settimer,aas1,off
GuiControl,2:,PRBAR,100
GuiControl,2:Text,Procentx ,100`%
return
}
GuiControl,2:Text,T5,%cy%
RES1:=Round((100*AC)/BC)
GuiControl,2:,PRBAR ,%res1%
GuiControl,2:Text,T1 ,%res1%`% ;- procent
GuiControl,2:Text,T2 ,%acc% ;- PlayedTime
GuiControl,2:Text,T3 ,%bcx% ;- Lenght
return
;========== CLEAR ===================
clearall:
GuiControl,2:Text,T1,
GuiControl,2:Text,T2,
GuiControl,2:Text,T3,
Guicontrol,2:text,T5
Guicontrol,2:text,prbar
GuiControl,2:,PRBAR,0
GuiControl,2:Text,Procentx ,0`%
return
;-------------------------------------
;=============== timecalc ===========
gosubtimecalc:
total:=0
y1=
y2=
y3=
stringsplit,Y,varxx,`:
if y3<>
{
hours:=(y1*60*60)*1000
minutes:=(y2*60)*1000
seconds:=(y3*1000)
total:=(hours+minutes+seconds)
}
if (y3="" and y2<>"")
{
minutes:=(y1*60)*1000
seconds:=(y2*1000)
total:=(minutes+seconds)
}
if (y3="" and y2="")
total:=(varxx*1000)
return
;======================================
;-------- saved at Samstag, 3. Februar 2018 12:08:11 --------------
;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=43654 ---
memorycheck:
memx:=checkWorkingset()//1024 . "-kB-RAM"
GuiControl,2:Text,MemoryX,%memx%
return
checkWorkingset(pid:=""){
static wmi:=comObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . a_computerName . "\root\cimv2")
pid:=pid?pid:dllCall("GetCurrentProcessId")
processInfo:=wmi.execQuery("select WorkingSetSize,ProcessId from Win32_Process")._NewEnum
while(processInfo[item]){
if(item.processId=pid){
workingSet:=item.WorkingSetSize
break
}
}
return workingSet
}
;-----------------------------------------------------------------
;-------- saved at Dienstag, 7. April 2020 16:34:11 SKAN --------------
;- xStr for general text extraction and parsing XML HTML
;- https://www.autohotkey.com/boards/viewtopic.php?f=6&t=74050
xStr(ByRef H, C:=0, B:="", E:="",ByRef BO:=1, EO:="", BI:=1, EI:=1, BT:="", ET:="") {
Local L, LB, LE, P1, P2, Q, N:="", F:=0 ; xStr v0.97 by SKAN on D1AL/D343 @ tiny.cc/xstr
Return SubStr(H,!(ErrorLevel:=!((P1:=(L:=StrLen(H))?(LB:=StrLen(B))?(F:=InStr(H,B,C&1,BO,BI))?F+(BT=N?LB
:BT):0:(Q:=(BO=1&&BT>0?BT+1:BO>0?BO:L+BO))>1?Q:1:0)&&(P2:=P1?(LE:=StrLen(E))?(F:=InStr(H,E,C>>1,EO=N?(F
?F+LB:P1):EO,EI))?F+LE-(ET=N?LE:ET):0:EO=N?(ET>0?L-ET+1:L+1):P1+EO:0)>=P1))?P1:L+1,(BO:=Min(P2,L+1))-P1)
}
;------------------------------------------------------------------
;======== END SCRIPT =======================================
Dies ist Original-script , funktioniert , EXTRA-3
Code: Select all
;- TV NDR EXTRA-3
;- https://www.autohotkey.com/boards/viewtopic.php?f=10&t=43808
;-------- saved at Freitag, 9. Februar 2018 19:53:26 --------------
;-------- https://autohotkey.com/boards/viewtopic.php?f=10&t=43808 ---
;- modified = 20180209
;- created = 20180205
;- name = TV_Extra-3 see last emission
;- XP / Win10 with [vlc.exe & Mozilla Firefox]
;-------------------------------------------------
#warn
#NoEnv
SendMode,Input
SetWorkingDir, %A_ScriptDir%
SetTitleMatchMode 2
SetBatchLines, -1
;--------------------------------------------------
filename1=TV_EXTRA-3
vlc1 =%a_programfiles%\videolan\vlc\vlc.exe
logfile =%a_scriptdir%\TV_Extra3_Logfile.txt
;------- download here : -------
folderx2=%a_desktop%\Downloads
ifnotexist,%folderx2%
filecreatedir,%folderx2%
;-----------------------------------------------
Menu,S2,add,Podcast-de ,Podcast-de
Menu,S2,add,Podcast-NDR ,EXTRA3_Podcast
Menu,S3,add,Logfile ,Logfilex
menu,myMenuBar,Add,EXTRA-3 ,:S2
menu,myMenuBar,Add,Logfile ,:S3
gui,2:menu,MyMenuBar
;-----------------------------------------------
;Gui,2: +AlwaysOnTop
Gui,2: Color, 000000
Gui,2:Font, S10 CDefault , FixedSys
;xxa=Shell.Explorer ;- IExplorer
xxa=Mozilla.Browser ;- Mozilla Firefox
ifexist,%vlc1%
Gui,2:Add,ActiveX, x10 y10 w1460 h900 vVlcx, VideoLAN.VLCPlugin.2
else
{
Gui,2:Add,ActiveX, x10 y10 w1460 h880 vWB1 ,%xxa%
WB1.Silent := True
ComObjError(false)
}
SM4=8 ; set volume level wave ( XP )
soundset,0,WAVE,mute ; WAVE ON
SoundSet,%SM4%,WAVE ; WAVE
Gui,2:Add, Slider , x1490 y100 w40 h190 altsubmit vVOL11a gVOL11 Range0-100 Vertical invert thick25 cGray left line10,%sm4%
SM5=10 ; set volume level master
soundset,0,master,mute ; master ON
SoundSet,%SM5%,master ; master
Gui,2:Add, Slider , x1490 y310 w40 h190 altsubmit vVOL12a gVOL12 Range0-100 Vertical invert thick25 cGray left line10,%sm5%
;Gui,2:add, Button , x10 y940 w100 h25 gPLAY,PLAY
ifexist,%vlc1%
Gui,2:add, Button , x240 y940 w100 h25 gSnapshot vSnapshot1, SNAPSHOT
Gui,2:add,Button , x350 y940 w100 h25 vDownload1 gDownload, DOWNLOAD
Gui,2:add,Button , x470 y940 w100 h25 gFolder,Folder
Gui,2:Add,Text , x600 y940 w800 vDownloadx cRed ;- show when Download
Gui,2:Add,Text , x1470 y940 w80 vMemoryX cYellow ;- Memory_used
Gui,2:Add, Progress, x140 y914 w1200 h18 vPRBAR backgroundGray range0-100
Gui,2:Add,Text, x5 y914 w40 vT1 cYellow ;- procent
Gui,2:Add,Text, x50 y914 w80 vT2 cYellow ;- played time actual
Gui,2:Add,Text, x1370 y914 w80 vT3 cYellow ;- total lenght from video
Gui,2:Add,Text, x1470 y914 w80 vT5 cYellow ;- vlc state
Gui,2: Show,x0 y0 w1550 h970,%filename1%
ifexist,%vlc1%
{
settimer,aas1,1000
settimer,aas1,off
}
settimer,memorycheck,1000
GuiControl,2:Disable,download1
gosub,lastnews
gosub,play
return
;-------------------------
2Guiclose:
exitapp
;-------------------------
podcast-de:
run,https://www.podcast.de/podcast/615938/
return
EXTRA3_Podcast:
run,http://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html
return
folder:
run,%folderx2%
return
logfilex:
run,%logfile%
return
SNAPSHOT:
;- rename saved picture bmp to png
ifexist,%vlc1%
vlcx.video.takeSnapshot()
return
;---------------------------------------------
;============================= download and then cut text =========================================
LastNews:
gosub, clearall
folderx=%a_scriptdir%
stringmid,datex,a_now,1,10
f1=https://www.ndr.de/fernsehen/sendungen/extra_3/video-podcast/index.html
;<span itemprop="contentUrl" content="https://mediandr-a.akamaihd.net/progressive/2018/0208/TV-20180208-2243-2400.hq.mp4" />
httpQuery(aaa,f1)
loop,parse,aaa,`n,`r
{
x=%A_loopfield%
if x contains <span itemprop="contentUrl" content=
{
y=%x%
break
}
}
Begin1 = <a href="
End1 := "mp3,m4a,wav,wma,flv,vob,mp4,mpg,wmv,avi" ;- end
stringlen,L1,Begin1
Loop Parse,Y,`" ;- split for `"
{
StringLeft,R1,A_LoopField,L1
SplitPath,A_LoopField, name, dir, ext, name_no_ext, drive
if ext in %End1%
{
x720 := a_loopfield
break
}
}
return
;------------------------------------
Play:
Gui,2:submit,nohide
stringmid,datex,a_now,1,10
if x720 contains mp4
{
fileappend,%datex%_%x720%`r`n,%logfile%
GuiControl,2:Enable,download1
ifexist,%vlc1%
{
vlcx.playlist.stop()
vlcx.playlist.items.clear()
vlcx.playlist.add(x720,"","""""")
vlcx.playlist.next()
settimer,aas1,on
}
else
WB1.Navigate(x720)
}
return
;-------------------------------------------------------------------
;-------------- DOWNLOAD -----------------------
download:
Gui,2:submit,nohide
stringmid,datex,a_now,1,10
SplitPath,x720, name, dir, ext, name_no_ext, drive
stringreplace,name,name,`%20,%A_space%,all ;replace `%20 with space
new=%folderx2%\EXTRA-3_%name%
GuiControl,2:Text,downloadx,Download...%x720%
;runwait,%comspec% /c wget %x720% -nc -O "%new%",,hide,PID3
urldownloadtofile,%x720%,%new%
GuiControl,2:Text,downloadx,
; ifexist,%new%
; run,%new%
return
;----------------------------------------------
;----- volumex -------------------------------
VOL11:
GuiControlGet, VOL11a
SoundSet,%vol11a%,WAVE
return
;----- volumex ----------
VOL12:
GuiControlGet, VOL12a
;Guicontrol,2:,T1,%VOL12a%
SoundSet,%vol12a%,master
return
;------------------------
;=========== settimer progressbar ==================
aas1:
gui,2:submit,nohide
bc:=vlcx.input.length
ac:=vlcx.input.time
acc:=(ac//1000)
bcx:=(bc//1000)
if (acc=0 or bcx=0)
return
;msgbox, 262208, ,acc=%acc%`nbcx=%bcx% , 1
SetFormat, float, 02
hours1 := (acc//3600)
minutes1 := (acc - hours1 * 3600)// 60
seconds1 := (acc - hours1 * 3600 - minutes1 * 60)
hours1 +=0.00
minutes1+=0.00
seconds1+=0.00
acc=%hours1%:%minutes1%:%seconds1%
;------- played-time ---------------
hours := (bcx//3600)
minutes := (bcx - hours * 3600)// 60
seconds := (bcx - hours * 3600 - minutes * 60)
hours +=0.00
minutes+=0.00
seconds+=0.00
bcx=%hours%:%minutes%:%seconds%
;----- total-time ----------------
ay:=vlcx.input.state
if (ay=0)
cy=Idle
if (ay=1)
cy=Opening
if (ay=2)
cy=Buffering
if (ay=3)
cy=Playing
if (ay=4)
cy=Paused
if (ay=5)
cy=Stopped
if (ay=7)
cy=Error
if (ay=6)
{
cy=Ended
GuiControl,2:Text,T5,%cy%
settimer,aas1,off
GuiControl,2:,PRBAR,100
GuiControl,2:Text,Procentx ,100`%
return
}
;GuiControl,2:Text,T4,AY=%ay%
GuiControl,2:Text,T5,%cy%
RES1:=Round((100*AC)/BC)
GuiControl,2:,PRBAR ,%res1%
GuiControl,2:Text,T1 ,%res1%`% ;- procent
GuiControl,2:Text,T2 ,%acc% ;- PlayedTime
GuiControl,2:Text,T3 ,%bcx% ;- Lenght
return
;========== CLEAR ===================
clearall:
GuiControl,2:Text,T1,
GuiControl,2:Text,T2,
GuiControl,2:Text,T3,
Guicontrol,2:text,T5
Guicontrol,2:text,prbar
GuiControl,2:,PRBAR,0
GuiControl,2:Text,Procentx ,0`%
return
;-------------------------------------
;-------- saved at Samstag, 3. Februar 2018 12:08:11 --------------
;-------- https://autohotkey.com/boards/viewtopic.php?f=5&t=43654 ---
memorycheck:
memx:=checkWorkingset()//1024 . "-kB"
GuiControl,2:Text,MemoryX,%memx%
return
checkWorkingset(pid:=""){
static wmi:=comObjGet("winmgmts:{impersonationLevel=impersonate}!\\" . a_computerName . "\root\cimv2")
pid:=pid?pid:dllCall("GetCurrentProcessId")
processInfo:=wmi.execQuery("select WorkingSetSize,ProcessId from Win32_Process")._NewEnum
while(processInfo[item]){
if(item.processId=pid){
workingSet:=item.WorkingSetSize
break
}
}
return workingSet
}
;-----------------------------------------------------------------
;-----------------------------------------------------------------
httpQuery(byref Result, lpszUrl, POSTDATA="", HEADERS="")
{
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WebRequest.Open("GET", lpszUrl)
WebRequest.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
WebRequest.Send(POSTDATA)
Result := WebRequest.ResponseText
WebRequest := ""
}
return
;=============================== END SCRIPT EXTRA-3 ================================
esc::exitapp