Skip to content

Commit

Permalink
Merge pull request #19 from fvdpol/exclude-playlists-in-export
Browse files Browse the repository at this point in the history
add feature/option to exclude the playlist section in the generated xml file
  • Loading branch information
fvdpol authored Nov 19, 2018
2 parents 0ff30a6 + d875ce6 commit 908b968
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 14 deletions.
2 changes: 1 addition & 1 deletion BuildMMIP.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

del ExportITunesXML.mmip
zip ExportITunesXML.mmip App.ico Install.ini Uninstall.ini ExportITunesXML.vbs
copy ExportITunesXML.mmip ExportITunesXML_v1.6.3.mmip
copy ExportITunesXML.mmip ExportITunesXML_v1.6.4.mmip


71 changes: 64 additions & 7 deletions ExportITunesXML.vbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@
' - correctly handle playlists with duplicate names
' - export using same sort order as MediaMonkey
' - export parent before children (as per iTunes behaviour)
' 1.6.3 reorder xml fields to (better) match iTunes format
' add Persistent ID for compatibility with Serato DJ
' add Grouping in export
' add dummy Library Persistent ID to the header for compatibility with Pioneer Recordbox DJ
' mark playlists that have sub-playlists as 'folder' (for compatibility with Pioneer Recordbox DJ)
' add "Play Date" (timestamp in numeric format) in addition to the "Play Date UTC"
' 1.6.3 reorder xml fields to (better) match iTunes format
' add Persistent ID for compatibility with Serato DJ
' add Grouping in export
' add dummy Library Persistent ID to the header for compatibility with Pioneer Recordbox DJ
' mark playlists that have sub-playlists as 'folder' (for compatibility with Pioneer Recordbox DJ)
' add "Play Date" (timestamp in numeric format) in addition to the "Play Date UTC"
' 1.6.4 add feature/option to exclude the playlist section in the generated xml file

option explicit ' report undefined variables, ...

Expand Down Expand Up @@ -325,6 +326,45 @@ function cleanFilename(byVal myFilename)
End Function


' Getter for the configured NoPlaylistExport boolean
function getNoPlaylistExport()
dim myIni
dim myValue
dim myBool

set myIni = SDB.IniFile
myValue = cleanFilename(myIni.StringValue("ExportITunesXML","NoPlaylistExport"))

' parse ini value to boolean; use default if not defined as 0/1
if myValue = "0" then
myBool = False
elseif myValue = "1" then
myBool = True
else
myBool = getDefaultNoPlaylistExport()
end if

getNoPlaylistExport = myBool
end function
'
' Setter for the configured ExportAtShutdown boolean
sub setNoPlaylistExport(byVal myBool)
dim myIni
set myIni = SDB.IniFile

if myBool then
myIni.StringValue("ExportITunesXML","NoPlaylistExport") = "1"
else
myIni.StringValue("ExportITunesXML","NoPlaylistExport") = "0"
end if
end sub
'
function getDefaultNoPlaylistExport()
getDefaultNoPlaylistExport = False
end function



' N must be numberic. Return value is N converted to a string, padded with
' a single "0" if N has only one digit.
function LdgZ(ByVal N)
Expand Down Expand Up @@ -636,7 +676,7 @@ sub Export
' are not converted into iTunes auto-playlists. A consequence of this is that
' e.g. randomized or size-limited playlists will contain a static snapshot taken
' at export time.
if playlistCount > 0 and not Progress.Terminate and not Script.Terminate then
if playlistCount > 0 and getNoPlaylistExport() = False and not Progress.Terminate and not Script.Terminate then
fout.WriteLine " <key>Playlists</key>"
fout.WriteLine " <array>"

Expand Down Expand Up @@ -828,6 +868,21 @@ Sub InitSheet(Sheet)
edt.common.Enabled = False ' not yet implemented >> deactivate this control
'
y = y + 25

Set edt = ui.NewCheckBox(GroupBox0)
edt.Common.SetRect 20, y-3, 20, 20
edt.Common.ControlName = "EITX_NoPlaylistExport"
edt.Checked = getNoPlaylistExport()
edt.common.Enabled = True
'
Set edt = ui.NewLabel(GroupBox0)
edt.Common.SetRect 40, y, 100, 20
edt.Caption = "Exclude export of Playlists"
edt.Autosize = False
edt.Common.Hint = "If option is set the iTunes library xml will only contain the tracks; the playlists will be excluded. " & _
"Default is off."
'
y = y + 25

End Sub

Expand All @@ -838,4 +893,6 @@ Sub SaveSheet(Sheet)
'
setFilename(Sheet.Common.ChildControl("EITX_Filename").Text)
setDirectory(Sheet.Common.ChildControl("EITX_Directory").Text)
'
setNoPlaylistExport(Sheet.Common.ChildControl("EITX_NoPlaylistExport").Checked)
End Sub
2 changes: 1 addition & 1 deletion Install.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Title=ExportITunesXML
Description=Export playlists to iTunes Library XML format
VersionMajor=1
VersionMinor=6
VersionRelease=3
VersionRelease=4
VersionBuild=0
Type=script
UpdateURL=https://raw.githubusercontent.com/fvdpol/MM-ExportITunesLibraryXml/master/ExportITunesXML.xml
Expand Down
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ A number of settings that were initially harcoded / configured in the script can

Navigate to Tools menu -> Options, and open the "Export to iTunes XML configuration dialog within the Library section.

| Setting | Description |
|---------|-------------|
| Setting | Description |
|--------------------|-------------|
| Export at Shutdown | If option is set the iTunes library xml will be exported when MediaMonkey is closed. <br> Default is off.|
| Periodic Export | If option is set the iTunes library xml will be exported every 60 minutes. <br> Default is off.|
| Filename | The file name for the exported iTunes Music Library XML file. <br> If blank/empty the default value of `iTunes Music Library.xml` will be used.|
| Directory | The directory where the iTunes Music Library XML file will be stored. <br> If blank/empty this will be initialised to the default location. On Windows 10 this is typically the `%APPDATA%\MediaMonkey` directory. |
| Periodic Export | If option is set the iTunes library xml will be exported every 60 minutes. <br> Default is off.|
| Filename | The file name for the exported iTunes Music Library XML file. <br> If blank/empty the default value of `iTunes Music Library.xml` will be used.|
| Directory | The directory where the iTunes Music Library XML file will be stored. <br> If blank/empty this will be initialised to the default location. On Windows 10 this is typically the `%APPDATA%\MediaMonkey` directory. |
| Exclude export of Playlists | If option is set the iTunes library xml will only contain the tracks; the playlists will be excluded. <br> Default is off.|


Note: Serato expects the xml file to be available in the original location where iTunes stores the file, which is typically in `C: \Users\{user}\Music\iTunes`
Expand Down Expand Up @@ -86,6 +87,11 @@ Note that Native Instruments Traktor is known to ignore / filter-out playlists t

## Version History

### Version 1.6.4
_in progress_
- add feature/option to exclude the playlist section in the generated xml file


### Version 1.6.3
_Released on November 16, 2018_
- reorder xml fields to (better) match iTunes format
Expand Down

0 comments on commit 908b968

Please sign in to comment.