IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
FooSQ proxy script for Squeezebox
marae
post May 19 2008, 21:53
Post #1





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



It's for using directly a Squeezebox with Foobar . Gapless . Enjoy

CODE
;============================== Start of FooSQ AutoIt script ==================================

; Author Marae; May 2008 - FooSQ

; FooSQ grab infos from Foobar windows title with an AutoIT script, then send "cli" command to SqueezeCenter.
; It is not necessary to wait for any rescan inside SqueezeCenter.
; Just add a folder/playlist inside Foobar (no tags needed), then press play (gapless).

; The time needed with my settings for adding a song in Now Playing then bufferize it is 10 sec.
; If we guess the next song, and we enqueue it 10 sec. before the end of the current one, it's gapless.
; Then FooSQ determine normal transition (remaining time pass by 0) or skip.
; AMIP guess the next song

; This is a first release, so you may see some Autoit error messages or desynchro sometime.

; To install:
; 1.- Install autoit and compile this script( http://www.autoitscript.com/autoit3/downloads.shtml )
; 2.- Put %path%/%playback_time_remaining_seconds%/%ispaused%/ in Foobar pref. Display - Title Formating - Main windows title
; 3.- Install AMIP ( http://amip.tools-for.net/ds/dl.php?f=/fil...p_foobar_09.zip ), then restart Foobar.
; in Foobar Pref, Tools, Amip, Enable Amip, enable File C:\nextsong.txt and put $next(%fn) in "Play" Field
; 4.- Start Foobar, play a song, verify you have "Full path file name/Remaining sec./?/" in windows title, and C:\nextsong.txt is the next song. Stop Foobar
; 5.- Start this compiled script

; Seekbar move, repeat song, click on a playing song, more then one squeezebox not implemented

; Cli ref : file:///C:/Program%20Files/SqueezeCenter/server/HTML/EN/html/docs/cli-api.html

; Tested with Autoit v3.2.10.0 - Foobar 0.9.4.4 - AMIP 2.63

; - Freeware - ( Use / Modify at your own risk. No support: Sources provided )


; --------------------------------------- Code Start ---------------------------------------
; AMIP file
$m_amip = "C:\nextsong.txt"

;slimserver ip & port
$m_ip = "127.0.0.1"
$m_port = 9090

; Start The TCP Services
TCPStartUp()

;Attempt to connect to SC
$m_tcp = TCPConnect($m_ip,$m_port)

If @error Then
MsgBox(0, "FooSQ", "SqueezeCenter not responding")
Exit
EndIf

; Match windows title substring
Opt("WinTitleMatchMode", 2)

; Title somewhere in title bar
$m_foo = "foobar2000"

; length of title while foobar is stopped
$m_lts = 19

; Status variables:

;File name played
$m_f = ""
;Remaining time
$m_r = "0"
; Status: 0 -> stop; 1 -> playing; 2 -> paused
$m_s = "0"
; Is paused: ? -> playing; 1 -> paused
$m_p = "?"
; Transition: 0 -> normal (not skipped)
$m_t = ""
; Length of windows title
$m_l = "0"
; Next file name for gapless
$m_n = ""
; Next file name already enqueued -> 1
$m_ne = ""
; in foobar preference : 1 -> yes, put loop idle
$m_pref = ""

; New status variable after song transition
; new file name
$m_fn = ""
; windows title new lenght
$m_ln = "0"

; loop timer . reduce if shuffled songs start too early
$m_lt=229

; get foobar windows title
$m_title = WinGetTitle($m_foo, "")

If $m_title = "0" Then
MsgBox(0, "FooSQ", "Please start Foobar")
Exit
EndIf

; clear playing now
TCPSend($m_tcp,"playlist clear" & @CRLF)

While 1

$m_title = WinGetTitle($m_foo, "")
If StringRegExp ( $m_title, $m_foo ) <> 1 Then
; no foobar anymore ?
Exit
EndIf

If StringRegExp ( $m_title, "Preferences" ) Then
; we are in foobar pref, put the loop idle
if $m_pref = "" Then
MsgBox(0, "FooSQ", "Staying in Foobar Preferences a while may desynchronize FooSQ. Do a Foobar Stop/Play when finished")
Endif
$m_pref = "1"
Else
$m_pref = ""
EndIf

If $m_pref = "" Then

$m_ln = StringLen($m_title)

if $m_ln <> $m_lts Then
; find new infos after transition
$a_tn = StringSplit($m_title, "/")
$m_fn = $a_tn[1]
$m_r = $a_tn[2]
$m_p = $a_tn[3]
EndIf

Select
; go to stop and clear now playing
Case $m_ln = $m_lts AND $m_s <> "0"
$m_s = "0"
TCPSend($m_tcp,"stop" & @CRLF & "playlist clear" & @CRLF)

; from stop to start
Case $m_ln <> $m_lts AND $m_s = "0"
$m_s = "1"
$m_f = $m_fn
; SC needs / and %20 for space
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)

; song change / pause while playing
Case $m_ln <> $m_lts AND $m_s = "1"
; goto pause
if $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp,"pause 1" & @CRLF)
Else
;
if $m_f <> $m_fn Then
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
if $m_t = "0" Then
if $m_fn <> $m_n Then
; normal transition, not next song
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
Else
; next song after skip, random button or click on another song
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
$m_t = ""
$m_ne = ""
Else
if $m_r = "11" OR $m_r = "10" Then
; enqueue next song ( when remain 11 or 10 sec if title is late)
if $m_ne = "" Then
$m_amips = FileOpen($m_amip, 0)
If $m_amips = -1 Then
MsgBox(0, "FooSQ", "AMIP next song file not found")
Exit
EndIf
$m_n = FileReadLine($m_amip)
FileClose($m_amip)
$m_sq = StringReplace(StringReplace($m_n, "\", "/"), " ", "%20")
TCPSend($m_tcp,"playlist insert " & $m_sq & @CRLF)
$m_ne = "1"
Endif
Endif
if $m_r = "0" OR $m_r = "1" Then
;remaining time pass by 0 (or 1 if title is late)
$m_t = "0"
Endif
Endif
$m_f = $m_fn
EndIf
; continue after pause
Case $m_ln <> $m_lts AND $m_s = "2"
if $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp, "pause 0" & @CRLF)
EndIf

EndSelect
Endif
sleep($m_lt)
WEnd
Exit
; ============================================= End of script =====================================


This post has been edited by Yirkha: Jul 1 2010, 23:35
Reason for edit: Codeboxed.
Go to the top of the page
+Quote Post
Chipicui
post May 20 2008, 15:18
Post #2





Group: Members
Posts: 88
Joined: 3-September 07
Member No.: 46732



Thanks a lot!
But... excuse my complete ignorance... I already (sometimes) use foobar with squeezebox just connecting to http://192.168....:port , so... what's different with this script?
Is it faster?... what are it's benefits compared to a normal connection?

Thanks smile.gif

This post has been edited by Chipicui: May 20 2008, 15:21
Go to the top of the page
+Quote Post
marae
post May 20 2008, 17:33
Post #3





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



QUOTE (Chipicui @ May 20 2008, 06:18) *
Thanks a lot!
But... excuse my complete ignorance... I already (sometimes) use foobar with squeezebox just connecting to http://192.168....:port , so... what's different with this script?
Is it faster?... what are it's benefits compared to a normal connection?

Thanks smile.gif


You are talking about MP3 streaming. FooSQ is lossless with lossless files.
Flac are decoded to wav inside the SBox, APE, ALAC etc. in SCenter.
Go to the top of the page
+Quote Post
Chipicui
post May 20 2008, 17:49
Post #4





Group: Members
Posts: 88
Joined: 3-September 07
Member No.: 46732



Oh...thanks!
My bad...
... you were talking about squeezebox while I was thinking about squeezecenter
Now I understand it... Thanks
Go to the top of the page
+Quote Post
lex_nasa
post Mar 19 2010, 06:10
Post #5





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



This script is fantastic - thank you!

Getting the right match of versions of the different software was quite tricky.

I'm running:

Windows 7 Ultimate
SqueezeCenter 7.3
Foobar 0.9.6.9
AMIP 2.65

Script compiled with AutoIt v3.3.6.0.

Everything works well, so you can completely bypass the SQ music library, so no need for constant "Look for new and changed music" rescans.

The script was unstable before but seems rock solid now compiled with AutoIt v3.3.6.0.

This post has been edited by lex_nasa: Mar 19 2010, 06:44
Go to the top of the page
+Quote Post
lex_nasa
post May 7 2010, 10:05
Post #6





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



I have updated the script and it is now working successfully with Foobar2000 1.0.3 and AMIP 2.67.

CODE
;============================== Start of FooSQ AutoIt script ==================================

; Author Marae; May 2008 - FooSQ
; Revised by Alan Morse Davies - May 2010

; FooSQ grab infos from Foobar windows title with an AutoIT script, then send "cli" command to SqueezeCenter.
; It is not necessary to wait for any rescan inside SqueezeCenter.
; Just add a folder/playlist inside Foobar (no tags needed), then press play (gapless).

; The time needed with my settings for adding a song in Now Playing then bufferize it is 10 sec.
; If we guess the next song, and we enqueue it 10 sec. before the end of the current one, it's gapless.
; Then FooSQ determine normal transition (remaining time pass by 0) or skip.
; AMIP guess the next song

; This is a first release, so you may see some Autoit error messages or desynchro sometime.

; To install:
; 1.- Install autoit and compile this script( http://www.autoitscript.com/autoit3/downloads.shtml )
; 2.- Put %path%/%playback_time_remaining_seconds%/%ispaused%/ in Foobar pref. Display - Title Formating - Main windows title
; 3.- Install AMIP ( http://amip.tools-for.net/ds/dl.php?f=/fil...p_foobar_09.zip ), then restart Foobar.
; in Foobar Pref, Tools, Amip, Enable Amip, enable File C:\nextsong.txt and put $next(%fn) in "Play" Field
; 4.- Start Foobar, play a song, verify you have "Full path file name/Remaining sec./?/" in windows title, and C:\nextsong.txt is the next song. Stop Foobar
; 5.- Start this compiled script

; Seekbar move, repeat song, click on a playing song, more then one squeezebox not implemented

; Cli ref : file:///C:/Program%20Files/SqueezeCenter/server/HTML/EN/html/docs/cli-api.html

; Tested with Autoit v3.3.6.1 - Foobar 1.0.3 - AMIP 2.67

; - Freeware - ( Use / Modify at your own risk. No support: Sources provided )


; --------------------------------------- Code Start ---------------------------------------
; AMIP file
$m_amip = "C:\nextsong.txt"

;slimserver ip & port
$m_ip = "127.0.0.1"
$m_port = 9090

; Start The TCP Services
TCPStartUp()

;Attempt to connect to SC
$m_tcp = TCPConnect($m_ip,$m_port)

If @error Then
MsgBox(0, "FooSQ", "SqueezeCenter not responding")
Exit
EndIf

; Match windows title substring
Opt("WinTitleMatchMode", 2)

; Title somewhere in title bar
$m_foo = "foobar2000"

; length of title while foobar is stopped
$m_lts = 17

; Status variables:

;File name played
$m_f = ""
;Remaining time
$m_r = "0"
; Status: 0 -> stop; 1 -> playing; 2 -> paused
$m_s = "0"
; Is paused: ? -> playing; 1 -> paused
$m_p = "?"
; Transition: 0 -> normal (not skipped)
$m_t = ""
; Length of windows title
$m_l = "0"
; Next file name for gapless
$m_n = ""
; Next file name already enqueued -> 1
$m_ne = ""
; in foobar preference : 1 -> yes, put loop idle
$m_pref = ""

; New status variable after song transition
; new file name
$m_fn = ""
; windows title new length
$m_ln = "0"

; loop timer . reduce if shuffled songs start too early
$m_lt=229

; get foobar windows title
$m_title = WinGetTitle($m_foo, "")

If $m_title = "0" Then
MsgBox(0, "FooSQ", "Please start Foobar")
Exit
EndIf

; clear playing now
TCPSend($m_tcp,"playlist clear" & @CRLF)

While 1

$m_title = WinGetTitle($m_foo, "")
If NOT StringInStr( $m_title, $m_foo ) Then
Exit
EndIf

If Stringinstr ( $m_title, "Preferences" ) Then
; we are in foobar pref, put the loop idle
if $m_pref = "" Then
MsgBox(0, "FooSQ", "Staying in Foobar Preferences a while may desynchronize FooSQ. Do a Foobar Stop/Play when finished")
Endif
$m_pref = "1"
Else
$m_pref = ""
EndIf

If $m_pref = "" Then

$m_ln = StringLen($m_title)

if $m_ln <> $m_lts Then
; find new infos after transition
$m_title = WinGetTitle($m_foo, "")
$a_tn = StringSplit($m_title, "/")
$m_fn = $a_tn[1]
$m_r = $a_tn[2]
$m_p = $a_tn[3]
EndIf

Select
; go to stop and clear now playing
Case $m_ln = $m_lts AND $m_s <> "0"
$m_s = "0"
TCPSend($m_tcp,"stop" & @CRLF & "playlist clear" & @CRLF)

; from stop to start
Case $m_ln <> $m_lts AND $m_s = "0"
$m_s = "1"
$m_f = $m_fn
; SC needs / and %20 for space
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)

; song change / pause while playing
Case $m_ln <> $m_lts AND $m_s = "1"
; goto pause
if $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp,"pause 1" & @CRLF)
Else
;
if $m_f <> $m_fn Then
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
if $m_t = "0" Then
if $m_fn <> $m_n Then
; normal transition, not next song
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
Else
; next song after skip, random button or click on another song
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
$m_t = ""
$m_ne = ""
Else
if $m_r = "11" OR $m_r = "10" Then
; enqueue next song ( when remain 11 or 10 sec if title is late)
if $m_ne = "" Then
$m_amips = FileOpen($m_amip, 0)
If $m_amips = -1 Then
MsgBox(0, "FooSQ", "AMIP next song file not found")
Exit
EndIf
$m_n = FileReadLine($m_amip)
FileClose($m_amip)
$m_sq = StringReplace(StringReplace($m_n, "\", "/"), " ", "%20")
TCPSend($m_tcp,"playlist insert " & $m_sq & @CRLF)
$m_ne = "1"
Endif
Endif
if $m_r = "0" OR $m_r = "1" Then
;remaining time pass by 0 (or 1 if title is late)
$m_t = "0"
Endif
Endif
$m_f = $m_fn
EndIf
; continue after pause
Case $m_ln <> $m_lts AND $m_s = "2"
if $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp, "pause 0" & @CRLF)
EndIf

EndSelect
Endif
sleep($m_lt)
WEnd
Exit
; ============================================= End of script =====================================


This post has been edited by Yirkha: Jul 1 2010, 23:35
Reason for edit: Codeboxed.
Go to the top of the page
+Quote Post
lex_nasa
post May 7 2010, 11:27
Post #7





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



Here's a super-streamlined version which is a little more robust. You need to remember to start Foobar first, but this version doesn't have the limitation of going out of sync every time you go into Foobar preferences. I've removed most of the error messages with the exception of a failure to connect with SqueezeCenter.

For those that can't be bothered messing around with AutoIt, here's link to a compiled .exe file (it's been virus checked):

http://www.at-sea.com/work/FooSQ.exe

You still need to follow the set-up instructions in the first message of this post.

A quick reminder about what this does....

This allows you to use Foobar2000 to playback through your SqueezeBox or Transporter boxes. Volume control and seekbar do not work.

CODE
$m_amip = "C:\nextsong.txt"
$m_ip = "127.0.0.1"
$m_port = 9090
$m_class = "[CLASS:{97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]"
TCPStartUp()
$m_tcp = TCPConnect($m_ip,$m_port)
If @error Then
MsgBox(48, "FooSQ", "SqueezeCenter not responding.")
Exit
EndIf
$m_foo = "foobar2000"
$m_lts = 17
$m_f = ""
$m_r = "0"
$m_s = "0"
$m_p = "?"
$m_t = ""
$m_l = "0"
$m_n = ""
$m_ne = ""
$m_fn = ""
$m_ln = "0"
$m_lt=229
$m_title = WinGetTitle($m_class, "")
TCPSend($m_tcp,"playlist clear" & @CRLF)
While 1
$m_title = WinGetTitle($m_class, "")
If NOT StringInStr( $m_title, $m_foo ) Then
Exit
EndIf
$m_ln = StringLen($m_title)
if $m_ln <> $m_lts Then
$m_title = WinGetTitle($m_class, "")
$a_tn = StringSplit($m_title, "/")
$m_fn = $a_tn[1]
$m_r = $a_tn[2]
$m_p = $a_tn[3]
EndIf
Select
Case $m_ln = $m_lts AND $m_s <> "0"
$m_s = "0"
TCPSend($m_tcp,"stop" & @CRLF & "playlist clear" & @CRLF)
Case $m_ln <> $m_lts AND $m_s = "0"
$m_s = "1"
$m_f = $m_fn
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)
Case $m_ln <> $m_lts AND $m_s = "1"
if $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp,"pause 1" & @CRLF)
Else
if $m_f <> $m_fn Then
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
if $m_t = "0" Then
if $m_fn <> $m_n Then
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
Else
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
$m_t = ""
$m_ne = ""
Else
if $m_r = "11" OR $m_r = "10" 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,"playlist insert " & $m_sq & @CRLF)
$m_ne = "1"
Endif
Endif
if $m_r = "0" OR $m_r = "1" Then
$m_t = "0"
Endif
Endif
$m_f = $m_fn
EndIf
Case $m_ln <> $m_lts AND $m_s = "2"
if $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp, "pause 0" & @CRLF)
EndIf
EndSelect
sleep($m_lt)
WEnd
Exit


