 |
|
 |
Standalone CD player widget, A widget that could play CDs w/o iTunes |
|
|
| SpaceCat85 |
Apr 20 2007, 05:22 PM
|
Posts: 2
Joined: 20-April 07
Member No.: 21,392

|
I'd like to see a simple, easy-to-use widget that could play CDs without requiring iTunes (or, on Windows, WMP). While both the Mac OS and Windows used to have simple apps for playing audio CDs, these days they make you launch the default Swiss Army Knife media player. I don't store many/any of my MP3s on my MacBook's hard drive for space reasons, and it seems like overkill to have something like iTunes open just to play a standard audio CD. The widget would include: -a simple, clean controller interface that isn't microscopic; possibly displayed as white text/icons on a black OS X-style bezel akin to the one used by Sizzling Keys and a few Dashboard widgets -basic CD-playing controls, including a disc repeat button -a collapsible playlist that lets you rearrange and/or disable tracks and possibly-the ability to query an online music database for track names -album art retrieving and displaying like Sputnik.
Mac OS 10.3.9 PPC and 10.4.9 Intel
|
|
|
|
|
| lilgshock |
May 24 2007, 04:10 PM
|
Posts: 1
Joined: 24-May 07
Member No.: 22,072

|
Wouthout some external OCX or COM control this isn't really possible, is it???
|
|
|
|
|
| g6auc |
May 24 2007, 05:33 PM
|

Posts: 4,265
Joined: 1-March 04
From: West Yorkshire, UK
Member No.: 2,322

