Skip to content

brucebentley/flickr-cli

Flickr CLI

Build Status

A command-line interface to Flickr. Upload & download photos, photo sets, directories via shell.

Prerequisites

Before you begin, make sure you have the following items installed & available.

Installation

  1. Clone the flick-cli repository from Github:

    git clone https://github.com/brucebentley/flickr-cli.git
  2. Install all of the required dependencies:

    composer install
  3. Go to https://www.flickr.com/services/apps/create/apply/ to create a new Flickr API key:

     
    Please Note:
    The first time you run ./bin/flickr-cli auth you'll be prompted to enter
    your new consumer key and secret.
     

Usage

Authenticating To The Flickr API

Get your Flickr access token & authenticate to Flickr:

./bin/flickr-cli auth

Uploading To Flickr

./bin/flickr-cli upload [-d DESCRIPTION] [-t TAG,...] [-s SET,...] DIRECTORY...

Downloading From Flickr

Basic Usage Example:

./bin/flickr-cli download -d DIRECTORY [SET...]

To download all photosets to directory photosets:

./bin/flickr-cli download -d photosets

To download only the photoset Holiday 2018:

./bin/flickr-cli download -d photosets 'Holiday 2018'

To download all photos into directories named by Photo ID, you can use the --id-dirs option:

 
Please Note:
This is a perfect method for doing a complete Flickr account backup, being that
Photo ID directory names will not change when you rename albums or photos.
 

./bin/flickr-cli download -d flickr_backup --id-dirs

This creates a stable directory structure of the form destination_dir/hash/hash/photo-ID/, and saves the full original photo file along with a metadata.yml file containing all photo metadata. The hashes, which are the first two sets of two characters of the MD5 hash of the ID, are required in order to prevent a single directory from containing too many subdirectories (to avoid problems with some filesystems).

Using Docker

Docker Image Setup

To use this software within Docker, follow these steps.

  1. Create a volume: (This is used to store the configuration file for the auth step)

    docker volume create flickr-cli
  2. Get the access token: (it will create config.yml file in the volume)

    docker run --rm -it -u $(id -u):$(id -g) -v "$PWD":/mnt -v flickr-cli:/data brucebentley/flickr-cli auth
  3. Alternatively, you can store the config.yml in your $HOME/.flickr-cli directory and use the following:

    # CREATE A NEW `.flickr-cli` DIRECTORY IN YOUR USER'S `$HOME` DIRECTORY.
    mkdir $HOME/.flickr-cli
    
    docker run --rm -it -u $(id -u):$(id -g) -v "$PWD":/mnt -v "$HOME/.flickr-cli":/data brucebentley/flickr-cli auth

Docker Image Usage

Upload directory 2018.12.24-Holiday-2018 full of JPEG photos to Flickr:

docker run --rm -it -u $(id -u):$(id -g) -v "$PWD":/mnt -v flickr-cli:/data brucebentley/flickr-cli upload --config=/data/config.yml --tags '2018.12.24 "Holiday 2018" Holiday 2018' --sets "Holiday 2018" 2018.12.24-Holiday-2018

For Docker image troubleshooting, you can use:

docker run --rm -it -u $(id -u):$(id -g) -v "$PWD":/mnt -v flickr-cli:/data --entrypoint=/bin/bash brucebentley/flickr-cli

Docker Image Paths

  • /app — Main application directory
  • /data — Volume for variable data
  • /mnt — Host system's $PWD

3rd-Party Documentation

License

Copyright © 2018 Bruce Bentley https://brucebentley.io

This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see http://www.gnu.org/licenses/.

About

A command-line interface to interact with Flickr. Upload & download photos, photo sets, directories via shell.

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published