Jump to content

Blox Online Radio Tuner


cppman
 Share

Recommended Posts

Blox Online Radio is a simple radio tuner program. You can play local audio files, streaming audio files, or just an audio file off the internet. As of now, there is only a small list (19) of stations to choose from. If you know of a station than let me know, and I'll add it to the list. Make sure you let me know in this format: <station name> | <stream url>.

You can download Blox Online Radio here.

The list is stored on my webserver, that way the program can be updated with radio stations whenever it needs to be. It automatically downloads the radio station list on each startup, or you can manually update it by right clicking the tray icon and selecting, "Update Station List".

It also has support for setting the current radio station as your personal message in MSN Messenger.

Here are some screenshots...

Posted Image Posted Image Posted Image

If you want to change stations, click the "stop" button, and find the station you want to listen to, and press "Play".

You can download the zip containing Blox Online Radio here. The zip contains a readme.txt file that explains how to use it.

You can alternatively download the zip file here: BloxRadio.zip

Link to comment
Share on other sites

  • 4 months later...
  • 1 year later...

@ccpman

should add a progress bar if possible for music read time :)

Cheers, FireFox.

I'm no longer working on this - it is really old.

This is a very old thread, and since it was all ready bumped, I thought I'd take this opportunity to just post the source for anyone who still wants it.

Global $g_UseMSNPM = False
Opt("TrayAutoPause", 0)
Opt("TrayMenuMode", 1)
Opt("TrayOnEventMode", 1)
#include <Constants.au3>
#include <GUIConstants.au3>
#include <file.au3>
#include <GUICombo.au3>

TraySetOnEvent($TRAY_EVENT_PRIMARYDOWN, "ShowWindow")
TraySetClick ( 8 )

SplashTextOn("Blox Online Radio", "Please wait while the station list is being updated...")

; Place the path to the station list here...
INetGet("http://blox.no-ip.org/stations.txt", @TempDir & "\stations.txt")
;;;;

SplashOff()

$hWnd = GUICreate("Blox Online Radio", 387, 126)
$hVolumeControl = GUICtrlCreateSlider(52, 40, 81, 25, BitOR($TBS_AUTOTICKS,$TBS_NOTICKS))
$hBalanceControl = GUICtrlCreateSlider(52+81+39, 40)
GUICtrlSetLimit($hBalanceControl, 100, -100)
GUICtrlCreateLabel("Volume", 4, 44, 39, 17)
GUICtrlCreateLabel("Balance", 52+81, 44, 39, 17)
GUICtrlCreateLabel("Station: ", 4, 16, 43, 17)
$hStationList = GUICtrlCreateCombo("", 52, 12, 309, 25)
GUICtrlCreateGroup("Status", 4, 76, 377, 45)
$hStationStatus = GUICtrlCreateLabel("Status", 12, 96, 360)
$hPlayButton = GUICtrlCreateButton("Play", 264, 40, 97, 25, 0)
GUISetState(@SW_SHOW)
;Populate Station List
Global $avStations 
_FileReadToArray(@TempDir & "\stations.txt", $avStations)
For $i = 1 to $avStations[0]
    $sztmp = StringSplit($avStations[$i], "|")
    _GUICtrlComboAddString($hStationList, $sztmp[1])
Next

$gMediaObject = _CreateWMPlayer()
GUICtrlSetData($hVolumeControl, $gMediaObject.settings.volume)
$lastStatus = _GetStatus($gMediaObject)

;Create Tray menu
$TrayMenu_SetMsnPM = TrayCreateItem("Enable MSN Personal Message")
$TrayMenu_UpdateStations = TrayCreateItem("Update Station List")
$TrayMenu_SetStation = TrayCreateItem("Set Radio Station")
$TrayMenu_SetBalance = TrayCreateItem("Set Balance")
$TrayMenu_SetVolume = TrayCreateItem("Set Volume")
$TrayMenu_Exit = TrayCreateItem("&Exit")
TrayItemSetOnEvent($TrayMenu_Exit, "Close")
TrayItemSetOnEvent($TrayMenu_SetVolume, "SetVol")
TrayItemSetOnEvent($TrayMenu_SetBalance, "SetBal")
TrayItemSetOnEvent($TrayMenu_SetStation, "SetStation")
TrayItemSetOnEvent($TrayMenu_UpdateStations, "UpdateStations")
TrayItemSetOnEvent($TrayMenu_SetMsnPM, "SetPM")


While 1
    $nMsg = GUIGetMsg()
    $status = _GetStatus($gMediaObject)
    if ($lastStatus <> $status) Then
        TraySetToolTip($status)
        GUICtrlSetData($hStationStatus, $status)
        $lastStatus = $status
    EndIf
    if ($g_useMSNPM == true) Then
        if (StringInStr($status, "Playing")) Then
            ChangeMSNMessage(3, true, $status)
        EndIf
    EndIf
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Close()
        Case $hPlayButton
            if (GUICtrlRead($hPlayButton) == "Play") Then
                if (GUICtrlRead($hStationList) == "") Then
                    MsgBox(48, "Blox Online Radio", "You must select a radio station from the drop-down box, or select your own.")
                    ContinueLoop
                EndIf
                $nSel = _GUICtrlComboGetCurSel($hStationList)+1
                $sztmp = StringSplit($avStations[$nSel], "|")
                $gMediaObject.URL = $sztmp[2]
                GUICtrlSetData($hStationStatus, _GetStatus($gMediaObject))
                GUICtrlSetData($hPlayButton, "Stop")
            Else
                ChangeMSNMessage(3, false, "")
                $gMediaObject.controls.stop()
                GUICtrlSetData($hPlayButton, "Play")
            EndIf
        Case $hVolumeControl
            $gMediaObject.settings.volume = GUICtrlRead($hVolumeControl)
        Case $hBalanceControl
            $gMediaObject.settings.balance = GUICtrlRead($hBalanceControl)
        Case $GUI_EVENT_MINIMIZE
            GUISetState(@SW_HIDE)
    EndSwitch
