PDA

View Full Version : SlimServer iTunes plugin...



AndreasG
2006-08-06, 04:47
Hi everybody,

I am a Mac user, so I use iTunes as my music player (on the Mac there just is no decent alternative -- yet). I really like my Squeezebox but I also miss the ease of use of iTunes. The SlimServer web interface is clumsy, slow and a real pain to use when compared to iTunes -- sorry to say that. Frequently I use iTunes and my Apple Airport Express instead of SlimServer/Squeezebox because it is so much easier to find songs, make playlists etc...

If I had a "whish" for a new feature in SlimServer/Squeezebox, it would be being able to control my Squeezebox from iTunes. As far as I understand, iTunes is capable of using plugins, so the question really is: Would it theoretically be possible to write an iTunes plugin that sends the currently played song to the Squeezebox (via SlimServer or not)? Am I the only one interested in such a thing?

Thanks for any replies.

Andreas

erland
2006-08-06, 12:20
Would it theoretically be possible to write an iTunes plugin that sends the currently played song to the Squeezebox (via SlimServer or not)?
I'm pretty sure it shall be possible. I know its possible to give slimserver a command to play a specific song, so if there are any problems they are on the iTunes side. But since there seems to be iTunes plugins which is able to to show information about currently played song I suspect there shouldn't be any problem on the iTunes side either.


Am I the only one interested in such a thing?
There are probably more people interested in this since you are not the only one that has complained on the slimserver web interface. Personally I think I would prefer integration with a simplier musicplayer instead of iTunes, or even better to improve the current slimserver web interface.

James
2006-08-06, 13:13
once upon a time...

http://forums.slimdevices.com/showthread.php?t=8967&highlight=itunes+control
James

alexfw
2006-08-07, 18:57
I messed around with the Applescript below (found via James's link above) and could not get it to work. My incompetence is the likely culprit, but it could also be that SlimServer and/or iTunes have changed enough since late '04 that it just don't work.

Should the below script still work as originally designed? Spousal ambivalence has turned into downright hostility, and being able to use iTunes as the interface is the key to bringing her 'round.

TIA,

Alex

Old 2004-10-02, 11:12
Anton F. van der Kraaij

Posts: n/a
Default Control SlimServer _from_ iTunes
Hi Everyone,

Well I think I have a solution for my problem. This applescript will
check if a song is playing in iTunes. If that is the case, it will play
it in the SlimServer. There is a check made for special symbols in
filenames. My guess is that some symbols are not fully supported yet
(it works for my library so far). Save it as an application and don't
forget to tick the 'stay open' checkbox. Probably still bugs or
features missing, but it is a start :-)

Hope this helps. Oscar, thanks for your help and the link to the old
post.

Greetings,

Anton.

-- Begin of Script
-- iSlimServer: Control SlimServer from iTunes
-- Plays whatever song is currently playing in iTunes on the SlimServer
-- Copyright Anton F. van der Kraaij 2004
-- Thanks to a script by Barry Brown for inspiration and help from
Oscar Marsch
--
-- This program is free software; you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation; either version 2 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- INSTRUCTIONS:
-- Set your variables server_address and server_port to your situation
-- Save this script as an application, making sure to click 'stay open'

global server_address, server_port, current_file_track

set server_address to "127.0.0.1" -- This is the slimserver's address
set server_port to "9000" -- This is the slimserver's port

set current_file_track to ""

on idle
try
tell application "Finder"
if (get name of every process) contains "iTunes" then set okflag to
true
end tell
if okflag then
-- iTunes is running. Check if it is playing a song.
tell application "iTunes"
if player state is paused or player state is stopped then
-- iTunes is not playing. Stop slimserver.
do shell script ("curl \"http://" & server_address & ":" &
server_port & "/status.html?p0=stop\"")
set okflag to false
return 10
end if
end tell
end if
if okflag then
tell application "iTunes"
if class of current track is file track then
try
copy current track's location to file_path_of_track
on error errText
display dialog errText buttons {"Cancel"} with icon 0
end try
end if -- not a file track
-- return file_path_of_track
if (current_file_track is not file_path_of_track) then
-- File in iTunes is different than file on SlimServer.
-- Thus update variable
set current_file_track to file_path_of_track

