Jump to content

Revision3 Tv Player


Datenshi
 Share

Recommended Posts

Posted Image

This is something i spent my rainy day on, It's practically a gui with JW flv player embedded, it'll list all the episodes from all the shows by Revision3.com(tech talk and gadgets), they're pretty good shows i kinda just started watching them but their online player wasn't working for me, and it was a real pain in the A** not to be able to stream it properly in mplayer/vlc. Anyway, i only spent a couple of hours on this so it might not be super optimized >_< at least it works fine without any huge bugs(knock on wood).

Oyeah, i almost forgot...the GUI is kinda big(1050x590) so if you're on a low resolution you'll have to adjust the code, its big cause you can watch 720p HD.

If anyone can get fullscreen to work let me know, i tried but it wouldn't work.

I'll host a RAR file with the JW Flv player,compiled exe and source, On my server.

Revision3TvPlayer.rar

Here's the source in code tag:

;Revision 3 TV player
;Author: Emanuel "Datenshi" Lindgren
;Credit: "ptrex" for player object code. http://www.autoitscript.com/forum/index.php?showtopic=65027&view=findpost&p=483970
;Uses JW Flv Player
;http://www.longtailvideo.com/players/jw-flv-player/


Opt("GUIOnEventMode", 1)
#include <GUIConstantsEX.au3>
#include <GuiListView.au3>
#include <WindowsConstants.au3>
#include <ButtonConstants.au3>
#include <ListViewConstants.au3>
#include <inet.au3>
#include <string.au3>
#Include <array.au3>
Dim $PageLinks
Dim $VidThumbnails
FileInstall("player.swf","player.swf")
; Initialize error handler
$oMyError = ObjEvent("AutoIt.Error","MyErrFunc")

; ---------------------------------- Declare objects -------------------------------
$oSWF = ObjCreate("ShockwaveFlash.ShockwaveFlash")

; -------------------------------------------- Main Gui ---------------------------------
$hGui = GuiCreate("Revision3 TV", 1050, 590,-1, -1, BitOR($WS_SYSMENU, $WS_VISIBLE))
GUISetBkColor("0x292929")
$DropdownShowSelect = GUICtrlCreateCombo("Tekzilla",50, 20, 150) ; create first item
                     GUICtrlSetData(-1, "Systm|Hak5|Xlr8rtv|ScamSchool|TRS|ROFL|PixelPerfect|iFanboy|Jvsworld|HDnation|Filmriot|Diggnation|Diggdialogg|Diggreel|coop|Appjudgment", "Tekzilla")
GUICtrlSetOnEvent($DropdownShowSelect,"ShowSelector")
$DropdownVidQuality = GUICtrlCreateCombo("HD-Quality",200, 20, 150) ; create first item
GUICtrlSetData(-1,"High-Quality|Low-Quality","HD-Quality")
GUICtrlSetOnEvent($DropdownVidQuality,"QualitySelector")

$hListView = GUICtrlCreateListView("Show Episodes", 792, 0,250,560)
_GUICtrlListView_SetColumnWidth($hListView, 0, $LVSCW_AUTOSIZE_USEHEADER)
$previewpic = GUICtrlCreatePic("", 568, 2, 0, 0);("", 568, 0, 201, 113)

GUIRegisterMsg($WM_NOTIFY, "WM_NOTIFY")
$oSWF_Object = GUICtrlCreateObj ($oSWF, 10, 100 , 770 , 450)
GUICtrlSetStyle ( $oSWF_Object,  $WS_VISIBLE )


With $oSWF
        .ScaleMode = 3 ;0 showall, 1 noborder, 2 exactFit, 3 noscale
        .bgcolor = "505050"
        .WMode = "transparent"
        .allowScriptAccess = "Always"
        .Quality = 1
        .flashvars = "autostart=true&fullscreen=true&smoothing=false"
        ;.Menu = "true"
EndWith

ShowSelector()

GUISetOnEvent($GUI_EVENT_CLOSE, "GUIeventClose")

GuiSetState()

While 1
    Sleep(100)
WEnd
;-------------------------------
Func ShowSelector($Quality = 1)
    $whatshow = GUICtrlRead($DropdownShowSelect)
    $Pool = "http://revision3.com/"&$whatshow&"/episodePage?type=recent&hideShow=1&hideArrows=1&type=recent&limit=500"
    $source = _InetGetSource($Pool)
    $PageLinks = StringRegExp($source,'href="(/.*?/.*?)"><img\sclass',3)
    $VidThumbnails = StringRegExp($source,'/revision3/images/shows/[-a-zA-Z0-9\_\.]*\w/\d*/.*.jpg',3)
    $VidNames = StringRegExp($source,'<br\s/>\s\s(.*)\s\s\(',3)
    If IsArray($VidNames) = 0 Then $VidNames = StringRegExp($source,'(\w.*)\s\s\(',3)
    Dim $items[Ubound($VidNames)]
   _GUICtrlListView_DeleteAllItems($hListView)
    For $x = 0 To Ubound($VidNames) -1
    $items[$x] = GUICtrlCreateListViewItem($VidNames[$x],$hListView)
