mikf / gallery-dl

Command-line program to download image galleries and collections from several image hosting sites
GNU General Public License v2.0
11.69k stars 954 forks source link

[yandere] pool title #4646

Open dajotim937 opened 1 year ago

dajotim937 commented 1 year ago

https://yande.re/pool/show/98590 gallery-dl.exe https://yande.re/pool/show/98590 -K doesn't have any tag (I wanted for directory) that would contain title of pool: "Megami #⁠279 2023-08"

And also for some extractors (like submission on reddit that contains gallery) gallery-dl has num field. Is it possible to add for yandere pools also?

mikf commented 1 year ago

Enable metadata and you'll get extended pool metadata, with title in {pool[title]}. This does not work for all moebooru instances, but it does for yande.re.

mikf commented 1 year ago

And also for some extractors (like submission on reddit that contains gallery) gallery-dl has num field. Is it possible to add for yandere pools also?

It's "possible", but it wouldn't be pretty and the order would probably be wrong as well ... I'd rather add some form of generic enumeration.

dajotim937 commented 1 year ago

What do you mean by "order would probably be wrong"? Are the pics returned in a different order than they appear on site?

Yeah, too many booru instances. I was looking at config for *.[booru].* so didn't notice that metadata option. But, for some reason, "pool": {"metadata": true} nor "pool.metadata":true still doesn't return extended metadata. Full config for extractor: removed

I'm stupid and didn't notice a new commit.=)

mikf commented 1 year ago

What do you mean by "order would probably be wrong"? Are the pics returned in a different order than they appear on site?

I don't know if this is also the case for moebooru instances, but for a pool:POOLID tag search danbooru returns posts in descending ID order. It needs the special ordpool:POOLID to return posts in pool order. moebooru instances / yande.re don't seem to have an ordpool equivalent.

mikf commented 1 year ago

Regarding enumerating (pool) posts: It is possible to (ab)use python post processors to at least provide an enumeration index for filenames.

1) Create a new gdl_utils.py file (or use whatever name) with this inside:

num = 0

def num_init(kwdict):
    global num
    num = 0

def num_inc(kwdict):
    global num
    num += 1
    kwdict["num"] = num

2) Call these functions with python post processors

    "postprocessors": [
        {
            "name": "python",
            "event": "init",
            "function": "/tmp/_/gdl_utils.py:num_init"
        },
        {
            "name": "python",
            "event": "post",
            "function": "/tmp/_/gdl_utils.py:num_inc"
        }
    ]

(replace "/tmp/_/gdl_utils.py" with the actual path)

Result:

$ gallery-dl -f "{num:>02}.{extension}" https://yande.re/pool/show/98680
/tmp/_/yandere/pool/98680/01.png
/tmp/_/yandere/pool/98680/02.png
/tmp/_/yandere/pool/98680/03.png
/tmp/_/yandere/pool/98680/04.png
/tmp/_/yandere/pool/98680/05.png
/tmp/_/yandere/pool/98680/06.png
/tmp/_/yandere/pool/98680/07.png
dajotim937 commented 1 year ago

What do you mean by "order would probably be wrong"? Are the pics returned in a different order than they appear on site?

I don't know if this is also the case for moebooru instances, but for a pool:POOLID tag search danbooru returns posts in descending ID order. It needs the special ordpool:POOLID to return posts in pool order. moebooru instances / yande.re don't seem to have an ordpool equivalent.

Well, yandere doesn't return post inside a pool ordered by id. Not in pool/show/ID nor in search with pool:ID. You can see that in my pool link (same order if you are using search /post?tags=pool%3A98590 and json): 1101176, 1101177, 1101179, 1101178, 1101182, 1101183, 1101181, 1101180, 1101184, 1101185, 1101190, 1101187, 1101189, 1101188, 1101191, 1101192, 1101567, 1101568.

So I thought about just enumeration from gallery-dl. Which one post returned in pool first gets 1, second - 2, etc.

Danbooru inside pool (/pools/ID) looks like also return in pool order (also in /pools/ID.json too). Well, if for pools you are using search to download, than I get what's the issue. I'll use your workaround then.

Update: checked Moebooru and MyImouto sites from SupportedSites.md: sakugabooru: pool 141, /post?tags=pool%3A141 and /pool/show/141 and /pool/show/141.json return same order like in pool, not by id; konachan: pool 415, /post?tags=pool%3A415 and /pool/show/415 both return same order like in pool, not by id and doesn't have /pool/show/id.json; lolibooru: pool 304, doesn't have search with pool:ID and /pool/show/id.json but return order here: https://lolibooru.moe/pool/show.json?id=ID

Don't know if any of this is useful for you.