This post has been edited by Yirkha: Jul 1 2010, 23:36
Reason for edit: Codeboxed.
Go to the top of the page
+Quote Post
marae
post Jun 1 2010, 22:13
Post #8





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



greatz lex_nasa

happy that somebody have an interest about my dirty code

I have developped the code (still dirty) if you are interrested:

for any IR remote control:
toggle shuffle/normal
play next
next /previous album if big playlists are organized x:\album\artist
put foosq in windows startup, wait for browser, kill it , start foobar

add album art windows where I like, (based on folder.jpg, as I don't like the wasted space with the standard lay out

I am going to holidays, see you next month

Cheers
Marae
Go to the top of the page
+Quote Post
lex_nasa
post Jun 12 2010, 05:37
Post #9





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



Great, maybe we can share and merge code? I've added a function for a global volume control on the numeric keypad: + and - for higher/lower, * for mute.

CODE
$m_amip = "C:\nextsong.txt"
$m_ip = "127.0.0.1"
$m_port = 9090
$m_class = "[CLASS:{97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]"
TCPStartUp()
$m_tcp = TCPConnect($m_ip,$m_port)
If @error Then
MsgBox(48, "FooSQ", "SqueezeCenter not responding.")
Exit
EndIf
$m_foo = "foobar2000"
$m_lts = 17
$m_f = ""
$m_r = "0"
$m_s = "0"
$m_p = "?"
$m_t = ""
$m_l = "0"
$m_n = ""
$m_ne = ""
$m_fn = ""
$m_ln = "0"
$m_lt=229
$m_title = WinGetTitle($m_class, "")
HotKeySet("{NUMPADADD}" ,"Volume")
HotKeySet("{NUMPADSUB}" ,"Volume")
HotKeySet("{NUMPADMULT}" ,"Volume")
TCPSend($m_tcp,"playlist clear" & @CRLF)
While 1
$m_title = WinGetTitle($m_class, "")
If NOT StringInStr( $m_title, $m_foo ) Then
Exit
EndIf
$m_ln = StringLen($m_title)
if $m_ln <> $m_lts Then
$m_title = WinGetTitle($m_class, "")
$a_tn = StringSplit($m_title, "/")
$m_fn = $a_tn[1]
$m_r = $a_tn[2]
$m_p = $a_tn[3]
EndIf
Select
Case $m_ln = $m_lts AND $m_s <> "0"
$m_s = "0"
TCPSend($m_tcp,"stop" & @CRLF & "playlist clear" & @CRLF)
Case $m_ln <> $m_lts AND $m_s = "0"
$m_s = "1"
$m_f = $m_fn
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)
Case $m_ln <> $m_lts AND $m_s = "1"
if $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp,"pause 1" & @CRLF)
Else
if $m_f <> $m_fn Then
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
if $m_t = "0" Then
if $m_fn <> $m_n Then
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
Else
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
Endif
$m_t = ""
$m_ne = ""
Else
if $m_r = "11" OR $m_r = "10" 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,"playlist insert " & $m_sq & @CRLF)
$m_ne = "1"
Endif
Endif
if $m_r = "0" OR $m_r = "1" Then
$m_t = "0"
Endif
Endif
$m_f = $m_fn
EndIf
Case $m_ln <> $m_lts AND $m_s = "2"
if $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp, "pause 0" & @CRLF)
EndIf
EndSelect
sleep($m_lt)
WEnd
Func Volume()
If StringInStr(@HotKeyPressed,"{NUMPADADD}") Then
TCPSend($m_tcp,"mixer volume +5" & @CRLF)
ElseIf StringInStr(@HotKeyPressed,"{NUMPADSUB}") Then
TCPSend($m_tcp,"mixer volume -5" & @CRLF)
ElseIf StringInStr(@HotKeyPressed,"{NUMPADMULT}") Then
TCPSend($m_tcp,"mixer volume 0" & @CRLF)
EndIf
EndFunc
Exit


