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

Unable to specify general download directory in Mastodon config #843

Closed
ntqr opened this issue Jun 19, 2020 · 2 comments
Closed

Unable to specify general download directory in Mastodon config #843

ntqr opened this issue Jun 19, 2020 · 2 comments

Comments

@ntqr
Copy link

ntqr commented Jun 19, 2020

For some reason, I'm unable to specify the download directory of mastodon without having to specify them for each mastodon instance extractors. The filename key works, but for the directory key I have to specify them individually for each instance like this:

"mastodon": 
{
	"filename": "name_test_{id}_{media[id]}.{extension}",
	"baraag.net": 
	{
		"access-token": "",
		"client-id": "",
		"client-secret": ""
	},
	"pawoo.net": 
	{
		"access-token": "",
		"client-id": "",
		"client-secret":  ""
	}		
},
"baraag":
{
	"directory": ["mastodon", "dir_test", "{account[username]}"]
},
...

So, is there a way to specify the download directory for all mastodon instances?

@mikf
Copy link
Owner

mikf commented Jun 19, 2020

I've taken your config example, modified a tiny bit (disabled access-tokens to use the default, added general directory in mastodon), and it works like it is supposed to: pawoo URLs use the general setting and baraag URLs the specialized one.

There is also nothing in the code that would cause config value lookup to work for filename but not for directory. Maybe it's just a typo on your end?

$ cat mastodon.json
{"extractor": {

"mastodon":
{
	"filename": "name_test_{id}_{media[id]}.{extension}",
	"directory": ["mastodon", "dir_test", "{account[username]}"],

	"baraag.net":
	{
		"-access-token": "",
		"client-id": "",
		"client-secret": ""
	},
	"pawoo.net":
	{
		"-access-token": "",
		"client-id": "",
		"client-secret":  ""
	}
},
"baraag":
{
	"directory": ["baraag", "dir_test", "{account[username]}"]
}

}}

# uses specialized 'directory' setting for 'baraag'
$ gallery-dl --ignore-config -c mastodon.json https://baraag.net/@cari/104320955275179512
./gallery-dl/baraag/dir_test/cari/name_test_104320955275179512_10109041.png

# uses general mastodon directory setting
$ gallery-dl --ignore-config -c mastodon.json https://pawoo.net/@pawoo_support/103128619742175257
./gallery-dl/mastodon/dir_test/pawoo_su…ame_test_103128619742175257_21205156.png

@ntqr
Copy link
Author

ntqr commented Jun 19, 2020

Ok, I looked into this a bit deeper and it seems that what's happening is that extractor.mastodon.directory is not properly overriding the base level extractor.directory, so it was using what I put in extractor.directory.
When I removed extractor.directory, it works fine.

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

2 participants