MM5 Media Sharing Server Port

To discuss development of addons / skins / customization of MediaMonkey v5 / v2024

Moderators: jiri, drakinite, Addon Administrators

eshaacacia
Posts: 10
Joined: Tue Jul 02, 2024 3:31 am

MM5 Media Sharing Server Port

Post by eshaacacia »

Hi,
I have created multiple servers for Media sharing, with different names and ports.
Is there a way I can externally set which server I want to enable on when the application is launched?

For example I have two servers Server1 and Server 2. I want to run a script (C++) that launches my Monkey Media application and enables 'Server1' as the server. Currently my script launches the application and I manually change the server by going into Tools>Options>Media Sharing
Last edited by eshaacacia on Tue Sep 17, 2024 4:36 am, edited 1 time in total.
Peke
Posts: 17899
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: MM5 Media Sharing Server Port

Post by Peke »

Hi,
I think that it would be easier to create two local Portable MM installations and set them with single Server enabled, then on your wish start one or another and also you can easily close one or another with external scripts.

If you need help let me know.

Dual servers often gets blocked in Firewall and need much more configuration than just starting to MMs :( If you wanty to go that way I can help you, but for now there is no API command to enable/disable MM servers.
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
eshaacacia
Posts: 10
Joined: Tue Jul 02, 2024 3:31 am

Re: MM5 Media Sharing Server Port

Post by eshaacacia »

Hi Peke,
Thanks for that answer. Making multiple portable installs also works but then I would need to change the path to MM every time. This too is doable but not the most efficient. I don't mind doing the configuration required for dual servers if its a one time setup.
Also just to clarify, it is not just two servers but possibly more around 7-8 that I will need to configure.
If you could help me understand my options I will be able to make an informed decision about what best suits my solution.
Thanks!
Peke
Posts: 17899
Joined: Tue Jun 10, 2003 7:21 pm
Location: Earth
Contact:

Re: MM5 Media Sharing Server Port

Post by Peke »

Hi,
Hmmm interesting, no one ever had need for more than 1-2 servers, in most cases 1 can be configured to serve both, so this is interesting use case and could benefit both MM and you as user.

What is the options and need for such number of servers? (Use PM or Ticket if you want to talk about this more privately)
Best regards,
Peke
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
Image
How to attach PICTURE/SCREENSHOTS to forum posts
eshaacacia
Posts: 10
Joined: Tue Jul 02, 2024 3:31 am

Re: MM5 Media Sharing Server Port

Post by eshaacacia »

Hi Peke,
Sure! I've just sent you a PM discussing some details regarding the same. As of now the portable installs seems to do the job although a bit annoying to set up each time. Could you enlighten me on the difference between a normal and a portable install?
eshaacacia
Posts: 10
Joined: Tue Jul 02, 2024 3:31 am

Re: MM5 Media Sharing Server Port

Post by eshaacacia »

Hi Peke,
Additional question. When I terminate my MM from my external script 80% of the time all four processes get terminated but 20% there is still one process running that I then have to manually end from the task manager. Could you help me debug this?
Here is the code snippet for the same:

Code: Select all

 
 // Terminate MediaMonkey process
 if (piMediaMonkey.hProcess) {
     // Attempt to close the main window gracefully before terminating the process
     PostMessage(hwndMediaMonkey, WM_CLOSE, 0, 0);
     WaitForSingleObject(piMediaMonkey.hProcess, 5000); // Wait up to 5 seconds for the process to close

     // If the process is still running, force terminate
     if (WaitForSingleObject(piMediaMonkey.hProcess, 0) != WAIT_OBJECT_0) {
         TerminateProcess(piMediaMonkey.hProcess, 0);
     }
     CloseHandle(piMediaMonkey.hProcess);
     CloseHandle(piMediaMonkey.hThread);
 }
 
PetrCBR
Posts: 1767
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: MM5 Media Sharing Server Port

Post by PetrCBR »

Try to make us a debuglog, please.
How to make a debuglog - step 4b: viewtopic.php?f=30&t=86643
Ludek
Posts: 5028
Joined: Fri Mar 09, 2007 9:00 am

Re: MM5 Media Sharing Server Port

Post by Ludek »

eshaacacia wrote: Mon Sep 16, 2024 4:57 am Hi,
I have created multiple servers for Media sharing, with different names and ports.
Is there a way I can externally set which server I want to enable on when the application is launched?

For example I have two servers Server1 and Server 2. I want to run a script (C++) that launches my Monkey Media application and enables 'Server1' as the server. Currently my script launches the application and I manually change the server by going into Tools>Options>Media Sharing
For controlling MediaMonkey from external applications see this: https://www.mediamonkey.com/wiki/Contro ... plications

This way you can run any JS code and enable/disable or configure the servers :
https://www.mediamonkey.com/docs/api/cl ... erver.html
eshaacacia
Posts: 10
Joined: Tue Jul 02, 2024 3:31 am

Re: MM5 Media Sharing Server Port

Post by eshaacacia »

Thanks for the API Ludek! For now I'm trying out with portable MM installs since I want to run multiple instances simultaneously and portable installs ensures proper isolation and concurrency management.
Currently when I run multiple portable installs of MM it works fine. But on leaving it running overnight when I try to cast to my device the next morning I get a Playback Error saying the device cannot decode the mp3 file. Do you have an idea what might be causing this?

edit: I have just noticed that from the two different instances, each from a separate portable install, each running on different servers, I can only command one device. If I try to command another device on the second instance it throws a playback error
EthnRift
Posts: 5
Joined: Mon Sep 23, 2024 5:54 am

Re: MM5 Media Sharing Server Port

Post by EthnRift »

eshaacacia wrote: Fri Sep 20, 2024 5:17 am Thanks for the API Ludek! For now I'm trying out with portable MM installs since I want to run multiple instances simultaneously and portable installs ensures proper isolation and concurrency management.
Currently when I run multiple portable installs of MM it works fine. But on leaving it running overnight when I try to cast to my device the next morning I get a Playback Error saying the device cannot decode the mp3 file. Do you have an idea what might be causing this?

edit: I have just noticed that from the two different instances, each from a separate portable install, each running on different servers, I can only command one device. If I try to command another device on the second instance it throws a playback error
Have you tried running just two instances and alternating between them more frequently, rather than leaving them running overnight? This could help determine if it's a timeout or buffering issue. Additionally, do you get the same playback error with different file types, or is it specific to MP3s? This might give a clue about the decoding capabilities of the devices.
Post Reply