Socket
Socket
Sign inDemoInstall

pic-postr

Package Overview
Dependencies
200
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    pic-postr

Pictures uploader tool for tumblr, flickr, yandex.fotki


Version published
Weekly downloads
1
Maintainers
1
Install size
13.7 MB
Created
Weekly downloads
 

Readme

Source

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

Keywords

FAQs

Last updated on 26 Oct 2016

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc