mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Add OS X imported UTI types into public UTI map
This commit is contained in:
parent
26e4ca1852
commit
afe811111d
@ -21,16 +21,17 @@ def generate_public_uti_map():
|
|||||||
raw = urllib.urlopen(
|
raw = urllib.urlopen(
|
||||||
'https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html').read()
|
'https://developer.apple.com/library/ios/documentation/Miscellaneous/Reference/UTIRef/Articles/System-DeclaredUniformTypeIdentifiers.html').read()
|
||||||
root = html5lib.parse(raw, treebuilder='lxml', namespaceHTMLElements=False)
|
root = html5lib.parse(raw, treebuilder='lxml', namespaceHTMLElements=False)
|
||||||
table = root.xpath('//table')[0]
|
tables = root.xpath('//table')[0::2]
|
||||||
data = {}
|
data = {}
|
||||||
for tr in table.xpath('descendant::tr')[1:]:
|
for table in tables:
|
||||||
td = tr.xpath('descendant::td')
|
for tr in table.xpath('descendant::tr')[1:]:
|
||||||
identifier = etree.tostring(td[0], method='text', encoding=unicode).strip()
|
td = tr.xpath('descendant::td')
|
||||||
tags = etree.tostring(td[2], method='text', encoding=unicode).strip()
|
identifier = etree.tostring(td[0], method='text', encoding=unicode).strip()
|
||||||
identifier = identifier.split()[0].replace('\u200b', '')
|
tags = etree.tostring(td[2], method='text', encoding=unicode).strip()
|
||||||
exts = [x.strip()[1:].lower() for x in tags.split(',') if x.strip().startswith('.')]
|
identifier = identifier.split()[0].replace('\u200b', '')
|
||||||
for ext in exts:
|
exts = [x.strip()[1:].lower() for x in tags.split(',') if x.strip().startswith('.')]
|
||||||
data[ext] = identifier
|
for ext in exts:
|
||||||
|
data[ext] = identifier
|
||||||
lines = ['PUBLIC_UTI_MAP = {']
|
lines = ['PUBLIC_UTI_MAP = {']
|
||||||
for ext in sorted(data):
|
for ext in sorted(data):
|
||||||
r = ("'" + ext + "':").ljust(16)
|
r = ("'" + ext + "':").ljust(16)
|
||||||
@ -47,14 +48,18 @@ PUBLIC_UTI_MAP = {
|
|||||||
'3gp': 'public.3gpp',
|
'3gp': 'public.3gpp',
|
||||||
'3gp2': 'public.3gpp2',
|
'3gp2': 'public.3gpp2',
|
||||||
'3gpp': 'public.3gpp',
|
'3gpp': 'public.3gpp',
|
||||||
|
'ai': 'com.adobe.illustrator.ai-image',
|
||||||
'aif': 'public.aiff-audio',
|
'aif': 'public.aiff-audio',
|
||||||
'aifc': 'public.aifc-audio',
|
'aifc': 'public.aifc-audio',
|
||||||
'aiff': 'public.aiff-audio',
|
'aiff': 'public.aiff-audio',
|
||||||
'app': 'com.apple.application-bundle',
|
'app': 'com.apple.application-bundle',
|
||||||
'applescript': 'com.apple.applescript.text',
|
'applescript': 'com.apple.applescript.text',
|
||||||
|
'asf': 'com.microsoft.advanced-systems-format',
|
||||||
|
'asx': 'com.microsoft.advanced-stream-redirector',
|
||||||
'au': 'public.ulaw-audio',
|
'au': 'public.ulaw-audio',
|
||||||
'avi': 'public.avi',
|
'avi': 'public.avi',
|
||||||
'bin': 'com.apple.macbinary-archive',
|
'bin': 'com.apple.macbinary-archive',
|
||||||
|
'bmp': 'com.microsoft.bmp',
|
||||||
'bundle': 'com.apple.bundle',
|
'bundle': 'com.apple.bundle',
|
||||||
'c': 'public.c-source',
|
'c': 'public.c-source',
|
||||||
'c++': 'public.c-plus-plus-source',
|
'c++': 'public.c-plus-plus-source',
|
||||||
@ -70,9 +75,15 @@ PUBLIC_UTI_MAP = {
|
|||||||
'defs': 'public.mig-source',
|
'defs': 'public.mig-source',
|
||||||
'dfont': 'com.apple.truetype-datafork-suitcase-font',
|
'dfont': 'com.apple.truetype-datafork-suitcase-font',
|
||||||
'dll': 'com.microsoft.windows-dynamic-link-library',
|
'dll': 'com.microsoft.windows-dynamic-link-library',
|
||||||
|
'doc': 'com.microsoft.word.doc',
|
||||||
|
'efx': 'com.js.efx-fax',
|
||||||
|
'eps': 'com.adobe.encapsulated-postscript',
|
||||||
'exe': 'com.microsoft.windows-executable',
|
'exe': 'com.microsoft.windows-executable',
|
||||||
'exp': 'com.apple.symbol-export',
|
'exp': 'com.apple.symbol-export',
|
||||||
|
'exr': 'com.ilm.openexr-image',
|
||||||
|
'fpx': 'com.kodak.flashpix.image',
|
||||||
'framework': 'com.apple.framework',
|
'framework': 'com.apple.framework',
|
||||||
|
'gif': 'com.compuserve.gif',
|
||||||
'gtar': 'org.gnu.gnu-tar-archive',
|
'gtar': 'org.gnu.gnu-tar-archive',
|
||||||
'gz': 'org.gnu.gnu-zip-archive',
|
'gz': 'org.gnu.gnu-zip-archive',
|
||||||
'gzip': 'org.gnu.gnu-zip-archive',
|
'gzip': 'org.gnu.gnu-zip-archive',
|
||||||
@ -86,16 +97,20 @@ PUBLIC_UTI_MAP = {
|
|||||||
'icc': 'com.apple.colorsync-profile',
|
'icc': 'com.apple.colorsync-profile',
|
||||||
'icm': 'com.apple.colorsync-profile',
|
'icm': 'com.apple.colorsync-profile',
|
||||||
'icns': 'com.apple.icns',
|
'icns': 'com.apple.icns',
|
||||||
|
'ico': 'com.microsoft.ico',
|
||||||
'jar': 'com.sun.java-archive',
|
'jar': 'com.sun.java-archive',
|
||||||
'jav': 'com.sun.java-source',
|
'jav': 'com.sun.java-source',
|
||||||
'java': 'com.sun.java-source',
|
'java': 'com.sun.java-source',
|
||||||
'javascript': 'com.netscape.javascript-source',
|
'javascript': 'com.netscape.javascript-source',
|
||||||
|
'jfx': 'com.j2.jfx-fax',
|
||||||
'jnlp': 'com.sun.java-web-start',
|
'jnlp': 'com.sun.java-web-start',
|
||||||
'jp2': 'public.jpeg-2000',
|
'jp2': 'public.jpeg-2000',
|
||||||
'jpeg': 'public.jpeg',
|
'jpeg': 'public.jpeg',
|
||||||
'jpg': 'public.jpeg',
|
'jpg': 'public.jpeg',
|
||||||
'js': 'com.netscape.javascript-source',
|
'js': 'com.netscape.javascript-source',
|
||||||
'jscript': 'com.netscape.javascript-source',
|
'jscript': 'com.netscape.javascript-source',
|
||||||
|
'key': 'com.apple.keynote.key',
|
||||||
|
'kth': 'com.apple.keynote.kth',
|
||||||
'm': 'public.objective-c-source',
|
'm': 'public.objective-c-source',
|
||||||
'm15': 'public.mpeg',
|
'm15': 'public.mpeg',
|
||||||
'm4a': 'public.mpeg-4-audio',
|
'm4a': 'public.mpeg-4-audio',
|
||||||
@ -113,6 +128,7 @@ PUBLIC_UTI_MAP = {
|
|||||||
'o': 'public.object-code',
|
'o': 'public.object-code',
|
||||||
'otf': 'public.opentype-font',
|
'otf': 'public.opentype-font',
|
||||||
'pct': 'com.apple.pict',
|
'pct': 'com.apple.pict',
|
||||||
|
'pdf': 'com.adobe.pdf',
|
||||||
'pf': 'com.apple.colorsync-profile',
|
'pf': 'com.apple.colorsync-profile',
|
||||||
'pfa': 'com.adobe.postscript.pfa-font',
|
'pfa': 'com.adobe.postscript.pfa-font',
|
||||||
'pfb': 'com.adobe.postscript-pfb-font',
|
'pfb': 'com.adobe.postscript-pfb-font',
|
||||||
@ -129,22 +145,34 @@ PUBLIC_UTI_MAP = {
|
|||||||
'pm': 'public.perl-script',
|
'pm': 'public.perl-script',
|
||||||
'png': 'public.png',
|
'png': 'public.png',
|
||||||
'pntg': 'com.apple.macpaint-image',
|
'pntg': 'com.apple.macpaint-image',
|
||||||
|
'ppt': 'com.microsoft.powerpoint.ppt',
|
||||||
|
'ps': 'com.adobe.postscript',
|
||||||
|
'psd': 'com.adobe.photoshop-image',
|
||||||
'py': 'public.python-script',
|
'py': 'public.python-script',
|
||||||
'qif': 'com.apple.quicktime-image',
|
'qif': 'com.apple.quicktime-image',
|
||||||
'qt': 'com.apple.quicktime-movie',
|
'qt': 'com.apple.quicktime-movie',
|
||||||
'qtif': 'com.apple.quicktime-image',
|
'qtif': 'com.apple.quicktime-image',
|
||||||
'qtz': 'com.apple.quartz-composer-composition',
|
'qtz': 'com.apple.quartz-composer-composition',
|
||||||
'r': 'com.apple.rez-source',
|
'r': 'com.apple.rez-source',
|
||||||
|
'ra': 'com.real.realaudio',
|
||||||
|
'ram': 'com.real.realaudio',
|
||||||
'rb': 'public.ruby-script',
|
'rb': 'public.ruby-script',
|
||||||
'rbw': 'public.ruby-script',
|
'rbw': 'public.ruby-script',
|
||||||
|
'rm': 'com.real.realmedia',
|
||||||
'rtf': 'public.rtf',
|
'rtf': 'public.rtf',
|
||||||
'rtfd': 'com.apple.rtfd',
|
'rtfd': 'com.apple.rtfd',
|
||||||
's': 'public.assembly-source',
|
's': 'public.assembly-source',
|
||||||
'scpt': 'com.apple.applescript.script',
|
'scpt': 'com.apple.applescript.script',
|
||||||
|
'sd2': 'com.digidesign.sd2-audio',
|
||||||
|
'sgi': 'com.sgi.sgi-image',
|
||||||
'sh': 'public.shell-script',
|
'sh': 'public.shell-script',
|
||||||
|
'sit': 'com.allume.stuffit-archive',
|
||||||
|
'sitx': 'com.allume.stuffit-archive',
|
||||||
|
'smil': 'com.real.smil',
|
||||||
'snd': 'public.ulaw-audio',
|
'snd': 'public.ulaw-audio',
|
||||||
'suit': 'com.apple.font-suitcase',
|
'suit': 'com.apple.font-suitcase',
|
||||||
'tar': 'public.tar-archive',
|
'tar': 'public.tar-archive',
|
||||||
|
'tga': 'com.truevision.tga-image',
|
||||||
'tgz': 'org.gnu.gnu-zip-tar-archive',
|
'tgz': 'org.gnu.gnu-zip-tar-archive',
|
||||||
'tif': 'public.tiff',
|
'tif': 'public.tiff',
|
||||||
'tiff': 'public.tiff',
|
'tiff': 'public.tiff',
|
||||||
@ -155,8 +183,18 @@ PUBLIC_UTI_MAP = {
|
|||||||
'vcard': 'public.vcard',
|
'vcard': 'public.vcard',
|
||||||
'vcf': 'public.vcard',
|
'vcf': 'public.vcard',
|
||||||
'vfw': 'public.avi',
|
'vfw': 'public.avi',
|
||||||
|
'wav': 'com.microsoft.waveform-audio',
|
||||||
|
'wave': 'com.microsoft.waveform-audio',
|
||||||
|
'wax': 'com.microsoft.windows-media-wax',
|
||||||
'wdgt': 'com.apple.dashboard-widget',
|
'wdgt': 'com.apple.dashboard-widget',
|
||||||
|
'wm': 'com.microsoft.windows-media-wm',
|
||||||
|
'wma': 'com.microsoft.windows-media-wma',
|
||||||
|
'wmp': 'com.microsoft.windows-media-wmp',
|
||||||
|
'wmv': 'com.microsoft.windows-media-wmv',
|
||||||
|
'wmx': 'com.microsoft.windows-media-wmx',
|
||||||
|
'wvx': 'com.microsoft.windows-media-wvx',
|
||||||
'xbm': 'public.xbitmap-image',
|
'xbm': 'public.xbitmap-image',
|
||||||
|
'xls': 'com.microsoft.excel.xls',
|
||||||
'xml': 'public.xml',
|
'xml': 'public.xml',
|
||||||
'zip': 'com.pkware.zip-archive',
|
'zip': 'com.pkware.zip-archive',
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user