Start playing at boot on Windows

Need help? Post your questions here.

Moderator: moderators

Start playing at boot on Windows

Postby todbr » Thu Jul 01, 2010 3:37 pm

I have a Windows Server 2008 machine where I'd like Subsonic to automatically start playing a default playlist at boot time. I plan to use this so I can hook the speaker output of the PC to the phone central in my company and have a waiting music playing over the phone - that's what I've been asked...

I decided to use Subsonic because, since it runs as a service, it can still play when no user is logged in or when the machine is locked (Win+L). I've already set up the player as "Jukebox" and the music's playing fine, but I haven't managed to start playing automatically.

I've seen topics on this for Linux and Mac OS, but nothing for Windows. Any help appreciated. Thanks.
todbr
 
Posts: 2
Joined: Thu Jul 01, 2010 3:27 pm

Postby delcypher » Sat Jul 03, 2010 11:56 pm

I don't have subsonic installed on my windows VM but if memory services correctly you can do the following to control services in windows

1. Bring up the services control panel by running 'services.msc'. Just hold [WINDOW_KEY] + r and a run window will appear. Type the command in there and press enter.

2. Find the subsonic service in the list and right click it and click properties.

3. Set the start up type to automatic or maybe automatic (delayed). I'm not really sure which is best.

As for getting a playlist to play automatically. I think I know a way but I haven't tested it.

Subsonic has the rest API which allows you to send commands to the server ( see http://www.subsonic.org/pages/api.jsp )

You tell the server to start playing the jukebox (user must be authorized to do this). By visiting the site (look at the page's source code to see what is happening) (or using a tool like wget)


Code: Select all
http://localhost:4040/rest/jukeBoxControl.view?u=username&p=password&v=1.2.0&c=dummy&action=start


where username is the username, password is the password for the user that's authorized to use the jukebox player, localhost is the address of the subsonic server and 4040 is the port the server is running on.

adding tracks to the jukebox playlist isn't made very easy though. You seem to need to add the id of every single track rather than using the id of a playlist

You find the track ids of a playlist by doing

Code: Select all
http://localhost:4040/rest/getPlaylists.view?u=username&p=password&v=1.2.0&c=dummy
.

which will give you a list of playlists.
Find the id of the playlist you want then you can get the track ids by doing.

Code: Select all
http://localhost:4040/rest/getPlaylist.view? u=username&p=password&v=1.2.0&c=dummy&id=playlist_id


You can then add tracks to the jukebox playlist by doing


Code: Select all
http://localhost:4040/rest/jukeBoxControl.view? u=username&p=password&v=1.2.0&c=dummy&action=add&id=track_id


If you want to automate this wget for windows is a much better bet.

I think I may look into this more because I've had a few problems using the rest API.

I hope this helps.
delcypher
 
Posts: 109
Joined: Tue Jun 01, 2010 10:39 am

Postby delcypher » Sun Jul 04, 2010 1:28 am

Hopefully this will help someone. I've been trying to figure out how to use wget to do REST API commands and not use the u & p keys as they are depricated. Here's how.

Ask for password
Code: Select all
wget -O - --post-data='v=1.2.0&c=dummy' --auth-no-challenge --user=username --ask-password 'http://localhost:4040/rest/ping.view'


or enterting the password as a command line argument


Code: Select all
wget -O - --post-data='v=1.2.0&c=dummy' --auth-no-challenge --user=username --password='password' 'http://localhost:4040/rest/ping.view'


The important parameter is the --auth-no-challenge option will send authentication details even if the server doesn't ask for them.
delcypher
 
Posts: 109
Joined: Tue Jun 01, 2010 10:39 am

Postby todbr » Mon Jul 05, 2010 1:52 pm

Great, I had taken a look a that also and figured out that could be a way to do it, but if I want to get the music playing even before any user does a login in Windows, I'm gonna have to write a small service (with delayed startup) just to call wget and make Subsonic start playing.

I can do that (in VB.Net), and I can post back when if there's interest in this, but it really should be something easier to do. And from what I've read, its difficult also in Linux and Mac.

So, feature request: any chance to have a "start playing current playlist on startup", or a more generic "start action X on startup"? Or maybe, in the future, some sort of scripting? (if we already have the API, that shouldn't be too hard).

Thanks!
todbr
 
Posts: 2
Joined: Thu Jul 01, 2010 3:27 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 22 guests