What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » how to filter the music?

how to filter the music?
Author: Message:
Matti
Elite Member
*****

Avatar
Script Developer and Helper

Posts: 1646
Reputation: 39
32 / Male / Flag
Joined: Apr 2004
RE: how to filter the music?
You should use a regular expression for that.

Here's a small function which will return an array containing the information out of a media string.
code:
function parseMedia(Media) {
   var mediaExp = /^\\0([a-z]+)\\0([0-1])\\0(.*)\\0(.*)\\0(.*)\\0(.*)\\0(.*)\\0$/i;
   if(typeof(Media) == "string" && mediaExp.test(Media)) {
      var arr = new Array();
      arr['type'] = RegExp.$1;
      arr['enabled'] = RegExp.$2;
      arr['format'] = RegExp.$3;
      arr['title'] = RegExp.$4;
      arr['artist'] = RegExp.$5;
      arr['album'] = RegExp.$6;
      arr['contentId'] = RegExp.$7;
      return arr;
   } else {
      return false;
   }
}
An example to use this:
code:
var arrMedia = parseMedia(Messenger.MyCurrentMedia);
if(!arrMedia) {
   //Here you can work with the arrMedia array
   Debug.Trace("Now Playing: " + arrMedia['artist'] + " - " + arrMedia['title'];
} else {
   //The media string was invalid
}
;)
Plus! Script Developer | Plus! Beta Tester | Creator of Countdown Live | Co-developer of Screenshot Sender 5

Found my post useful? Rate me!
11-21-2006 05:27 PM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
how to filter the music? - by roflmao456 on 11-21-2006 at 03:13 AM
RE: how to filter the music? - by Matti on 11-21-2006 at 05:27 PM
RE: RE: how to filter the music? - by roflmao456 on 11-21-2006 at 09:15 PM
RE: how to filter the music? - by Spunky on 11-21-2006 at 09:39 PM
RE: RE: how to filter the music? - by roflmao456 on 11-21-2006 at 09:46 PM
RE: how to filter the music? - by Spunky on 11-22-2006 at 12:00 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On