MediaMonkey

Questions and comments specific to a particular plugin should go here.
Post Reply
User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

MediaMonkey

Post by Pako » Mon Oct 29, 2007 8:44 am

I'm find another player/music manager:
MediaMonkey (formerly Songs-DB) is a multi-featured music manager that includes many useful tools. It acts as a Music Manager, Scanner, Player, Encoder, Decoder, Converter, Grabber, Tagger, Renamer, Playlister, Locator, Cacher and more. It includes powerful scanning features of all music files, as well as a built in player and Encoder/Decoder. In addition Songs-DB can also convert among various types of files and extract (rip) data from audio CDs. Additional tools include a file renamer, ID tag editor (read/write) and a caching system that caches songs from removable media to HD and built-in support for CDDb.

I made plugin for him. I have one problem. Writing to MediaMonkey is only
temporary. I'm in contact with MediaMonkey's developers and I hope, this problem will be solved.

I'm made also one script (EventGhost.vbs) for MediaMonkey, which can transmit events to EG.
INSTALL: Put script to MediaMonkey's "Scripts\Auto" folder and (re)start MediaMonkey.

Pako

EDIT (2011-11-28):
The latest version of the plugin can always be found here.
Last edited by Pako on Mon Sep 14, 2009 6:45 am, edited 1 time in total.

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: Plugin for MediaMonkey

Post by Bitmonster » Mon Oct 29, 2007 9:11 am

Very nice coding. You've made big progresses in Python coding.

I have added the plugin to the beta installer.

BTW: Did you try to use the ActiveX interface of EG for the VBS-Script? This should be easier than searching in the registry and calling the events through the command line.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: Plugin for MediaMonkey

Post by Pako » Mon Oct 29, 2007 12:08 pm

Bitmonster wrote:Very nice coding. You've made big progresses in Python coding.
Thanks for praise.
Bitmonster wrote:BTW: Did you try to use the ActiveX interface of EG for the VBS-Script? This should be easier than searching in the registry and calling the events through the command line.
New version attached.

Pako
Attachments
Script.zip
(803 Bytes) Downloaded 627 times

User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: MediaMonkey

Post by Pako » Fri Nov 02, 2007 1:12 pm

New version: 0.1.1.
Write to database MediaMonkey is already permanent.
Problem was between my chair and keyboard. :)
I'm add choice "Make entry to ID3 tag too" for parameters, where it is possible.

Pako
Attachments
MediaMonkeyPlugin011.zip
(9.17 KiB) Downloaded 650 times

User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: MediaMonkey

Post by Pako » Thu Nov 08, 2007 2:48 pm

Is nice, that in build 1151 is also plugin MediaMonkey.
Be missing there but script EventGhost.vbs (event sender).
Pako

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: MediaMonkey

Post by Bitmonster » Thu Nov 08, 2007 4:06 pm

Yes, the installer build script was not configured for .vbs. => 03.6.1152
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: MediaMonkey

Post by Pako » Fri Nov 23, 2007 8:48 pm

New release 0.1.2:
Removing little bugs, complement event.Skip() code.

Pako
Attachments
__init__.py
Release 0.1.2
(44.75 KiB) Downloaded 592 times

Alink
Posts: 12
Joined: Mon Dec 10, 2007 6:23 pm

Re: MediaMonkey

Post by Alink » Mon Dec 10, 2007 6:35 pm

Hi!

I am wondering if there is any way to connect to a running Mediamonkey session without having started it from within Eventghost.

Trying to do so now generates the error: ”MediaMonkey is not running or connected” even when Mediamonkey IS in fact running.

Like f.i the plugin for Media Player Classic: If Media Player Classic is running, the plugin connects to it and the controls work. If not an error is thrown in EventGhost log.

I’ve tried to compare the code for these two, but my knowledge in Python programming is weak.

/Alink

User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: MediaMonkey

Post by Pako » Mon Dec 10, 2007 9:09 pm

MM plugin cannot work as well as MPC plugin.
MM plugin is based on ActiveX.
Control MM through EG must always begin Action "Start/Connect MediaMonkey".
It makes no odds, whether MM is already running (Action only Connect) or is not running (Action Start and Connect).

Pako

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: MediaMonkey

Post by Bitmonster » Mon Dec 10, 2007 9:22 pm

Can't you add an automatic connect to every action? Something like:

Code: Select all

# in plugin
def GetMM(self):
    if self.MM is None:
        try:
            self.MM = Dispatch("SongsDB.SDBApplication")
        except:
            raise self.Exceptions.ProgramNotRunning
    return self.MM

# in action
def __call__(self):
    self.plugin.GetMM().Player.Play()
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

Alink
Posts: 12
Joined: Mon Dec 10, 2007 6:23 pm

Re: MediaMonkey