|
QUOTE(Michael's Programming @ Apr 20 2007, 07:33 PM)  If it could read CDs, this widget would be quite easy, as I would think. I've just run this command in Widget Tester: CODE play("/Volumes/Dolly Parton/1 Baby I'm Burning - Live.aiff"); The play command played the track. The track is 22 Mbyte in size. I don't know how big a file you can play. However, once you've started to play the track, there's no control over it, other than to stop it. You could use my cross-platform Media Player classes to play the track in QuickTime Player or Windows Media Player. On the Macintosh, you would see the application window (but you can hide it). On Windows, you don't need to see it at all, You also have control over the stream, if your Widget wants that. Media Player Classes. CODE var wmpPlayer = new WMP("file:///Volumes/Dolly Parton/1 Baby I'm Burning - Live.aiff"); wmpPlayer.play(); That's all you need to play a CD track using the class. On the Macintosh, you get the QuickTime Player window:  PLUG: The classes can also be used to play audio and video streams - I have several originally Windows only radio station players running on my iMac. Harry. This post has been edited by g6auc: May 24 2007, 06:04 PM
|
|
|
|
|
| BOINCer |
May 24 2007, 08:15 PM
|
Posts: 1,288
Joined: 28-September 05
From: Buenos Aires, Argentina
Member No.: 10,111

|
Mac OS X shows the CD as containing .aiff files with the audio. Windows shows the CD as containing .cda files, which are all 44 bytes, and contain the serial number of the CD, track number, etc. If you copy the .cda to your hard disk, it will ask for that specific CD (if it's not in the drive already) when you open it. At least that's how it worked on Windows 98 with the CD player  All these are really abstractions the OS does. A music CD doesn't even have files at all. It has "Audio tracks" which contain uncompressed 44,100Hz 16-bit stereo audio (and some little extra data like track count and length), instead of "Data tracks" which contain a filesystem.
|
|
|
|
|
| g6auc |
May 24 2007, 08:42 PM
|

Posts: 4,265
Joined: 1-March 04
From: West Yorkshire, UK
Member No.: 2,322

|
QUOTE(Michael's Programming @ May 24 2007, 09:01 PM)  ...why is the file you played in AIFF? ... or was that a custom CD you made? Or something else entirely? The CD was a giveaway CD from a national newspaper. I've also loaded a commercial music CD (Verdi's Requiem on the Philips lable). Both appear in the Finder showing AIFF files. What is actually on the CD is not really my concern. The "AIFF" files can be played with the Konfabulator play() command, but QuickTime Player does a better job and is (apple)scriptable. It is, of course, also possible to use iTunes. I would assume that you would also be able to play the CD using the WMP OCX - that is what my Media Player class would try to do on Windows. Harry.
|
|
|
|
|
| Michael's Programming |
May 24 2007, 08:42 PM
|

Posts: 761
Joined: 30-March 07
From: Ottawa, Canada
Member No.: 20,895

|
Ah. That makes sense. So what we could do is just get the CD, and use filesystem.getDirectoryContents to get the names of all the files, then play them in order, or maybe a shuffle function built in. Follow?
EDIT: Sorry. My post was in response to BOINCer's post. SpaceCat85, the original requester, said he would like a widget that could do this without iTunes however, so that's out of the question.
EDIT 2: g6auc, your classes look quite promising. That would remove most of the harder code on my part. I'm guessing that it's all right if I redistribute it under one of my widgets, as long as I leave the copyright notice in the files. (I've never bothered to read the GPL, even though I use lots of open-source software: Fedora, GIMP, Firefox...)
|
|
|
|
|
| g6auc |
May 24 2007, 09:01 PM
|

Posts: 4,265
Joined: 1-March 04
From: West Yorkshire, UK
Member No.: 2,322

|
QUOTE(Michael's Programming @ May 24 2007, 09:42 PM)  So what we could do is just get the CD, and use filesystem.getDirectoryContents to get the names of all the files, then play them in order, or maybe a shuffle function built in. That's correct. You could try the play() function, but I suspect that it might break with big files - but try it. If you want a player UI that has the usual play/pause and volume controls, etc., you would be better off using the WMP OCX (on Windows) and QuickTime Player (on Macintosh). You can do that in a cross-platform way using my Media Player class, or you could repeat the work that I have done and make your own class. Harry.
|
|
|
|
|
| g6auc |
May 24 2007, 09:08 PM
|

Posts: 4,265
Joined: 1-March 04
From: West Yorkshire, UK
Member No.: 2,322

|
QUOTE(Michael's Programming @ May 24 2007, 09:42 PM)  g6auc, your classes look quite promising. That would remove most of the harder code on my part. I'm guessing that it's all right if I redistribute it under one of my widgets, as long as I leave the copyright notice in the files That's correct.That's essentially what the license says. If you make modifications you should mark them as such. However, if you had problems with the classes, I'd be happy to try to help. Harry.
|
|
|
|
|
| g6auc |
May 24 2007, 09:19 PM
|

Posts: 4,265
Joined: 1-March 04
From: West Yorkshire, UK
Member No.: 2,322

|
QUOTE(Michael's Programming @ May 24 2007, 10:06 PM)  I thinking now to select a CD, I should just use a chooseFolder call. That'll allow it to play anything on the local system. You could, but that's rather ugly. You could construct a pull-down menu with the mounted volumes, and maybe try to eliminate those that can't be CDs. Have a look at Eject Volumes. It has code to create a menu of mounted volumes. It's a Macintosh Widget, but should be easy to modify. You are welocome to lift code from it.
|
|
|
|
|
| BOINCer |
May 24 2007, 09:29 PM
|
Posts: 1,288
Joined: 28-September 05
From: Buenos Aires, Argentina
Member No.: 10,111

|
If you use a GPL library, basically your code has to be GPL as well. That means the source code has to be available and free to modify and redistribute. Source availability is a moot point for widgets, since all widgets so far have code available (I don't know of any widget using JS obfuscation yet). And then the copyright notices of course; I know of very few licenses where you aren't required to keep original author copyright (example: the WTFPL). There is DVD-Audio, but they haven't been used much (ie. there aren't many in the market). That's what the AUDIO_TS folder on DVDs is for; it's usually empty for movie DVDs.
|
|
|
|
|
| Michael's Programming |
May 24 2007, 09:56 PM
|

Posts: 761
Joined: 30-March 07
From: Ottawa, Canada
Member No.: 20,895

|
Can anyone try the following .kon file on their computer with a CD in. It should list the CD and no other drives. Basically, it just checks if the total size is less than 700MB and is not 0. Printing copied from the docs. CODE <?xml version="1.1"?> <widget debug="on"> <action trigger="onLoad"> <![CDATA[ var vols = filesystem.volumes; for(var a = 0; a < vols.length; a++) if(vols[a].totalBytes < 734003200 && vols[a].totalBytes != 0) print( "Volume " + filesystem.getDisplayName( vols[a].path ) + " (path " + vols[a].path + ") has a capacity of " + bytesToUIString( vols[a].totalBytes ) + " and " + bytesToUIString( vols[a].freeBytes ) + " free." ); ]]> </action> </widget>
|
|
|
|
|
| g6auc |
May 24 2007, 10:10 PM
|

Posts: 4,265
Joined: 1-March 04
From: West Yorkshire, UK
Member No.: 2,322

|
QUOTE(Michael's Programming @ May 24 2007, 10:56 PM)  Can anyone try the following .kon file on their computer with a CD in. It should list the CD and no other drives. Basically, it just checks if the total size is less than 700MB and is not 0. Printing copied from the docs. CODE Yahoo! Widget Engine 4.0.3x177 on 2007-05-24 23:06:10 +0100 Loaded Widget 'test' from /Users/nhw/Desktop/test.kon Volume Dolly Parton (path /Volumes/Dolly Parton) has a capacity of 415.4 MB and 0 bytes free. As expected. However, your limit of 700MB is a bit low. I've seen CDs in 750MB range. Why not use 800MB or 1GB?
|
|
|
|
|
| Michael's Programming |
May 24 2007, 10:12 PM
|

Posts: 761
Joined: 30-March 07
From: Ottawa, Canada
Member No.: 20,895

|
I might try 800MB. Here's the update code. CODE <?xml version="1.1"?> <widget debug="on"> <action trigger="onLoad"> <![CDATA[ var vols = filesystem.volumes; for(var a = 0; a < vols.length; a++) if(vols[a].totalBytes < 838860800 && vols[a].totalBytes != 0) print( "Volume " + filesystem.getDisplayName( vols[a].path ) + " (path " + vols[a].path + ") has a capacity of " + bytesToUIString( vols[a].totalBytes ) + " and " + bytesToUIString( vols[a].freeBytes ) + " free." ); ]]> </action> </widget>
|
|
|
|
|
| g6auc |
May 24 2007, 10:56 PM
|

Posts: 4,265
Joined: 1-March 04
From: West Yorkshire, UK
Member No.: 2,322

|
QUOTE(Michael's Programming @ May 24 2007, 11:36 PM)  g6auc, there may be a problem with your code for this widget. If the CD has extras on it, I can't check what tracks are available. I can still play them by manually defining the .cda file, but using filesystem.itemExists on the file return false. It return true if there are no extras though. If I define a file that I know is not there, I get an alert saying that WMP cannot play the item. No exception is thrown. Don't know if this is something you can intercept.
As I don't have a Windows computer that will run K, it's not possible for me to do any tests on Windows. The cross-platform code uses the WMP OCX on Windows. The code was written based on the Microsoft documentation and tested by volunteers here on the Forum. If you have a Windows computer, you are in a better position than I am to play with the code.
|
|
|
|
|
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:
|
 |