MediaMonkey 5 plugin for Rainmeter

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

Moderators: jiri, drakinite, Addon Administrators

TIV73
Posts: 229
Joined: Sat Nov 12, 2011 1:31 pm

MediaMonkey 5 plugin for Rainmeter

Post by TIV73 »

One of the things I really grew to love when listening to music in the background while doing other stuff, is the NowPlaying plugin for rainmeter to display some basic information about the currently playing track on the taskbar. Unfortunately, that plugin is not (yet) compatible with MediaMonkey 5. Because not having this would actually prevent me from migrating to MM5 once it's released, I went ahead and wrote a plugin that works with the current alpha.

The plugin is compatible with both Mediamonkey 4 and 5 and supports all fields and functions of the NowPlaying plugin (plus a few additions specific to MediaMonkey), so existing layouts can be migrated with minimal changes.


Download
To get the latest version, head over to the releases page on github.
Installation instructions, available measures and example configurations can also be found there.


Disclaimer
MediaMonkey 5 is currently in Alpha Stage, which means that it's still beeing actively developed, so changes that break the functionality of the plugin could happen anytime. That said, unless some very basic functionality is changed, the plugin should probably be fine.
There are still some kinks I want to iron out, but I'm not planning on investing a lot of time until MediaMonkey has a release candidate or at least reaches beta status.
For MediaMonkey 4 the plugin should be stable, I have been using it since April on daily basis without any noteworthy issues.
Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

Hi!

First and foremost: Thanks for the plugin and sharing it!
Second: I can't get it work with the latest Rainmeter and MM. Does it still work and the error is on my side?
TIV73
Posts: 229
Joined: Sat Nov 12, 2011 1:31 pm

Re: MediaMonkey 5 plugin for Rainmeter

Post by TIV73 »

It should generally still work fine, but if you run into problems there's a dev branch in the github repo with some updates - but you'd have to compile the dll yourself. Im using the preview version with Rainmeter 4.5.16.2687 and MediaMonkey 5.0.4, which are the respective latest non-preview versions, and everything works fine with that.

You can also download the preview from this link.
Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

Ah great, thanks man! I will try that out. Good to know it basically still works!
Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

Tried with your version, same MM and more recent rainmeter-version.
Log says:
"Mediamonkey.dll: Unknown error while updating player details ('InitMMSession'):Value to add was out of range.
Parameter name: value (Kodi\MediaMonkey.ini - [mPlayer])"

I'm using MediaMonkey in Portable-mode, might that pose a problem?
TIV73
Posts: 229
Joined: Sat Nov 12, 2011 1:31 pm

Re: MediaMonkey 5 plugin for Rainmeter

Post by TIV73 »

Unless you are running multiple instances at the same time portable mode shouldn't make any difference. The error message sounds like rainmeter doesn't like something about the ini file that contains the player measure. Could you try replacing your ini file with the one below and see if it works with that? Also, check if uncommenting the PlayerPath property and setting the path to your mediamonkey.exe does anything.

Code: Select all

; MediaMonkey

[Rainmeter]
Author=mmuffins
AppVersion=1001000
Update=500
BackgroundMode=1

[Metadata]
Name=MediaMonkey
Description=Displays information of the currently playing song.
Tags=Taskbar | Music | MediaMonkey
License=MIT
Variant=1

[Variables]

;-------------------------

[MeasurePlayer]
Measure=Plugin
Plugin=MediaMonkey
;PlayerPath=C:\Portable Apps\MediaMonkey 5\MediaMonkey.exe
PlayerType=TITLE
DisableLeadingZero=0

[MeasureState]
;0 for stopped, 1 for playing, and 2 for paused.
Measure=Plugin
Plugin=MediaMonkey
PlayerName=[MeasurePlayer]
PlayerType=State

[MeasureStatus]
;0 for inactive (player closed) and 1 for active (player open).
Measure=Plugin
Plugin=MediaMonkey
PlayerName=[MeasurePlayer]
PlayerType=Status

[MeasureTitle]
Measure=Plugin
Plugin=MediaMonkey
PlayerName=[MeasurePlayer]
PlayerType=Title

;-------------------------

[NowPlayingString]
Meter=String
MeasureName=MeasureTitle
X=180
Y=4
FontColor=255, 255, 255, 255
FontFace=Trebuchet MS
FontSize=10
StringAlign=RIGHT
StringStyle=NORMAL
AntiAlias=1
Text="%1"

Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

No, single instance only.
I checked your ini and replaced mine with it (path adapted and uncommented after first try), but the error remains:

"Mediamonkey.dll: Unknown error while updating player details ('InitMMSession'):Value to add was out of range.
Parameter name: value (Kodi\MediaMonkey.ini - [MeasurePlayer])"

I assume there's nothing to setup in MM regarding this issue?
Can it be the played media itself? FLAC? UNC-path for all files?

Thanks for your help though, mate!
TIV73
Posts: 229
Joined: Sat Nov 12, 2011 1:31 pm

Re: MediaMonkey 5 plugin for Rainmeter

Post by TIV73 »

Well, yeah. Between the settings and application version your setup seems to be as close to the one that I've been using for some two years on a daily basis without any major issues like the one you are experiencing.

