• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Import PDF meta data - field mapping
#1
Hi, first post.

As far as I understand, importing of meta data in a PDF into the meta data fields of a song in MobileSheets now works. I found this conversation that provides a little bit of information: https://www.zubersoft.com/mobilesheets/f...-8020.html

But there is no details on how this actually works. In particular hat PDF meta data fields are mapped to what MobileSheet song meta data fields?

Here are the PDF fields (I think):
Title, Author, Subject, Keywords, Creator, Producer

In that thread Mike says that
Title -> Title
Author -> Composers
Subject -> Genres

Is that it? Or will any of the others be mapped in some way? Is this documented somewhere? The manual seems a bit old (3.6.2) and I cannot find any info there.

I am producing my PDFConfused with a python program using th pypdf library. I can write several meta data fields, including "CustomFields". Is this the way to do it to add things like Artists and Lyricists?
Reply
#2
The mapping in most cases is very straight forward, i.e. Artist -> Artist, Collection->Collection, Year -> Year, etc. These are not standard fields though - it's more like custom metadata (typically using the xmpDM namespace). For the more standardized fields, Author maps to Composer, Books maps to Album, Subject maps to Genre, Keywords maps to Keywords and Title maps to Title. I don't support Creator or Producer.

This is the full list of fields I look for:

                    "Title", "Artist", "Album", "Keywords", "Composer", "Genre", "Books",
                    "Collection", "Setlist", "Key", "Signature", "Year", "Subject", "Author",
                    "Duration", "CustomGroup", "SourceType", "Custom", "Custom2"

using the PDF library method of getting metadata, and then 

                            "composer", "album", "artist", "genre",
                            "key", "Composer", "Album", "Artist", "Genre", "Key",
                            "Collection", "collection", "Setlist", "setlist", "signature", "Signature",
                            "Year", "year", "Duration", "duration", "CustomGroup", "customGroup",
                            "SourceType", "sourceType", "custom", "Custom", "custom2", "Custom2"

using an xpath query of ".//*/Description/<field>" of the XMP data retrieved from the PDF. I also do a search for .//xmpDM:<field> for composer, album, artist, genre and key just to cover all possibilities.

Mike
Reply
#3
Great! Thanks. I will experiment and see what I can put into my PDFs using the pypdf library!
Reply
#4
(02-25-2024, 07:38 AM)andreaskagedal Wrote: Great! Thanks. I will experiment and see what I can put into my PDFs using the pypdf library!

I think pypdf cannot write XMP Metadata.
I wrote a Script using the exiftool Library.
And currently I am working to replace it with xmp-toolkit
Reply
#5
(02-25-2024, 04:45 PM)kabakakao Wrote:
(02-25-2024, 07:38 AM)andreaskagedal Wrote: Great! Thanks. I will experiment and see what I can put into my PDFs using the pypdf library!

I think pypdf cannot write XMP Metadata.
I wrote a Script using the exiftool Library.
And currently I am working to replace it with xmp-toolkit

The  "PDF library method" worked fine. I could write all attributes with pypdf and they were picked up by MobileSheets when I imported the PDF. Great! (Actually, I did not try them all, but the ones I tried did work)

What exactly is the point of using the "xpath" attributes? It seems to be the same ones supported.

For me it would have been nice to also be able to import the "tempos" field. But it is not critical. If it is ever supported, I will probably use it. It is supported by the CVS import, so it does not seem completely unrealistic.

I see that forscore (the competing iPad app) also support importing some of the fields using the standard PDF field "Keywords". I guess the only point in suporting this would be to be able to import the same scores in both apps with the same result.
Reply
#6
I can add support for tempos - that's not a difficult change to make. As far as your question, the xpath queries were absolutely required based on feedback from the last forum post about this. The PDF library "getMeta" calls do not grab the values from XMP in the same way as the xpath query, and different tools populate the metadata in different ways, so I wanted to cover all my bases.

Mike
Reply
#7
Thumbs Up 
OK. I understand. And adding support for tempos would be great (but is not super urgent). Thanks!
Reply
#8
I see from the realease notes for 3.8.32 that the support for importing Tempo from pdf metadata has already been implemented! Great! And thanks for extremely quick response. Wonderful. I will be using this for sure.
Reply
#9
You are welcome - glad it will be of use to you!

Mike
Reply




Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2024 MyBB Group.