Wulfre / e621dl

An automated download script for e621.net.
19 stars 8 forks source link

Download x posts, sorted by y? #32

Open aparmar2000 opened 5 years ago

aparmar2000 commented 5 years ago

What the title says - It would be useful to be able to download a certain number of posts, sorted by a certain criteria.

lurkbbs commented 5 years ago

What do you mean? Can you give an example?

aparmar2000 commented 5 years ago

Downloading the 10 highest-score posts.

lurkbbs commented 5 years ago

As of now, that's not possible :-( Given how code and e621 api works, it requires a lot of manual work:

First, set days to really big number, like 100000 (that's about 250 years ago). Then use metatag order:score. That will start downloading all there sorted by score. Then you can terminate downloading, sort by date from old to new, and delete all except first ten.

If I understand correctly, Wulfre has minimum functions policy: https://github.com/Wulfre/e621dl/issues/20 I suppose I can add post limit to my fork, not sure how fast though.

lurkbbs commented 5 years ago

I thought about it for a while. There are some questions:

  1. How to make it sorted in the Explorer? Is something like {score}.{id}.{ext} enough, or only 0.{id}.{ext} 1.{id}.{ext} ... will do? Or that is not a concern at all, all 10 can be in random order?
  2. Sorting can vary from request to request, only for first 320 results granularity is guaranteed. After that, there is some slight chance to download same files twice. Is it OK?
  3. Also, order will change every so often. Download folder should be manually or automatically purged on every redownload. What do you think?
aparmar2000 commented 5 years ago

1) That's not really a concern. 2) Yeah, that's kinda a given. 3) Manually. It's easy enough to add a DELETE command to a batch file and probably not a good idea to assume that users want to delete existing files.

lurkbbs commented 5 years ago

Well, I think more of purge folder flag in config. Just not sure if anybody else needs that.

lurkbbs commented 5 years ago

OK, you can try it: https://github.com/lurkbbs/e621dl

example config.ini:

[Settings]
include_md5 = false
make_hardlinks = true ; may not work on Windows 7
make_cache = true ; saves time and bandwidth
db = false 

;db used mostly to recreate download folder
;structure, no metatag support for now

[Defaults]
days = 365000
ratings = s,q,e
min_score = -99999999999
post_from = api
max_downloads = 10

[order_score]
Tags = order:score
max_downloads = 20

[order_views]
Tags = order:views

[order_favcount]
Tags = order:favcount

[order_comments]
Tags = order:comments

Also, I was wrong, there is no way to use order metatag in Wulfre's version, it requires different posts iteration. It is not used by default because of 320*750 posts limit. Good thing they are quite similar so it was not that hard to implement both and choose best depending on order presence.

Edit: If something is not working, please make an issue here: https://github.com/lurkbbs/e621dl/issues