Getting XLobby to control an inserted CD

Help each other out

Getting XLobby to control an inserted CD

Postby Roscoe62 on Mon Apr 05, 2004 8:35 am

I'm currently using alpha 40.1 and am loving it! However I'm now at the point where I'm figuring out how to get X to control some of the "what if" scenarios.

The first of these is gaining control of a CD that's been put into the CD-ROM drive. When X is running Winamp is already active, and I've got Windows currently set up to play any inserted CD with Winamp so the CD just starts playing. OK so far, so good, but then if I want to skip to the next track or pause.....none of the controls within X work on the CD.

What I'm looking for is some way to navigate/control an inserted CD - preferably from the PPC client. I'm thinking about setting up a page specifically for this situation, and adding a button on XLobby's main menu to access that page, but it's handling the messaging to Winamp that I'm not sure how to do. Does anyone have any ideas? How is everyone else handling this situation?

Cheers
Ross
Roscoe62
 
Posts: 215
Joined: Fri Jun 27, 2003 9:49 am
Location: New Zealand

Postby stevenhanna6 on Mon Apr 05, 2004 11:54 pm

i think your the second person to ask about this....the solution will probably be this....

if the playlist is empty...then xlobby will use winamps playlist...thereby accessing the playlist for the cd you've just inserted. I think this should do? I'll write it down so I dont forget to add it.
stevenhanna6
 
Posts: 904
Joined: Tue Feb 18, 2003 10:39 am
Location: Ontario, Canada

Postby wmandra on Tue Apr 06, 2004 12:53 am

The Windows autoplay feature functions differently depending on which version of Windows you are using. They are very similar between 2k and XP, and for this discussion I will assume most people are using XP. When a disc is inserted Windows fist tries to determine what kind of media it contains (CD Audio, DVD, Blank), it then checks the registry to determine how to handle the event (HKLM\Software\Microsoft\Windows\CurrentVersion\Explorer\AutoplayHandlers\EventHandlers)
, if a default application is specified it is launched otherwise a window will appear giving the user a list of options. Now in order for a program to act as an autoplay handler must implement the IHWEventHandler interface in a registered COM server.
I have started some work on creating a program to do this, but my progress has slowed due to other commitments. But here is what I came up with so far:

1. You would need to create a COM dll that was registered as an autoplay handler for the "PlayCDAudioOnArrival", "PlayDVDMovieOnArrival", and possibly "HandleCDBurningOnArrival" events.

2. Make this the default handler for all these events so no "What would you like to do window?" appears.

3. Then depending on which event was triggered send a sendmessage event to Xlobby

4. When the event is triggered in Xlobby an overlay screen could appear giving the user a choice either play or rip. The overlay screens could look identical, but you must have seperate screens so that the play / rip buttons can launch the appropriate external applications.

5. When the user makes their selection an external program is launched in the background to handle the request.

Currently I have overlay screens created on my system that work perfectly using EAC and Smartripper via the command line for ripping CDs and DVDs. The only thing I haven't got around to writing is the autoplay handler dll. Unfortunately I just don't have the time right now, but if anyone else is interested I would suggest looking at how some other programs like winamp and WMP9 look in the autoplay section of the registry (mentioned above), also here is a link to the MS article discussing how everything works:
http://msdn.microsoft.com/library/en-us ... _using.asp

As always if anyone has any other questions just ask :)

Bill
wmandra
 
Posts: 43
Joined: Sun Jan 18, 2004 5:59 pm
Location: Bloomfield, NJ

Postby Roscoe62 on Tue Apr 06, 2004 12:56 am

Thanks Steven! :D

The only other thing I could think of is to create a set of commands within Girder to use Winamp's hotkeys, and then creating a set of buttons on a page somewhere to access them directly.

Your way will do this much more cleanly and eliminate the dependency on Girder which is good for new people.

There are a couple of test conditions, however, that might require some additional thought...

For example, what if someone inserted a CD while an online playlist was already underway? What would happen? What if the CD wasn't ejected and the user wanted to create a playlist from their online files, and then later wanted to play the CD again?

....and just to really throw the spanner in the works, a similar set of conditions exist for those people wanting to play a DVD...perhaps a hired DVD that doesn't exist in their database. I imagine the TT/Zoom controls would work OK but I haven't tested that yet. That may need to be looked at also.

Just as an example, what if the user is watching an online movie and inserts a DVD into the drive. What would happen? Would that interrupt the currently playing movie? Would a similar set of controls need to be used? Perhaps getting Windows to take no action on any inserted CDs or DVDs until directed to by XLobby is a partial answer?

Sorry if this adds complexity, but if it serves to make XLobby more robust (or idiot-proof) then it's got to be a good thing right?

FWIW I do a lot of testing in my work, so I often have to think about things that people might do beyond the normal mode of operation. To that end I might be of some use in identifying some of these conditions.