WEnd

Func _CreateWMPlayer()
    $Object = ObjCreate("WMPlayer.OCX.7")
    $Object.URL = ""
    return $Object
EndFunc

Func _GetStatus($Object)
    return $Object.status
EndFunc

Func ShowWindow()
    GUISetState(@SW_SHOW)
EndFunc

Func Close()
    $nRes = MsgBox(BitOr(3, 32), "Blox Online Radio", "Are you sure you would like to exit?")
    if ( ($nRes = 2) or ($nRes = 7) ) Then
        Return
    Else
        ChangeMSNMessage(3, false, "")
        Exit
    EndIf
EndFunc

Func SetVol()
    $nRes = InputBox("Blox Online Radio", "Please input a number between 0 and 100 designation the volume you would like.", "50")
    GUICtrlSetData($hVolumeControl, $nRes)
    $gMediaObject.settings.volume = int($nRes)
EndFunc

Func SetBal()
    $nRes = InputBox("Blox Online Radio", "Please input a number between -100 and 100 designation the stereo balance you would like.", "0")
    GUICtrlSetData($hBalanceControl, $nRes)
    $gMediaObject.settings.balance = int($nRes)
EndFunc

Func SetStation()
    $nRes = InputBox("Blox Online Radio", "Please type in the URL of the streaming radio station you would like to listen to.")
    if ($nRes == "") Then
        MsgBox(48, "Blox Online Radio", "You must select a radio station from the drop-down box, or select your own.")
        Return
    EndIf
    $gMediaObject.url = $nRes
EndFunc

Func UpdateStations()
    _GUICtrlComboResetContent($hStationList)
    SplashTextOn("Blox Online Radio", "Please wait while the station list is being updated...")
        INetGet("http://blox.no-ip.org/stations.txt", @TempDir & "\stations.txt")
    SplashOff()
    _FileReadToArray(@TempDir & "\stations.txt", $avStations)
    For $i = 1 to $avStations[0]
        $sztmp = StringSplit($avStations[$i], "|")
        _GUICtrlComboAddString($hStationList, $sztmp[1])
    Next
EndFunc

;;;
; Thanks to CoePSX
;;;
Func ChangeMSNMessage($iType, $bEnable, $szText)
    Local Const $szFormat = "CoePSX\\0%s\\0%d\\0{0}\\0%s\\0\\0\\0\\0\\0"
    Local Const $WM_COPYDATA = 0x4A
    Local $szType
    Local $szMessage
    Local $iSize
    Local $pMem
    Local $stCopyData
    Local $hWindow

    ;; Format the message ;;
    Switch ($iType)
        Case 1
            $szType = "Games"
        Case 2
            $szType = "Office"
        Case Else
            $szType = "Music"
    EndSwitch
    $szMessage = StringFormat($szFormat, $szType, $bEnable, $szText)
    
    ;; Create a unicode string ;;
    $iSize = StringLen($szMessage) + 1
    $pMem = DllStructCreate("ushort[" & $iSize & "]")
    For $i = 0 To $iSize
        DllStructSetData($pMem, 1, Asc(StringMid($szMessage, $i, 1)), $i)
    Next
    DllStructSetData($pMem, 1, 0, $iSize)
    
    ;; Create the COPYDATASTRUCT ;;
    $stCopyData = DllStructCreate("uint;uint;ptr")
    DllStructSetData($stCopyData, 1, 0x547) ;dwData = MSN magic number
    DllStructSetData($stCopyData, 2, ($iSize * 2)) ;cbData = Size of the message
    DllStructSetData($stCopyData, 3, DllStructGetPtr($pMem)) ;lpData = Pointer to the message
    
    ;; Send the WM_COPYDATA message ;;
    $hWindow = DllCall("user32", "hwnd", "FindWindowExA", "int", 0, "int", 0, "str", "MsnMsgrUIManager", "int", 0)
    While ($hWindow[0])
        DllCall("user32", "int", "SendMessageA", "hwnd", $hWindow[0], "int", $WM_COPYDATA, "int", 0, "ptr", DllStructGetPtr($stCopyData))
        $hWindow = DllCall("user32", "hwnd", "FindWindowExA", "int", 0, "hwnd", $hWindow[0], "str", "MsnMsgrUIManager", "int", 0)
    WEnd
    
    ;; Cleanup ;;
    $pMem = 0
    $stCopyData = 0
EndFunc   ;==>ChangeMSNMessage

Func SetPM()
    $text = TrayItemGetText($TrayMenu_SetMsnPm)
    if ($text = "Enable MSN Personal Message") Then
        TrayItemSetText($TrayMenu_SetMsnPm, "Disable MSN Pesonal Message")
        $g_UseMSNPM = True
    Else
        TrayItemSetText($TrayMenu_SetMsnPm, "Enable MSN Personal Message")
        ChangeMSNMessage(3, false, "")
        $g_UseMSNPM = False
    EndIf
EndFunc
Edited by cppman
Link to comment
Share on other sites

I modified the source a bot to fit the new autoitVersion.

Some includes and functions are out of date and i updated them.

I am continuing this script now with the same name.

Planned :

ICQ / Yahoo / Teamspeak / AIM Statuus Message Support.

Better Interface

Code Tweaks

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...