Skip to content

[patreon] get per-image metadata #4286

@lectrode

Description

@lectrode

I would like to grab metadata for individual images in each post on patreon. Like the following (as found with -K):

images[N]['file_name']
images[N]['metadata']['dimensions']['h']
images[N]['metadata']['dimensions']['w']

However I can't seem to figure out how to get the current image N. {num} seems like it should work, but it doesn't, as images[{num}]['file_name'] returns None. Not only that, but it is the wrong value per image as well (the array index starts with 0, but {num} starts at 1).

Manually putting images[0]['file_name'] and images[1]['file_name'] works for getting the first 2 filenames, but ideally this would not be statically defined in the content format string.

For future reference, I'd also like to know how to output all values for an array. Something akin to the following:

images[*]['file_name']

content format is currently as follows (not doing what i'd like it to do):

"content-format"  : "resolution: {images[{num}]['metadata']['dimensions']['w']}x{images[{num}]['metadata']['dimensions']['h']}\nfilename: {images[{num}]['file_name']}\n\n"

Current example output:

resolution: NonexNone
filename: None

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions