Installation Packages

From MediaMonkey Wiki
Revision as of 15:33, 19 February 2011 by Redx (talk | contribs) (Sample Installation Package for Scripts)
Jump to: navigation, search

Installation Packages structure

Additional Extensions can be easily installed in MediaMonkey using Installation Packages. Each installation package is a ZIP file with MMIP extension, when such a file is executed, it is automatically installed in MediaMonkey (see Tools|Extensions menu item). Inside the package can be included any files that need to be installed, but there are also some special files that can or must be included:

Mandantory - this file describes the package and what to install.
Optional - Icon of the package.
Optional (but suggested) - describes steps on uninstall, which files to remove, etc.
Optional - is automatically preserved by installer and can be called by Uninstall.ini on uninstallation.

Install.ini file

The installation file has a structure of an ini file, i.e. some sections with keys and values.

[Header] section

Each install.ini file starts with a mandantory section [Header]. It contains basic information about the product being installed, namely:

Unique string identification of the product. It should contain only alphanumeric characters, digits or underscores.
Product title shown to user.
Detailed product description.
Major version number.
Minor version number.
Release number.
Build number. Any of these numbers can be missing, e.g. if only VersionMajor and VersionMinor are present, the version number shown to user would be 'VersionMajor.VersionMinor'.
Type of product being installed. Either script, skin or misc. This is used so that MM knows more about the extension.
URL where MM should look for updates of this product. If this key is missing, MM can still try to find out whether a new version has been released by asking MM web scripting repository using product ID above.
A script file to execute. There is either a fully specified path entered here.

A name of function to be called within the script file. If this entry is missing or empty, it's supposed that there's no need for calling a function and simple execution of the script file does whatever a developer wants to do.

Other sections

After the header section, there can follow an arbitrary number of other sections specifying actions installer should do. The possible sections follow.

NOTE: Sections are executed in order of appearance.

[Copy] section

This section tells where individual files from the installer ZIP file should be placed. Expected keys there include:

Source file name in the installer ZIP file.
Destination file path. It can contain constants useful for placing files in common paths (the same as InnoSetup constants). Currently implemented constants:
  • {app} = MediaMonkey installation folder.
  • {sys} = Windows system folder.
Comma separated list of flags related to this copy operation. Can be any of:
If the target file already exists, it will be overwritten only if the source file is newer. If this flag isn't specified, the target file will always be overwritten.
If the target file is a DLL library then it registers specified DLL library by calling DllRegisterServer() from it.
If the target file already exists, it won't be overwritten by the source file. Note that this flag takes effect only with MediaMonkey 3.2.1 and higher!

If your package contains various files to be copied, you need one [Copy] Section for each individual file.

[Delete] section

This section is primarily for 'uninstall.ini' file. The only parameter is:

Full path of the file to be deleted.

[Execute] section

This section allows developer to execute a script and thus do any other necessary installation/uninstallation actions, for example prepare Scripts.ini content. Expected keys here are:

A script file to execute. Case sensitive. There is either a fully specified path entered here, or if there is no path information, the script is expected to be located in the installation ZIP file and is prepared to a temporary location prior its execution. For uninstaller 'uninstall.vbs' can be specified here and it would be called from its location.
A name of function to be called within the script file. If this entry is missing or empty, it's supposed that there's no need for calling a function and simple execution of the script file does whatever a developer wants to do.

Uninstall.ini file

'Uninstall.ini' file will is very similar to 'Install.ini' file, just [Header] section is missing. Other sections allow developers to properly delete installed files and remove any other traces of installation, e.g. execute a script that would delete some entries in Scripts.ini file.

Sample Installation Package for Skins

Sample MMIP file can contain e.g. the following files:

  • App.ico icons shown in the extenions dialog
  • Install.ini file that tells where stuff is copied to
  • Uninstall.ini tells what should be deleted when uninstalling

Sample Install.ini file

Comments in [] should be removed

ID=UniqueSkinName [this is used when MM needs to see if update is available]
Title=Skin Name
Description=Well a description
Type=skin [so MM knows what it is]
UpdateURL= http://yourserver/file


[you can copy more stuff if you want]

Sample Uninstall.ini file


Sample Installation Package for Scripts

Sample content of MMIP file

Sample MMIP file can contain e.g. the following files:

  • App.ico
  • Install.ini
  • Sample Option Sheets.vbs
  • Uninstall.ini
  • Uninstall.vbs

Sample Install.ini file

Title=Sample Option Sheets
Description=Sample Option Sheets.vbs

Src=Sample Option Sheets.vbs
Tgt={app}\scripts\auto\Sample Option Sheets.vbs



File={app}\scripts\auto\Sample Option Sheets.vbs

Use an install.vbs if you need to do more config, like installing menus or other configurations

Sample install.vbs

'Add entries to script.ini if you need to show up in the Scripts menu
Dim inip : inip = SDB.ScriptsPath & "Scripts.ini"
Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
If Not (inif Is Nothing) Then
	inif.StringValue(scriptName,"Filename") = "PersonalTagEnhancer.vbs"
	inif.StringValue(scriptName,"Procname") = "PersonalTagEnhancer"
	inif.StringValue(scriptName,"Order") = "10"
	inif.StringValue(scriptName,"DisplayName") = "PersonalTagEnhancer"
	inif.StringValue(scriptName,"Description") = "Fixes most important tags using personal preferences"
	inif.StringValue(scriptName,"Language") = "VBScript"
	inif.StringValue(scriptName,"ScriptType") = "0"
	inif.StringValue(scriptName,"Shortcut") = "Ctrl+i"
End If 

' Add entries for Mediamonkey.ini	
' Here you set the variables you need
' all 3 types are shown here
Dim ini: Set ini = SDB.IniFile
If Not ini.ValueExists("AdvShutdown","Enabled") Then ini.StringValue("AdvShutdown","Enabled") = "Enabled"
If Not ini.ValueExists("AdvShutdown","Timeout") Then ini.BoolValue("AdvShutdown","Timeout") = True
If Not ini.ValueExists("AdvShutdown","Action")  Then ini.IntValue("AdvShutdown","Action") = 1

Sample Uninstall.ini file

File={app}\scripts\auto\Sample Option Sheets.vbs


Sample Uninstall.vbs file

myName = "Sample Script"    'Put script name here
iniSec = "SampleScript"     'Put ini section name here

' Deletes settings from MediaMonkey.ini
MsgDeleteSettings = "Do you want to remove " & myName & " settings as well?" & vbNewLine & _
                    "If you click No, script settings will be left in MediaMonkey.ini"

If (Not (SDB.IniFile Is Nothing)) and (MsgBox(MsgDeleteSettings, vbYesNo) = vbYes) Then
End If

'Remove entries from scripts.ini
Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
If Not (inif Is Nothing) Then
End If

Sample version file

<SoftwareVersion> <VersionMajor>5</VersionMajor> <VersionMinor>6</VersionMinor> <VersionRelease>0</VersionRelease> <VersionBuild>0</VersionBuild> <UpdateURL>http://url/to/mmip</UpdateURL> <NewVersionDescription>Comment</NewVersionDescription> </SoftwareVersion>

See also