[Frage] Radio

11/30/2012 01:58 Dein Verstand#1
Hey houuu :3
Hab hier so einen Script gefunden.
Darin ist ein Technobase , House , ... .fm stream!
Joaaah .. hab die form geändert und die hotkeys aber .. als ich umgeschaltet habe , kommt ein error ich hab aber kein dunst wie ich den behebe !?

11/30/2012 05:11 BladeTiger12#2
PHP Code:
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_icon=RadioIco.ico
#AutoIt3Wrapper_Add_Constants=n
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

Const $urlTechnoBase = 'http://listen.technobase.fm/tunein-dsl-asx'
Const $urlHouseTime = 'http://listen.housetime.fm/tunein-dsl-asx'
Const $urlHardBase = 'http://listen.hardbase.fm/tunein-dsl-asx'
Const $urlTranceBase = 'http://listen.trancebase.fm/tunein-dsl-asx'
Const $urlCoreTime = 'http://listen.coretime.fm/tunein-dsl-asx'

$oWMP = ObjCreate ( "WMPLayer.ocx" )

$oWMP.URL = $urlTechnoBase
$oWMP
.controls.stop()


Dim $arrStatus[12]
$arrStatus[0] = 'Unbekannt'
$arrStatus[1] = 'Gestoppt'
$arrStatus[2] = 'Pause'
$arrStatus[3] = 'Playing'
$arrStatus[4] = 'ScanForward'
$arrStatus[5] = 'ScanReverse'
$arrStatus[6] = 'Buffering'
$arrStatus[7] = 'Warten'
$arrStatus[8] = 'MediaEnded'
$arrStatus[9] = 'Transitioning'
$arrStatus[10] = 'Bereit'
$arrStatus[11] = 'Wiederverbinden...'


$lastStatus = 0

#include <ButtonConstants.au3>
#include <EditConstants.au3>
#include <GUIConstantsEx.au3>
#include <SliderConstants.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#include <ProgressConstants.au3>
#include <Security.au3>
#include <Memory.au3>
#include <UDFGlobalID.au3>
#include <GuiStatusBar.au3>
#include <GUIEdit.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <Constants.au3>
#include <GUIEdit.au3>
#include <GuiToolbar.au3>
#include <inet.au3>
#include <array.au3>
#include-once

$frmMain = GUICreate("Radio", 338, 203, -1, -1)

$BG = GUICtrlCreatePic("sample1.JPG", 0, 0, 400, 300,BitOR($SS_NOTIFY,$WS_GROUP,$WS_CLIPSIBLINGS,$GUI_DISABLE))

$Pic1 = GUICtrlCreatePic("GHG.jpg", 1, 0, 335, 145)