This post has been edited by Yirkha: Jul 1 2010, 23:36
Reason for edit: Codeboxed.
Go to the top of the page
+Quote Post
marae
post Jul 1 2010, 22:41
Post #10





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



Greetings lex_nasa

As there is at last ONE person interested by some code by itself, some updates after 2 years wink.gif

Improved:

will work with more version of foobar (including 1.0.3) without code mods, just need to setup the location if not default
we can stay in Preferences or other confusing windows without hassle

New:

foosq must be started before foobar to remove some dependency about version
IR remote control, you need to learn code if remote control <> mac-mini
there is a fadout with a nice curve while playing with remote control: next, random and next/previous albums functions, then, volume 100%
pop up window cd cover on top where we like if needed, if folder.jpg in dirs

your nice volume code is not implemented, TBD

cheers
Marae
CODE

;============================== Start FooSQ AutoIt script V 2010.1.8p ==================================

; Author Marae ; May 2008 - July 2010

; !!!!!!! CAUTION !!!!!! The Squeeze Center volume is reverted to 100% for every song

; - Freeware - / Sources provided / Use / Modify / Transmit / And the usual statements about responsabilities (no ones)

; IF YOU TRANSMIT this code, add in your script: "; Idea by Marae" , Thank you

; Tested with Transporter Firmware: 62, SC 7.2, Ethernet cable with WinXP SP2 on Mac-Mini, Autoit v3.3.6.1 - Foobar 1.03 - AMIP 2.67

