Porting scripts for MM 4.0

This forum is for questions / discussions regarding development of addons / tweaks for MediaMonkey.

Moderator: Gurus

Porting scripts for MM 4.0

Postby jiri » Thu Dec 23, 2010 10:57 am

I added a small Wiki section that describes changes that might be needed for some scripts, it's here: http://www.mediamonkey.com/wiki/index.p ... tallations

Feel free to post more examples/tips, in case you find some.

Thanks,
Jiri
jiri
 
Posts: 5112
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic

Re: Porting scripts for MM 4.0

Postby ZvezdanD » Sat Jan 15, 2011 4:49 am

Well, it is not enough to change only that. Here are some differences which I have discovered that could stop executing some scripts:
1. When track finish with reproduction with MM 3.x we had OnTrackProperties event , then OnTrackEnd, then OnPlaybackEnd; with 4.0 we have OnTrackEnd, then OnPlaybackEnd, then OnTrackProperties instead;

2. If you set SDBSongData.PlayCounter = 0, with MM3 SDBSongData.LastPlayed stays unchanged, but with MM4 it is set to 0 as well;

3. Setting SDB.MainTree.Node_XXX.Expanded = True/False not works anymore (this is obviously a bug and I hope it would be resolved as soon as possible since several of my scripts are using that);

4. Error because VarType(SDBSongData.FileLength) = 20 while it should be = 3 as before (one more bug);

5. some Web Browser controls are not displayed at all (Magic Nodes and RegExp scripts are affected); I am trying to find some solution, but I am afraid that this could be resolved only in the program itself.
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export/Create Playlists for Child Nodes 4.0.4 (2013-08-03)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.2 (2013-08-31)  Find Currently Playing Track 1.3 (2013-11-09)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0.1 (2013-07-10)  Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2755
Joined: Thu Jun 08, 2006 7:40 pm

Re: Porting scripts for MM 4.0

Postby Peke » Sat Jan 15, 2011 8:45 pm

Best regards,
Pavle
MM Core Developer and Admin of free MediaMonkey extensions Hosting
Image
Image
Peke
 
Posts: 8200
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia

Re: Porting scripts for MM 4.0

Postby ZvezdanD » Sun Jan 16, 2011 4:09 am

Peke wrote:re 1. tracked and tested within http://www.ventismedia.com/mantis/view.php?id=7084

I am sorry, but your description in that report was not very clear to me. Beside of that, you are mentioning only change of PlayCount, but forgot to mention LastPlayed. And why you put that issue in Last.fm plugin Project when it could have some side effect with any script?
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export/Create Playlists for Child Nodes 4.0.4 (2013-08-03)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.2 (2013-08-31)  Find Currently Playing Track 1.3 (2013-11-09)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0.1 (2013-07-10)  Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2755
Joined: Thu Jun 08, 2006 7:40 pm

Re: Porting scripts for MM 4.0

Postby ZvezdanD » Sun Jan 16, 2011 7:37 pm

ZvezdanD wrote:5. some Web Browser controls are not displayed at all (Magic Nodes and RegExp scripts are affected); I am trying to find some solution, but I am afraid that this could be resolved only in the program itself.

I have found a reason for that and reported in Mantis: Second Web Browser control on form has serious problem with Common.Anchors property [4.x]
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export/Create Playlists for Child Nodes 4.0.4 (2013-08-03)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.2 (2013-08-31)  Find Currently Playing Track 1.3 (2013-11-09)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0.1 (2013-07-10)  Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2755
Joined: Thu Jun 08, 2006 7:40 pm

Re: Porting scripts for MM 4.0

Postby Eyal » Sun Jan 30, 2011 4:18 am

jiri wrote:I added a small Wiki section that describes changes that might be needed for some scripts, it's here:

Making scripts ready for per-user installations
Starting from MediaMonkey 4.0, scripts can be (and are suggested to be) installed per-user, and so they don't have to be installed in Program Files folder, but are installed in local Windows folders. The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location. That said, some pre-4.0 scripts might need tweaking. For example, a popular script Lyricator has >1000 lines, but there's only one change needed in order to get it working under local installation, namely:

Dim sAppPath: sAppPath = sdb.ApplicationPath & "Scripts\Lyricator\"needs to be changed to

Dim sAppPath: sAppPath = sdb.ScriptsPath & "Lyricator\"


Hi,

I finally found why I had hard time debugging my new script under MM4!

- I'm running Windows XP, MM 3.2.4.
- I upgrade MM3 by installing MM4 in same folder. The folder already contained scripts in \Program Files\Mediamonkey\Scripts\Auto,
with my new script in it. So far so good. The script is working.
- I made some changes to my script, rebuilt the mmip and install it. The script now seems to run twice (?)

Reason: New mmip installation put the script in C:\Documents and Settings\Eyal\Application Data\MediaMonkey\Scripts\Auto, instead of overwriting the old one. So after restarting MM, 2 versions of the script are running simultaneously.

Here's the mmip:
Code: Select all
[Header]
ID=PlayedDateAndCounter
Title=Played Date & Counter
Description=Sets Played Date and Counter on playback startup
VersionMajor=1
VersionMinor=0
Type=Script

[Copy]
Src=PlayedDateAndCounter.vbs
Tgt={app}\Scripts\Auto\PlayedDateAndCounter.vbs

[Execute]
File={app}\Scripts\Auto\PlayedDateAndCounter.vbs
Function=OnStartup

I think {app}\ should install in application folder. {usr}\ or another variable name might be used to install into local folder.

Is that what you meant by "The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location." ?

Thanks

Eyal :~)
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
Eyal
 
Posts: 3062
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: Porting scripts for MM 4.0

Postby rovingcowboy » Sun Jan 30, 2011 6:10 am

Eyal wrote:
jiri wrote:I added a small Wiki section that describes changes that might be needed for some scripts, it's here:

Making scripts ready for per-user installations
Starting from MediaMonkey 4.0, scripts can be (and are suggested to be) installed per-user, and so they don't have to be installed in Program Files folder, but are installed in local Windows folders. The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location. That said, some pre-4.0 scripts might need tweaking. For example, a popular script Lyricator has >1000 lines, but there's only one change needed in order to get it working under local installation, namely:

Dim sAppPath: sAppPath = sdb.ApplicationPath & "Scripts\Lyricator\"needs to be changed to

Dim sAppPath: sAppPath = sdb.ScriptsPath & "Lyricator\"


Hi,

I finally found why I had hard time debugging my new script under MM4!

- I'm running Windows XP, MM 3.2.4.
- I upgrade MM3 by installing MM4 in same folder. The folder already contained scripts in \Program Files\Mediamonkey\Scripts\Auto,
with my new script in it. So far so good. The scripts is working.
- I made some changes to my script, rebuilt the mmip and install it. The script now seems to run twice (?)

Reason: New mmip installation put the script in C:\Documents and Settings\Eyal\Application Data\MediaMonkey\Scripts\Auto, instead of overwriting the old one. So after restarting MM, 2 versions of the script are running simultaneously.

Here's the mmip:
Code: Select all
[Header]
ID=PlayedDateAndCounter
Title=Played Date & Counter
Description=Sets Played Date and Counter on playback startup
VersionMajor=1
VersionMinor=0
Type=Script

[Copy]
Src=PlayedDateAndCounter.vbs
Tgt={app}\Scripts\Auto\PlayedDateAndCounter.vbs

[Execute]
File={app}\Scripts\Auto\PlayedDateAndCounter.vbs
Function=OnStartup

I think {app}\ should install in application folder. {usr}\ or another variable name might be used to install local folder.

Is that what you meant by "The mechanism in MM is internally make as transparent as possible, so that scripts don't have to care much about their installed location." ?

Thanks

Eyal :~)



