Shoutbox

PSM changing when a media stops - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: PSM changing when a media stops (/showthread.php?tid=92691)

PSM changing when a media stops by Bhaclash on 10-26-2009 at 07:53 PM

Hello!

I'm tweaking mPSM to write the media info to PSM not to 'what I'm listening to'. It works fine now, but there's a small problem: when I stop the music, onEvent_MyMediaChange isn't called (at least it isn't shown in the debug tool), so I can't remove the last music info from my PSM...

eg.
Music info: artist1 - title1
My PSM looks like: personalmessage || artist1 - title1
If I skip to music : artist2 - title2, the PSM will be: personalmessage || artist2 - title2
So it's fine. But if I stop the music, my PSM remains this: personalmessage || artist2 - title2
instead of : personalmessage

Is there any way to solve this problem?

Thanks in advance,
Bhaclash


EDIT: ohh, I've found a code here, but it doesn't work.


RE: PSM changing when a media stops by Spunky on 10-27-2009 at 02:46 AM

I think the script works that way because, once the music stopped playing, WLM  would revert back to displaying the personal message. In WLM 14, both can be shown at the same time meaning it would never be removed.

If I remember rightly I wrote the mPSM script based on somebody else's code for setting the media message.


I'll take a look in the morning, it's 2:45am and I've not long got back from taking my son to the hospital and I should have work tomorrow


RE: PSM changing when a media stops by Bhaclash on 10-27-2009 at 07:45 PM

Oh, I forgot to mention I'm using WLM 8.5, not the latest one (and I'm not planning to change yet). And about the code, yes, mPSM uses function setNowPlaying, which is written by -dt- if I'm not mistaken.
All I need is to recognize somehow when the media stops if it can be done... I can't figure out how to do it by myself.


RE: PSM changing when a media stops by Schnappi on 10-28-2009 at 07:39 AM

can you write something similar for wlm 14?


RE: PSM changing when a media stops by Spunky on 10-28-2009 at 02:43 PM

I'll take a look at this when I finish work (2pm GMT)



I've had a look, and I can't reproduce it.  What I have done, however, is to add an extra line of code that should disable the media PSM when it thinks it's stopped. Try it out and let me know if it works :p

http://spunkylm.co.uk/files/mPSM.plsc

It may download as a zip file... Just rename it to a plsc
RE: PSM changing when a media stops by Bhaclash on 10-31-2009 at 12:53 AM

Okay, I managed to solve the problem with the help of your script :)
My onEvent_MyMediaChange function looks like this:

code:
function OnEvent_MyMediaChange(NewMedia){
    var tmp = NewMedia;
    try{
        tmp=tmp.split("\\0");
        tmp[3]=tmp[3].replace(prefix,"");
        tmp[3]=tmp[3].replace(suffix,"");
        tmp[3]=prefix+" "+tmp[3]+" "+suffix;
        tmp[3]=tmp[3].replace(/\s\s/g," ");
        Messenger.MyPersonalMessage=prefix+" || "+tmp[4]+" - "+tmp[5]+ " || "+suffix;
        setNowPlaying(false,icon,tmp[3],tmp[4],tmp[5],tmp[6],tmp[7]);
    }catch(e){
        if(e.number!="-2146823281"){
            Debug.Trace("HANDLED: error "+e.number);
            Debug.Trace("Please report any bugs to the Author at:");
            Debug.Trace("http://shoutbox.menthix.net/forumdisplay.php?fid=39");
        }else{
            Debug.Trace("HANDLED: Array element tmp[3] does not exist. This is most likely the way the file information has been completed");
            Messenger.MyPersonalMessage=prefix+" "+suffix;
        }
    }
}


I've only changed the underlined parts.
Thank you, Spunky, for your help and the whole mPSM script ;)

-------------------------------------------------------------------------------

I was a bit quick to say it's working...:/ Now at first it displays the PSM correctly, then it removes the song's title from the PSM...
Somehow the else branch is always triggered... Why could it be?