npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pic-postr

v0.3.5

Published

Pictures uploader tool for tumblr, flickr, yandex.fotki

Downloads

27

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:

| Option | Type | Default | Description | |--------|------|---------|-------------| | logLevel | String | 'warn' | Optional. Possible values are: 'debug', 'info', 'warn', 'error' | | imConvertPath | String | 'convert' | Optional. Path to imagemagick's convert utility, if not in PATH | | tumblr | tumblrConfigOptions | - | Config for Tumblr. Used for folders with service: 'tumblr' | | flickr | flickrConfigOptions | - | Config for Flickr. Used for folders with service: 'flickr' | | fotki | fotkiConfigOptions | - | Config for Yandex.Photos. Used for folders with service: 'fotki' | | folders | Object | - | Object with keys matching picture folders inside baseFolderPath directory, values are: folderConfigOptions |

tumblrConfigOptions and flickrConfigOptions

| Option | Type | Default | Description | |--------|------|---------|-------------| | appConsumerKey | String | - | Service API application consumer key for OAuth | | appSecretKey | String | - | Service API application secret key for OAuth | | accessToken | String | - | Service API OAuth access token | | accessSecret | String | - | Service API OAuth access secret | | interval | Number | 60 | Time interval between posts for service, in seconds | | order | String | 'abc' | Optional. Post files in given order (file name is used for sorting). Values: 'abc', 'zyx', 'random' | | extractIptc | Boolean | false | Optional. Extract IPTC/XMP metadata to be used in post fields callbacks.| | post | postConfigOptions | N | Data object fields to post config |

tumblrConfigOptions (Tumblr-only options)

| Option | Type | Default | Description | |--------|------|---------|-------------|
| blog | String | N | Blog name to post to. Can be overriden with folderConfigOptions.blog |

fotkiConfigOptions

| Option | Type | Default | Description | |--------|------|---------|-------------| | userName | String | - | Yandex login (without @yandex) | | accessToken | String | - | Service API OAuth access token | | interval | Number | 60 | Time interval between posts for service, in seconds | | order | String | 'abc' | Optional. Post files in given order (file name is used for sorting). Values: 'abc', 'zyx', 'random' | | extractIptc | Boolean | false | Optional. Extract IPTC/XMP metadata to be used in post fields callbacks.| | album | String | N | Album name to post to. Can be overriden with folderConfigOptions.album | | post | postConfigOptions | N | Data object fields to post config |

folderConfigOptions

| Option | Type | Default | Description | |--------|------|---------|-------------| | service | String | N | '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