Different ini-update-handling in MM 3.1?

Beta Testing for Windows Products and plugins

Moderator: Gurus

Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Different ini-update-handling in MM 3.1?

Post by Big_Berny »

Hi devs,
I just discovered problem with AutoRateAccurate and MM Pre-3.1.

Problem:
To prevent the script from running multiple times at the same time, I write into the mediamonkey.ini 'ini.StringValue("AutoRateAcc", "IsWorking") = "True"'. Now I have a problem with this part since 3.1 because it seems to set IsWorking to "True" (I can see that if I run 'SDB.Messagebox ini.StringValue("AutoRateAcc", "IsWorking"), mtWarning, Array(mbOK)' afterwards WITHIN THE SAME SCRIPT-INSTANCE) but it doesn't really saves this modified mediamonkey.ini. At least the ini on the harddisk didn't get modified (directly), it seems like it would be in a sort of cache. If now a second instance of the script runs and tries to look if another instance is already running it thinks that it isn't because in the ini which it loads 'ini.StringValue("AutoRateAcc", "IsWorking") = "False"' and not 'ini.StringValue("AutoRateAcc", "IsWorking") = "True"', altough it should be.

I also tried to pause a instance to look the mediamonkey.ini in my text-editor and it really shows the old 'ini.StringValue("AutoRateAcc", "IsWorking") = "False"' altough the running scrpt shows me per msgbox that it should be 'True'.

Big_Berny
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
jiri
Posts: 5426
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Different ini-update-handling in MM 3.1?

Post by jiri »

Yes, ini file is only saved when the ini file object instance is destroyed, e.g. when the script terminates or by setting

Set ini = Nothing

I hope that it won't cause much trouble.

Jiri
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Different ini-update-handling in MM 3.1?

Post by MoDementia »

Hmm, I know of 1 problem I will have.

If you run a vbscript from a html page you cannot get a msg box, the only way I have been able to debug this part of scripts is to write it to the ini.
Now I have to create my own text file to debug? :(

Just debugging in general will be a pain, especially for users; we can't ask them to look at the ini i.e. before they click ok etc
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Different ini-update-handling in MM 3.1?

Post by MoDementia »

I reread Big Berny's post, does it mean that the ini is now only local to the script that opens/write it?

If so this really is a big problem where the script has child scripts
i.e. main script writes a value for the html onevent script to read?
jiri
Posts: 5426
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Different ini-update-handling in MM 3.1?

Post by jiri »

The only difference is when you use ini file object as a variable, e.g.

Set inif = SDB.IniFile
inif.StringValue...
inif.StringValue...
...

if you however use it as

SDB.IniFile.StringValue("x", "y") = "z"

then the change will be immediatelly written to disk.

Jiri
Big_Berny
Posts: 1784
Joined: Mon Nov 28, 2005 11:55 am
Location: Switzerland
Contact:

Re: Different ini-update-handling in MM 3.1?

Post by Big_Berny »

Hi jiri,
ok, so we can use 'SDB.IniFile.StringValue("x", "y") = "z"' instead for the party we really need immediate inifile-update?

By the way: What happens if there are more instances which modify the ini (with inif.StringValue...)? Will always the last running instance be written on the disc?
Image
Scripts in use: Genre Finder / Last.fm DJ / Magic Nodes / AutoRateAccurate / Last.FM Node
Skins in use: ZuneSkin SP / Eclipse SP
AutoRateAccurate 3.0.0 (New) - Rates all your songs in less than 5 seconds!
About me: icoaching - internet | marketing | design
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: Different ini-update-handling in MM 3.1?

Post by Teknojnky »

Jiri, what does this change fix or improve that is important to break compatibility with existing scripts?
Teknojnky
Posts: 5537
Joined: Tue Sep 06, 2005 11:01 pm
Contact:

Re: Different ini-update-handling in MM 3.1?

Post by Teknojnky »

jiri wrote:The only difference is when you use ini file object as a variable, e.g.

Set inif = SDB.IniFile
inif.StringValue...
inif.StringValue...
...

if you however use it as

SDB.IniFile.StringValue("x", "y") = "z"

then the change will be immediatelly written to disk.

Jiri
In 1212,
SDB.IniFile.StringValue("x", "y") = "z"

then the change will be immediatelly written to disk.
Is FALSE. Read/writing to the ini values do persist inbetween script instances, however the changes are NOT written until MM is closed.
Bex
Posts: 6316
Joined: Fri May 21, 2004 5:44 am
Location: Sweden

Re: Different ini-update-handling in MM 3.1?

Post by Bex »

Yes, I can confirm that. I think it started in 1205. Anyway, the changes are correctly made within MM's internal memory so any scripts works correct. It's a bit unusual to not see the made changes in the ini file until MM is shut down.
Btw, if you use an alias or not is not an issue anymore, they are all treated the same. In fact, Jiri recommends to use alias:
http://www.mediamonkey.com/forum/viewto ... 07#p182207
Advanced Duplicate Find & Fix Find More From Same - Custom Search. | Transfer PlayStat & Copy-Paste Tags/AlbumArt between any tracks.
Tagging Inconsistencies Do you think you have your tags in order? Think again...
Play History & Stats Node Like having your Last-FM account stored locally, but more advanced.
Case & Leading Zero Fixer Works on filenames too!

All My Scripts
MoDementia
Posts: 1321
Joined: Thu Jun 15, 2006 3:26 pm
Location: Geelong, Victoria, Australia

Re: Different ini-update-handling in MM 3.1?

Post by MoDementia »

Nice Link Bex, secret MM business hey?
nynaevelan
Posts: 5559
Joined: Wed Feb 07, 2007 11:07 pm
Location: New Jersey, USA
Contact:

Re: Different ini-update-handling in MM 3.1?

Post by nynaevelan »

:lol: :lol:
3.2x - Win7 Ultimate (Zen Touch 2 16 GB/Zen 8GB)
Link to Favorite Scripts/Skins

Join Dropbox, the online site to share your files
Post Reply