#include-once
#include <INet.au3>
#include <String.au3>
; #FUNCTION# ===================================================================
; Name ..........: _GetTrack
; Description ...: Returns the Current running Track from the Internetradio
;				   "TechnoBase.FM".
; AutoIt Version : V3.3.2.0
; Syntax ........: _GetTrack()
; Parameter(s): .:
; Return Value ..: Success      - Track
;                  Failure      - Error
;                  @ERROR       - 1 TechnoBase is Offline
;								- 2 No Connection to the Internet
;								- 3 TechnoBase internal Error
; Author(s) .....: ettecks
; Date ..........: 1st February 2010
; Link ..........: http://autoit.de/index.php?page=User&userID=203936
; Related .......:
; Example .......: No
; ==============================================================================
Func _GetTrack()
	Local $Right = "20"
	Local $Left = "21"
	Ping("http://www.technobase.fm/tracklist.php") ; Check If TechnoBase is Online
	If @error Then
		SetError(1)
	EndIf
	Ping("www.google.de") ; Check If Internetconnection exists
	If @error Then
		SetError(2)
	Else
		$Source = _INetGetSource("http://www.technobase.fm/tracklist.php") ; Get Source
		$Between = _StringBetween($Source, 'hidden">', '</div>') ; Find Track
			$A1 = StringTrimLeft($Between[0], $Left) ; Remove Spaces on the left
		If @error Then ; If Track coudln't be found then
			SetError(3) ; SetError
		Else
			$A2 = StringTrimRight($A1, $Right) ; Remove Spaces on the right
			Return $A2 ; Return the Raw Track
		EndIf
	EndIf
EndFunc   ;==>_GetTrack



