Reading the IniFile

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

Moderator: jiri

crap_inhuman
Posts: 786
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Reading the IniFile

Post by crap_inhuman »

The com-object SDB.IniFile isn't available in the Beta MM5. Will this be included in the final Version of MM5? If not, how can i read from Mediamonkey.ini?

Greetings
Sven
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
jiri
Posts: 5397
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic
Contact:

Re: Reading the IniFile

Post by jiri »

Could you clarify the exact user-case, please? We don't plan to port all of the COM, but will try to help with everything that makes sense.

Thanks,
Jiri
crap_inhuman
Posts: 786
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Reading the IniFile

Post by crap_inhuman »

Hi Jiri,

i need the following settings from the ini-file:

"PreviewSettings" -> "DefaultCoverStorage"
"AAMasks" -> "Mask1"
"CustomFields" -> "Fld1Name"
"CustomFields" -> "Fld2Name"
"CustomFields" -> "Fld3Name"
"CustomFields" -> "Fld4Name"
"CustomFields" -> "Fld5Name"
"Appearance" -> "MultiStringSeparator"

It would be great if i can read this settings.

Thank you!

Greetings,
Sven
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
Peke
Posts: 13484
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia
Contact:

Re: Reading the IniFile

Post by Peke »

Are you referring to tools that can devs use in order to read/write MediaMonkey.INI?
Best regards,
Pavle
MediaMonkey Team lead QA/Tech Support guru
Admin of Free MediaMonkey addon Site HappyMonkeying
Image
Image
How to add SCREENSHOTS to forum
crap_inhuman
Posts: 786
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Reading the IniFile

Post by crap_inhuman »

I implemented my own read/write function in the script to store the user settings.

So it would be helpful for me if i can use a COM which give me the path to the mediamonkey.ini (like SDB.TemporaryFolder)
With the path i can use my func to read the settings i need.
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
PetrCBR
Posts: 1701
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: Reading the IniFile

Post by PetrCBR »

As a workaround for now ...

We have API for accessing INI from JS:

Code: Select all

var sett = JSON.parse(app.settings.getJSON(''));
var Custom1 = sett.CustomFields.Fld1Name;
In COM model we have SDB.runJSCode method to run JS code and return values you're required.
crap_inhuman
Posts: 786
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Reading the IniFile

Post by crap_inhuman »

Thank you for the workaround!
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
crap_inhuman
Posts: 786
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Reading the IniFile

Post by crap_inhuman »

PetrCBR wrote:As a workaround for now ...

We have API for accessing INI from JS:

Code: Select all

var sett = JSON.parse(app.settings.getJSON(''));
var Custom1 = sett.CustomFields.Fld1Name;
In COM model we have SDB.runJSCode method to run JS code and return values you're required.
How did i get the var Custom1 back to the COM model?
I tested it with this vbscript. The test with window.alert show me the name of the Customfield1, so it works, but i need the name in the ret variable.

Code: Select all

Set SDB = CreateObject("SongsDB5.SDBApplication")
Code = "var sett = JSON.parse(app.settings.getJSON(''));" & vbCrLf
Code = Code & "var Custom1 = sett.CustomFields.Fld1Name;" & vbCrLf 
Code = Code & "window.alert(Custom1);"
ret = SDB.runJSCode(Code, True)
MsgBox(ret)

Thanks for your help.
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
PetrCBR
Posts: 1701
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: Reading the IniFile

Post by PetrCBR »

Simply use return

for example:

Code: Select all

Set SDB = CreateObject("SongsDB5.SDBApplication")
Code = "(function () { var sett = JSON.parse(app.settings.getJSON(''));" & vbCrLf
Code = Code & "var Custom1 = sett.CustomFields.Fld1Name;" & vbCrLf 
Code = Code & "return Custom1; })()"
ret = SDB.runJSCode(Code, True)
MsgBox(ret)
crap_inhuman
Posts: 786
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Reading the IniFile

Post by crap_inhuman »

Happy new year to you and the MM-Team.

Sorry, but it doesn't work for all settings:

I try to fetch these 3 settings

Code: Select all

Set SDB = CreateObject("SongsDB5.SDBApplication")
SDB.ShutdownAfterDisconnect = False
Code = "(function () { var sett = JSON.parse(app.settings.getJSON(''));" & vbCrLf
'Code = Code & "var ret = sett.PreviewSettings.DefaultCoverStorage;" & vbCrLf
'Code = Code & "var ret = sett.Appearance.MultiStringSeparator;" & vbCrLf
Code = Code & "var ret = sett.AAMasks.Mask1;" & vbCrLf

Code = Code & "return ret; })()"
ret = SDB.runJSCode(Code, True)
MsgBox(ret)
Trying to fetch the setting: PreviewSettings.DefaultCoverStorage returns nothing
Trying to fetch the setting: AAMasks.Mask1 returns an Application Error

Trying to fetch the setting: MultiStringSeparator return the correct value
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
PetrCBR
Posts: 1701
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: Reading the IniFile

Post by PetrCBR »

Best would be to add
var sett = JSON.parse(app.settings.getJSON(''));
into JS script and using a devtools check what values you can access.
crap_inhuman
Posts: 786
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany
Contact:

Re: Reading the IniFile

Post by crap_inhuman »

PetrCBR wrote:Best would be to add
var sett = JSON.parse(app.settings.getJSON(''));
into JS script and using a devtools check what values you can access.
I don't know, what i have to do. Could you please this more explain?
Metal up your ass !
-----------------------------------------------
I added my first 2 videos on youtube. The language is german.

Discogs Autorisierung: https://www.youtube.com/watch?v=oryxKKtnEnc
Discogs Tagger Bedienung: https://www.youtube.com/watch?v=85Wk-5rd-W0
PetrCBR
Posts: 1701
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech
Contact:

Re: Reading the IniFile

Post by PetrCBR »

I've added complete list of settings into wiki
Post Reply