pp

pic-postr

Pictures uploader tool for popular services

Showing:

Popularity

Downloads/wk

0

GitHub Stars

2

Maintenance

Last Commit

5yrs ago

Contributors

0

Package

Dependencies

12

Size (min+gzip)

325.8KB

License

ISC

Type Definitions

Tree-Shakeable

No?

Categories

Readme

pic-postr

Pictures uploader tool, supports tumblr, flickr and Yandex.Fotki (more services support to come). Uploads given pictures from configured folders and watches for new files being added to upload.

Installation

npm install pic-postr

Authentication

Each service requieres OAuth authentication to perform picures upload. This implies API keys retrieving process completion for pic-postr app with each service you desire to post to.

To accomplish this process, refer to servie's docs:

Get access with Tumblr

Get access with Flickr

Get access with Yandex.Fotki

Usage

Example folders structure

/base/folder/
    tumblr-drafts
    tumblr-queue
    flickr-public

Folders tumblr-drafts, tumblr-queue and flickr-public could contain some pictures at the run moment or files could be added on the fly.

Runner script (postr.js):

require('pic-postr').init('/base/folder', {
    logLevel: 'info',
    tumblr: {
        appConsumerKey: '...',
        appSecretKey: '...',
        accessToken: '...',
        accessSecret: '...',
        interval: 30,
        blog: 'the-blog',
        post: {
            caption: 'Feel free to LIKE my photo',
            date: function (filePath) {
                return new Date(require('fs').statSync(filePath).ctime).toISOString()
            }
        }
    },
    flickr: {
        appConsumerKey: '...',
        appSecretKey: '...',
        accessToken: '...',
        accessSecret: '...',
        interval: 10,
        order: 'abc',
        extractIptc: true,
        post: {
            title: function (filePath, metaIptc) {
                return metaIptc.description;
            },
            // more about metaIptc: https://github.com/achesco/extract-iptc 
            tags: function (filePath, metaIptc) {
                !metaIptc.keywords && return null;
                return typeof meta.keywords === 'string' ? meta.keywords : meta.keywords.join(' '); // flickr requires white-space separated tags
            },
            is_public: 1
        }
    },
    fotki: {
        userName: 'yandex-login',
        accessToken: '...',
        album: 'My Album Name'
    },
    folders: {
        'tumblr-drafts': {
            service: 'tumblr',
            interval: 20,
            order: 'abc',
            post: {
                state: 'draft'
            }
        },
        'tumblr-queue': {
            service: 'tumblr',
            order: 'random',
            post: {
                state: 'queue'
            }
        },
        'flickr-public': {
            service: 'flickr'
        },
        'to-fotki': {
            post: {
                access: 'private',
                xxx: true
            }
        }
    }
});

After node postr.js execution we'll get main program running, posting and monitoring configured folders with given settings by child processes. Could be run as a background service.

node postr.js > postr.log 2>&1 &

Options explained

require('pic-postr').init(baseFolderPath, appConfigOptins);

baseFolderPath

String containing absolute or relative path to the base application folder. Base folder must contain images folders configured under the folder section of appConfigOptions.

appConfigOptions

Application config object, possible fields are:

OptionTypeDefaultDescription
logLevelString'warn'Optional. Possible values are: 'debug', 'info', 'warn', 'error'
imConvertPathString'convert'Optional. Path to imagemagick's convert utility, if not in PATH
tumblrtumblrConfigOptions-Config for Tumblr. Used for folders with service: 'tumblr'
flickrflickrConfigOptions-Config for Flickr. Used for folders with service: 'flickr'
fotkifotkiConfigOptions-Config for Yandex.Photos. Used for folders with service: 'fotki'
foldersObject-Object with keys matching picture folders inside baseFolderPath directory, values are: folderConfigOptions

tumblrConfigOptions and flickrConfigOptions

OptionTypeDefaultDescription
appConsumerKeyString-Service API application consumer key for OAuth
appSecretKeyString-Service API application secret key for OAuth
accessTokenString-Service API OAuth access token
accessSecretString-Service API OAuth access secret
intervalNumber60Time interval between posts for service, in seconds
orderString'abc'Optional. Post files in given order (file name is used for sorting). Values: 'abc', 'zyx', 'random'
extractIptcBooleanfalseOptional. Extract IPTC/XMP metadata to be used in post fields callbacks.
postpostConfigOptionsNData object fields to post config

tumblrConfigOptions (Tumblr-only options)

OptionTypeDefaultDescription
blogStringNBlog name to post to. Can be overriden with folderConfigOptions.blog

fotkiConfigOptions

OptionTypeDefaultDescription
userNameString-Yandex login (without @yandex)
accessTokenString-Service API OAuth access token
intervalNumber60Time interval between posts for service, in seconds
orderString'abc'Optional. Post files in given order (file name is used for sorting). Values: 'abc', 'zyx', 'random'
extractIptcBooleanfalseOptional. Extract IPTC/XMP metadata to be used in post fields callbacks.
albumStringNAlbum name to post to. Can be overriden with folderConfigOptions.album
postpostConfigOptionsNData object fields to post config

folderConfigOptions

OptionTypeDefaultDescription
serviceStringN'tumblr', 'flickr' or 'fotki'

Plus any of the following service-level config fields: interval, order, extractIptc, post; blog for tumblr-only and album for fotki may also be overriden on folder level.

postConfigOptions

Post config options depend on service. Any supported field's config value could be set to function. It'll be called for every time before posting picture file and should return fiel's value. Function arguments are:

  • filePath path to file being posted
  • metaIptc metadata parsed from image being posted. Requires extractIptc optinon set to true.

Return value should be service's API compatible value. Return null or undefined to ignore and use default instead.

Tumblr's postConfigOptions

Supported fields are: state, tags, tweet, date, format, slug, caption, link, source. Description and possible values

Flickr's postConfigOptions

Supported fields are: title, description, tags, is_public, is_friend, is_family, safety_level, content_type, hidden. Description and possible values

Fotki's postConfigOptions

Supported fields are: title, summary, hide_original, xxx, disable_comments, access, tags. Description and possible values

Post fields callbacks

If metaIptc set to true post fields options set to function will receive extracted IPTC metadata object as second param (file path is first). Metadata fields details

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial