Created
June 1, 2016 04:23
-
-
Save nkalvi/7e277d3be15d4746733f7bf9d2e5f2d0 to your computer and use it in GitHub Desktop.
Python3.5: List iOS app details in tabular form (by reading .ipa files under ~/Music/iTunes/iTunes Media/Mobile Applications/)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys | |
import plistlib | |
import zipfile | |
import glob | |
import os | |
columns = ['Title', 'Seller', 'Category', 'version', 'Released', 'Purchased', 'AppleIdForPurchase'] | |
print(*columns, sep = "\t") | |
for f in glob.glob(os.path.expanduser('~/Music/iTunes/iTunes Media/Mobile Applications/') + '*.ipa'): | |
with zipfile.ZipFile(f) as myzip: | |
fp = myzip.read('iTunesMetadata.plist') | |
pl = plistlib.loads(fp) | |
values = [ pl['itemName'], pl['artistName'], pl['genre'], pl.get('bundleShortVersionString', 'no version'), pl['releaseDate'], | |
pl['purchaseDate'], pl['com.apple.iTunesStore.downloadInfo']['accountInfo']['AppleID'] ] | |
print(*values, sep = "\t") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment