Skip to content

Commit

Permalink
PICARD-1402: Register macOS app for supported file types
Browse files Browse the repository at this point in the history
Allows opening these file types from Finder or by drag and drop on the dock icon.
  • Loading branch information
phw committed Jan 14, 2020
1 parent bda5b5f commit 382d13c
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
33 changes: 33 additions & 0 deletions picard.spec
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,40 @@ else:
'CFBundleVersion': '%d.%d.%d' % PICARD_VERSION[:3],
'CFBundleShortVersionString': PICARD_VERSION.to_string(short=True),
'LSMinimumSystemVersion': '10.12',
'CFBundleDocumentTypes': [{
# Add UTIs understood by macOS
'LSItemContentTypes': [
'com.apple.m4a-audio',
'com.apple.m4v-video',
'com.apple.protected-mpeg-4-audio',
'com.microsoft.advanced-systems-format',
'com.microsoft.waveform-audio',
'com.microsoft.windows-media-wm',
'com.microsoft.windows-media-wma',
'com.microsoft.windows-media-wmv',
'org.xiph.flac',
'public.aac-audio',
'public.ac3-audio',
'public.aifc-audio',
'public.aiff-audio',
'public.enhanced-ac3-audio',
'public.midi-audio',
'public.mp3',
'public.mpeg-4',
'public.mpeg-4-audio',
],
'CFBundleTypeRole': 'Editor',
}],
}

# Add additional supported file types by extension
from picard.formats import supported_formats
for extensions, name in supported_formats():
info_plist['CFBundleDocumentTypes'].append({
'CFBundleTypeExtensions': [ext[1:] for ext in extensions],
'CFBundleTypeRole': 'Editor',
})

app = BUNDLE(coll,
name='{} {}.app'.format(PICARD_ORG_NAME, PICARD_APP_NAME),
icon='picard.icns',
Expand Down
2 changes: 1 addition & 1 deletion picard/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def unregister_module(self, name):
pass

def __iter__(self):
enabled_plugins = config.setting["enabled_plugins"]
enabled_plugins = config.setting["enabled_plugins"] if config.setting else []
for name in self.__dict:
if name is None or name in enabled_plugins:
for item in self.__dict[name]:
Expand Down

0 comments on commit 382d13c

Please sign in to comment.