Skip to content

Add Path to image scraper args#6856

Open
NativeRavenclaw wants to merge 2 commits intostashapp:developfrom
NativeRavenclaw:image-scraper-fields
Open

Add Path to image scraper args#6856
NativeRavenclaw wants to merge 2 commits intostashapp:developfrom
NativeRavenclaw:image-scraper-fields

Conversation

@NativeRavenclaw
Copy link
Copy Markdown

Tools like gallery-dl --write-metadata provide additional metadata to the download as separate file, i.e. /stash/pic.png gets an accompanying /stash/pic.png.json.

Adding a Path field to the scraper args will allow scrapers to find such metadata files. This seems in line with scenes/galleries passing their Filename(s) to their scraper args.

Copy link
Copy Markdown
Collaborator

@Gykes Gykes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So, i'm a little confused on what you are trying to accomplish here. If you are trying to do what I think you are trying to do them I believe that creating an imageInput similar to scene and gallery input with a Files []fileInput would be better. Again, without a full unerstanding of your goal then it's had to recommend any alternatives.

@NativeRavenclaw
Copy link
Copy Markdown
Author

I'm trying to get a custom python scraper to get the path/filename of an image from scraper_args(). Scenes have them - images don't.

def main():
    op, args = scraper_args()
    log.info("op: %s\n" % op)
    log.info("args: %s\n" % args)

    result = None
    match op:
        case "image-by-fragment":
            input_data = args

            # path = input_data['files'][0]['path'] # <--- does not exist
            path = input_data['path']               # <--- exists with this PR
            result = image_by_fragment(path)

        case "scene-by-fragment":
            input_data = args

            path = input_data['files'][0]['path']  # <--- exists
            log.info("path: %s\n" % path)

            result = scene_by_fragment(path)

Using imageInput looks to be more in line with what the other entities get. I was a bit put off by the "input" naming, but will look into implementing it that way.

@NativeRavenclaw
Copy link
Copy Markdown
Author

I think that's better? Running it through a scraper through the UI, the files array now exists like for scene/gallery. I couldn't find any tests for this to adjust - tell me if I missed them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants