Post images, auto-magically!
Fair warning: I do not intend on making this user-friendly. It is likely that this will not work for you as this is a niche implementation for my personal use. If you want a certain feature or a current feature to work differently, fork it and make your own custom version. This is not intended to be generalized or perfect for your use case. There are already other projects out there that are more general, but they do not fit my use case. If you can't tell by the fact that I'm using JSON for the configuration management, this is not intended to be user-friendly.
This application uses "basic" API scope to perform all of its functionality. There isn't good documentation I can find to just link to, but these permissions are basically for browsing, stash, and publishing
To start the setup, clone the repo to your machine.
If you want to set this up as your own application in DeviantArt (in case mine gets taken down), you should first follow the instructions in info.md
An example configuration is provided in example_config.json. This should give you a general idea of how the file is laid out.
Within post_config is where your configuration of different post types will go. The names of each must be unique and include the following fields:
{
"type": "daily|rotation",
"images_per_day": 1,
"time": "01:01",
"galleries": [
"gallery1",
"gallery2",
"..."
],
"tags": [
"type dependent"
]
}For daily postings, your config should look something like this:
{
"daily_images": {
"type": "daily",
"directory": "path/to/images",
"images_per_day": 1,
"time": "01:01",
"galleries": [
"folderid1",
"folderid2"
],
"tags": [
"tag1",
"tag2"
]
}
}For rotation postings, your config should look something like this:
{
"rotation_images": {
"type": "rotation",
"last_posted": 0,
"directories": [
"path/to/first/folder",
"path/to/second/folder",
"and/so/on"
],
"images_per_day": 1,
"time": "01:01",
"galleries": [
"folderid1",
"folderid2"
],
"tags": [
"tag1",
"tag2"
]
}
}You can also add the flag for AI content (default is false):
{
"rotation_images": {
"type": "rotation",
"last_posted": 0,
"directories": [
"path/to/first/folder",
"path/to/second/folder",
"and/so/on"
],
"images_per_day": 1,
"time": "01:01",
"galleries": [
"folderid1",
"folderid2"
],
"tags": [
"tag1",
"tag2"
],
"is_ai": true
}
}Before running the application, you will need to rename the file to da_config.json.
Otherwise, the application will not run.
I would also recommend using absolute paths for the directories to hopefully avoid issues caused by messing up relative paths (though they are supported).
As this is a rather niche use case, I haven't bothered automating getting folder ids. So, you will have to use the console from DeviantArt to see all of your folders.
From there, you will need the value of folderid of the folders you are going to try to post to.
These are the values you will need for the galleries field of the post configurations.
Set up a virtual environment how you prefer, or just run it if you have all requirements in your environment already.
Then run the application:
py main.pyor on POSIX compliant OSs:
python3 main.pyThis will open DeviantArt's OAUTH page in your default browser.
After authenticating the application, refresh_token in the config will be your new token.
I could make a script for doing this, but this is niche and I do not intend on others using this. Think of it as a reference for making your own niche script.
From here, the application will wait until the time set to post, refresh the token, upload the image(s), and publish them to deviantart.
Now that the configuration is settled, you can finally run everything. You may do this locally with the same commands from before in Run The Application Locally.
services:
da-poster:
image: samhaswon/da-poster:latest
container_name: da-poster
environment:
- TZ=America/New_York
restart: unless-stopped
volumes:
- ./da_config.json:/usr/src/app/da_config.json
- ./images:/usr/src/app/images