Anyway, I'm happy to help in testing these scenarios out if you need someone.

Cheers
Ross
Roscoe62
 
Posts: 215
Joined: Fri Jun 27, 2003 9:49 am
Location: New Zealand

Postby chadwolcott on Tue Apr 06, 2004 2:37 am

sounds like you are getting there Bill, any chance you could make windows stop autorunning that stupid PC-Friendly etc software when a video DVD is "incorrectly" seen as a data DVD by windows?
chadwolcott
 
Posts: 107
Joined: Fri Sep 05, 2003 2:34 pm
Location: Boston, MA

Postby wmandra on Tue Apr 06, 2004 2:53 am

Chad,
It can definately be done, it's all in how an autoplay handler deals with autoplay events. Another less elegant option would be to disable the data DVD handler all togeather (if you know you will never use data DVDs on your HTPC). Like I said in my earlier post though, I just don't have the time to do the actual coding on the autoplay handler dll, I am actually hoping someone else out there will help me out and hack out that portion.

Bill
wmandra
 
Posts: 43
Joined: Sun Jan 18, 2004 5:59 pm
Location: Bloomfield, NJ

Postby Roscoe62 on Tue Apr 06, 2004 2:59 am

Hi Bill,

You've obviously put a lot of thought into this process and your way of handling these situations sounds nice and clean. However, I think the few examples I outlined in my earlier post still warrant looking at. Unfortunately I don't have any expertise in programming or the Windows OS. I only know how to create problems :wink:

I love the idea of having an overlay come up asking you whether you'd like to play or rip but, for me, I'd use that on my study PC, not the HTPC. Would it be possible to get a copy of your skin so I can see how you did that? I've often wondered whether I could automate those functions....and it sounds like you already have!

It would be great if you could find the time to put your head together with Steven on these issues, because it would be great forXLobby to have a bulletproof way of handling these kinds of events.
Roscoe62
 
Posts: 215
Joined: Fri Jun 27, 2003 9:49 am
Location: New Zealand

Postby stevenhanna6 on Tue Apr 06, 2004 7:38 am

I looked into that autoplay handler stuff....doesnt look to easy. But since autoplay is basicly for applications that aren't running....I think I will have xlobby just monitor the compact disc drives...and if someone puts a new disc in...xlobby will notice then trigger a custom overlay. I've already done some testing...and it does work quite well. All I have to do is add some text boxes for "audio cd inserted overlay" ...etc...in setup.
stevenhanna6
 
Posts: 904
Joined: Tue Feb 18, 2003 10:39 am
Location: Ontario, Canada

Postby wmandra on Tue Apr 06, 2004 3:16 pm

steven,
Thats an even better idea! One question though, do the autoplay handlers still want to work? How about disabaling autoplay while Xlobby is running...... Take a look at HKLM/Software/Microsoft/Windows/CurrentVersion/Explorer/AutoplayHandlers/CancelAutoPlay/CLSID

Just store the value in the key in a variable and then change the registry to a CLSID of 00000000-0000-0000-0000-000000000000 then when Xlobby exits it can just change it back.


Bill
wmandra
 
Posts: 43
Joined: Sun Jan 18, 2004 5:59 pm
Location: Bloomfield, NJ

Postby Roscoe62 on Tue Apr 06, 2004 8:09 pm

Gentlemen, this conversation is officially way over my head. :)

Whatever solution you decide to go with Steven, please also allow the solution to work on the PPC screens. My aim is to control the whole system with it.

Thanks
Roscoe62
 
Posts: 215
Joined: Fri Jun 27, 2003 9:49 am
Location: New Zealand

Postby stevenhanna6 on Tue Apr 06, 2004 10:09 pm

bill, there is actually another way to stop autoplay if your application is running...so I dont have to mess with the registry...and it works all the way back to windows95.

roscoe, I'll make sure it works with the ppc...well I'll try to :)

So far I have xlobby monitoring the drives...and showing an overlay that has a button "play cd" once you click it....it starts playing the cd like a regular album...so can mix in other mp3 albums from your collection if you want and shuffle...or edit the playlist as usual.
stevenhanna6
 
Posts: 904
Joined: Tue Feb 18, 2003 10:39 am
Location: Ontario, Canada

Postby Roscoe62 on Wed Apr 07, 2004 3:16 am

Superb! Far more than I expected! :D
Roscoe62
 
Posts: 215
Joined: Fri Jun 27, 2003 9:49 am
Location: New Zealand

Postby noviceboy on Wed Apr 07, 2004 9:00 am

Thinking out aloud...

but what if Xlobby is in server mode and someone using a client is listening,watching something . What would happen if someone at the server put in an Audio CD?

Would the client user "get distrurbed"?
noviceboy
 
Posts: 137
Joined: Fri Dec 19, 2003 1:26 pm
Location: Munich, Germany