boardom Forum Index boardom
b2 message board
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Windows Media Player 9 + Whats Playing Now

 
Post new topic   Reply to topic    boardom Forum Index -> Hacks
View previous topic :: View next topic  
Author Message
KJ



Joined: 15 Jun 2003
Posts: 5

PostPosted: Sat Jul 19, 2003 10:41 pm    Post subject: Windows Media Player 9 + Whats Playing Now Reply with quote

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
View user's profile Send private message
KJ



Joined: 15 Jun 2003
Posts: 5

PostPosted: Sun Jul 20, 2003 4:46 pm    Post subject: Edit... Reply with quote

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
View user's profile Send private message
afterefx



Joined: 13 Jun 2003
Posts: 25
Location: Texas

PostPosted: Fri Jul 25, 2003 3:18 am    Post subject: Reply with quote

i found a plug-in for winamp3 so that you can use it instead of wmp9
here

thnx for the script. it works great! Very Happy
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address
Viper007Bond



Joined: 15 Aug 2003
Posts: 266
Location: Portland, Oregon, USA

PostPosted: Fri Aug 15, 2003 4:04 pm    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
GooGirl



Joined: 15 Jul 2003
Posts: 19

PostPosted: Sat Aug 16, 2003 5:57 pm    Post subject: Reply with quote

Would this work with Kazaa? If not, is there a way to do that?

Thanks Smile
_________________
"That which you do not risk leaves you risking so much more."
Always,
~GooGirl
Back to top
View user's profile Send private message Send e-mail
KJ



Joined: 15 Jun 2003
Posts: 5

PostPosted: Sat Aug 16, 2003 6:38 pm    Post subject: Kazaa? Probly not.. Reply with quote

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
View user's profile Send private message
Viper007Bond



Joined: 15 Aug 2003
Posts: 266
Location: Portland, Oregon, USA

PostPosted: Sun Aug 17, 2003 5:05 am    Post subject: Reply with quote

I can sorta see using WMP, but why use KaZaA? Question
_________________
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
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
ludvig87



Joined: 08 Aug 2003
Posts: 54
Location: Denmark

PostPosted: Tue Oct 14, 2003 2:39 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website MSN Messenger
Candle



Joined: 23 Dec 2002
Posts: 547

PostPosted: Tue Oct 14, 2003 4:03 pm    Post subject: Reply with quote

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
View user's profile Send private message
Joey



Joined: 06 Jun 2003
Posts: 5

PostPosted: Thu Nov 27, 2003 5:06 am    Post subject: Reply with quote

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
View user's profile Send private message
jackiefg



Joined: 15 Oct 2003
Posts: 29
Location: Toronto, Ontario, Canada

PostPosted: Tue Jan 06, 2004 12:52 am    Post subject: Change your stylesheet Reply with quote

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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    boardom Forum Index -> Hacks All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB 2 © 2001, 2002 phpBB Group