Currently played info to file

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

Posts: 1
Joined: Sun Feb 14, 2021 6:10 pm

Currently played info to file

Post by PhanZero »

I have written myself a little script for MM4 to output some information from the currently played track to files - artist, title and cover art. I converted that script with that VBS2JS tool, but have no idea how to add it to MM5. I created a info.json file and made a zip file with these, renamed it to .mmip and imported it. You might have already guessed it: It installed, but it's not working. Probably it's the file name or the conversion, I really don't know. See, I'm not a programmer, I did this script with a lot of trial & error and it's not perfect, but it worked. Now what do I do to get it to run in MM5?

It's really a deal breaker with MM5...
Posts: 354
Joined: Tue May 12, 2020 10:06 am

Re: Currently played info to file

Post by drakinite »

I admittedly haven't used the VBS2JS tool myself, so I'm not sure how well the converted code will work. But try this:

Create a file "init.js", and in it put:

Code: Select all

localRequirejs('<NAME OF YOUR OTHER JS FILE>');
So if your other js file is called "myScript.js", it'll be:

Code: Select all

MM automatically searches for init.js in your addon, so init.js will automatically run. The "localRequirejs" command will invoke your other script; and the "requirejs('actions')" is standard as actions.js initializes the majority of MM5 code.
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
Posts: 121
Joined: Sat Nov 12, 2011 1:31 pm

Re: Currently played info to file

Post by TIV73 »

I actually needed something vaguely similar for debugging reasons a while ago and still had it lying around, so I figured I could just freshen it up a little, add some of the requested features, and publish it.

The addon hooks into the event that fires whenever a track is changed, gets the details of that track and exports the track title, artist, and cover to their respective files in the specified export directory.

A word of warning - this is intended as starting point, not as end-user ready addon. I tested it locally and it worked as advertised, but there's only the bare minimum of polish and error handling, so you might need to further customize and/or troubleshoot it if it doesn't work for you. With that out of the way, you can get the addon here.
Post Reply