Getting IPA details in scripts

I read someplace on the net that one could use “defaults” to read the fields in an IPA file, a simpler method is to simply use plutil. Assuming that the iTunesMetadata.plist is already extracted from the IPA file, the following examples will get the fields from the plist.

a=`plutil -p iTunesMetadata.plist | grep -i appleId | cut -d "\"" -f4`
b=`plutil -p iTunesMetadata.plist | grep -i genre | cut -d "\"" -f4`
c=`plutil -p iTunesMetadata.plist | grep -i itemName | cut -d "\"" -f4 | tr -d ';*\".$' | tr ':' '-' | tr '/' '&'`
d=`plutil -p iTunesMetadata.plist | grep -i bundleShortVersionString | cut -d "\"" -f4`

Some of the common characters appearing the itemName have been “fixed” in this example. Unlike the “defaults” to read the plist, “plutil” keeps the proper encoding, besides being easier to parse and deal with.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s