This operation reads remote media references prepared by concentrator, imports them into Mastodon instance and prepares a remote references lookup table for toot so that it can bind new statuses with their remote media references.
$ java -jar egor.jar media -help usage: egor.mastodon.MediaImporter [-a <ACCESS_TOKEN>] [-c <CLIENT_ID>] [-f <FILENAME>] [-h <HOSTNAME>] [-help] [-u <FILENAME>] -a,--access-token <ACCESS_TOKEN> Client access token -c,--client-id <CLIENT_ID> Client id -f,--config <FILENAME> Configuration file -h,--home <HOSTNAME> Mastodon server hostname -help print this message -u,--unique-media-db <FILENAME> Media hash database
Configuration variables (access token, client id, home) are read from a configuration file, but they can be reconfigured by the explicit parameters --access-token, --client-id and --home.
The filename specifies configuration file with credentials.
This database stores references to remote media already saved into Mastodon. It will be updated accordingly.
# process xkcd.com, extract media references (xkcd.media) and prepare textual import (xkcd.out) $ java -jar egor.jar concentrator -f "TITLE LINK #JOKE" -u https://xkcd.com/rss.xml -r xkcd.media -ri >xkcd.out # import media references (download + save them into Mastodon), prepare lookup table (xkcd-media.resolver) # eliminate media duplicates (xkcd-media.db) $ java -jar egor.jar media -f hahabimbi.cfg -u xkcd-media.db > xkcd-media.resolver <xkcd.media # import RSS feed (xkcd.out), resolve media attachments (xkcd-media.resolver) and eliminate all duplicates (xkcd-hash.db) $ java -jar egor.jar toot -f hahabimbi.cfg -u xkcd-hash.db -m xkcd-media.resolver <xkcd.out
Note: This script can run in a cron.