$comSender = GUICtrlCreateLabel("TechnoBase", 64, 152, 92, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

$lblInfo = GUICtrlCreateLabel("Info...",275,92,200)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

GUICtrlCreateLabel("Sender :", 8, 152, 54, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")

$trackname = GUICtrlCreateLabel("Song", 16, 176, 36, 20)
GUICtrlSetFont(-1, 10, 400, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

GUICtrlCreateLabel("Play/Stop = Numpad1", 216, 152, 109, 17)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

GUICtrlCreateLabel("Next = Numpad2", 216, 168, 84, 17)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)

GUICtrlCreateLabel("Back = Numpad3", 216, 184, 87, 17)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetState(-1, $GUI_ONTOP)
GUISetState(@SW_SHOW)

HotKeySet("{NUMPAD1}", "HotAnAus")
HotKeySet("{NUMPAD2}", "HotNext")
HotKeySet("{NUMPAD3}", "HotBack")

Global 
$HotKey = 0
$track 
= 0
$zeit 
= 0

While 1



    
If $track >= 500 then
        
Switch GUICtrlRead($comSender)

            Case 
'TechnoBase'
                
$source = _INetGetSource("http://www.technobase.fm/tracklist.php")
                
$TechnoExp2 = StringReplace($source,"amp;","&")
                
$TechnoExp = StringRegExp($TechnoExp2, 'border="\d" src=".+" alt=".+" title="(.+?)" />', 3)
                if 
isarray($TechnoExp) Then
                GUICtrlSetData
($trackname,$TechnoExp2)
                else
                
GUICtrlSetData($trackname,"Song not found")
                EndIf
                
$track = 0
            
Case 'HouseTime'
                
$source = _INetGetSource("http://www.housetime.fm/tracklist.php")
                
$HouseExp2 = StringReplace($source,"amp;","&")
                
$HouseExp = StringRegExp($HouseExp2, 'border="\d" src=".+" alt=".+" title="(.+?)" />', 3)
                
GUICtrlSetData($trackname,$HouseExp2)
                
$track = 0
            
Case 'HardBase'
                
$source = _INetGetSource("http://www.hardbase.fm/tracklist.php")
                
$HardExp2 = StringReplace($source,"amp;","&")
                
$HardExp = StringRegExp($HardExp2, 'border="\d" src=".+" alt=".+" title="(.+?)" />', 3)
                
GUICtrlSetData($trackname,$HardExp)
                
$track = 0
            
Case 'TranceBase'
                
$source = _INetGetSource("http://www.trancebase.fm/tracklist.php")
                
$TranceExp2 = StringReplace($source,"amp;","&")
                
$TranceExp = StringRegExp($TranceExp2, 'border="\d" src=".+" alt=".+" title="(.+?)" />', 3)
                If 
IsArray($TranceExp) Then
                GUICtrlSetData
($trackname,$TranceExp2)
                EndIf
                
$track = 0
            
Case 'CoreTime'
                
$source = _INetGetSource("http://www.coretime.fm/tracklist.php")
                
$CoreExp2 = StringReplace($source,"amp;","&")
                
$CoreExp = StringRegExp($CoreExp2, 'border="\d" src=".+" alt=".+" title="(.+?)" />', 3)
                
GUICtrlSetData($trackname,$CoreExp2)
                
$track = 0

        
EndSwitch
    EndIf

    
$nMsg = GUIGetMsg()
    Switch 
$nMsg
        
Case $GUI_EVENT_CLOSE
            
Exit

        Case 
$comSender
            $oWMP
.controls.stop()
            Switch 
GUICtrlRead($comSender)
                Case 
'TechnoBase'
                    
$oWMP.URL = $urlTechnoBase
                    GUICtrlSetImage
($BG,"sample1.JPG")
                Case 
'HouseTime'
                    
$oWMP.URL = $urlHouseTime
                    GUICtrlSetImage
($BG,"")
                Case 
'HardBase'
                    
$oWMP.URL = $urlHardBase
                    GUICtrlSetImage
($BG,"sample2.JPG")
                Case 
'TranceBase'
                    
$oWMP.URL = $urlTranceBase
                    GUICtrlSetImage
($BG,"sample3.JPG")
                Case 
'CoreTime'
                    
$oWMP.URL = $urlCoreTime
            
EndSwitch
            
$oWMP.controls.play()

            
$zeit = TimerInit()

    EndSwitch
    
$curStatus = $oWMP.playstate
    
If $curStatus <> $lastStatus Then
        GUICtrlSetData
($lblInfo, $arrStatus[$curStatus])
        
$lastStatus = $curStatus
    
EndIf

$track=$track+1
Wend

$oWMP
.URL = "http://www.HardBase.de/HardBaselive/media/einslive.asx"

$oWMP.controls.play()
While 
$oWMP.playstate > 2
    Sleep 
( 10 )
WEnd

Func HotAnAus
()
    If 
$HotKey = 0 Then
        $oWMP
.controls.play()
            
$HotKey = 1
    
ElseIf $HotKey = 1 Then
        $oWMP
.controls.stop()
            
$HotKey = 0
    
Endif
EndFunc

Func HotNext
()

    
$read = GuiCtrlRead($comSender)

    If 
$read = "TechnoBase" Then
        $oWMP
.URL = $urlHouseTime
            GUICtrlSetData
($comsender, "HouseTime")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundHouse2.jpg")

    ElseIf 
$read = "HouseTime" Then
        $oWMP
.URL = $urlHardBase
            GUICtrlSetData
($comsender, "HardBase")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundHard2.jpg")

    ElseIf 
$read = "HardBase" Then
        $oWMP
.URL = $urlTranceBase
            GUICtrlSetData
($comsender, "TranceBase")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundTrance2.jpg")

    ElseIf 
$read = "TranceBase" Then
        $oWMP
.URL = $urlCoreTime
            GUICtrlSetData
($comsender, "CoreTime")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundCore2.jpg")

    ElseIf 
$read = "CoreTime" Then
        $oWMP
.URL = $urlTechnoBase
            GUICtrlSetData
($comsender, "TechnoBase")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundTechno2.jpg")

    EndIf

EndFunc

Func HotBack
()

    
$read = GuiCtrlRead($comSender)

    If 
$read = "TechnoBase" Then
        $oWMP
.URL = $urlCoreTime
            GUICtrlSetData
($comsender, "CoreTime")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundCore2.jpg")

    ElseIf 
$read = "HouseTime" Then
        $oWMP
.URL = $urlTechnoBase
            GUICtrlSetData
($comsender, "TechnoBase")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundTechno2.jpg")

    ElseIf 
$read = "HardBase" Then
        $oWMP
.URL = $urlHouseTime
            GUICtrlSetData
($comsender, "HouseTime")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundHouse2.jpg")

    ElseIf 
$read = "TranceBase" Then
        $oWMP
.URL = $urlHardBase
            GUICtrlSetData
($comsender, "HardBase")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundHard2.jpg")

    ElseIf 
$read = "CoreTime" Then
        $oWMP
.URL = $urlTranceBase
            GUICtrlSetData
($comsender, "TranceBase")
                
GUICtrlSetData($BG, @TempDir & "RadioBackroundTrance2.jpg")

EndIf

EndFunc 
Das ist wegen dem Track name.
Vielleicht wird er nicht richtig ausgelessen oder so...
Naja auf jedenfall habe ich da jetzt einfach mal die Variable von StringReplace hingemacht.
Kommt zwar der Songname nicht raus aber so gehts.
11/30/2012 14:58 Dein Verstand#3
thanks :3
bin dir was schuldig *-*
11/30/2012 16:14 BladeTiger12#4
Achja will dir nur sagen der Error kam wegen:
PHP Code:
StringRegExp($Sender, 'border="\d" src=".+" alt=".+" title="(.+?)" />', 3) 
Entweder hat jeder Sender ein anderen Quellcode(" 'border="\d" src=".+" alt=".+" title="(.+?)" />'") oder Autoit macht das irgendwie Falsch was ich eher nicht glaube.
11/30/2012 23:53 Requiable#5
Da ist mein Radio mit drin o__0
Wat zur Hölle.
12/01/2012 23:00 Dein Verstand#6
Quote:
Originally Posted by Requiable View Post
Da ist mein Radio mit drin o__0
Wat zur Hölle.
Gut zu wissen :) Danke :*