Reading the IniFile

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

Moderator: jiri

Reading the IniFile

Postby crap_inhuman » Mon Dec 26, 2016 6:06 am

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
crap_inhuman
 
Posts: 499
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Reading the IniFile

Postby jiri » Mon Dec 26, 2016 3:52 pm

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
jiri
 
Posts: 5291
Joined: Tue Aug 14, 2001 7:00 pm
Location: Czech Republic

Re: Reading the IniFile

Postby crap_inhuman » Mon Dec 26, 2016 7:52 pm

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
crap_inhuman
 
Posts: 499
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Reading the IniFile

Postby Peke » Mon Dec 26, 2016 8:12 pm

Are you referring to tools that can devs use in order to read/write MediaMonkey.INI?
Best regards,
Pavle
MM Core Developer and Admin of free MediaMonkey extensions Hosting
Image
Image
Peke
 
Posts: 10498
Joined: Tue Jun 10, 2003 7:21 pm
Location: Serbia

Re: Reading the IniFile

Postby crap_inhuman » Mon Dec 26, 2016 8:39 pm

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
crap_inhuman
 
Posts: 499
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Reading the IniFile

Postby PetrCBR » Tue Dec 27, 2016 6:43 am

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.
PetrCBR
 
Posts: 1338
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: Reading the IniFile

Postby crap_inhuman » Tue Dec 27, 2016 10:54 am

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: 499
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Reading the IniFile

Postby crap_inhuman » Fri Dec 30, 2016 10:17 pm

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
crap_inhuman
 
Posts: 499
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Reading the IniFile

Postby PetrCBR » Sat Dec 31, 2016 6:47 am

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)
PetrCBR
 
Posts: 1338
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: Reading the IniFile

Postby crap_inhuman » Sun Jan 01, 2017 10:19 am

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
crap_inhuman
 
Posts: 499
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Reading the IniFile

Postby PetrCBR » Sun Jan 01, 2017 12:56 pm

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.
PetrCBR
 
Posts: 1338
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech

Re: Reading the IniFile

Postby crap_inhuman » Fri Jan 06, 2017 6:31 pm

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
crap_inhuman
 
Posts: 499
Joined: Sat Jan 26, 2013 6:00 am
Location: Friedberg / Hessen / Germany

Re: Reading the IniFile

Postby PetrCBR » Sun Jan 08, 2017 6:27 am

I've added complete list of settings into wiki
PetrCBR
 
Posts: 1338
Joined: Tue Mar 07, 2006 5:31 pm
Location: Czech


Return to MediaMonkey 5 developer forum

Who is online

Users browsing this forum: No registered users and 5 guests