-- convert mac path to unix path for use in URL with curl (be
careful with special characters here)
set mac_path to (file_path_of_track as text)
set root to (offset of ":" in mac_path)
set rootdisk to (characters 1 thru (root - 1) of mac_path)
tell application "Finder"
if (disk (rootdisk as string) is the startup disk) then
set unixpath to "%2f" & (characters (root + 1) thru end of
mac_path)
else
set unixpath to "%2fVolumes:" & mac_path
end if
end tell
set chars to every character of unixpath
repeat with i from 2 to length of chars
if item i of chars as text is equal to "/" then
set item i of chars to ":"
else if item i of chars as text is equal to ":" then
set item i of chars to "%2f"
else if item i of chars as text is equal to "\"" then
set item i of chars to "\\" & "\""
else if item i of chars as text is equal to "*" then
set item i of chars to "\\*"
else if item i of chars as text is equal to "?" then
set item i of chars to "\\?"
else if item i of chars as text is equal to " " then
set item i of chars to "%20"
else if item i of chars as text is equal to "+" then
set item i of chars to "%2b"
else if item i of chars as text is equal to "&" then
set item i of chars to "%26"
else if item i of chars as text is equal to "\\" then
set item i of chars to "\\\\"
end if
end repeat
set filetoplay to every item of chars as string
-- end conversion
-- Tell slimserver to stop current song and play the song
currently playing in iTunes
do shell script ("curl \"http://" & server_address & ":" &
server_port & "/status.html?p0=stop\"")
do shell script ("curl \"http://" & server_address & ":" &
server_port & "/status.html?p0=playlist&p1=play&p2=" & filetoplay &
"\"")
end if
end tell
end if
end try
return 10
end idle
-- end of script

evergreen25
2006-08-08, 09:10
I agree the iTunes interface is superior to the current slimserver. My main complaint with iTunes is that it doesn't support FLAC, but I guess we can't have everything in life.

I am using a Windows-only plugin that updates the slimserver playlist from the iTunes Party Shuffle playlist. More info here:
http://www.jamescraig.co.uk/SlimServer

and here
http://forums.slimdevices.com/showthread.php?t=25997

If I want to listen at the same time on my computer I use the latest version of Softsqueeze for Slimserver 6.3 and sync softsqueeze with my Squeezebox v2. It is working surprisingly well for such a kludgy solution.

Sorry I can't be of more help with a Mac solution, but maybe you can glean something from Mr. Craig's good work.

Craig, James (IT)
2006-08-08, 11:00
Alex,
What happened when you tried it? Anything at all?

Do you have more than 1 squeezebox - The script below assumes only one
player.

James
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

lagosirio
2008-01-23, 03:45
Hi Together!
I just found this interesting thread and think about buying a SB.
I would like very much to go even a step further end use FrontRow instead of iTunes. (With its extremely simple and comfortable user interface).
Will that work?

peter
2008-01-23, 04:06
lagosirio wrote:
> Hi Together!
> I just found this interesting thread and think about buying a SB.
> I would like very much to go even a step further end use FrontRow
> instead of iTunes. (With its extremely simple and comfortable user
> interface).
> Will that work?
>

In a word: No

Regards,
Peter

lagosirio
2008-01-25, 06:29
As recommended I now installed SoftSqueeze and SqueezeServer to see how that works.
A really cool thing this software!
( Additionally I use Safari and ScirptDebugger 4.0)

However with the script I have now one problem which I don't unterstand:
Executing the "do shell script" lines in the end I get the Error Message below.

What is this about?



<HTML><HEAD><TITLE>403 Forbidden</TITLE></HEAD>
<BODY>403 Forbidden: status.html
<!--.................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. .................................................. ..................................................-->
<p>In order to request this URL from a Bookmark/Favorite, or some means other than following a link from the SqueezeCenter web interface, you will need to use a URL with a \"cauth\" security parameter. If you received this error when following a link from the SqueezeCenter web interface, you will want to make sure your web browser software (including proxy servers and spyware/privacy software) is allowing \"Referer\" headers to be sent. Below is the appropriate URL for the URL you attempted.<br>
<br>
<A HREF="/status.html?p0=stop&;cauth=a30a2b67010c9827e402922d42a8f519">http://127.0.0.1:9000/status.html?p0=stop&;cauth=a30a2b67010c9827e402922d42a8f519</A></p><p>Because your CSRF protection level is set at 'MEDIUM', you can use the same &quot;;cauth=&quot; value for any URL; this means you should be more careful who you share your URLs with.</p>
</BODY></HTML>

James
2008-01-25, 15:40
Try changing the CSRF protection level setting in Settings->Advanced->Security to none.

James

lagosirio
2008-01-27, 09:04
Found a much better solution:
Convert the iTunes output to a radio-stream!
A great tool for this is "NiceCast"
For Apple Apple Leopard download V1.9 or later.