hey eyal for my skin mmip i just tried to get updated it put the skin name in the skins choice window twice you might have found the answer for me i'll look in that other place on mine for the extra skin.
roving cowboy / keith hall. My skins viewtopic.php?f=9&t=16724 for some help check on Monkey's helpful messages at viewtopic.php?p=44008#44008 MY SYSTEMS.1.Xp pro sp3, vers 3.2 jukebox, pcchips mb. amd sem... built by me) 2.WinXP pro sp3, vers 2.5.5 and vers 3.2 backup storage, shuttle 32a mb,734 MHz amd athlon put together by me.) 3.WinXp pro sp 3 version 2.5 and version 3.2 work gigabyte mb. 281 GHz amd athlon x2 240 built by me.) 4.Dell demension, winxp pro sp3, mm3.5 spare jukebox.) 5.WinXp pro sp3, vers 2.5.5, moms computer. Sony vaio.)6. Samsung Galaxy Note2. Android 4.4) 7. Proscan tablet Android 4.3 )8. amd a8-5600 apu 3.60ghz windows 7 pro bought from computer store.
rovingcowboy
 
Posts: 13882
Joined: Sat Oct 25, 2003 7:57 am
Location: (Texas)

Re: Porting scripts for MM 4.0

Postby ZvezdanD » Mon Jan 31, 2011 2:59 am

Eyal wrote:I think {app}\ should install in application folder. {usr}\ or another variable name might be used to install into local folder.

I don't think so. If you introduce something like that, none existing installer package would be compatible with MM4. During installation of the new version of script/skin, the program itself should uninstall the old version of the same script/skin, not matter if it is previously installed in local or global folder and not matter of the current user choice of the installation folder.

I am going to report that in Mantis: Uninstall of old version of scripts/skins during installation of new version doesn't work always.
Magic Nodes 4.2 (2011-07-01) RegExp Find & Replace 4.3 (2011-07-06)  Invert Selection/Select None 1.5 (2012-02-04)  Export/Create Playlists for Child Nodes 4.0.4 (2013-08-03)  Expand Child Nodes/Expand All 1.1.1 (2012-02-13)  Event Logger 2.4.1 (2012-02-06)  Filtered Statistics Report 1.5.1 (2009-10-09)  Track Redirection & Synchronization 3.4 (2012-10-08)  Restore/Synchronize Database 3.1.2 (2013-08-31)  Find Currently Playing Track 1.3 (2013-11-09)  Queue List 1.2 (2012-02-06)  Add to Library on Play 1.0 (2010-10-20)  Tree Report for Child Nodes 1.1 (2010-11-04)  Update Location of Files in Database 1.3.3 (2012-06-12)  Inherit Child Playlists 1.0.1 (2013-07-10)  Add Currently Playing/Selected Track(s) to Playlist 1.1.1 (2012-02-06)
ZvezdanD
 
Posts: 2755
Joined: Thu Jun 08, 2006 7:40 pm

Re: Porting scripts for MM 4.0

Postby Ludek » Mon Jan 31, 2011 8:20 am

Eyal wrote:- I'm running Windows XP, MM 3.2.4.
- I upgrade MM3 by installing MM4 in same folder. The folder already contained scripts in \Program Files\Mediamonkey\Scripts\Auto,
with my new script in it. So far so good. The script is working.
- I made some changes to my script, rebuilt the mmip and install it. The script now seems to run twice (?)


Thanks, fixed as http://www.ventismedia.com/mantis/view.php?id=7273
Ludek
 
Posts: 1779
Joined: Fri Mar 09, 2007 9:00 am

Re: Porting scripts for MM 4.0

Postby Eyal » Mon Jan 31, 2011 9:59 am

Thank you.
Skins for MediaMonkey: Cafe, Carbon, Helium, Spotify, Zekton. [ Wiki Zone ].
Eyal
 
Posts: 3062
Joined: Sun Jun 26, 2005 9:27 am
Location: Québec

Re: Porting scripts for MM 4.0

Postby Psyker7 » Mon Mar 28, 2011 7:28 am

In terms of creating files to be used by the script, is it better to use Script.ScriptPath or %appdata%\mediamonkey?

I just went and re-wrote my script to use %appdata% to now discover MM4 can install scripts to %appdata% now.

Given I would prefer it to be compatible with MM3 & 4, I'm thinking using %appdata% is the best option for now...
Psyker7
 
Posts: 254
Joined: Sat Mar 03, 2007 8:00 am


Return to Addons developer forum

Who is online

Users browsing this forum: No registered users and 0 guests

cron