Beegrene
Beegrene

Reputation: 41

Get file details in python

I'm trying to extract the details of a file using Python. Specifically, when I right click a photo and select properties, under the Details tab of the menu that pops up, there's a whole bunch of details about the file. What I really need is the contents of the "People" detail.

This is the menu in question:

Is there a good way of getting that People detail in a string or something?

Some people have suggested using ExifRead. I tried that, but it didn't pull the People tag out of the Exif data.

Upvotes: 4

Views: 3311

Answers (1)

Burhan Khalid
Burhan Khalid

Reputation: 174758

This is not EXIF data but rather data that Windows populates for different types of objects in the Windows Property System.

The one you are concerned with is called System.Photo.PeopleNames:

propertyDescription
   name = System.Photo.PeopleNames
   shellPKey = PKEY_Photo_PeopleNames
   formatID = E8309B6E-084C-49B4-B1FC-90A80331B638
   propID = 100
   searchInfo
      inInvertedIndex = true
      isColumn = true
      isColumnSparse = true
      columnIndexType = OnDemand
      maxSize = 128
      mnemonics = people|people tag|people tags
   labelInfo
      label = People
      sortDescription
      invitationText = Add a people tag
      hideLabel = false
   typeInfo
      type = String
      groupingRange = Discrete
      isInnate = true
      canBePurged = true
      multipleValues = true
      isGroup = false
      aggregationType = Union
      isTreeProperty = false
      isViewable = true
      isQueryable (Vista) = false
      includeInFullTextQuery (Vista) = false
      searchRawValue (Windows 7) = true
      conditionType = String
      defaultOperation = Equal
   aliasInfo
      sortByAlias = None
      additionalSortByAliases = None
   displayInfo
      defaultColumnWidth = 11
      displayType = String
      alignment = Left
      relativeDescriptionType = General
      defaultSortDirection = Ascending
      stringFormat
         formatAs = General
      booleanFormat
         formatAs = YesNo
      numberFormat
         formatAs = General
         formatDurationAs = hh:mm:ss
      dateTimeFormat
         formatAs = General
         formatTimeAs = ShortTime
         formatDateAs = ShortDate
      enumeratedList
         defaultText
         useValueForDefault = False
         enum
            value
            text
         enumRange
            minValue
            setValue
            text
      drawControl
         control = Default
      editControl
         control = Default
      filterControl
         control = Default
      queryControl
         control = Default

To access this information in Python, use win32com.propsys.

Upvotes: 1

Related Questions