Post by Alink » Wed Dec 12, 2007 9:59 am

Bitmonster, yes your suggestion seems to work fine. I modified Pako's script with this and it ran smoothly.

I also added a simple action to load a playlist by name:

Code: Select all

class LoadPlaylist(ActionBase):
    name = "Load Playlist by Name"
    description = "Loads a MediaMonkey playlist defined by name."
    class text:
        playlistName = "Name of Playlist:"

    def __call__(self, plString):
        MMobj = self.plugin.GetMM()
        MMobj.Player.Stop()
        MMobj.Player.PlaylistClear()
        plItems = MMobj.PlaylistByTitle(plString).Tracks
        MMobj.Player.PlaylistAddTracks(plItems)
        MMobj.Player.currentSongIndex = 0
        MMobj.Player.Play()
        
    def Configure(self, plString=""):
        panel = eg.ConfigPanel(self)
        text = self.text
        textCtrl = wx.TextCtrl(panel, -1, plString, style=wx.TE_NOHIDESEL)
        SizerAdd = panel.sizer.Add
        SizerAdd(wx.StaticText(panel, -1, text.playlistName))
        SizerAdd(textCtrl, 0, wx.EXPAND)

        while panel.Affirmed():
            panel.SetResult(textCtrl.GetValue())

I am wondering, though (and sorry if this is a more general Python question): is there a way to release an object that is created via the Dispatch method?

Now, closing MediaMonkey will pop up the warning "There are still active COM objects in this application. One or more clients may have references to these objects, so manually closing this application may cause those client application(s) to fail."

User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: MediaMonkey

Post by Pako » Wed Dec 12, 2007 1:47 pm

I prepare modification of plugin.
Will there also action "Load Playlist by Name" :) .
Alink wrote:I am wondering, though (and sorry if this is a more general Python question): is there a way to release an object that is created via the Dispatch method?

Now, closing MediaMonkey will pop up the warning "There are still active COM objects in this application. One or more clients may have references to these objects, so manually closing this application may cause those client application(s) to fail."
You can use EG action "Exit MediaMonkey".

Pako

Alink
Posts: 12
Joined: Mon Dec 10, 2007 6:23 pm

Re: MediaMonkey

Post by Alink » Wed Dec 12, 2007 3:08 pm

Pako wrote:I prepare modification of plugin.
Will there also action "Load Playlist by Name" :) .
Alink wrote:I am wondering, though (and sorry if this is a more general Python question): is there a way to release an object that is created via the Dispatch method?

Now, closing MediaMonkey will pop up the warning "There are still active COM objects in this application. One or more clients may have references to these objects, so manually closing this application may cause those client application(s) to fail."
You can use EG action "Exit MediaMonkey".

Pako
No, I don't want to close the application, just release the COM object.

User avatar
Pako
Plugin Developer
Posts: 2262
Joined: Sat Nov 11, 2006 1:31 pm
Location: Czech Republic
Contact:

Re: MediaMonkey

Post by Pako » Wed Dec 12, 2007 3:47 pm

Code: Select all

class Exit(eg.ActionClass):
    name = "Exit/Disconnect MediaMonkey"
    description = "Exit or Disconnect MediaMonkey."
    class text:
        choice_label="Close MediaMonkey too"
    
    def __call__(self,choice):
        try:
            if self.plugin.MM:
                del self.plugin.MM
        except:
            pass
        self.plugin.MM=None
        if choice:
            eg.plugins.Window.FindWindow(
                u'MediaMonkey.exe',
                u'{*}MediaMonkey{*}',
                u'TFMainWindow',
                None,
                None,
                1,
                True,
                1.0,
                0
            )
            eg.plugins.Window.Close()
        
    def Configure(self, choice=False):
        panel = eg.ConfigPanel(self)
        choiceCtrl = wx.CheckBox(panel, -1, self.text.choice_label)
        choiceCtrl.SetValue(choice)
        panel.AddCtrl(choiceCtrl)

        while panel.Affirmed():
            panel.SetResult(choiceCtrl.GetValue())
It is all right ?

Pako

User avatar
Bitmonster
Site Admin
Posts: 2239
Joined: Mon Feb 06, 2006 10:28 pm

Re: MediaMonkey

Post by Bitmonster » Wed Dec 12, 2007 3:51 pm

Well, this is problematic. Normally Python releases the dispatch to the COM object as soon as every reference to the COM object is deleted. So you can do something like:

del self.MM
self.MM = None

The problem is, that we don't know when MediaMonkey wants to close, as we have no direct event callback. One possibility might be to get and release the dispatch on every command.

Code: Select all

def DoCommand(command):
    mm = Dispatch("SongsDB.SDBApplication")
    getattr(mm.Player, command)()
    del mm

DoCommand("Play")
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!

Post Reply