; FooSQ grab infos from Foobar window title, then send "cli" command to SqueezeCenter (SC).

; The time needed with my settings for adding a new song/bufferize in SC is 10 sec.
; If we guess the next song, and we enqueue it 10 sec. before the end of the current one, it's gapless.
; Then FooSQ look for normal transition (remaining time pass by 0) or skip.
; AMIP guess the next song

; To install:
; 0.- Install autoit ( http://www.autoitscript.com/autoit3/downloads.shtml )
; 1.- Check "custom variables" below and modify those if needed, compile this script using "Compile Script to .exe" in Autoit start menu
; 2.- Put %path%/%playback_time_remaining_seconds%/%ispaused%/ in Foobar pref. Default User Interface - Window title
; 3.- Install AMIP, then restart Foobar.
; in Foobar Pref, Tools, Amip, Enable Amip, enable "Write song info to file" then File: C:\nextsong.txt and $next(%fn) in "Play:" Field
; 4.- Start Foobar, play a song, verify you have "Full path file name/Remaining sec./?/ [foobar2000 ...]" in window title, and C:\nextsong.txt is the next song. Quit Foobar
; 5.- SC must be running, start FooSQ, foobar will start ... Press play on your favorite song, Enjoy wink.gif


; Other Foobar settings:
; Enable "Playback follows cursor" on and also the opposite in Playback menu
; WARNING: "Resume playback after restarting ..." in Preference Playback is NOT possible without desynchro
; Seekbar move, Volume, and more then one squeezebox not implemented

;BUG:
; if you disable some IP connectivity (e.g wifi) and use for exemple "File open" in a previously remote enabled location,
; foobar will freeze, then foosq will stop

; with this code it's possible to use the mac-mini remote control = IR

; IR keys

; right -> next song
; left -> toggle default / shuffle tracks
; up -> skip up previous album in PL, play new album now
; down -> skip down next album in PL, play new album now
; Alt - up -> Same but wait for the end of the current song. All PL album up/down disabled before to play new song (difficult to guess cursor pos. , foobar cannot return cursor pos)
; Alt - down -> Same
; menu -> Alt code for 5 sec
; center -> random skip in PL

; to use another remote control, find the IR codes:
; Command Prompt: "telnet 127.0.0.1 9090" (default)
; "listen 1" + Return
; play with your remote control (do not use the slim device one !!), then replace in this script $m_ir_*

; for fade out on IR next etc, set SC options, Player, audio, Volume control adjust

; Cli ref : file:///C:/Program%20Files/SqueezeCenter/server/HTML/EN/html/docs/cli-api.html

; V 0.1 initial
; V 0.2 add IR
; V 2010.1.3 next / previous album skip with IR, fade out when some IR interruption
; V 2010.1.5 choice for next / previous album : play now or wait for the end of the current song
; V 2010.1.6 album cd cover art
; V 2010.1.8 remove dependency about foobar version:(works with foobar windows handle #), foobar is considered idle when foobar title begin with:
; "foobar2000", and end with a number. Now we can go to foobar preferences without hassle.
; WARNING: to be shure to get the correct handle #, foobar NEED be started with foosq (msgbox provided if foobar is running)

; In rare case, you may see some Autoit error messages or foosq stop, just restart foosq again, then press OK

; --------------------------------------- Code Start ---------------------------------------
#include
#include
#include
#include
#include
#include
#include
; ----------- MANDATORY custom variables to check -----------------

; foobar default command
$m_fooexe = "c:\program files\foobar2000\foobar2000.exe"

; AMIP file for gapless
$m_amip = "C:\nextsong.txt"

;SC ip & port, if you change the default setting
$m_ip = "127.0.0.1"
$m_port = 9090

; ----------- Optional custom variables -----------------

; IR codes for remote control
$m_ir_alt = "77e1c0ce"
$m_ir_next = "77e160ce"
$m_ir_random = "77e1a0ce"
$m_ir_toggle = "77e190ce"
$m_ir_pl_down = "77e130ce"
$m_ir_pl_up = "77e150ce"

; M3U playlist files for playing next/previous album in a PL with remote control; work only with mac mini remote control if you don't change IR code
; Works well if songs in PLs are sorted like x:\Artist\Album AND one song exists only in one PL
; dir where you export all your PLS in M3U format(right click on a tab, Save all playlists...)
$m_plsd = "C:\audio\pls.m3u"
; CLEAN sometime inside dir if some PLs not used anymore
; to disable $m_plsd = ""
; check are made if dir exists and some PLs in also

; ALWAYS ON TOP: cover cd album art popup window size
; to disable:
; $m_size = 0
$m_size = 300
; horizontal pos, ok for screen 1360x768
$m_aah = 1033
; vertical
$m_aav = 396
; name of file containing the cover cd image in each directory
$m_jpg = "folder.jpg"

; ----------- End of custom variables -----------------

; Somewhere always in foobar title bar
$m_foo = "foobar2000"

; Start The TCP Services
TCPStartUp()

; Match windows title substring
Opt("WinTitleMatchMode", 2)

;Attempt to connect to SC
$m_tcp = TCPConnect($m_ip,$m_port)
If @error Then
MsgBox(0, "FooSQ Warning", "SqueezeCenter not responding")
Exit
EndIf

; foobar running ?
$m_ok = WinActivate ($m_foo)
if $m_ok <> 0 Then
; quit it, so we are shure to get the correct handle #
$m_w = MsgBox(1,"FooSQ Warning","Not allowed, Start FooSQ first." & @CRLF & @CRLF & "Press OK and Foobar will restart after 5 sec." & @CRLF & @CRLF & "Press Cancel to quit FooSQ")
if $m_w = 2 Then
Exit
EndIf
Run($m_fooexe & " /quit")
sleep(5000)
TCPSend($m_tcp,"stop" & @CRLF & "playlist clear" & @CRLF)
Endif

; start it
Run($m_fooexe, "", @SW_MAXIMIZE)
WinActivate ($m_foo)
WinWaitActive ( $m_foo )
WinSetState ( $m_foo, "", @SW_MAXIMIZE )

; foobar handle #
$m_fooh = WinGetHandle( $m_foo )

;vol has been to 0 during fade out
$m_dec = 0
;File name played
$m_f = ""
;Remaining time
$m_r = "0"
; Status: 0 -> stop ; 1 -> playing; 2 -> paused
$m_s = "0"
; Is paused: ? -> playing; 1 -> paused
$m_p = "?"
; Transition: 0 -> normal (not skipped)
$m_t = ""
; Length of windows title
$m_l = "0"
; Next file name for gapless
$m_n = ""
; Next file name already enqueued -> 1
$m_ne = ""
; new file name
$m_fn = ""
;ir
$m_ir = ""
$m_irn = 0
;art
$m_ojpgf = ""
$m_handle = 0
$m_search = 0
; file to send to SB
$m_sq=""
; number of foobar cursor press for next/previous album
$m_out=1
; Alt key pressed on IR remote control
$m_alt=0
; time [ms] when timer start for Alt stuff
$m_stimer=0
; don't allow more then one Alt up/down in PL before play, as I don't know where is the cursor
$m_noal = 0
; TUNING
; loop timer in ms
$m_lt= 90

; fill an array with PLs file names
if $m_plsd <> "" Then
Dim $a_plf
$a_plf=_FileListToArray($m_plsd,"*.m3u", 1)
If @Error Then
; no PLs saved
$m_plsd = ""
Else
; size then fill an array which will contain the number of PL, then the full PL paths
Dim $a_pln[$a_plf[0]+1]
$a_pln[0]=$a_plf[0]
for $i = 1 to $a_plf[0]
$a_pln[$i] = $m_plsd & "\" & $a_plf[$i]
next
; read the content of the first PL file in array a_pl
Dim $a_pl
$m_pln=1
_FileReadToArray($a_pln[$m_pln],$a_pl)
Endif
Endif

; receive notification
TCPSend($m_tcp,"listen 1" & @CRLF)

; main loop
While 1

; get title
$m_title = WinGetTitle($m_fooh)
if $m_title = "0" Then
; no foobar anymore ?
Exit
EndIf

; check if foobar have stopped so there are $m_foo in the beginning of foobar title and a number to the end
If StringRegExp ( $m_title, "^" & $m_foo & ".*[0-9]$" ) Then
$m_idle = 1
Else
$m_idle = 0
Endif
If $m_idle = 0 Then
; find new infos after transition
$a_tn = StringSplit($m_title, "/")
$m_fn = $a_tn[1]
$m_r = $a_tn[2]
$m_p = $a_tn[3]
Endif

Select

Case $m_idle = 1 AND $m_s <> "0"
; go to stop and clear now playing
$m_s = "0"
TCPSend($m_tcp,"stop" & @CRLF & "playlist clear" & @CRLF)

Case $m_idle = 0 AND $m_s = "0"
; from stop to start
$m_s = "1"
$m_f = $m_fn
; SC needs / and %20 for space
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
if $m_dec = 1 Then
$m_dec = 0
TCPSend($m_tcp,"mixer volume " & "100" & @CRLF)
EndIf
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)
f_art()
$m_noal = 0

; song change or pause while playing
Case $m_idle = 0 AND $m_s = "1"
; goto pause
if $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp,"pause 1" & @CRLF)
Else
;
if $m_f <> $m_fn Then
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
if $m_t = "0" Then
if $m_fn <> $m_n Then
; normal transition, not next song
if $m_dec = 1 Then
$m_dec = 0
TCPSend($m_tcp,"mixer volume " & "100" & @CRLF)
EndIf
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
f_art()
$m_noal = 0
Else
f_art()
Endif
Else
; next song after skip, random button or click on another song
if $m_dec = 1 Then
$m_dec = 0
TCPSend($m_tcp,"mixer volume " & "100" & @CRLF)
EndIf
TCPSend($m_tcp,"playlist play " & $m_sq & @CRLF)
f_art()
$m_noal = 0
Endif
$m_t = ""
$m_ne = ""
Else
if $m_r = "11" OR $m_r = "10" Then
; enqueue next song ( when remain 11 or 10 sec if title is late)
if $m_ne = "" Then
$m_amips = FileOpen($m_amip, 0)
If $m_amips = -1 Then
MsgBox(0, "FooSQ Warning", "AMIP next song file not found, read intro")
Exit
EndIf
$m_n = FileReadLine($m_amip)
FileClose($m_amip)
$m_sq = StringReplace(StringReplace($m_n, "\", "/"), " ", "%20")
TCPSend($m_tcp,"playlist insert " & $m_sq & @CRLF)
$m_ne = "1"
Endif
Endif
if $m_r = "0" OR $m_r = "1" Then
;remaining time pass by 0 (or 1 if title is late)
$m_t = "0"
Endif
Endif
$m_f = $m_fn
EndIf
; continue after pause
Case $m_idle = 0 AND $m_s = "2"
if $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp, "pause 0" & @CRLF)
EndIf

EndSelect

; check if Alt IR timer play for more then 5 sec
if $m_alt = 1 Then
if TimerDiff($m_stimer) >= 5000 Then
$m_alt = 0
Endif
Endif

; receive IR code
$m_data = TCPRecv ( $m_tcp, 2048 )
$m_search= StringInStr ( $m_data, "unknownir",2)
Select
Case $m_search > 0 AND $m_irn = 0
; first IR code received, need to disable the next one.
$m_ir = StringMid($m_data, $m_search +10 , 8)
Select
Case $m_ir = $m_ir_alt
; Alt key pressed
$m_alt = 1
; start timer
$m_stimer = TimerInit()
$m_irn = 1

Case $m_ir = $m_ir_next
;next
f_vol_dec()
Run($m_fooexe & " /next")
$m_irn = 1

Case $m_ir = $m_ir_random
;random
f_vol_dec()
Run($m_fooexe & " /rand")
$m_irn = 1


Case $m_ir = $m_ir_toggle
;toggle shuffle - normal
$m_sh = ControlGetText($m_fooh, "", "ComboBox1")
if $m_sh = "Default" Then
Run($m_fooexe & ' /"command:Shuffle (tracks)"')
$m_irn = 1
Endif
if $m_sh = "Shuffle (tracks)" Then
Run($m_fooexe & " /command:Default")
$m_irn = 1
Endif

Case $m_ir = $m_ir_pl_down AND $m_noal = 0 AND $m_plsd <> ""
; next album down in pl
; search current pos
$m_pos = _ArraySearch($a_pl, $m_f, 0, 0, 1, 0)

If @error Then
$a_pl = 0
For $i = 1 to $a_pln[0]
_FileReadToArray($a_pln[$i],$a_pl)
$m_pos = _ArraySearch($a_pl, $m_f, 0, 0, 1, 0)
if @error = 0 Then
ExitLoop
Endif
Next
Endif

;find path
Dim $szDrive, $szDir, $szFName, $szExt
$a_path = _PathSplit($m_f, $szDrive, $szDir, $szFName, $szExt)
$m_path0 = $a_path[2]
For $i = $m_pos + 1 to $a_pl[0]
$a_path = _PathSplit($a_pl[$i], $szDrive, $szDir, $szFName, $szExt)
if $a_path[2] <> $m_path0 Then
$m_out = $i - $m_pos
ExitLoop
Endif
Next
WinActivate ( $m_fooh )
WinWaitActive ( $m_fooh )
For $i = 1 to $m_out
Send("{DOWN}")
Next
if $m_alt = 0 Then
f_vol_dec()
Send("{ENTER}")
Else
$m_alt = 0
$m_noal = 1
Endif
$m_irn = 1

Case $m_ir = $m_ir_pl_up AND $m_noal = 0 AND $m_plsd <> ""
;next album up in pl
; search current pos
$m_pos = _ArraySearch($a_pl, $m_f, 0, 0, 1, 0)

If @error Then
$a_pl = 0
For $i = 1 to $a_pln[0]
_FileReadToArray($a_pln[$i],$a_pl)
$m_pos = _ArraySearch($a_pl, $m_f, 0, 0, 1, 0)
if @error = 0 Then
ExitLoop
Endif
Next
Endif
;find path
Dim $szDrive, $szDir, $szFName, $szExt
$a_path = _PathSplit($m_f, $szDrive, $szDir, $szFName, $szExt)
$m_path0 = $a_path[2]
$m_reach = 0
For $i = $m_pos to 1 step -1
$a_path = _PathSplit($a_pl[$i], $szDrive, $szDir, $szFName, $szExt)
if $a_path[2] <> $m_path0 Then
if $m_reach = 0 Then
$m_reach = 1
$m_path0=$a_path[2]
Else
ExitLoop
Endif
Endif
Next
WinActivate ( $m_fooh )
WinWaitActive ( $m_fooh )
$m_out = $m_pos -$i -1
For $i = 1 to $m_out
Send("{UP}")
Next
if $m_alt = 0 Then
f_vol_dec()
Send("{ENTER}")
Else
$m_alt = 0
$m_noal = 1
Endif
$m_irn = 1

EndSelect

Case $m_search > 0 AND $m_irn = 1
$m_irn = 0

Case $m_search = 0 AND $m_irn = 1
$m_irn = 0

EndSelect
sleep($m_lt)
WEnd
Exit

Func f_vol_dec()
$a_fo = StringSplit("99.4,98.8,98.3,97.8,97.1,96,95,93.8,92,90,87,83,78,72,65,57,48,38,27,15,0", ",")
WinActivate ( $m_fooh )
WinWaitActive ( $m_fooh )

For $i = 1 to $a_fo[0]
TCPSend($m_tcp,"mixer volume " & $a_fo[$i] & @CRLF)
; fade out speed
sleep(170)
Next
$m_dec = 1
EndFunc

; Func create cd album cover art
Func f_art()
if $m_size <> 0 Then
; get path and find jpg
Dim $szDrive, $szDir, $szFName, $szExt
$a_path = _PathSplit($m_fn, $szDrive, $szDir, $szFName, $szExt)
$m_path = $a_path[2]
$m_drive = $a_path[1]
$m_jpgf = $m_drive & $m_path & $m_jpg
$m_search = FileFindFirstFile($m_jpgf)
FileClose($m_search)

If $m_search = -1 Then
; no art anymore
if $m_handle <> 0 Then
; previous art ?
GUIDelete($m_handle)
$m_handle = 0
EndIf
Else
; do it only for different art
if $m_ojpgf <> $m_jpgf Then
;get current active windows
$m_ahandle=_WinAPI_GetForegroundWindow()
if $m_handle <> 0 Then
; kill previous art
GUIDelete($m_handle)
EndIf
$m_handle=GUICreate("AA", $m_size, $m_size, $m_aah, $m_aav, BitOR($WS_POPUP, $WS_SIZEBOX),$WS_EX_TOOLWINDOW)
GUICtrlSetColor(-1,0xFFFFFD)
WinSetOnTop("AA", "", 1)
GUICtrlCreatePic($m_jpgf, 0, 0, $m_size, $m_size)
GUISetState ()
;restore previous active window
WinActivate ($m_ahandle)
WinWaitActive ($m_ahandle)
EndIf
EndIf
;remember the current art
$m_ojpgf = $m_jpgf
Endif
EndFunc

; ============================================= End of script =====================================
Go to the top of the page
+Quote Post
marae
post Jul 1 2010, 22:58
Post #11





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



oups cut and past problem ...

will see, sorry
Go to the top of the page
+Quote Post
Yirkha
post Jul 1 2010, 23:42
Post #12





Group: FB2K Moderator
Posts: 2359
Joined: 30-November 07
Member No.: 49158



Perhaps you could use some external storage for the scripts rather than pasting them here inside the posts? It would guarantee no characters (including even whitespace) are lost due to forum formatting, converted to emoticons or whatever. And for example pastebin.com allows you to show differences between subsequent revisions, which might be handy too.


--------------------
Full-quoting makes you scroll past the same junk over and over.
Go to the top of the page
+Quote Post
marae
post Jul 2 2010, 08:12
Post #13





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



Thanks for the guidance
I have posted the script in the squeezebox forum, because attachments are possible. Now indentation is preserved

http://forums.slimdevices.com/showthread.p...9193#post559193
Go to the top of the page
+Quote Post
lex_nasa
post Jul 5 2010, 16:34
Post #14





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



Mmmm... can't get this to compile properly or run in Win 7. You prefer to get the handle from the Windows API rather than using the Win CLASSID to identify the correct app? I'm guessing that my method doesn't work reliably if you're running FB2K on a Mac Mini? I admire all the work you've done on the IR stuff BTW.
Go to the top of the page
+Quote Post
marae
post Jul 6 2010, 07:50
Post #15





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



>can't get this to compile properly or run in Win 7
Unfortunately, I don't have windows 7

>You prefer to get the handle from the Windows API rather than using the Win CLASSID to identify the correct app? I'm guessing that my method doesn't work reliably if you're running FB2K on a Mac Mini
I have developed all the code with foobar 0.9.4 and the class id is different, so the idea was to find an universal solution for all F2k version (it's work on win xp)


All the code was really solid on foobar 0.9.4 , now I am facing bugs with 1.03 with IR codes (especially up/down in PLs) , I will try to solve it

About your volume code, I think that it is not a good idea to do digital volume on 16 bits sources (distortion) , but I will try to adapt my fade out lines

After, I think I will be finished from my side, all I need is there

I am just curious, do you have had feedback elsewhere then hydro/slim device forums about all the super documentation you have made on your site or successful use ?

Cheers
Go to the top of the page
+Quote Post
marae
post Jul 8 2010, 07:19
Post #16





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



I have posted a new version in slim device forum, see release notes
If you are still unable to compile/use with windows 7, try to comment _WinAPI_GetForegroundWindow() (and disable cover art: $m_size = 0 )
give me the error messages
cheers
Go to the top of the page
+Quote Post
lex_nasa
post Jul 10 2010, 05:05
Post #17





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



QUOTE (marae @ Jul 7 2010, 22:19) *
I have posted a new version in slim device forum, see release notes
If you are still unable to compile/use with windows 7, try to comment _WinAPI_GetForegroundWindow() (and disable cover art: $m_size = 0 )
give me the error messages
cheers

Hi! This works OK so far - nice job!
Go to the top of the page
+Quote Post
lex_nasa
post Jul 13 2010, 04:55
Post #18





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



QUOTE (lex_nasa @ Jul 9 2010, 20:05) *
QUOTE (marae @ Jul 7 2010, 22:19) *
I have posted a new version in slim device forum, see release notes
If you are still unable to compile/use with windows 7, try to comment _WinAPI_GetForegroundWindow() (and disable cover art: $m_size = 0 )
give me the error messages
cheers

Hi! This works OK so far - nice job!

I've revised the code without the IR and album art components, this also makes it more stable on Win 7 and doesn't try to start Foobar2000 from within the script so you still need to start Foobar2000 first.
CODE
$m_amip = "C:\nextsong.txt"
$m_ip = "127.0.0.1"
$m_port = 9090
$m_fooh = "[CLASS:{97E27FAA-C0B3-4b8e-A693-ED7881E99FC1}]"
$m_size = 0
$m_foo = "foobar2000"
$m_f = ""
$m_r = "0"
$m_s = "0"
$m_p = "?"
$m_t = ""
$m_l = "0"
$m_n = ""
$m_ne = ""
$m_fn = ""
$m_sq = ""
$m_lt = 50
$m_title = ""
$m_idle = 0
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")
TCPSend($m_tcp, "listen 1" & @CRLF)
While 1
$m_title = WinGetTitle($m_fooh)
If $m_title = "0" Then
Sleep($m_lt)
$m_title = WinGetTitle($m_fooh)
If $m_title = "0" Then
Sleep($m_lt)
$m_title = WinGetTitle($m_fooh)
If $m_title = "0" Then
TCPSend($m_tcp, "stop" & @CRLF & "playlist clear" & @CRLF)
Exit
EndIf
EndIf
EndIf
If StringRegExp($m_title, "^" & $m_foo & ".*[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]
EndIf
Select
Case $m_idle = 1 And $m_s <> "0"
$m_s = "0"
TCPSend($m_tcp, "stop" & @CRLF & "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, "playlist play " & $m_sq & @CRLF)
Case $m_idle = 0 And $m_s = "1"
If $m_p = "1" Then
$m_s = "2"
TCPSend($m_tcp, "pause 1" & @CRLF)
Else
If $m_f <> $m_fn Then
$m_sq = StringReplace(StringReplace($m_fn, "\", "/"), " ", "%20")
If $m_t = "0" Then
If $m_fn <> $m_n Then
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)
EndIf
Else
TCPSend($m_tcp, "playlist play " & $m_sq & @CRLF)
EndIf
$m_t = ""
$m_ne = ""
Else
If $m_r = "11" Or $m_r = "10" Then
If $m_ne = "" Then
$m_amips = FileOpen($m_amip, 0)
If $m_amips = -1 Then
MsgBox(0, "FooSQ Warning", "AMIP next song file not found, read intro")
Exit
EndIf
$m_n = FileReadLine($m_amip)
FileClose($m_amip)
$m_sq = StringReplace(StringReplace($m_n, "\", "/"), " ", "%20")
TCPSend($m_tcp, "playlist insert " & $m_sq & @CRLF)
$m_ne = "1"
EndIf
EndIf
If $m_r = "0" Or $m_r = "1" Then
$m_t = "0"
EndIf
EndIf
$m_f = $m_fn
EndIf
Case $m_idle = 0 And $m_s = "2"
If $m_p = "?" Then
$m_s = "1"
TCPSend($m_tcp, "pause 0" & @CRLF)
EndIf
EndSelect
Sleep($m_lt)
WEnd
Func f_vol()
Select
Case StringInStr(@HotKeyPressed, "{NUMPADADD}")
TCPSend($m_tcp, "mixer volume +5" & @CRLF)
Case StringInStr(@HotKeyPressed, "{NUMPADSUB}")
TCPSend($m_tcp, "mixer volume -5" & @CRLF)
Case StringInStr(@HotKeyPressed, "{NUMPADMULT}")
TCPSend($m_tcp, "mixer volume 0" & @CRLF)
EndSelect
EndFunc ;==>f_vol
Exit

Go to the top of the page
+Quote Post
marae
post Jul 14 2010, 08:41
Post #19





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



Many thanks to lex_nasa for the brilliant idea to use CLASS id for controlling the windows

Before to say bye bye for a while, I do a poll

- I am using only the lex_nasa version, don't need other function
- I am using IR
- I am using CD cover art pop up
- I like the fade out
- I am using skip album in playlists
- I am interested with seekbar move
- I don't use, I don't know how to do it
- I don't use, it's not working or too much bugged

Cheers

Go to the top of the page
+Quote Post
lex_nasa
post Jul 18 2010, 06:31
Post #20





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



I got no feedback atall from SlimDevices forum, even after setting up the web page and hosting the compiled binary - I guess not enough people are interested. Oh well... thanks Marae again for your effort.
Go to the top of the page
+Quote Post
marae
post Jul 19 2010, 08:38
Post #21





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



You too ! and, thanks a lot for your ideas
I will come back in October, I am just curious to see if more people have some interest and will answer to the poll.
Good bye
Go to the top of the page
+Quote Post
marae
post Jul 21 2010, 20:08
Post #22





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



last comments,

remove Send($m_tcp, "listen 1" & @CRLF)
it's only used when you retrieve info from SC

in your site "this should now work with ANY version of Foobar2000 " false : classid change with older version ...

new code: (not posted before some interrest)
random cd cover if not available, to show my other albums to my friends
seekbar move
as it was buggy resynch: after 30sec, look for remaining time in SC, if desynchro , adjust. also for very long foosq sessions

cheers
Go to the top of the page
+Quote Post
lex_nasa
post Jul 23 2010, 07:03
Post #23





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



QUOTE (marae @ Jul 21 2010, 11:08) *
new code: (not posted before some interrest)
random cd cover if not available, to show my other albums to my friends
seekbar move
as it was buggy resynch: after 30sec, look for remaining time in SC, if desynchro , adjust. also for very long foosq sessions

I'm interested, particularly in seekbar move... have amended my my version of the script, will do web site soon. Thanks!
Go to the top of the page
+Quote Post
marae
post Jul 23 2010, 12:59
Post #24





Group: Members
Posts: 45
Joined: 23-January 04
Member No.: 11460



About seekbar move the idea is simple, if the difference of time during one loop is greater then lets say 3 sec, you take this new time and send it to SC

BUT

the next song (queued) start in SC sometime 20 sec later then expected. This a random bug from SC (I have 7.2 and don't want to change) .
So the choice is to disable gapless (no next song enqueued) as soon as seekbar is moved. After of course you enable gapless again

I will publish the code lets say in one month, it's need to be tested a little more and I am busy.
Go to the top of the page
+Quote Post
lex_nasa
post Jul 25 2010, 09:07
Post #25





Group: Members
Posts: 64
Joined: 27-May 04
Member No.: 14361



Great, I look forward to it... thanks again for your effort!
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 16th April 2014 - 15:11