Need AppleScript to "add tracks" from xml-file to music app (including date/time change and edit track-infos)
Hi,
as I decided to completely move everything from windows to OSX I finally want to transfer my iTunes Windows Library to OSX Music App.
As I really spent a lot of time in organizing and building my database, I have to keep all data - including the non taggable ones :)
I searched a lot and know basic options to transfer, BUT:
My music files are well organized and located outside the iTunes user folder. All files are well tagged (aif-files). As I build my windows library for years and very carefully, I HAVE to keep the track date added infos.
I know changing system date/time is not a smart programing way.... but as far as I know, the only option to meet my goal in this case:)
####
The script-goal would be:
# OPEN my individual exported XML-File (sample file enclosed)
# Read each entry through the end
# Read File entry, example:
<FILE>S:\SOUNDPOOL\ALBUMS\VARIOUS ARTISTS\(AHK-TOONG BAY-BI) COVERED [2011]\NINE INCH NAILS - Zoo Station [2011#01].AIF</FILE>
Change (old) windows base folder: "S:\SOUNDPOOL\“ to (new) osx folder: "file:///Volumes/_KOPIFLIX_EXT/_MEDIA/SOUNDPOOL/„
# Read other "additional" variables for this entry:
<GROUPING>Rock</GROUPING>
<COMPILATION>1</COMPILATION>
<DATEADDED>2011-02-01T00:22:04</DATEADDED>
<LASTPLAYED>2012-01-13T09:43:16</LASTPLAYED>
<RATING>0</RATING>
<PLAYEDCOUNT>5</PLAYEDCOUNT>
# Launch Music App (if not already open)
# Change OSX date/time to read variable DATEADDED, example: 2011-02-01T00:22:04
# Add Audio-File to Music Library.
# Write/Set the corresponding variables for this file (GROUPING,….PLAYEDCOUNT)
(all other infos are tagged properly and are imported through import/adding file)
# ? if necessary, close Music App
# ? if necessary, set osx date/time to current local time
# Read next file-entry from XML-File
# Loop til end of file
I really would appreciate help very much, thank you!
(sorry, I cannot add a file here - enclosed some sample text from my noted xml-file)
<?xml version="1.0" encoding="UTF-8"?>
<dataroot xmlnsd="urn:schemas-microsoft-comfficedata" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="T_ITUNES_EXPORT.xsd" generated="2024-03-02T15:21:28">
<T_ITUNES_EXPORT>
<FILE>S:\SOUNDPOOL\ALBUMS\VARIOUS ARTISTS\(AHK-TOONG BAY-BI) COVERED [2011]\NINE INCH NAILS - Zoo Station [2011#01].AIF</FILE>
<GROUPING></GROUPING>
<COMPILATION>1</COMPILATION>
<GAPLESS>0</GAPLESS>
<DATEADDED>2011-02-01T00:22:04</DATEADDED>
<LASTPLAYED>2012-01-13T09:43:16</LASTPLAYED>
<RATING>0</RATING>
<PLAYEDCOUNT>5</PLAYEDCOUNT>
</T_ITUNES_EXPORT>
<T_ITUNES_EXPORT>
<FILE>S:\SOUNDPOOL\ALBUMS\VARIOUS ARTISTS\(AHK-TOONG BAY-BI) COVERED [2011]\KILLERS, THE - Ultra Violet (Light My Way) [2011#10].AIF</FILE>
<GROUPING></GROUPING>
<COMPILATION>1</COMPILATION>
<GAPLESS>0</GAPLESS>
<DATEADDED>2011-02-01T01:53:30</DATEADDED>
<LASTPLAYED>2011-11-07T02:16:33</LASTPLAYED>
<RATING>0</RATING>
<PLAYEDCOUNT>2</PLAYEDCOUNT>
</T_ITUNES_EXPORT>
<T_ITUNES_EXPORT>
<FILE>S:\SOUNDPOOL\ALBUMS\VARIOUS ARTISTS\(AHK-TOONG BAY-BI) COVERED [2011]\GLASVEGAS - Acrobat [2011#11].AIF</FILE>
<GROUPING></GROUPING>
<COMPILATION>1</COMPILATION>
<GAPLESS>0</GAPLESS>
<DATEADDED>2011-02-01T01:35:07</DATEADDED>
<LASTPLAYED>2011-11-07T02:20:42</LASTPLAYED>
<RATING>0</RATING>
<PLAYEDCOUNT>2</PLAYEDCOUNT>
</T_ITUNES_EXPORT>
I'm on OSX Ventura 13.6.4, Music App Version 1.3.6.14
Mac Studio (2023)