View previous topic :: View next topic |
Author |
Message |
KJ
Joined: 15 Jun 2003 Posts: 5
|
Posted: Sat Jul 19, 2003 10:41 pm Post subject: Windows Media Player 9 + Whats Playing Now |
|
|
With WMP9 and w.bloggar, you can insert the current playing song into your blog entry. I've coded it down to basic Javascript, but this only works with Internet Explorer entry. Make the following modifications:
Save the following code in the b2-include folder as music.php:
Code: | <script language="JavaScript">
function displaySong() {
var Sh = new ActiveXObject("WScript.Shell");
var key = "HKCU\\Software\\Microsoft\\MediaPlayer\\CurrentMetadata"
var strDisplayString = "<div class=\"music\">" + "Currently Playing :: ";
var strTrackInfo;
var strDisplayString;
var fHaveMetadata = false;
try
{
strTrackInfo = Sh.RegRead( key + "\\Title" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += strTrackInfo;
}
}
catch( ex )
{
try
{
strTrackInfo = Sh.RegRead( key + "\\Name" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " :: " + strTrackInfo;
}
}
catch( ex )
{
}
}
try
{
strTrackInfo = Sh.RegRead( key + "\\DurationString" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " :: " + strTrackInfo;
}
}
catch( ex )
{
}
try
{
strTrackInfo = Sh.RegRead( key + "\\Author" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " :: " + strTrackInfo;
}
}
catch( ex )
{
}
try
{ strTrackInfo = Sh.RegRead( key + "\\Album" );
if( 0 != strTrackInfo.length )
{
fHaveMetadata = true;
strDisplayString += " on the album " + strTrackInfo;
}
}
catch( ex )
{}
strDisplayString += "</div>";
if( !fHaveMetadata )
{ strDisplayString = "No media playing currently.";}
document.forms[0].content.value = document.forms[0].content.value + strDisplayString;
}
</script>
<input type="button" value="Insert Current Song" onclick="displaySong()" class="search" />
|
Then, in b2edit.form.php add the following line whereever you want to see the button appear:
Code: | <?php include('music.php'); ?> |
I currently add it between the spellcheck button code and the upload a file/image code, so that section will look like this:
Code: | ton" value="Spellcheck" onclick="DoSpell
('post','content','');" class="search" tabindex="9"/>
< ?php } ?>
< ?php include('music.php'); ?>
< ?php if ( ($use_fileupload) && ($user_level >upload_minlevel) && ((ereg(" ".$user_login." ", $fileupload_allowedusers)) || (trim($fileupload_allowedusers)=="")) ) { ?> |
One final note: This loads an unsigned ActiveX control. So you'll need to do the following to your security settings. In Tools/Internet Options/Security/Trusted Sites/Sites, add your website that you edit the blog on. You will still get a security warning but you can get past that by clicking Custom Level and changing Initialize and Script ActiveX controls not marked as Safe from Prompt to Enable.
Finally, you'll need the plugin from Microsoft: http://www.microsoft.com/windowsxp/expertzone/columns/robinson/03april17.asp
Anyone wanting the full page of code can just download it at http://www.pirate-king.com/episode/77 |
|
Back to top |
|
 |
KJ
Joined: 15 Jun 2003 Posts: 5
|
Posted: Sun Jul 20, 2003 4:46 pm Post subject: Edit... |
|
|
I've edited the main topic above so that it now follows the hack submission guidelines. It should be much easier to work with now. |
|
Back to top |
|
 |
afterefx
Joined: 13 Jun 2003 Posts: 25 Location: Texas
|
Posted: Fri Jul 25, 2003 3:18 am Post subject: |
|
|
i found a plug-in for winamp3 so that you can use it instead of wmp9
here
thnx for the script. it works great!  |
|
Back to top |
|
 |
Viper007Bond
Joined: 15 Aug 2003 Posts: 266 Location: Portland, Oregon, USA
|
Posted: Fri Aug 15, 2003 4:04 pm Post subject: |
|
|
You can also use Audio-Tracker (no WMP support though - but then again, why are you using WMP?). _________________ http://www.viper007bond.com
If you haven't already installed b2, I advise you look into WordPress or b2evo instead as b2 is dead. |
|
Back to top |
|
 |
GooGirl
Joined: 15 Jul 2003 Posts: 19
|
Posted: Sat Aug 16, 2003 5:57 pm Post subject: |
|
|
Would this work with Kazaa? If not, is there a way to do that?
Thanks  _________________ "That which you do not risk leaves you risking so much more."
Always,
~GooGirl |
|
Back to top |
|
 |
KJ
Joined: 15 Jun 2003 Posts: 5
|
Posted: Sat Aug 16, 2003 6:38 pm Post subject: Kazaa? Probly not.. |
|
|
What this code does is read the following registry key:
HKCU\Software\Microsoft\MediaPlayer\CurrentMetadata
for songs that are playing. Since Kazaa doesn't save what is currently playing to the registry, it won't work. Now, if a patch comes out for Kazaa that will, then this code can be modified to do that.... |
|
Back to top |
|
 |
Viper007Bond
Joined: 15 Aug 2003 Posts: 266 Location: Portland, Oregon, USA
|
Posted: Sun Aug 17, 2003 5:05 am Post subject: |
|
|
I can sorta see using WMP, but why use KaZaA? _________________ http://www.viper007bond.com
If you haven't already installed b2, I advise you look into WordPress or b2evo instead as b2 is dead. |
|
Back to top |
|
 |
ludvig87
Joined: 08 Aug 2003 Posts: 54 Location: Denmark
|
Posted: Tue Oct 14, 2003 2:39 pm Post subject: |
|
|
bah!
The plug in is only avaible for people with Windows XP and I dont have that...
We run on a domain here at home, and XP cant do that (we cant set it up and a computer company cant either - grr)) |
|
Back to top |
|
 |
Candle
Joined: 23 Dec 2002 Posts: 547
|
Posted: Tue Oct 14, 2003 4:03 pm Post subject: |
|
|
ludvig87 wrote: | bah!
The plug in is only avaible for people with Windows XP and I dont have that...
We run on a domain here at home, and XP cant do that (we cant set it up and a computer company cant either - grr)) |
Talk about dumb!! _________________ My Game Forum
 |
|
Back to top |
|
 |
Joey
Joined: 06 Jun 2003 Posts: 5
|
Posted: Thu Nov 27, 2003 5:06 am Post subject: |
|
|
Ngahhh...I dunno how to change the colour of the text and include borders for the currently listening song although I have included #music on layout2b.css...help |
|
Back to top |
|
 |
jackiefg
Joined: 15 Oct 2003 Posts: 29 Location: Toronto, Ontario, Canada
|
Posted: Tue Jan 06, 2004 12:52 am Post subject: Change your stylesheet |
|
|
Change your stylesheet to add borders or change the colours of your text.
It puts in a class called "media" so add that class to your stylesheet and change it to whatever colours you like. Mine, for example, are as follows:
.media {
background: #ccc;
color: #000;
font-family: Verdana, sans-serif;
font-size: 8pt;
font-weight: normal;
border: 1px dotted #000;
padding: 3px;
}
I wanted the code to validate properly in XHTML, so I adjusted the default html settings in the player to say [span class="media - instead of [div class="media. _________________ jackiefg |
|
Back to top |
|
 |
|