#Include #include #Include #include #include #include #include #include #include #include #include Local $oIE = _IECreateEmbedded() #Region ### START Koda GUI section ### Form=C:\Users\Hunter\Desktop\Programming\Projects\AutoIt\TV Shows.kxf $Form1 = GUICreate("TV Shows", 1178, 454, -1, -1) $List1 = GUICtrlCreateList("", 8, 40, 233, 383, BitOR($WS_BORDER, $WS_VSCROLL)) $List2 = GUICtrlCreateList("", 247, 40, 337, 383, BitOR($WS_BORDER, $WS_VSCROLL)) $Label1 = GUICtrlCreateLabel("TV Shows", 8, 21, 53, 17) $Label2 = GUICtrlCreateLabel("Episodes", 248, 21, 47, 17) $Label3 = GUICtrlCreateLabel("TV Show", 592, 21, 48, 17) $Button1 = GUICtrlCreateButton("Previous Source", 592, 425, 90, 25) $Button2 = GUICtrlCreateButton("Next Source", 688, 425, 90, 25) $Button3 = GUICtrlCreateButton("Visit Website", 1096, 425, 75, 25) $Button4 = GUICtrlCreateButton("Watch In Default Browser", 951, 425, 139, 25) $Label4 = GUICtrlCreateLabel("Source : ", 787, 431, 47, 17) $Label5 = GUICtrlCreateLabel("", 832, 431, 12, 17) GUICtrlSetData(-1, "0") $Label6 = GUICtrlCreateLabel("of", 845, 431, 12, 17) $Label7 = GUICtrlCreateLabel("", 858, 431, 12, 17) GUICtrlSetData(-1, "0") $Label8 = GUICtrlCreateLabel("", 638, 21, 524, 17) GUICtrlCreateObj($oIE, 592, 40, 577, 383) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### Global $currenttitle, $titles, $cleantitle, $array3, $array2, $array1, $array4, $array5, $array6, $selectedtitlenum, $selectedtitlesite Global $selectioncheck="0" Global $selectioncheck2="0" Global $currentep Global $eps Global $eps2 Global $epssplit Global $selectedepssite Global $array7 Global $watchitheresite Global $watchhere Global $finalsite Global $allinfo Global $read Global $frames Global $framessplit Global $sourcestart Global $sourceend Global $sourceselection Global $currentepisode Retrieve() While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $Button1 PreviousSource() Case $Button2 NextSource() Case $Button3 VisitPage() Case $Button4 VisitFrameDB() EndSwitch ReadSelectedTitle() ReadSelectedEpisode() WEnd Func Retrieve() $Url = "http://www.couchtuner.ch/" ; Tv List Source $array1 = _StringBetween(_INetGetSource ($Url), "

Ongoing Tv List ONLY!

", "") $info = $array1[0] ; Seperate tv shows source to a array $array2 = _StringBetween($info, "
  • ", "") ; Create a array of tv shows links (1st set of links) $array3 = _StringBetween($info, '", "") ; Convert the current title to a string $cleantitle=BinaryToString($currenttitle[0], 4) $cleantitle=StringReplace($cleantitle, '& ', '') ; Create a array of titles $titles=""&$titles&"|"&$cleantitle&"" Next ; Set List1 to the title names GUICtrlSetData($List1, $titles) EndFunc Func ReadSelectedTitle() $selection = GUICtrlRead($list1) if $selectioncheck <> $selection Then if $selection <> "" Then $selectioncheck = $selection $titlessplit = StringSplit($titles, "|") For $i = 0 to UBound($titlessplit) - 1 if $titlessplit[$i] = $selection Then $selectedtitlenum = $i - 1 EndIf Next $selectedtitlesite=$array3[$selectedtitlenum] Retrieve2() EndIf EndIf EndFunc Func Retrieve2() ;Episodes Source $array4 = _StringBetween(_INetGetSource ($selectedtitlesite), '
  • ', '

    ') if IsArray($array4) Then $info2 = $array4[0] ; Seperate tv shows source to a array $array5 = _StringBetween($info2, '
    ") ; Create a array of tv shows links (2nd set of links) $array6 = _StringBetween($info2, 'ef="', '"') For $i = 0 to UBound($array5) - 1 ; Extract title from seperated tv shows source $currentep=_StringBetween($array5[$i], ">", "") ; Create a array of titles $eps=""&$eps&"|"&$currentep[0]&"" Next ; Set List2 to the title names GUICtrlSetData($List2, "") GUICtrlSetData($List2, $eps) $eps2 = $eps $eps = "" Else GUICtrlSetData($List2, "") EndIf EndFunc Func ReadSelectedEpisode() $selection = GUICtrlRead($List2) $currentepisode = GUICtrlRead($List2) if $selectioncheck <> $selection Then if $selection <> "" Then $selectioncheck = $selection $epssplit = StringSplit($eps2, "|") For $i = 0 to UBound($epssplit) - 1 if $epssplit[$i] = $selection Then $selectedepsnum = $i - 2 EndIf Next $selectedepssite=$array6[$selectedepsnum] Linkorvid() EndIf EndIf EndFunc Func Linkorvid() $read = _INetGetSource($selectedepssite) $findit = "Watch it here :" If StringInStr($read, $findit) Then Link() Else Vid() EndIf EndFunc Func Link() $read = _INetGetSource($selectedepssite) $read2 = _StringBetween($read, '">Watch it here :', '">') $read3 = _ArrayToString($read2, @TAB, 0, UBound($read2) - 1) $read4 = _StringBetween($read3, 'a href="', '') $selectedepssite=$read4[0] RetIFrame() EndFunc Func Vid() RetIframe() EndFunc Func RetIFrame() $frames = "" $read = _INetGetSource($selectedepssite) $read2 = _StringBetween($read, '
    ') $front=' 2 Then $sourceselection = $sourceselection - 1 $temp = GUICtrlRead($label5) GUICtrlSetData($label5, $temp - 1) Visit() EndIf EndFunc Func Visit() _IENavigate($oIE, "about:blank") if UBound($framessplit) - 1 < 2 Then GUICtrlSetData($label5, "0") Else _IEDocWriteHTML ($oIE, $framessplit[$sourceselection]) _IEAction($oIE, "refresh") EndIf EndFunc Func VisitPage() if $selectedepssite <> "" Then Run(@comspec & " /c start " & $selectedepssite, "", @SW_HIDE) EndIf EndFunc Func VisitFrameDB() if IsArray($framessplit) Then if FileExists(@TempDir & "Source.html") Then FileDelete(@TempDir & "Source.html") EndIf _FileCreate(@TempDir & "Source.html") FileWriteLine(@TempDir & "Source.html", $framessplit[$sourceselection]) Run(@comspec & " /c start " & @TempDir & "Source.html", "", @SW_HIDE) EndIf EndFunc