@peter: Regarding your "in a word": This works even with FrontRow !



See even: http://forums.slimdevices.com/archive/index.php/t-30222.html

Scallywagfr78
2008-01-27, 10:47
Hello,
Two small points while I "have the floor":

1. I read somewhere on the slimdevices site about SS that there was no need under version 6.5.4 to rescan a musicbase managed through iTunes presumably after changes and/or additions. I am using 6.5.5 five SB2+3s and I never came across this possibility?

2. Concerning the new Duet hand-held controller: Am I to understand the I would be able to run my whole installation with this Controller, collectively and individually (each SB separately)? My present setup consists of Winxp SS 6.5.5 SB2s and SB3s using both ethernet and wifi and a (iTunes managed) musicbase of some size.

Any clarification and help would be appreciated.
Regards and thanks

Craig, James \(IT\)
2008-01-28, 11:08
> 1. I read somewhere on the slimdevices site about SS that there was no
need under version 6.5.4 to rescan a musicbase managed through iTunes
presumably after changes and/or additions. I am using 6.5.5 five SB2+3s
and I never came across this possibility?

This is not true. Any changes in music library always require a
SlimServer rescan, regardless of the source.

James
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

Scallywagfr78
2008-01-29, 09:24
> 1. I read somewhere on the slimdevices site about SS that there was no
need under version 6.5.4 to rescan a musicbase managed through iTunes
presumably after changes and/or additions. I am using 6.5.5 five SB2+3s
and I never came across this possibility?

This is not true. Any changes in music library always require a
SlimServer rescan, regardless of the source.

James
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

Hello,
I sense from your reply that we seem to "play on similar wavelengths". That is also my understanding.
I suggest you have a look at (under "Tips and Tricks: iTunes (Mac or Windows)":
http://www.slimdevices.com/pi_features.html
Maybe some Logitech "wishfull thinking" ....
Thanks for your answer.
More generally: this leaves item 2 of my original message unanswered.
Anyone motivated?
Regards

nacmacfeegle
2008-01-29, 09:28
"Any changes in music library always require a
SlimServer rescan, regardless of the source."

I'm pretty sure that if you 'browse music folder' via the SB to your changed music directories, eg a new album etc, then you don't need a rescan.

moley6knipe
2008-01-29, 10:59
...but if you use iTunes integration, Browse Music Folder doesn't appear. At least for me, anyway.

Nice username by the way! Bigjobs!

Scallywagfr78
2008-01-30, 07:07
"Any changes in music library always require a
SlimServer rescan, regardless of the source."

I'm pretty sure that if you 'browse music folder' via the SB to your changed music directories, eg a new album etc, then you don't need a rescan.

Maybe, but the album cover does not show up under Album Diaporama, although the album name is given. This way you can listen to new albums but albums with changed names show up truncated (the first song is cut off and only minimal info is given) quite rightly as SS does not seem to find them at least on my PC with 6.5.5..
Doesn't all this confirm the adage: if changed or new rescan! (in my case a rescan takes "some time"!)
Regards

nacmacfeegle
2008-01-30, 07:13
Aye, sorry guys my bad, I use Itunes but I don't have it integrated with the slimserver....Now I know why!

lagosirio
2008-02-08, 11:03
Try changing the CSRF protection level setting in Settings->Advanced->Security to none.

James

Dear James,
I have no idea where to do that. (I use OS X and Safari)
Do you mean the web browser? I can't find anything regarding "CSRF" configuration at all.

radish
2008-02-08, 11:37
Dear James,
I have no idea where to do that. (I use OS X and Safari)
Do you mean the web browser? I can't find anything regarding "CSRF" configuration at all.

It's a slimserver setting.

lagosirio
2008-02-08, 14:00
Wow , cool, thank you. The error is gone :-)
I found so many setting-options I did not know about.

Now I still have a little problem: The script runs once only. I have to start it again and again.
Has this something to do with the "on idle" loop or with the way I compile it?
(I don't know anything about script programming)

Craig, James \(IT\)
2008-02-11, 03:47
Is this with the perl script? In it's original form it should loop
forever.

James
--------------------------------------------------------

NOTICE: If received in error, please destroy and notify sender. Sender does not intend to waive confidentiality or privilege. Use of this email is prohibited when received in error.

lagosirio
2008-02-11, 14:24
I found the problem: It did not work continuously because I had saved it without "Stay Open" option. :-) (I am script beginner)