Sign in to follow this  
Followers 0
eagle4life69

Another media Player

4 posts in this topic

#1 ·  Posted (edited)

#include <Array.au3>
#include <File.au3>
#include <GuiConstants.au3>
WinClose("Subsonic 128k", "")
If @DesktopDepth > 8 Then
        $WinImage = @TempDir & "\" & "Sub.bmp"
        FileInstall("Sub.bmp", $WinImage, 1)
        
    
    EndIf
    $StripeStart = 60

#region Object
$oMyError = ObjEvent("AutoIt.Error","Quit")
$oMediaplayer = ObjCreate("WMPlayer.OCX.7")    

If Not IsObj($oMediaplayer) Then Exit

$oMediaplayer.Enabled = true
$oMediaplayer.WindowlessVideo= true
$oMediaPlayer.UImode="invisible"
$oMediaPlayer.URL="http://www.arhynes.org/stream/m3u/128k.m3u"
$oMediaPlayControl=$oMediaPlayer.Controls
$oMediaPlaySettings=$oMediaPlayer.Settings


#endregion

#region GUI

GuiCreate("Subsonic 128k", 468, 175, -1, (@DesktopHeight / 2) - (@DesktopHeight / 4.25), 0x00000000,$WS_EX_TOPMOST)



GUISetBkColor (0x2D3D4C)
GUICtrlCreatePic($WinImage, 0, 0, 0, 0)

$Volume = GuiCtrlCreateSlider(130, 80, 180, 20)
GuiCtrlCreateLabel("Volume", 130, 65, 40, 20)
GUICtrlSetColor(-1,0xDDDDDD)    ; Gray

; Created By
$font="Comic Sans MS"
GuiCtrlCreateLabel("Created By Eagle4life69", 0, 117,75, 25, )
GUICtrlSetFont (-1,7, 400,"",$font)
GUICtrlSetColor(-2,0xDDDDDD)    ; Gray
GuiCtrlCreateLabel("Ver. 2.1", 425, 130, 40, 20)
GUICtrlSetFont (-1,7, 400,"",$font)
GUICtrlSetColor(-2,0xDDDDDD)    ; Gray
         
GUISetState ()
GUICtrlSetData($Volume, 100)

$Play = GuiCtrlCreateButton("Play", 100, 110, 40, 25,$WS_DLGFRAME)
GUICtrlSetFont (-1,7, 400,"",$font)
$Stop = GuiCtrlCreateButton("Stop", 160, 110, 40, 25,$WS_DLGFRAME)
GUICtrlSetFont (-1,7, 400,"",$font)
$Exit = GuiCtrlCreateButton("Exit", 220, 110, 40, 25,$WS_DLGFRAME)
GUICtrlSetFont (-1,7, 400,"",$font)
$Now = GuiCtrlCreateButton("Now Playing", 280, 110, 75, 25,$WS_DLGFRAME)
GuiSetState()
$VolLevel = 100
HotKeySet("{F8}", "Hide")
HotKeySet("{F9}", "Show")
HotKeySet("{F7}", "Time")

$begin=0
while 1



while $begin<>0

ToolTip("", 0, 0)
$loc=StringSplit("175,378",","); default location

InetGet("http://www.subsonicradio.com/station/plain.php","c:\Subsonicradio.txt",1)
    $contents = fileRead("c:\Subsonicradio.txt",filegetsize("C:\Subsonicradio.txt"))
    $playing=StringReplace($contents,"&","=")
    $playing=StringSplit($playing,"=")
    If $playing[4] = "user" Then
    $Errreq = $playing[5]
    $playing[4] = $playing[5]
    $Errsong = $playing[2] &" & "& $playing[3]
    $playing[2] = $Errsong
    EndIf
    If $playing[4] = "" Then
    $playing[4]="*Random Play*"
    EndIf
    $Re=$playing[4]
    $playing[4]="Requested By - " & $Re
    FileDelete ( "C:\Subsonicradio.txt" )
$file2= "c:\Subsonicradio2.txt"
InetGet("http://www.subsonicradio.com/station/current_song.php",$file2,1)
    $contents2 = fileRead($file2,filegetsize($file2))
        

$Lineslog = _FileCountLines($file2)
$mathlog = ($Lineslog-"6")
$linelog = FileReadLine($file2,$mathlog)
    $timer=StringReplace($linelog,">","<")
    $timer=StringSplit($timer,"<",)
    MsgBox(0,"3",$timer[3])

$amount=$timer[3]; default time
FileDelete ( "C:\Subsonicradio2.txt" )

while (TimerStop($begin)/1000)<$amount
$time=$amount-int(TimerStop($begin)/1000)/1
if $time>60 then
ToolTip($playing[2]&"                  "&$playing[4]&"                    "&int($time/60)&":"&$time-int($time/60)*60,$loc[1],$loc[2])
else
if $time<60 then
ToolTip($playing[2]&"                  "&$playing[4]&"                    "&$time,$loc[1],$loc[2])
else
if $time<10 then
ToolTip($playing[2]&"                  "&$playing[4]&"                    "&$time,$loc[1],$loc[2])
endif
endif
endif
sleep(20)
wend
wend
ToolTip("")


   $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case $msg = $Play
        $oMediaPlayControl.Play
    Case $msg = $Stop
        $oMediaPlayControl.Stop
    Case $msg = $Exit
        $oMediaPlayControl.Stop
    Exit
    Case Else
        If GUICtrlread($Volume) <> $VolLevel Then
            $oMediaPlaySettings.Volume = GUICtrlRead($Volume)
            $VolLevel = GUICtrlRead($Volume)
        EndIf

    If $msg = $Now then
    InetGet("http://www.subsonicradio.com/station/plain.php","c:\Subsonicradio.txt")
    $contents = fileRead("c:\Subsonicradio.txt",filegetsize("C:\Subsonicradio.txt"))
    $playing=StringReplace($contents,"&","=")
    $playing=StringSplit($playing,"=")
    If $playing[4] = "user" Then
    $Errreq = $playing[5]
    $playing[4] = $playing[5]
    $Errsong = $playing[2] &" & "& $playing[3]
    $playing[2] = $Errsong
    EndIf
    If $playing[4] = "" Then
    $playing[4]="*Random Play*"
    EndIf
    Msgbox(8192,"Requested By - " & $playing[4],$playing[2],5)

    FileDelete ( "C:\Subsonicradio.txt" )
    EndIf

EndSelect 
   WEnd


Exit


#endregion

#region functions
Func Quit()
    $oMediaPlayControl.Stop
    Exit
EndFunc

Func Hide()
    GUISetState(@SW_HIDE)
$begin = 0
EndFunc

Func Show()
    GUISetState(@SW_SHOW)
$begin = 0
EndFunc
Func Time()
$begin = TimerStart()
EndFunc

#endregion

Here is my code. Can someone help me change the fact that my users need to press F7 to display the song.

Okay I added the image for you, also at the end of the timer I need it to re DL the next song

Sub.bmp

Edited by eagle4life69

Share this post


Link to post
Share on other sites



it would be really cool to have my player use the Windows media player and put out saying I am using my own player. As you may or may not know when you connect to a streaming radio play it displays the player u are using I would like to name the player so I know who is really listening with my player. Thanks for any help you can give me

Share this post


Link to post
Share on other sites

okay nice basic player, but that doesn't do a darn thing I would like to see. I already use the windows media player but I and to tell that I am using my own player. Does anyone know how to change the Name of the player on the code side (and I don't mean the name of the program)

Share this post


Link to post
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
Sign in to follow this  
Followers 0