Skip to content

Commit

Permalink
Fix for #95 kMDItemContentTypeTree serialization
Browse files Browse the repository at this point in the history
  • Loading branch information
RhetTbull committed Apr 19, 2023
1 parent 21e9f4f commit 72f7d0f
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions osxmetadata/mditem.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,11 +160,14 @@ def get_mditem_metadata(
return CFDate_to_datetime(value)
elif attribute_type == "list[datetime.datetime]":
return [CFDate_to_datetime(x) for x in value]
# these are a hack but works for MDImporter attributes that don't have a documented type
elif "__NSCFArray" in repr(type(value)):
# this is a hack but works for MDImporter attributes that don't have a documented type
return [str(x) for x in value]
elif "__NSArrayI" in repr(type(value)):
return [str(x) for x in value]
elif "__NSArrayM" in repr(type(value)):
return [str(x) for x in value]
elif "__NSTaggedDate" in repr(type(value)):
# this is a hack but works for MDImporter attributes that don't have a documented type
return NSDate_to_datetime(value)
elif isinstance(value, objc.pyobjc_unicode):
return str(value)
Expand Down

0 comments on commit 72f7d0f

Please sign in to comment.