1 2 Previous Next 16 Replies Latest reply on Aug 9, 2015 4:26 PM by DaleYoung_1

    Import iTunes library?!

    Lars456

      Title

      Import iTunes library?!

      Post

      Hi

       

      Is there a way to import one or more itunes libraries to filemaker? I use FM9.

      I have different itunes libraries and want to combine all the informations in one database. 

       

      As I know from a coworker, Filemaker 10 offers new templates like Music Library, is it possible to import different itunes-Databases into this file? 

      An extraction of the cover out of the mp3 into the cover-field would be nice but is not a must-have :-)

       

       

      Thanks,

      Lars 

        • 1. Re: Import iTunes library?!
          spiffking03
             I'm actually using filemaker 10 and I'm not so sure the new template is all it's cracked up to be. I'm running into all sorts of script errors for "integer" when I try to import them. Doesn't matter which field, it just doesn't like the word "integer" and the iTunes library XML uses it quite a bit.
          • 2. Re: Import iTunes library?!
            lolliffe
               I agree.  Importing information, well, in particular tracks and times, is in no way intuitive, and at first glance, looks like it might be impossible.  I can't believe that there isn't an obvious way to do this from iTunes.
            • 3. Re: Import iTunes library?!
              apw

              Yes, there is. I succeeded in importing files from an iTunes library, but I am only halfway.

               

              Import through File/Import/Folder, the folder being the iTunes library.

              Now you have to indicate the matching records.

              I assume the records in Filemaker to which you want to attach an iTunes file have a record number. If not, assign a record number automatically.

              Convert this record number to a text variable  within FMP as follows: 'record number & ".mp3"'. (Calculation, the result must be text.)

              Match this text variable with the file name in iTunes.

               

              It works, but you have to adjust the iTunes file names somewhat.

              First of all, the extension is not always ".mp3".

              Secondly, iTunes adds digits to a song title; these have be removed.

               

              As I have to import some 25000 iTunes files, I am now trying to find a way to address and manipulate the iTunes file data directly, so that i do not have to adjust all the file names in iTunes.

              I'll keep you informed.

               

               

              • 4. Re: Import iTunes library?!
                apw

                A small correction.

                 

                In the third line I should have written " the folder being an album in the iTunes file", not the whole file.

                 

                That's as far as I've got.

                • 5. Re: Import iTunes library?!
                  FentonJones

                  The way I Import my iTunes Library is via XML Import, using an XSL stylesheet to transform the data for FileMaker import. Much of the data about the songs is in the xml file, "iTunes Music Library.xml", which is in your iTunes folder, in your Music folder. It has the song name, the album, the artist, and some other info, including the URL syntax location of the file; which can open iTunes and play the song using the OpenURL step (if iTunes is the default for such, which it is by default).

                   

                  The "iTunes Music Library.xml" file is a "plist" file (property list?), the standard Mac OS xml structure for most preference files, etc., including its applications, such as iTunes & iPhoto. It uses a somewhat abstract structure, for maximum flexibilty. Basically the data is in the next element, after the one which has the key name (or label) of the data. There is a special XSL element to target the next element of the same level, so it is not hard to get (once you know how :-)

                   

                  <xsl:value-of select="key[text()='Track ID']/following-sibling::*" />

                   

                  If you want to automate this further, you can target the xml directly in a script. You can also calculation its path, using AppleScript to get the folder. There is a special AppleScript command for the location of your Music folder.

                   

                  path to music folder as text

                  -- "Macintosh HD:Users:fej:Music:"

                   

                  I will just paste the XSL stylesheet here, as it is awkward to attach files. 

                   

                   

                  <?xml version="1.0" encoding="utf-8"?>
                  <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                    <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
                    <xsl:template match="/">
                      <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
                        <ERRORCODE>0</ERRORCODE>
                        <PRODUCT BUILD="" NAME="" VERSION="" />
                        <DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="" />
                        <METADATA>
                          <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track ID" TYPE="NUMBER" />
                          <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Name" TYPE="TEXT" />
                          <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Artist" TYPE="TEXT" />
                          <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album" TYPE="TEXT" />
                          <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Location" TYPE="TEXT" />
                        </METADATA>
                        <RESULTSET FOUND="">
                          <xsl:for-each select="/plist/dict/dict/dict">
                            <ROW MODID="0" RECORDID="">
                              <COL>
                                <DATA>
                                  <xsl:value-of select="key[text()='Track ID']/following-sibling::*" />
                                </DATA>
                              </COL>
                              <COL>
                                <DATA>
                                  <xsl:value-of select="key[text()='Name']/following-sibling::*" />
                                </DATA>
                              </COL>
                              <COL>
                                <DATA>
                                  <xsl:value-of select="key[text()='Artist']/following-sibling::*" />
                                </DATA>
                              </COL>
                              <COL>
                                <DATA>
                                  <xsl:value-of select="key[text()='Album']/following-sibling::*" />
                                </DATA>
                              </COL>
                              <COL>
                                <DATA>
                                  <xsl:value-of select="key[text()='Location']/following-sibling::*" />
                                </DATA>
                              </COL>
                            </ROW>
                          </xsl:for-each>
                        </RESULTSET>
                      </FMPXMLRESULT>
                    </xsl:template>
                  </xsl:stylesheet>

                   

                   

                  • 6. Re: Import iTunes library?!
                    apw

                    iMac, FMP 11, OS 10.6.2

                     

                    All of a sudden it became quiet after your dazzling display of professional expertise.:smileyvery-happy:

                    I think the reason was that one expected a solution in terms of the presently available and easily accessible possibilities within FMP and iTunes.

                    But easy solutions are apparently not always available.

                    I did some studying and now I understand most of your message.

                    The song data are available in the"iTunes Music Library.xml" file, which was very useful information.

                    This is a *.xml file and can be accessed with a *.xsl stylesheet.

                    I know by now what XML and XSL are; I even have an editor for XML and XSL, be it on a trial base, called EditiX.

                    I imported your style sheet into EditiX, which resulted eventually in a correct *.xml file.

                    I did not succeed in "assigning XSLT status" to the file, so I simply changed the extension into *.xslt, a doubtful procedure.

                    Can I run your style sheet as it is or is some processing required?

                    Nevertheless, FMP accepted the style sheet, but only one empty record was added.

                     

                    I am afraid I shall have to learn the XSL language - I'm getting a grasp of its structure by inputting your sheet - but it would help, if you could describe what is going on in your style sheet. I assume that "METADATA" are a description of the data in the *.xml file.

                     

                    Furthermore, could you recommend a XML-XSL editor and a language description?

                    • 7. Re: Import iTunes library?!
                      FentonJones

                      Yes, it is not as easy as you might think. But it is the most direct way to do it. I'm uploading a link to my file, on my web site. It will be there for a while. 

                       

                      http://fentonjones.com/New/iTunesLibrary_to_FM.zip

                       

                      Hopefully it will work for anyone with a standard set up of iTunes. But I can't guarantee that. It uses AppleScript to dynamically get your path to your Music folder. The iTunes folder should be within there, with the iTunes Music Library.xml at its top level.

                       

                      XML/XSL is a little difficult to grasp at first. But you've been using it's less powerful sibling HTML for years. The "X" in XML means "extsensible." You can create your own tags, as long as you follow the rules. XSL is a sibling of XML, a markup language to filter, extract and augment XML. Together they can do a great deal.

                       

                      As far as XML programs. I am basically a lightweight XML user (comparatively). So most dedicated XML/XSL applications have way more do-das than I need (or want). I use an older free app, TestXSLT, which is designed for the kind of light work I do, and to work interactively with my text editor BBEdit (or TextWrangler I believe). In other words, I write the XSL in BBEdit, Save the file, and the changes show up in TestXSLT, which is basically a "transformation" tool. Available somewhere here:

                       

                      http://www.entropy.ch/software/macosx/

                       

                      If you have BBEdit, you will also want the BBEdit XSLT Language Clipping set, on the same page.

                       

                      TestXSLT is not entirely stable, as it is old. It will Quit unexpectedly occasionally (often on quit or launch), but usually this doesn't matter, as the actual data is in BBEdit, not TestXSLT. So I just launch it again.

                       

                      There is also a free (non-commercial) XML/XSL editor (4th paragraph) at: http://www.exchangerxml.com/

                       

                      There is also oXygen, which has a low non-commercial license: http://www.oxygenxml.com/download.html

                       

                      But for my needs, simple xsl stylesheets, I find TestXSLT the easiest to use.

                      • 8. Re: Import iTunes library?!
                        FentonJones

                        RE: METADATA 

                        It is a description of the FileMaker Fields you want, with the Type of field. They are the names you see in the Import XML field line-up, and FileMaker will not Import XML without them. It is assumed that they match the order of the data in the RESULTSET below (but it's up to you to make sure they do). 

                         

                        If you transformed the XML outside of FileMaker (which you can), to create a FileMaker syntax xml file, then just used Open, XML Data Source, then FileMaker could create a new FileMaker database from the file, naming the fields and making them the type specified.

                        • 9. Re: Import iTunes library?!
                          apw

                          Thanks for your time and effort.

                          I downloaded the recommended tools.

                          First I'll try to get your programme running and work my way through it, getting acquainted with the employed techniques.

                          I'll keep you informed.

                          • 10. Re: Import iTunes library?!
                            apw

                            The import from the iTunes.xml file works flawlessly. I still have to work out the path file, but I expect no problem there.

                            I am importing 'Total Time' from the iTunes file which is expressed in thousands of seconds. I can transform the data within FMP, but i would prefer to import 'Total Time' in minutes/seconds. I tried already "key[time()='Total Time'] etc, but it doesn't work.

                            Is it possible to import 'Total Time' from iTunes in a minutes/seconds format?

                            • 11. Re: Import iTunes library?!
                              FentonJones

                              I would think you'd want to keep the 1000th of a second timing, as it is more accurate. You could then auto-enter it into another  FileMaker field (xml total time/1000), with a Time result. Interestingly, though it displays like a regular FileMaker Time field (hours:minutes:seconds), as you'd expect, if you click into the field, you will see the "thousandths" as a decimal. Apparently this is stored; I subtracted an even second from the above, and the decimal remained the same in the resulting field.

                               

                              XSL also has some simple math operators; it had "div", and "mod". So you could do the above on the xml data before passing to FileMaker.

                               

                              <COL>
                              <DATA>
                              <xsl:variable name="total_time" select="key[text()='Total Time']/following-sibling::*"/>
                              <xsl:value-of select="ceiling ($total_time div 1000)" />
                              </DATA>
                              </COL>

                               

                              rounds up to the next second in every case; or you could use round () or floor ()

                              • 12. Re: Import iTunes library?!
                                barefootguru

                                Awesome, thanks Fenton.  Found this thread through a Google search and with a bit of programming-by-Google have added every field I found in the iTunes Music Library file.

                                 

                                 

                                <?xml version="1.0" encoding="utf-8"?>
                                <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                                     <!-- 2010-05-22 Tom Robinson, based on stylesheet to import 5 fields by Fenton Jones http://forum-en.filemaker.com/t5/Using-FileMaker-Pro/Import-iTunes-library/td-p/5560 -->
                                     <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
                                     <xsl:template match="/">
                                          <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
                                               <ERRORCODE>0</ERRORCODE>
                                               <PRODUCT BUILD="" NAME="" VERSION="" />
                                               <DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="" />
                                               <METADATA>  <!-- Fields defined in same order as found in iTunes file -->
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track ID" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Name" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Artist" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album Artist" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Composer" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Grouping" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Genre" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Kind" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Size" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Total Time" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Start Time" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Stop Time" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Disc Number" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Disc Count" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track Number" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track Count" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Year" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="BPM" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Date Modified UTC" TYPE="TIMESTAMP" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Date Added UTC" TYPE="TIMESTAMP" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Bit Rate" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sample Rate" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Part of Gapless Album" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Volume Adjustment" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Equalizer" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Comments" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Play Count" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Play Date" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Play Date UTC" TYPE="TIMESTAMP" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Release Date UTC" TYPE="TIMESTAMP" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Skip Count" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Skip Date UTC" TYPE="TIMESTAMP" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Rating" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album Rating" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album Rating Computed" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Compilation" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Artwork Count" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Series" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Season" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Episode" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Episode Order" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Album" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Album Artist" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Artist" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Composer" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Name" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Series" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Persistent ID" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Clean" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Disabled" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Explicit" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track Type" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Has Video" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="HD" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Video Width" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Video Height" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Movie" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Music Video" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Podcast" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Purchased" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="TV Show" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Protected" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Normalization" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="File Type" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Location" TYPE="TEXT" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="File Folder Count" TYPE="NUMBER" />
                                                    <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Library Folder Count" TYPE="NUMBER" />
                                               </METADATA>
                                               <RESULTSET FOUND="">
                                                    <xsl:for-each select="/plist/dict/dict/dict">
                                                         <ROW MODID="0" RECORDID="">
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Track ID']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Name']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Artist']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Album Artist']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Composer']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Album']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Grouping']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Genre']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Kind']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Size']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Total Time']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Start Time']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Stop Time']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Disc Number']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Disc Count']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Track Number']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Track Count']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Year']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='BPM']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="substring(key[text()='Date Modified']/following-sibling::*,1,10)" />
                                                                        <xsl:text> </xsl:text>
                                                                        <xsl:value-of select="substring(key[text()='Date Modified']/following-sibling::*,12,8)" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="substring(key[text()='Date Added']/following-sibling::*,1,10)" />
                                                                        <xsl:text> </xsl:text>
                                                                        <xsl:value-of select="substring(key[text()='Date Added']/following-sibling::*,12,8)" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Bit Rate']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Sample Rate']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Part Of Gapless Album']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Volume Adjustment']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Equalizer']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Comments']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Play Count']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Play Date']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="substring(key[text()='Play Date UTC']/following-sibling::*,1,10)" />
                                                                        <xsl:text> </xsl:text>
                                                                        <xsl:value-of select="substring(key[text()='Play Date UTC']/following-sibling::*,12,8)" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="substring(key[text()='Release Date']/following-sibling::*,1,10)" />
                                                                        <xsl:text> </xsl:text>
                                                                        <xsl:value-of select="substring(key[text()='Release Date']/following-sibling::*,12,8)" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Skip Count']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="substring(key[text()='Skip Date']/following-sibling::*,1,10)" />
                                                                        <xsl:text> </xsl:text>
                                                                        <xsl:value-of select="substring(key[text()='Skip Date']/following-sibling::*,12,8)" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Rating']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Album Rating']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Album Rating Computed']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Compilation']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Artwork Count']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Series']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Season']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Episode']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Episode Order']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Sort Album']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Sort Album Artist']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Sort Artist']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Sort Composer']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Sort Name']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Sort Series']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Persistent ID']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Clean']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Disabled']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Explicit']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Track Type']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Has Video']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='HD']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Video Width']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Video Height']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Movie']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Music Video']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Podcast']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Purchased']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='TV Show']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Protected']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:if test="key[text()='Normalization']/following-sibling::*[1][self::true]">1</xsl:if>
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='File Type']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Location']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='File Folder Count']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                              <COL>
                                                                   <DATA>
                                                                        <xsl:value-of select="key[text()='Library Folder Count']/following-sibling::*" />
                                                                   </DATA>
                                                              </COL>
                                                         </ROW>
                                                    </xsl:for-each>
                                               </RESULTSET>
                                          </FMPXMLRESULT>
                                     </xsl:template>
                                </xsl:stylesheet>

                                 

                                [You would think the BB software would be smart enough not to parse text inside a code block.  That stupid smily above is a colon followed by 'o']

                                 

                                • 13. Re: Import iTunes library?!
                                  dumiya

                                  Hi

                                  (An agricultural way of doing it)

                                  However depending on what you want:

                                  I sorted the iTunes columns in the order I wanted.

                                  Selected all the entries I wanted

                                  Pasted in to a word processer to sort out that the tabs were correct

                                  Created  a File in FM with the fields I wanted (This I think is automatic if you use excel)

                                  Then imported the Info.

                                  Etc

                                  Then looked for duplicates (from the other itunes library)

                                  Worked for me but it was very hands on doing it

                                  Please disregard if I have missed the point of the question!

                                  • 14. Re: Import iTunes library?!
                                    barefootguru

                                    I improved my XLST to import the Total Time (track length) into a FileMaker time field (and also improved the date coding).

                                     

                                    Note you can't just format seconds as a time field in FileMaker--it only works if there's a decimal.  e.g. 61.1 displays correctly as 0:01:01 but 62 displays as 62:00:00

                                     

                                    As an added complication FileMaker ignores the XLST command to format a number with decimals, so I've used string functions instead.

                                     

                                    (Posted in 2 parts to keep under 20K limit.)

                                     

                                    Cheers

                                     

                                    <?xml version="1.0" encoding="utf-8"?>
                                    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
                                         <!-- 2010-05-22 Tom Robinson, based on stylesheet to import 5 fields by Fenton Jones http://forum-en.filemaker.com/t5/Using-FileMaker-Pro/Import-iTunes-library/td-p/5560 -->
                                         <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="yes" />
                                         <xsl:template match="/">
                                              <FMPXMLRESULT xmlns="http://www.filemaker.com/fmpxmlresult">
                                                   <ERRORCODE>0</ERRORCODE>
                                                   <PRODUCT BUILD="" NAME="" VERSION="" />
                                                   <DATABASE DATEFORMAT="" LAYOUT="" NAME="" RECORDS="" TIMEFORMAT="" />
                                                   <METADATA>  <!-- Fields defined in same order as found in iTunes file -->
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track ID" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Name" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Artist" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album Artist" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Composer" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Grouping" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Genre" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Kind" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Size" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Total Time" TYPE="TIME" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Start Time" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Stop Time" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Disc Number" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Disc Count" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track Number" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track Count" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Year" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="BPM" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Date Modified UTC" TYPE="TIMESTAMP" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Date Added UTC" TYPE="TIMESTAMP" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Bit Rate" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sample Rate" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Part of Gapless Album" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Volume Adjustment" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Equalizer" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Comments" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Play Count" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Play Date" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Play Date UTC" TYPE="TIMESTAMP" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Release Date UTC" TYPE="TIMESTAMP" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Skip Count" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Skip Date UTC" TYPE="TIMESTAMP" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Rating" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album Rating" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Album Rating Computed" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Compilation" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Artwork Count" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Series" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Season" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Episode" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Episode Order" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Album" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Album Artist" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Artist" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Composer" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Name" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Sort Series" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Persistent ID" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Clean" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Disabled" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Explicit" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Track Type" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Has Video" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="HD" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Video Width" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Video Height" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Movie" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Music Video" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Podcast" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Purchased" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="TV Show" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Protected" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Normalization" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="File Type" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Location" TYPE="TEXT" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="File Folder Count" TYPE="NUMBER" />
                                                        <FIELD EMPTYOK="YES" MAXREPEAT="1" NAME="Library Folder Count" TYPE="NUMBER" />
                                                   </METADATA>
                                    
                                    1 2 Previous Next