Hallo Leute,
ich möchte euch mal eins meiner ersten Werke vorstellen , welches immernoch in Entwicklung ist. (Je nachdem wieviel Zeit ich übrig hab)
Es ist ein Web-Radio welches zusätzlich das Abspielen von Youtube-Titel unterstützt.
Würde gern wissen wies so ankommt und was man noch verbessern könnte bzw. ein paar Fragen hätte ich sogar schon.
Das einzige was ihr dazu braucht ist FF und das Plugin "Mozrepl".
Ich habe jetzt erstmal bewusst Sachen wie Mozrepldetector und Updater rausgelassen , da ich die eh neu schreiben muss.
Hier mal ein Screen:
[Blockierte Grafik: http://img716.imageshack.us/img716/7786/swrscreen.png]
Uploaded with ImageShack.us
Source:
Spoiler anzeigen
#include <WinAPI.au3>
#include "SliderTip.au3"
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <Misc.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <String.au3>
#include <GuiListView.au3>
#include <Date.au3>
#include <GuiMenu.au3>
#include <Array.au3>
#include "ModernMenuRaw.au3"
#include "_FF_YouTube_API.au3"
#include "FF.au3"
If _Singleton("SWR", 1) = 0 Then
MsgBox(16, "Fehler", "Ste`s Web-Radio wird bereits ausgeführt.")
Exit
EndIf
Opt("GUIOnEventMode", 1)
Opt("WinTitleMatchMode",3)
Opt("TrayOnEventMode", 1)
Opt("TrayMenuMode", 1)
AutoItSetOption("GUICloseOnESC", 0)
OnAutoItExitRegister("_cleanUp")
;###To Do###
;Auf "Variablen-Zombies" überprüfen
;FFRestarter_fixen (_FFTabClose broken)
;Neuen Updater schreiben
;Alle Bilder in Dll packen(vereinfacht updates)
;###########
;//Vars
Global $num = 0, $Label, $ff, $WMP, $iPos = 0, $YoutubeIsRunning = 0, $editForm, $all_stop, $sURL, $RadioIsRunning = 0, _
$path = @ScriptDir & "/Daten/radio.ini", $Input1, $Input2, $addForm, $stopurl = "about:blank", $vSlider, $iOld = -9, _
$delgui, $list, $dpath = @ScriptDir & "/Daten", $pauseico = $dpath & "/pause.bmp", $playico = $dpath & "/play.bmp", _
$volumeicon, $stopcurrenttimer = 0, $ytctlabel, $Hour, $Mins, $Secs, $sTime, $Time, $max, $ytmaxtime, $ytbufferlabel, $ytctimeslider, _
$readyttime, $Form1, $index, $eInput1, $eInput2, $menu1, $Capture = False, $tooltip, $stitle, $ismaxtime, $neterror = 0, $ended = 0, _
$adlib1, $sspeed = 1.5, $WinToWait = "The Book of Mozilla, 11:9 - Mozilla Firefox" , $WinFF = "SWR_FOX"
Dim $senderinfo[99][4]
Global $Version = "v.0.8.1", _
$muteico = @ScriptDir & "/Daten/Mute.bmp", _
$vlowico = @ScriptDir & "/Daten/Volumen_Lowr.bmp", _
$vmidico = @ScriptDir & "/Daten/Volumen_Middler.bmp", _
$vhighico = @ScriptDir & "/Daten/Volumen_Highr.bmp"
;//
$Youtube = IniReadSection($path, "Youtube")
$Radio = IniReadSection($path, "Radio")
$Other = IniReadSection($path, "Other")
$Form1 = GUICreate("Loading...", 253, 149, 990, 30, -1, $WS_EX_TOPMOST)
GUISetBkColor(0x4169E1)
$cBG = GUICtrlCreatePic($dpath & "/bck.jpg", 0, 0, 253, 149, $WS_CLIPSIBLINGS)
GUICtrlSetState(-1, $GUI_DISABLE)
GUISetOnEvent(-3, "_Exit")
$WMP = ObjCreate("WMPlayer.OCX")
$Play = GUICtrlCreatePic($playico, 184, 50, 32, 32)
$stop = GUICtrlCreatePic($dpath & "/stop.bmp", 218, 51, 32, 32)
GUICtrlSetOnEvent(-1, "_stop")
$Label = GUICtrlCreateLabel("CheckingNet...", 25, 14, 300, 16)
GUICtrlSetFont(-1, 11, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0x00FF00)
#region Youtube Controls
$ytctimeslider = _GuiCtrlCreateTransSlider1(5, 105, 242, 25, $Form1)
GUICtrlSetOnEvent(-1, "_seek")
$ytctlabel = GUICtrlCreateLabel("00:00", 13, 110, 40, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFF0000)
$ytmaxtime = GUICtrlCreateLabel("/ 00:00", 48, 110, 55, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFF0000)
$ytbufferlabel = GUICtrlCreateLabel("", 165, 112, 120, 25)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetColor(-1, 0xFF0000)
#endregion Youtube Controls
$Group1 = GUICtrlCreateGroup("", 0, 38, 253, 11)
$vSlider = _GuiCtrlCreateTransSlider2(5, 75, 140, 30, $Form1)
$volumeicon = GUICtrlCreatePic($dpath & "/Volumen_Middler.bmp", 146, 50, 32, 32)
GUICtrlSetOnEvent(-1, '_mute')
$menu1 = GUICtrlCreateMenu("&Titel")
SetBlueMenuColors()
$menu2 = GUICtrlCreateMenu("Extras")
SetBlueMenuColors()
_CreateSideZeug($menu1, "Titel")
_CreateSideZeug($menu2, "Extras")
$senderlist = _GUICtrlCreateODMenuItem("Radiosender suchen", $menu2, "shell32.dll", -210)
GUICtrlSetOnEvent(-1, '_Senderlist')
$senderlist2 = _GUICtrlCreateODMenuItem("Youtubetitel suchen", $menu2, @ScriptDir & "/Daten/youtube.ico")
GUICtrlSetOnEvent(-1, '_Senderlist2')
$add = _GUICtrlCreateODMenuItem("Titel hinzufügen", $menu2, "shell32.dll", -217)
GUICtrlSetOnEvent(-1, "_addtitle")
$edit = _GUICtrlCreateODMenuItem("Titel bearbeiten/löschen", $menu2, "shell32.dll", -132)
GUICtrlSetOnEvent(-1, "_DeleteOrEditTitle")
$Updateitem = _GUICtrlCreateODMenuItem("Update", $menu2, "shell32.dll", -14)
GUICtrlSetOnEvent(-1, '_update')
$creditz = _GUICtrlCreateODMenuItem("Credits", $menu2, "shell32.dll", -222)
GUICtrlSetOnEvent(-1, '_creditz')
_GUICtrlCreateODMenuItem("", $menu2)
$exit = _GUICtrlCreateODMenuItem("Beenden", $menu2, "shell32.dll", -28)
GUICtrlSetOnEvent(-1, "_Exit")
$titem = TrayCreateItem("Stumm schalten")
TrayItemSetOnEvent(-1, '_mute')
$titem2 = TrayCreateItem("Beenden")
TrayItemSetOnEvent(-1, '_Exit')
;//Radio(*asx)
For $i = 1 To UBound($Radio) - 1
$handle = _GUICtrlCreateODMenuItem($Radio[$i][0], $menu1, "shell32.dll", -139)
GUICtrlSetOnEvent(-1, "_identify")
$senderinfo[$i][0] = $Radio[$i][0]
$senderinfo[$i][1] = $Radio[$i][1]
$senderinfo[$i][2] = $handle
$senderinfo[$i][3] = "Radio"
$num += 1
Next
;//Youtube
For $i = 1 To UBound($Youtube) - 1
$handle = _GUICtrlCreateODMenuItem($Youtube[$i][0], $menu1, @ScriptDir & "/Daten/youtube.ico")
GUICtrlSetOnEvent(-1, "_identify")
$num += 1
$senderinfo[$num][0] = $Youtube[$i][0]
$senderinfo[$num][1] = $Youtube[$i][1]
$senderinfo[$num][2] = $handle
$senderinfo[$num][3] = "Youtube"
Next
;//Other
For $i = 1 To UBound($Other) - 1
$handle = _GUICtrlCreateODMenuItem($Other[$i][0], $menu1, "shell32.dll", -176) ; -211
GUICtrlSetOnEvent(-1, "_identify")
$num += 1
$senderinfo[$num][0] = $Other[$i][0]
$senderinfo[$num][1] = $Other[$i][1]
$senderinfo[$num][2] = $handle
$senderinfo[$num][3] = "Other"
Next
GUICtrlSetState($menu1, $GUI_DISABLE)
GUICtrlSetState($menu2, $GUI_DISABLE)
_DisableYTControls()
GUICtrlSetCursor($ytctimeslider, 0)
GUICtrlSetCursor($vSlider, 0)
GUISetState(@SW_SHOW)
_StartUpNetCheck()
GUICtrlSetData($Label, "Online")
$ff = _FFStart("about:mozilla", "default", 1, True,Default,Default,$WinToWait)
WinSetTitle($WinToWait,"",$WinFF)
If $ff = 0 Then
MsgBox(16+262144,"Fehler","Es konnte keine Verbindung hergestellt werden , bitte überprüfen Sie Ihre Interneteinstellungen.")
WinKill($WinFF)
Exit
EndIf
_FFPrefSet("browser.link.open_newwindow", 2)
WinSetTitle($Form1, "", "Ste`s Web-Radio " & $Version)
GUICtrlSetState($menu1, $GUI_ENABLE)
GUICtrlSetState($menu2, $GUI_ENABLE)
AdlibRegister("_volume", 50)
AdlibRegister("_NetChecker", 1000)
;~ Run(@ScriptDir & "/Updater.exe")
While Sleep(40)
_RadioMode()
_YTMode()
WEnd
Func _Senderlist()
__FFStartProcess("http://www.surfmusik.de/bundesland.htm", True)
EndFunc ;==>_Senderlist
Func _Senderlist2()
__FFStartProcess("http://www.youtube.com/?gl=DE&hl=de", True)
EndFunc ;==>_Senderlist2
Func _creditz()
MsgBox(64, "Credits", "Dieses Tool wurde gecoded von: S.Della Volpe" & @CRLF & "Scriptsprache: AutoIt" & @CRLF & "Besucht das deutsche Forum: http://www.autoit.de/" & @CRLF & @CRLF & "Icons von: http://findicons.com/" & @CRLF & "Sollte ich in irgend einer Weise gegen Copyright verstoßen, sagen Sie bitte bescheid, ich behebe es sofort!" & @CRLF & "Bei Bedarf kontaktieren Sie mich bitte über das Forum.")
EndFunc ;==>_creditz
Func _CreateSideZeug($param, $text)
Local $nSideItem
$nSideItem = _CreateSideMenu($param)
_SetSideMenuText($nSideItem, $text)
_SetSideMenuColor($nSideItem, __GCR_ColorConvert(0xFFFFFF))
_SetSideMenuBkColor($nSideItem, __GCR_ColorConvert(0x3399FF))
_SetSideMenuBkGradColor($nSideItem, __GCR_ColorConvert(0xFF0000))
EndFunc ;==>_CreateSideZeug
Func __GCR_ColorConvert($nColor);RGB to BGR or BGR to RGB
Return _
BitOR(BitAND($nColor, 0xFF000000), _
BitShift(BitAND($nColor, 0x000000FF), -16), _
BitAND($nColor, 0x0000FF00), _
BitShift(BitAND($nColor, 0x00FF0000), 16))
EndFunc ;==>__GCR_ColorConvert
Func _Exit()
Exit
EndFunc ;==>_Exit
#region main
Func _identify()
$adlib1 = 0
AdlibUnRegister("_Laufschrift")
GUICtrlSetData($Label, "Loading...")
For $i = 0 To UBound($senderinfo) - 1
If @GUI_CtrlId = $senderinfo[$i][2] Then _core($i)
Next
EndFunc ;==>_identify
Func _core($ID)
_FFRestarter()
_FF_YT("stopVideo")
$stitle = $senderinfo[$ID][0]
$sURL = $senderinfo[$ID][1]
$RadioIsRunning = 0
If $WMP.playstate <> 0 Then $WMP.controls.stop()
Switch $senderinfo[$ID][3]
Case "Youtube"
#region Yt-LinkChecker
GUICtrlSetData($ytbufferlabel, " Linkcheck...")
InetRead($sURL)
If @error Then
MsgBox(16 + 262144, "Fehler", "Der Titel '" & $stitle & "' ist nicht mehr verfügbar.")
_stop()
Return
EndIf
GUICtrlSetData($ytbufferlabel, "")
#endregion Yt-LinkChecker
_FFOpenURL($sURL, False)
AdlibRegister('_ytloadcheck', 20)
Case "Radio"
_FFOpenUrl($stopurl, False)
$WMP.URL = $sURL
$WMP.controls.play()
_setControls(1)
AdlibRegister('_loadcheck', 20)
Case "Other"
_FFOpenURL($sURL)
_setControls()
Sleep(1500)
GUICtrlSetData($Label, $stitle)
$adlib1 = 1
AdlibRegister("_Laufschrift")
EndSwitch
EndFunc ;==>_core
Func _ytloadcheck()
If _FF_YT("getPlayerState") = 1 Then
AdlibUnRegister('_ytloadcheck')
_setControls(2)
$iOld -= 1
GUICtrlSetData($Label, $stitle)
$adlib1 = 1
AdlibRegister("_Laufschrift")
GUICtrlSetImage($Play, $pauseico)
EndIf
EndFunc ;==>_ytloadcheck
Func _loadcheck()
If $WMP.playstate = 3 Then
$RadioIsRunning = 1
AdlibUnRegister('_loadcheck')
$iOld -= 1
GUICtrlSetData($Label, $stitle)
$adlib1 = 1
AdlibRegister("_Laufschrift")
GUICtrlSetImage($Play, $pauseico)
EndIf
EndFunc ;==>_loadcheck
Func _radiopause()
$WMP.controls.pause()
GUICtrlSetOnEvent($Play, "_radioplay")
GUICtrlSetImage($Play, $playico)
EndFunc ;==>_radiopause
Func _radioplay()
If $all_stop = 1 Then Return
$WMP.controls.play()
GUICtrlSetOnEvent($Play, "_radiopause")
GUICtrlSetImage($Play, $pauseico)
EndFunc ;==>_radioplay
Func _stop()
If GUICtrlRead($Label) = "Online" Then Return
$ended = 0
$adlib1 = 0
AdlibUnRegister("_Laufschrift")
GUICtrlSetData($Label, "Stopping...")
_SliderTip_UnRegisterToolTip($ytctimeslider, $hWnd_Slider)
AdlibUnRegister('_loadcheck')
AdlibUnRegister('_ytloadcheck')
_FFAction("stop")
_FFOpenUrl($stopurl)
If $YoutubeIsRunning = 1 Then
$YoutubeIsRunning = 0
_DisableYTControls()
Else
$RadioIsRunning = 0
$WMP.controls.stop()
EndIf
GUICtrlSetData($ytbufferlabel, "")
GUICtrlSetImage($Play, $playico)
GUICtrlSetData($Label, "Online")
$all_stop = 1
EndFunc ;==>_stop
#endregion main
Func _addtitle()
If WinExists("Hinzufügen") Then Return
$addForm = GUICreate("Hinzufügen", 391, 158, 403, 131, -1, $WS_EX_TOPMOST)
GUISetBkColor(0x4169E1)
GUISetOnEvent(-3, "_gdelete1")
$Button1 = GUICtrlCreateButton("Speichern", 8, 80, 369, 38)
GUICtrlSetOnEvent(-1, "_add")
$Button2 = GUICtrlCreateButton("Radiosender aus asx-Datei importieren", 8, 123, 369, 28, 0)
GUICtrlSetOnEvent(-1, "_ReadChannelfromASX")
$Label1 = GUICtrlCreateLabel("Titel:", 16, 16, 39, 20)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Input1 = GUICtrlCreateInput("", 64, 16, 313, 21)
$Label2 = GUICtrlCreateLabel("URL:", 16, 48, 38, 20)
GUICtrlSetFont(-1, 8, 800, 0, "MS Sans Serif")
GUICtrlSetColor(-1, 0xFF0000)
$Input2 = GUICtrlCreateInput("", 64, 48, 313, 21)
GUISetState(@SW_SHOW)
EndFunc ;==>_addtitle
Func _add()
Local $section
$rtitle = GUICtrlRead($Input1)
$rUrl = GUICtrlRead($Input2)
If $rtitle = "" Or $rUrl = "" Then
MsgBox(16, "Fehler", "Bitte füllen Sie alle Felder aus.")
Return
ElseIf Not StringInStr(StringLeft($rUrl, 7), "http://") Then
MsgBox(16, "Fehler", "Bitte geben Sie eine vollständige URL-Adresse ein. (http://..)")
Return
EndIf
$section = _what($rUrl)
IniWrite($path, $section, $rtitle, $rUrl)
$num += 1
$senderinfo[$num][0] = $rtitle
$senderinfo[$num][1] = $rUrl
Switch $section
Case "Youtube"
$handle = _GUICtrlCreateODMenuItem($rtitle, $menu1, @ScriptDir & "/Daten/youtube.ico")
Case "Radio"
$handle = _GUICtrlCreateODMenuItem($rtitle, $menu1, "shell32.dll", -139)
Case "Other"
$handle = _GUICtrlCreateODMenuItem($rtitle, $menu1, "shell32.dll", -176)
EndSwitch
GUICtrlSetOnEvent(-1, "_identify")
$senderinfo[$num][2] = $handle
$senderinfo[$num][3] = $section
_gdelete1()
MsgBox(64 + 262144, "", "Der Titel '" & $rtitle & "' wurde hinzugefügt.")
EndFunc ;==>_add
Func _DeleteOrEditTitle()
;~ _ArrayDisplay($senderinfo)
If WinExists("Titel bearbeiten/löschen") Then Return
$delgui = GUICreate("Titel bearbeiten/löschen", 276, 296, 468, 181)
GUISetBkColor(0x4169E1)
GUISetOnEvent(-3, '_gdelete2')
$list = GUICtrlCreateListView("Titel ", 8, 16, 257, 201)
_GUICtrlListView_SetColumnWidth($list, 0, 250)
For $i = 1 To $num
GUICtrlCreateListViewItem($senderinfo[$i][0], $list)
Next
$Button1 = GUICtrlCreateButton("Löschen", 8, 232, 120, 49)
GUICtrlSetOnEvent(-1, "_delete")
$Button2 = GUICtrlCreateButton("Bearbeiten", 140, 232, 120, 49)
GUICtrlSetOnEvent(-1, "_edit")
GUISetState(@SW_SHOW)
EndFunc ;==>_DeleteOrEditTitle
Func _edit()
$selectedItemtext = StringTrimRight(GUICtrlRead(GUICtrlRead($list)), 1)
If $selectedItemtext = "" Then
MsgBox(16, "Fehler", "Bitte wählen Sie einen Titel aus.")
Return
EndIf
If WinExists("Titel bearbeiten") Then Return
$index = _ArraySearch($senderinfo, $selectedItemtext)
$editForm = GUICreate("Titel bearbeiten", 391, 121, 406, 134, -1, $WS_EX_TOPMOST)
GUISetBkColor(0x4169E1)
GUISetOnEvent(-3, "_gdelete3")
$Button1 = GUICtrlCreateButton("Speichern", 8, 80, 369, 25)
GUICtrlSetOnEvent(-1, "_change")
$Label1 = GUICtrlCreateLabel("Titel:", 16, 16, 39, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$eInput1 = GUICtrlCreateInput($senderinfo[$index][0], 64, 16, 313, 21)
$Label2 = GUICtrlCreateLabel("URL:", 16, 48, 38, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$eInput2 = GUICtrlCreateInput($senderinfo[$index][1], 64, 48, 313, 21)
GUISetState(@SW_SHOW)
EndFunc ;==>_edit
Func _change()
$title = GUICtrlRead($eInput1)
$url = GUICtrlRead($eInput2)
If $title = "" Or $url = "" Then
MsgBox(16, "Fehler", "Bitte füllen Sie alle Felder aus.")
Return
ElseIf $title == $senderinfo[$index][0] And $url == $senderinfo[$index][1] Then
MsgBox(16, "Fehler", "Es wurden keine Änderungen vorgenommen.")
Return
ElseIf Not StringInStr(StringLeft($url, 7), "http://") Then
MsgBox(16, "Fehler", "Bitte geben Sie eine vollständige URL-Adresse ein. (http://..)")
Return
EndIf
_gdelete2()
IniDelete($path, $senderinfo[$index][3], $senderinfo[$index][0])
;~ _ArrayDisplay($senderinfo)
$section = _what($url)
$senderinfo[$index][0] = $title
$senderinfo[$index][1] = $url
$senderinfo[$index][3] = $section
IniWrite($path, $senderinfo[$index][3], $senderinfo[$index][0], $senderinfo[$index][1])
_GUICtrlODMenuItemSetText($senderinfo[$index][2], $senderinfo[$index][0])
Switch $section
Case "Youtube"
_GUICtrlODMenuItemSetIcon($senderinfo[$index][2], @ScriptDir & "/Daten/youtube.ico", 0)
Case "Radio"
_GUICtrlODMenuItemSetIcon($senderinfo[$index][2], "shell32.dll", -139)
Case "Other"
_GUICtrlODMenuItemSetIcon($senderinfo[$index][2], "shell32.dll", -176)
EndSwitch
_gdelete3()
EndFunc ;==>_change
Func _delete()
$selectedItemtext = StringTrimRight(GUICtrlRead(GUICtrlRead($list)), 1)
If $selectedItemtext = "" Then
MsgBox(16, "Fehler", "Bitte wählen Sie einen Titel aus.")
Return
EndIf
$index = _ArraySearch($senderinfo, $selectedItemtext)
GUICtrlDelete($senderinfo[$index][2])
IniDelete($path, $senderinfo[$index][3], $selectedItemtext)
_ArrayDelete($senderinfo, $index)
$num -= 1
_GUICtrlListView_DeleteItemsSelected($list)
EndFunc ;==>_delete
Func _volume()
$iVolume = GUICtrlRead($vSlider)
If $iOld <> $iVolume Then
_setVolumeIcon($iVolume)
If $YoutubeIsRunning = 1 Then
_FF_YT("setVolume", $iVolume)
Else
$WMP.settings.volume = $iVolume
EndIf
$iOld = $iVolume
EndIf
EndFunc ;==>_volume
Func _setVolumeIcon($iVolume)
If $iVolume = 0 Then
GUICtrlSetImage($volumeicon, $muteico)
ElseIf $iVolume < 33 Then
GUICtrlSetImage($volumeicon, $vlowico)
ElseIf $iVolume < 66 Then
GUICtrlSetImage($volumeicon, $vmidico)
ElseIf $iVolume > 85 Then
GUICtrlSetImage($volumeicon, $vhighico)
EndIf
EndFunc ;==>_setVolumeIcon
Func _Laufschrift()
If $adlib1 = 0 Then Return
GUICtrlSetData($Label, StringMid($stitle, $iPos) & " " & $stitle)
$iPos += $sspeed
If $iPos > StringLen($stitle) Then $iPos = 0
EndFunc ;==>_Laufschrift
Func _seek()
If _FF_YT("getPlayerState") = 2 Then GUICtrlSetData($ytctlabel, _ytime())
_FF_YT("seekTo", $readyttime)
EndFunc ;==>_seek
Func _update()
Run(@ScriptDir & "/Updater.exe")
EndFunc ;==>_update
Func _ytpause()
_FF_YT("pausevideo")
$stopcurrenttimer = 1
GUICtrlSetOnEvent($Play, "_ytplay")
GUICtrlSetImage($Play, $playico)
EndFunc ;==>_ytpause
Func _ytplay()
If $all_stop = 1 Then Return
_FF_YT("playvideo")
$stopcurrenttimer = 0
GUICtrlSetOnEvent($Play, "_ytpause")
GUICtrlSetImage($Play, $pauseico)
EndFunc ;==>_ytplay
Func _RadioMode()
If $RadioIsRunning = 1 Then
;~ If $WMP.playstate <> 3 Then ToolTip($WMP.playstate)
If $WMP.playstate = 1 Or $WMP.playstate = 10 Then
GUICtrlSetData($ytbufferlabel, "Reconnecting...")
Sleep(700)
$WMP.URL = $sURL
$WMP.controls.play()
;~ While $WMP.playstate <> 3
;~ Sleep(20)
;~ WEnd
GUICtrlSetData($ytbufferlabel, "Reconnected")
Sleep(800)
GUICtrlSetData($ytbufferlabel, "")
EndIf
EndIf
EndFunc ;==>_RadioMode
Func _YTMode()
Local $currenttime
If $YoutubeIsRunning = 1 Then
$readyttime = GUICtrlRead($ytctimeslider)
If _FF_YT("getPlayerState") = 3 Then
If GUICtrlRead($ytbufferlabel) <> " Buffering..." Then GUICtrlSetData($ytbufferlabel, " Buffering...")
Else
If GUICtrlRead($ytbufferlabel) <> "" Then GUICtrlSetData($ytbufferlabel, "")
EndIf
If $stopcurrenttimer = 0 Then
$currenttime = Ceiling(_FF_YT("getCurrentTime"))
If StringInStr($currenttime, "http://") = 0 Then
_TicksToTime($currenttime * 1000, $Hour, $Mins, $Secs)
$sTime = $Time
$Time = StringFormat("%02i:%02i", $Mins, $Secs)
EndIf
If _FF_YT("getPlayerState") = 0 And $currenttime > ($max - 1) And $ended = 0 Then
GUICtrlSetOnEvent($Play, "_ytplay")
GUICtrlSetImage($Play, $playico)
$ended = 1
$sspeed = 0.4
ElseIf _FF_YT("getPlayerState") = 1 And $ended = 1 Then
$ended = 0
$sspeed = 1.5
GUICtrlSetOnEvent($Play, "_ytpause")
GUICtrlSetImage($Play, $pauseico)
EndIf
If $Capture = False And $sTime <> $Time And $currenttime <= $max And $currenttime <> 0 Then
GUICtrlSetData($ytctlabel, $Time)
GUICtrlSetData($ytctimeslider, $currenttime)
EndIf
EndIf ; $stopcurrenttimer-EndIf
EndIf ; $YoutubeIsRunning-EndIf
EndFunc ;==>_YTMode
Func _DisableYTControls()
GUICtrlSetData($ytbufferlabel, "")
GUICtrlSetState($ytctimeslider, $GUI_DISABLE)
GUICtrlSetState($ytctlabel, $GUI_DISABLE)
GUICtrlSetState($ytmaxtime, $GUI_DISABLE)
GUICtrlSetData($ytctimeslider, 0)
GUICtrlSetData($ytctlabel, "00:00")
GUICtrlSetData($ytmaxtime, "/ 00:00")
EndFunc ;==>_DisableYTControls
Func _setControls($Mode = 0)
If $sspeed <> 1.5 Then $sspeed = 1.5
If $Mode <> 2 Then
$YoutubeIsRunning = 0
$stopcurrenttimer = 1
GUICtrlSetData($ytctlabel, "00:00")
GUICtrlSetData($ytmaxtime, "/ 00:00")
GUICtrlSetData($ytctimeslider, 0)
GUICtrlSetState($ytctimeslider, $GUI_DISABLE)
GUICtrlSetState($ytctlabel, $GUI_DISABLE)
GUICtrlSetState($ytmaxtime, $GUI_DISABLE)
_SliderTip_UnRegisterToolTip($ytctimeslider, $hWnd_Slider)
Else
$ended = 0
GUICtrlSetOnEvent($Play, "_ytplay")
$YoutubeIsRunning = 1
$stopcurrenttimer = 0
GUICtrlSetState($vSlider, $GUI_ENABLE)
GUICtrlSetState($Play, $GUI_ENABLE)
GUICtrlSetState($ytctimeslider, $GUI_ENABLE)
GUICtrlSetState($ytctlabel, $GUI_ENABLE)
GUICtrlSetState($ytmaxtime, $GUI_ENABLE)
$max = Ceiling(_FF_YT("getDuration"))
GUICtrlSetLimit($ytctimeslider, $max)
$getmaxtime = _TicksToTime($max * 1000, $Hour, $Mins, $Secs)
$ismaxtime = StringFormat("%02i:%02i", $Mins, $Secs)
GUICtrlSetData($ytmaxtime, "/ " & $ismaxtime)
_SliderTip_RegisterToolTip($ytctimeslider, $hWnd_Slider, "_ytime", True)
EndIf
If $Mode = 0 Then
GUICtrlSetState($vSlider, $GUI_DISABLE)
GUICtrlSetState($Play, $GUI_DISABLE)
ElseIf $Mode = 1 Then
GUICtrlSetOnEvent($Play, "_radioplay")
GUICtrlSetState($vSlider, $GUI_ENABLE)
GUICtrlSetState($Play, $GUI_ENABLE)
EndIf
$all_stop = 0
EndFunc ;==>_setControls
Func _FFRestarter()
If Not WinExists($ff) Then
$ff = _FFStart("www.google.de", "default", 1, False)
_FFTabClose("Google", "label")
_FFPrefSet("browser.link.open_newwindow", 2)
;~ Sleep(100)
;~ WinSetState($ff, "", @SW_DISABLE)
;~ WinSetTrans($ff, "", 0)
;~ WinSetState($ff, "", @SW_HIDE)
EndIf
EndFunc ;==>_FFRestarter
Func _mute()
GUICtrlSetData($vSlider, 0)
EndFunc ;==>_mute
Func _gdelete1()
GUIDelete($addForm)
EndFunc ;==>_gdelete1
Func _gdelete2()
GUIDelete($delgui)
EndFunc ;==>_gdelete2
Func _gdelete3()
GUIDelete($editForm)
EndFunc ;==>_gdelete3
Func _ytime()
_TicksToTime($readyttime * 1000, $Hour, $Mins, $Secs)
$tooltip = StringFormat("%02i:%02i", $Mins, $Secs)
Return $tooltip
EndFunc ;==>_ytime
Func _klick_true()
$a = GUIGetCursorInfo($hWnd_Slider)
If IsArray($a) Then
If $a[4] = $ytctimeslider Then $Capture = True
EndIf
EndFunc
Func _klick_false()
$Capture = False
EndFunc
;//InternetCheck
[/autoit] [autoit][/autoit] [autoit]Func _StartUpNetCheck()
If _INetCheck() = False Then
MsgBox(16, "Fehler", "Keine Internetverbindung verfügbar.")
Exit
EndIf
EndFunc ;==>_StartUpNetCheck
Func _NetChecker()
If _INetCheck() = False Then
$neterror += 1
Else
$neterror = 0
EndIf
If $neterror = 5 Then
AdlibUnRegister("_NetChecker")
MsgBox(16, "Fehler", "Die Verbindung zum Internet wurde getrennt.")
Exit
EndIf
If BitAND(WinGetState($ff), 2) Then
WinSetTrans($ff, "", 0)
WinSetState($ff, "", @SW_HIDE)
EndIf
EndFunc ;==>_NetChecker
Func _INetCheck()
Local Const $NETWORK_ALIVE_LAN = 0x1 ;net card connection
Local Const $NETWORK_ALIVE_WAN = 0x2 ;RAS (internet) connection
Local Const $NETWORK_ALIVE_AOL = 0x4 ;AOL
Local $aRet, $iResult
$aRet = DllCall("sensapi.dll", "int", "IsNetworkAlive", "int*", 0)
If BitAND($aRet[1], $NETWORK_ALIVE_LAN) Then $iResult &= "LAN connected" & @LF
If BitAND($aRet[1], $NETWORK_ALIVE_WAN) Then $iResult &= "WAN connected" & @LF
If BitAND($aRet[1], $NETWORK_ALIVE_AOL) Then $iResult &= "AOL connected" & @LF
Return $iResult
EndFunc ;==>_INetCheck
;//End-InternetCheck
Func _ReadChannelfromASX()
Local $readerror = 0
$choosed = FileOpenDialog("Durchsuchen...", "Wählen Sie Ihre ASX-Datei aus.", "ASX files (*.asx)")
If @error Then Return
$file = FileOpen($choosed)
$text = FileRead($file)
;Name
$name = _StringBetween($text, '<Title >', '</Title>')
If @error Then $name = _StringBetween($text, '<TITLE>', '</TITLE>')
If @error Then $name = _StringBetween($text, '<abstract>', '</abstract>')
If @error Then $readerror += 1
;URL
$url = _StringBetween($text, '<ref href="', '" />')
If @error Then $url = _StringBetween($text, '<REF HREF = "', '"/>')
If @error Then $url = _StringBetween($text, '<Ref href = "', '" />')
If @error Then $readerror += 1
If $readerror > 0 Then
MsgBox(16, "Fehler", "Fehler beim Lesen der Datei.")
FileClose($file)
Return
Else
GUICtrlSetData($Input1, $name[0])
GUICtrlSetData($Input2, $url[0])
FileClose($file)
EndIf
EndFunc ;==>_ReadChannelfromASX
Func _what($sURL)
Local $section
If StringInStr((StringLeft($sURL, 23)), "youtube.com") Then
$section = "Youtube"
ElseIf _isRadioStream($sURL) Then
$section = "Radio"
Else
$section = "Other"
EndIf
Return $section
EndFunc ;==>_what
Func _cleanUp()
If WinExists($WinToWait) Then WinKill($WinToWait)
_SliderTip_UnRegisterToolTip($ytctimeslider, $hWnd_Slider)
If $ff <> 0 Then
_FFPrefSet("browser.link.open_newwindow", 3)
Sleep(100)
_FFQuit()
EndIf
EndFunc ;==>_cleanUp
Func _GuiCtrlCreateTransSlider1($left, $top, $width, $height, $hWnd_Main)
;Slider
Global $hWnd_Slider = GUICreate("", $width, $height, $left, $top, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hWnd_Main)
GUISetOnEvent($GUI_EVENT_PRIMARYDOWN, "_klick_true");
GUISetOnEvent($GUI_EVENT_PRIMARYUP, "_klick_false");
$cSlider = GUICtrlCreateSlider(0, 0, $width, $height, $TBS_NOTICKS)
GUICtrlSetBkColor(-1, 0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($hWnd_Slider, 0xABCDEF)
GUISetState()
GUISwitch($hWnd_Main);
Return $cSlider
EndFunc ;==>_GuiCtrlCreateTransSlider1
Func _GuiCtrlCreateTransSlider2($left, $top, $width, $height, $hWnd_Main)
;Slider
Global $hWnd_vol = GUICreate("", $width, $height, $left, $top, $WS_POPUP, BitOR($WS_EX_MDICHILD, $WS_EX_LAYERED), $hWnd_Main)
$cSlider = GUICtrlCreateSlider(0, 0, $width, $height, $TBS_NOTICKS)
GUICtrlSetData(-1, 35)
GUICtrlSetBkColor(-1, 0xABCDEF)
_WinAPI_SetLayeredWindowAttributes($hWnd_vol, 0xABCDEF)
GUISetState()
GUISwitch($hWnd_Main);
Return $cSlider
EndFunc ;==>_GuiCtrlCreateTransSlider2
Func _isRadioStream($sURL)
Local $bRet = False, $oWMP = ObjCreate("WMPlayer.OCX")
$oWMP.URL = $sURL
$oWMP.controls.play()
Do
Sleep(30)
Until $oWMP.playstate <> 9
If $oWMP.playstate <> 10 Then $bRet = True
$oWMP.controls.stop()
$oWMP = 0
Return $bRet
EndFunc
Dank geht an yxyx und name22 , die mich immer mal wieder unterstützen.