Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

file naming convention #827

Closed
Butterfly-Dragon opened this issue Jun 13, 2020 · 12 comments
Closed

file naming convention #827

Butterfly-Dragon opened this issue Jun 13, 2020 · 12 comments

Comments

@Butterfly-Dragon
Copy link

Currently gallery-dl names files on a "per site" basis with a "default" that can be given.

But.

Would it be possible to have the file naming based on the source embed post instead of the redirected site? Like: if i have a twitter post that contains a youtube video... follow the twitter naming convention instead of the youtube naming convention, using the source post to solve any unknowns.

I can't find such an option.

I can understand this to be an annoyance in the case of people "reply-twitting" and stuff like that where images get misattributed or other similar things.

@mikf
Copy link
Owner

mikf commented Jun 16, 2020

The category-transfer option should maybe do that. It lets child extractors spawned for downloading embedded content inherit the config values of its parent.

@Butterfly-Dragon
Copy link
Author

will see if that creates any problem, i would not want the downloader to spawn a bunch of "none none none"

@hellupline
Copy link
Contributor

using

        "reddit": {
            "directory": ["{category}", "{subreddit}"],
            "category-transfer": true,
            "comments": 0,
            "morecomments": false,
            "date-min": 0,
            "date-max": 253402210800,
            "date-format": "%Y-%m-%dT%H:%M:%S",
            "videos": true,
            "user-agent": "Python:gallery-dl:0.8.4 (by /u/mikf1)"
        },

causes :

~/gallery-dl/reddit/None/FILENAME

instead of

~/gallery-dl/reddit/SUBREDDIT_NAME/FILENAME

@mikf
Copy link
Owner

mikf commented Jun 25, 2020

@hellupline try parent-directory instead of category-transfer for Reddit.

This will yield ~/gallery-dl/reddit/SUBREDDIT_NAME/OTHER_CATEGORY/FILENAME as path for files from sites other than Reddit, and you can remove the OTHER_CATEGORY part by setting an empty directory for that specific site (or in general): "directory": []

@Butterfly-Dragon
Copy link
Author

Butterfly-Dragon commented Mar 17, 2021

okay, found (more or less what troubles me.

the "base directory" for parent-directory is not base-directory,
but base-directory with the added directory

So you quickly get to large amounts of nested directories.

is this the desired output?

@mikf
Copy link
Owner

mikf commented Mar 23, 2021

Yes, because anything else doesn't make much sense and that's the only way to put files from imgur, gfycat, etc linked in Reddit posts into the same directory as files coming from Reddit itself. Enabling this behavior is more or less the only reason why ´parent-directory´ exists in the first place.

What exactly are you trying to do where parent-directory might help and nested directories become a problem?


By the way, the new parent-metadata option from #1364 might be helpful if you want to use the same metadata for filenames on different sites, but there is also a good chance this'll only work for reddit with imgur, gfycat, etc.

@Butterfly-Dragon
Copy link
Author

Butterfly-Dragon commented Mar 23, 2021 via email

@bluerthanever
Copy link

actually i am having similar problems, not sure if it's big enough to be called problems though.
i will also take reddit as an example. i want the content spawned by reddit extractor for example gyfcat to use a specific directory format, but if i download using a gyfcat link i want it to use another set of format.
i guess that's not possible for now, except for using different configurations.
this is like how i picture the settings in configuration:

{
    "extractor": {
        "reddit": {
            "directory_fmt": ["{blah}", "{blah}"],
            "gyfcat": {
                "directory_fmt": ["{bleh}", "{bleh}"]
            }
        },
        "gyfcat": {
            "directory_fmt": ["{pfff}", "{pfff}"],
        }
    }
}

@mikf
Copy link
Owner

mikf commented Aug 21, 2021

@bluerthanever parent-metadata and conditional directory names can solve this:

{
    "extractor": {
        "reddit": {
            "directory": ["{blah}", "{blah}"],
            "parent-metadata": "_reddit_"
        },
        "gfycat": {
            "directory": {
                "'_reddit_' in locals()": ["{bleh}", "{bleh}"],
                ""                      : ["{pfff}", "{pfff}"]
            }
        }
    }
}

Maybe just enabling parent-directory also does what you want.

@bluerthanever
Copy link

wow. never knew i could use it like that! that's amazing.
thank you very much!

@mikf
Copy link
Owner

mikf commented Aug 23, 2021

Small correction: gyfcat -> gfycat

@bluerthanever
Copy link

my fault, haha. thanks again.

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

No branches or pull requests

4 participants