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:
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
29 / Male / Flag
Joined: Nov 2006
Status: Away
O.P. RE: RE: how to filter the music?
quote:
Originally posted by Mattike
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
}
;)


when i use it in the OnEvent_MyMediaChange function it ends up as undefined... i just copied and pasted the code
[quote]
Ultimatess6
: What a noob mod
11-21-2006 09:15 PM
Profile 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