Currently played info to file

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

Moderators: jiri, drakinite, Addon Administrators

PhanZero
Posts: 2
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...
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

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

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

Code: Select all

requirejs('actions');
localRequirejs('myScript');
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.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
TIV73
Posts: 229
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.
PhanZero
Posts: 2
Joined: Sun Feb 14, 2021 6:10 pm

Re: Currently played info to file

Post by PhanZero »

Sorry, had no time to check back on my topic. Your script works great for what I need @TIV73 and if there's something more I might need in it, it'll be a good starting point for me. Thank you very much!
Post Reply