The plugin basically just connects to the chromium engine running the mediamonkey frontend, queries it for details of the currently playing track, maps that to a bunch of object properties and hands it over to rainmeter. So all that I can think of is something in your environment that's so different from mine that it causes issues I never even thought about. UNC paths are fine, btw. I tested for those.

One of the things I can think of to troubleshoot this is if you could upload a couple of your files somewhere so I can have a look at them and try to reproduce the issue locally.

Also, could you try to download this zip, extract it, and run it while mediamonkey is already playing a song? It's a small application that's used for debugging when building the the mediamonkey api. It was never intended to run standalone, so no idea if it even starts on your machine, but it's worth a shot at least.
Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

The tool works, yet it only tells me the same error like rainmeter about the value out of bounds :-)
Due to pulling it from chromium I tried disabling everything that might influence that here, like firewall, pihole and the likes. But still nothing.
This is weird as it should work the same as with your setup if everything is kinda the same.
I'm running win10 enterprise N on a domain-setting. MM is portable and the database and all files are on UNC-paths in my (local) cloud. No antivirus or whatever.

Too bad, I'm already out of ideas and MM doesn't offer a simple API or shared memory or webhooks or something like that.

But thank you for trying to help, much appreciated!
TIV73
Posts: 229
Joined: Sat Nov 12, 2011 1:31 pm

Re: MediaMonkey 5 plugin for Rainmeter

Post by TIV73 »

That's interesting. That sounds that the issue may actually be related to the library, rather than the rainmeter plugin. If you can, consider uploading a bunch of your media files somwhere and sharing the link (privately) with me.
An out of bounds exception in the console application could mean that there's just some random value that's bigger than I expected it to ever be or some format mapping that I got wrong.
Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

It sounds like that, yes. So I tested a file outside of my library (context->play with mm), took a short path, an mp3 with simple short tagging without any fancy characters. Sadly the same:

"Mediamonkey.dll: Unknown error while updating player details ('InitMMSession'):Value to add was out of range. Parameter name: value"

So it can't be the library, or can it still be? Would a sample file still be helpful?
TIV73
Posts: 229
Joined: Sat Nov 12, 2011 1:31 pm

Re: MediaMonkey 5 plugin for Rainmeter

Post by TIV73 »

I actually meant the application library that passes the information from mediamonkey to the rainmeter plugin, not your mediamonkey library :D. The latter is never actually touched, only the currently playing file is queried - you can play any random file that's not in your library and it should work just fine.

If you say that you run into the error even when using a simple mp3 it's less likely that it's a data mapping issue - but we could still give you sending me a bunch of files a shot, just to be sure.

I also created a new version of the debugging application which is more verbose than before. Same as before, could you run MediaMonkeyNetSample.exe while playing a file and send me the console output?
Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

Oh oops :lol:
But what application library you meant then? There's Rainmeter, there's your snippet and your plugin ...

Soooo, I tried precisely as this:

-unload your mm-rainmeter-snippet, rainmeter running
-start MM, do nothing
-start your debuggolero

at this point the output is:

main
mmsession init
OpenSessionAsync
GetDebuggingUri
GetRemoteSession
GetWebSockets
GetEndpointAddress
CreateSession
OpenSessionAsyncDone
RefreshCurrentTrackAsync
PreventConcurrentCalls
GetCurrentTrack
DeserializeTrack
SerializerSettings
PopulateTrackObject
JsonConvertDeserialize
Unknown error: Value to add was out of range. (Parameter 'value')

Which tells me, the error at the end had nothing to do with your plugin at all?

-load the rainmeter-snippet
-play a song

nothing happens, nothing works, no debug-output.

At least we figured out it's not related to your plugin and also no mapping-issue?
TIV73
Posts: 229
Joined: Sat Nov 12, 2011 1:31 pm

Re: MediaMonkey 5 plugin for Rainmeter

Post by TIV73 »

Kodijack wrote: Sat Jan 14, 2023 12:52 pm But what application library you meant then? There's Rainmeter, there's your snippet and your plugin ...
All the communication with mediamonkey, getting data, parsing song objects, etc. is all done by an application library called MediaMonkeyNet. The rainmeter plugin itself isn't really doing much of anything, it's just there to glue the library and rainmeter together.

The debug application you ran is basically a standalone version of that application library, which is why you don't need rainmeter to run it. And from the log output it looks like the track object provided by mediamonkey cannot be deserialized by the library. Which is great, because we now have a better idea of where to look. Which is why I prepared yet another version of the debugging tool.

As before could you please
  • Download and extract the tool
  • Unload the mediamonkey plugin from rainmeter (or just close rainmeter alltogether, it's not needed)
  • Make sure a track is playing in mediamonkey
  • Run the tool
  • Send me the console output
The output should be more or less the same as before, with the notable difference that it now also contains the track json that's being parsed, which is basically the textual representation of the song metadata that mediamonkey is currently playing.
Kodijack
Posts: 46
Joined: Thu Nov 30, 2017 6:55 am
Location: Krautland
Contact:

Re: MediaMonkey 5 plugin for Rainmeter

Post by Kodijack »

Oh. I had no idea :-)
Ok, did it, and here's the result:

https://pastebin.com/5sp2UPAa

A lot more info. Chose a run-of-the-mill-track with no special characters or anything.
Post Reply