Next
    Endfunc
;----------------------------
Func QualitySelector()
$whatQuality = GUICtrlRead($DropdownVidQuality)
Switch $whatQuality
    Case "HD-Quality"
        Return 0
    Case "High-Quality"
        return 1
    Case "Low-Quality"
        Return 2
EndSwitch
EndFunc
;----------------------------
Func _FileOpen($Hotlink = 0)
$FileOpen = _URIEncode("http://bitcast-a.bitgravity.com/"&$Hotlink)
$oSWF.GotoFrame(1)
$oSWF.Movie = @ScriptDir & "\player.swf?file="&$FileOpen
$oSWF.rewind
$oSWF.flashvars = "autostart=true&fullscreen=true&smoothing=false"
EndFunc

Func GUIeventClose()
    Exit
EndFunc   ;==>GUIeventClose
;----------------------------
Func _URIEncode($sData) ; by Prog@ndy
    Local $aData = StringSplit(BinaryToString(StringToBinary($sData,4),1),"")
    Local $nChar
    $sData=""
    For $i = 1 To $aData[0]
        $nChar = Asc($aData[$i])
        Switch $nChar
            Case 45, 46, 48-57, 65 To 90, 95, 97 To 122, 126
                $sData &= $aData[$i]
            Case 32
                $sData &= "+"
            Case Else
                $sData &= "%" & Hex($nChar,2)
        EndSwitch
    Next
    Return $sData
EndFunc
;----------------------------
Func SetPreviewImage($Index)
    InetGet("http://bitcast-a.bitgravity.com"&$VidThumbnails[$Index],@Tempdir&"/"&$Index&"-R3tv.jpg")
    GUICtrlSetImage($previewpic,@Tempdir&"/"&$Index&"-R3tv.jpg")
Endfunc
;----------------------------
Func GetHotlink($LV_Index)
$VideoPage = $PageLinks[$LV_Index]
$Vidsource = _InetGetsource("http://revision3.com"&$VideoPage)
$HotLink = StringRegExp($Vidsource,"/revision3/web/[-a-zA-Z0-9\_\.]*\w/\d*/.*[mp4|flv]",3)
$QualityValue = QualitySelector()
Return $HotLink[$QualityValue]
EndFunc
;----------------------------
Func MyErrFunc() ; author ptrex
  $HexNumber=hex($oMyError.number,8)
  Msgbox(0,"AutoItCOM Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext _
            )
  SetError(1)  ; to check for after this function returns
Endfunc
;----------------------------
Func WM_NOTIFY($hWnd, $iMsg, $iwParam, $ilParam)
    #forceref $hWnd, $iMsg, $iwParam
    Local $hWndFrom, $iIDFrom, $iCode, $tNMHDR, $hWndListView, $tInfo

    $hWndListView = $hListView
    If Not IsHWnd($hListView) Then $hWndListView = GUICtrlGetHandle($hListView)

    $tNMHDR = DllStructCreate($tagNMHDR, $ilParam)
    $hWndFrom = HWnd(DllStructGetData($tNMHDR, "hWndFrom"))
    $iIDFrom = DllStructGetData($tNMHDR, "IDFrom")
    $iCode = DllStructGetData($tNMHDR, "Code")
    Switch $hWndFrom
        Case $hWndListView
            Switch $iCode
                Case $NM_CLICK ; Sent by a list-view control when the user clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    $Index = DllStructGetData($tInfo, "Index")
                    SetPreviewImage($Index)
                Case $NM_DBLCLK ; Sent by a list-view control when the user double-clicks an item with the left mouse button
                    $tInfo = DllStructCreate($tagNMITEMACTIVATE, $ilParam)
                    $Index = DllStructGetData($tInfo, "Index")
                    $Hotlink = GetHotlink($Index)
                    _FileOpen($Hotlink)
            EndSwitch
    EndSwitch
    Return $GUI_RUNDEFMSG
EndFunc   ;==>WM_NOTIFY

Don't forget you'll need JW FLV Player in scriptdir and name it "player.swf", don't worry about it if you download the .rar its all in there.

Enjoy! and if you steal my code, gief credit :(

Edited by Datenshi
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...