The AutoIt script is here:
$m_ip = IniRead("FooSQ.ini","parameters","SqueezeBoxServerIP","")
$m_port =
IniRead("FooSQ.ini","parameters","SqueezeBoxServerCLIPort","")
$m_playerid =
IniRead("FooSQ.ini","parameters","SqueezeBoxPlayerID","")
$m_fooexe = IniRead("FooSQ.ini","parameters","Foobar2000Location","")
$m_amip = IniRead("FooSQ.ini","parameters","AMIPFile","")
$m_fooh = "[CLASS:{97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]"
$m_f = ""
$m_r = "0"
$m_s = "0"
$m_p = "?"
$m_t = ""
$m_n = ""
$m_ne = ""
$m_fn = ""
$m_sq = ""
$m_title = ""
$m_idle = 0
$m_ro = "0"
$m_seek = 0
$m_elt = ""
$m_seekt = 8
$m_0gap = 0
$m_0seek = 0
Run($m_fooexe, "", @SW_MAXIMIZE)
WinWait($m_fooh, "", 30)
$m_fooha = WinGetHandle($m_fooh)
TCPStartup()
$m_tcp = TCPConnect($m_ip, $m_port)
If @error Then
MsgBox(48, "FooSQ Warning", "Squeezebox Server not responding.")
Exit
EndIf
HotKeySet("{NUMPADADD}", "f_vol")
HotKeySet("{NUMPADSUB}", "f_vol")
HotKeySet("{NUMPADMULT}", "f_vol")
While 1
If Not WinExists($m_fooha) Then
sleep(300)
TCPSend($m_tcp,$m_playerid & " stop" & @CRLF & $m_playerid & "
playlist clear" & @CRLF)
Exit
EndIf
$m_title = WinGetTitle($m_fooha)
If StringRegExp($m_title, "^" & "foobar2000" & ".*[0-9]$") Then
$m_idle = 1
Else
$m_idle = 0
EndIf
If $m_idle = 0 And $m_title <> "" Then
$a_tn = StringSplit($m_title, "/")
$m_fn = $a_tn[1]
$m_r = $a_tn[2]
$m_p = $a_tn[3]
$m_elt = $a_tn[4]
if number($m_seekt) > 0 AND $m_0seek = 0 Then
$m_seekv = number($m_r) - number($m_ro)
if abs($m_seekv) > $m_seekt AND $m_ro <> "0" AND $m_f
= $m_fn Then
$m_seek = 1
Endif
Endif
$m_ro = $m_r
if $m_0seek > 0 then
$m_0seek = $m_0seek -1
endif
Else
$m_0gap = 1
$m_0seek = 50
EndIf
Select
Case $m_idle = 1 And $m_s <> "0"
$m_s = "0"
TCPSend($m_tcp,$m_playerid & " stop" & @CRLF & $m_playerid
& " playlist clear" & @CRLF)
Case $m_idle = 0 And $m_s = "0"
$m_s = "1"
$m_f = $m_fn
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ",
"%20")
TCPSend($m_tcp,$m_playerid & " playlist play " & $m_sq &
@CRLF)
Case $m_idle = 0 AND $m_s = "1" AND $m_seek = 0
if $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp,$m_playerid & " pause 1" & @CRLF)
Else
if $m_f <> $m_fn Then
if $m_t = "0" Then
if $m_fn <> $m_n Then
$m_sq =
StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
TCPSend($m_tcp,$m_playerid & " playlist
play " & $m_sq & @CRLF)
Endif
endif
$m_t = ""
$m_ne = ""
$m_f = $m_fn
Else
if number($m_r) < 12 AND number($m_r) > 1 AND
$m_0gap = 0 Then
if $m_ne = "" Then
$m_amips = FileOpen($m_amip, 0)
$m_n = FileReadLine($m_amip)
FileClose($m_amip)
$m_sq =
StringReplace(StringReplace($m_n, "\", "/"), " ", "%20")
TCPSend($m_tcp,$m_playerid & " playlist
insert " & $m_sq & @CRLF)
$m_ne = "1"
Endif
Endif
if Number($m_r) < 2 Then
$m_t = "0"
$m_0gap = 0
Endif
Endif
EndIf
Case $m_idle = 0 And $m_s = "2"
If $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp,$m_playerid & " pause 0" & @CRLF)
EndIf
Case $m_idle = 0 AND $m_s = "1" AND $m_seek = 1
$m_seek = 0
$m_ne = ""
TCPSend($m_tcp,$m_playerid & " playlist clear" &
@CRLF)
TCPSend($m_tcp,$m_playerid & " playlist play " &
StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20") & @CRLF)
TCPSend($m_tcp,$m_playerid & " pause 1" & @CRLF)
sleep(50)
TCPSend($m_tcp,$m_playerid & " time " & $m_elt &
@CRLF)
Sleep(50)
TCPSend($m_tcp,$m_playerid & " pause 0" & @CRLF)
EndSelect
Sleep(50)
WEnd
Func f_vol()
Select
Case StringInStr(@HotKeyPressed, "{NUMPADADD}")
TCPSend($m_tcp,$m_playerid & " mixer volume +5" & @CRLF)
Case StringInStr(@HotKeyPressed, "{NUMPADSUB}")
TCPSend($m_tcp,$m_playerid & " mixer volume -5" & @CRLF)
Case StringInStr(@HotKeyPressed, "{NUMPADMULT}")
TCPSend($m_tcp,$m_playerid & " mixer volume 0" & @CRLF)
EndSelect
EndFunc
--
stuffedspacedog
------------------------------------------------------------------------
stuffedspacedog's Profile: http://forums.slimdevices.com/member.php?userid=38655
View this thread: http://forums.slimdevices.com/showthread.php?t=79575
_______________________________________________
discuss mailing list
[email protected]
http://lists.slimdevices.com/mailman/listinfo/discuss