mikf / gallery-dl

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

[DeviantArt] Favorites Filename Configurations #5742

Open cheese529 opened 5 months ago

cheese529 commented 5 months ago

Here's my current config for downloading from DeviantArt. What do I need to change to make the favorited images have a different filename when downloaded, ideally would like to have the author of the image in the filename. So for example, when downloading from [almost NSFW] https://www.deviantart.com/sleepygimp, I need everything uploaded by the creator to follow "filename": "{title} [{date:%Y-%m-%d}] {index_base36}.{extension}", but everything inside the favorited folder should be "filename": "{title} [{date:%Y-%m-%d}] {index_base36} {author}.{extension}", Tried to use chat gpt to figure this out but had no luck. Also if there is anything else I should be changing inside my config or adding please feel free to let me know :)

"deviantart":
{
    "filename": "{title} [{date:%Y-%m-%d}] {index_base36}.{extension}",
    "client-id": "",
    "client-secret": "",
    "refresh-token": "",
    "auto-watch": true,
    "auto-unwatch": true,
    "comments": false,
    "extra": true,
    "flat": false,
    "folders":false,
    "group": true,
    "include": "all",
    "parent-directory": true,
    "journals": "html",
    "jwt": false,
    "mature": true,
    "metadata": true,
    "postprocessors": [
        {
            "name": "metadata",
            "mode": "custom",
            "mtime": true,
            "filename": "{title} [{date:%Y-%m-%d}] {index_base36}.html",
            "filter": "description",
            "directory" : "HTML Descriptions",
            "extension": "html",
            "content-format": "<!DOCTYPE html><html><meta charset='utf-8'>Username: <a href='https://www.deviantart.com/{username}'>{username}</a> \n<br><br>\n URL: <a href='{url}'>{url[8:]}</a> \n<br><br>\n Title: <b>{title}</b> \n<br><br>\n Description: {description} \n<br><br>\n <img src={preview['src']}></html>"
        },
        {
            "name": "metadata",
            "mode": "custom",
            "mtime": true,
            "filename": "{title} [{date:%Y-%m-%d}] {index_base36}.txt",
            "filter": "description",
            "directory"       : "Descriptions",
            "content-format"  : "{description}\n",
            "extension-format": "descr.txt"
        }
    ],
    "original": true,
    "quality": 100,
    "pagination": "api",
    "public": false,
    "wait-min": 0
},
mikf commented 5 months ago

You can specify options per subcategory - favorite in this case nvm it's collection

"deviantart":
{
    "filename": "{title} [{date:%Y-%m-%d}] {index_base36}.{extension}",
    "collection": {
        "filename": "{title} [{date:%Y-%m-%d}] {index_base36} {author}.{extension}"
    }
}

"content-format": "<!DOCTYPE html> ...

You could place this rather long format string in an external file. https://gdl-org.github.io/docs/formatting.html#special-type-format-strings

"content-format": "\fT C:/path/to/template.html"

Tried to use chat gpt to figure this out but had no luck.

ChatGPT has absolutely no idea how to use and configure gallery-dl. At least it didn't a few months ago when I tested it.

cheese529 commented 5 months ago
  • favorite in this case

I tried exactly what you wrote but unfortunately it doesn't seem to be working. Everything inside the favorites folder still downloads with the OG filename I have.


        "deviantart":
        {
            "filename": "{title} [{date:%Y-%m-%d}] {index_base36}.{extension}",
            "favorite": {
                "filename": "{title} [{date:%Y-%m-%d}] {author[username]} - {index_base36}.{extension}"
            },
            "client-id": "31030",
            "client-secret": "b83117cc9f8375d4a40a515354fcb587",
            "refresh-token": "e8046f485ef1f05f93511beb680a37f27f8b6a16",
            "auto-watch": true,
            "auto-unwatch": true,
            "comments": false,
            "extra": true,
            "flat": false,
            "folders":false,
            "group": true,
            "include": "all",
            "parent-directory": true,
            "journals": "html",
            "jwt": false,
            "mature": true,
            "metadata": true,```
mikf commented 5 months ago

My bad. It needs to be collection, or you set flat for favorite to true.

cheese529 commented 5 months ago

You could place this rather long format string in an external file.

Thank you so much for this. Is there anything else I could change for the format string itself in order to make the post processed HTML file look as much like DeviantArt as possible, 1:1 in terms of font and green background etc, Kinda like how you made the journal html files resemble DA very nicely.

It needs to be collection

This ended up fixing it for me thanks.